예제 #1
0
파일: websiteLogin.py 프로젝트: BYTE128/hms
def add_user(username, password, user_type):
    myCursor = myDb.cursor()
    myCursor.execute("select username from userstore")
    if username in list(map(lambda x: x[0], myCursor.fetchall())):
        flash("This username already exists. Try another One!", "danger")
        return redirect(url_for('index'))
    myCursor.execute(
        "insert into userstore(username, password, user_type) values('{}', '{}', '{}')"
        .format(username, generate_password_hash(password), user_type))
    myDb.commit()
    myCursor = myDb.cursor()
    flash(
        "User {} created successfully! User can start using this id.".format(
            username), "success")
    return redirect(url_for('main.index'))
예제 #2
0
def showQuantity():
    req = request.get_json(force=True)
    print(req)
    myCursor = myDb.cursor()
    myCursor.execute("select quantity,rate from medicinesmaster where med_name = '%s'" % (req['medicine']))
    myResult = myCursor.fetchall()
    return jsonify(myResult)
예제 #3
0
def showRate():
    req = request.get_json(force=True)
    print(req)
    myCursor = myDb.cursor()
    myCursor.execute(
        "select rate from diagnosticsmaster where test_name = '%s'" %
        (req['test']))
    myResult = myCursor.fetchall()
    return jsonify(myResult)
예제 #4
0
def fetchPatientDetails():
    myResult = []
    req = request.get_json(force=True)
    patientId = req.get('patientID')
    if patientId != None and patientId != '':
        myCursor = myDb.cursor()
        myCursor.execute("SELECT ws_pat_name,ws_age,ws_doj,ws_rtype,ws_adrs,state,city FROM patient where ws_pat_id = %s" % (int(patientId)))
        myResult = myCursor.fetchall()
        myCursor.close()
        if myResult == []:
            return jsonify({"message": "Patient ID dosesn't exist"})
    else:
        return jsonify({"message": "Please enter full 9 digit Patient ID"})

    myCursor = myDb.cursor()
    myCursor.execute("select medicinesmaster.med_name, medicines.quan_issued, medicinesmaster.rate from medicines JOIN medicinesmaster on medicines.ws_med_id = medicinesmaster.med_id where medicines.ws_pat_id = %s order by medicinesmaster.med_name" % (patientId))
    myResult.extend(myCursor.fetchall())
    myCursor.close()
    return jsonify(myResult)
예제 #5
0
def search():
    myresult = []
    c = 0
    msg = "Patient ID Does'nt Exists"
    if request.method == 'POST':
        form = request.form
        search_value = request.form['patient_id']
        c = int(search_value)
        myCursor = myDb.cursor()
        myCursor.execute(
            """SELECT ws_pat_name,ws_age,ws_doj,ws_rtype,ws_adrs,state,city FROM patient where ws_pat_id = %s """
            % (c))
        myresult = myCursor.fetchall()

    return render_template('search.html', myresult=myresult, c=c)
예제 #6
0
def addTests():
    req = request.get_json(force=True)
    print(req)
    patientIDDict = req.pop(0)
    for i in req:
        myCursor = myDb.cursor()
        myCursor.execute(
            "select test_id from diagnosticsmaster where test_name = '%s'" %
            (i['Test'].upper()))
        myResult = myCursor.fetchall()
        testId = myResult[0][0]
        myCursor.execute("insert into diagnosticstable values({}, {})".format(
            int(patientIDDict['patientID']), testId))
        myCursor.close()
        myDb.commit()
    return jsonify({"message": "Tests Added Successfully"})
예제 #7
0
def issueMedicines():
    req = request.get_json(force=True)
    print(req)
    patientIDDict = req.pop(0)
    for i in req:
        myCursor = myDb.cursor()
        myCursor.execute("select med_id from medicinesmaster where med_name = '%s'" % (i['Medicine'].upper()))
        myResult = myCursor.fetchall()
        medId = myResult[0][0]
        myCursor.execute("update medicinesmaster set quantity = quantity - {} where med_id = {}".format(int(i['Quantity']), medId))
        myCursor.execute("select * from medicines where ws_pat_id = {} and ws_med_id = {}".format(int(patientIDDict['patientID']), medId))
        myResult = myCursor.fetchall()
        if myResult == []:
            myCursor.execute("insert into medicines values({}, {}, {})".format(int(patientIDDict['patientID']), medId, int(i['Quantity'])))
        else:
            myCursor.execute("update medicines set quan_issued = quan_issued + {} where ws_pat_id = {} and ws_med_id = {}".format(int(i['Quantity']), int(patientIDDict['patientID']), medId))
        myCursor.close()
        myDb.commit()
    return jsonify({"message": "Medicines Issued Successfully"})
예제 #8
0
파일: websiteLogin.py 프로젝트: BYTE128/hms
def login():
    if session.get('username'):
        return redirect(url_for('main.index'))

    if request.method == 'POST':
        username = request.form.get('username')
        password = request.form.get('password')
        if username != None:
            myCursor = myDb.cursor()
            myCursor.execute(
                "select password,user_type from userstore where username = '******'"
                .format(username))
            myResult = myCursor.fetchall()
            myCursor.close()
            if myResult != [] and check_password_hash(myResult[0][0],
                                                      password):
                session['username'] = username.upper()
                session['user_type'] = myResult[0][1]
                return redirect(url_for('main.index'))
        flash("Username doesn't exist or Password incorrect", "danger")

    return render_template("login.html")
예제 #9
0
def view():
    mview=myDb.cursor()
    mview.execute("SELECT * FROM patient")
    view_result = mview.fetchall()
    return render_template("display.html",view_result=view_result)
예제 #10
0
from flask import Blueprint, request, flash, render_template, jsonify, make_response
from application import myDb
from random import randint
from datetime import date

bp = Blueprint('managePatientInformation', __name__, template_folder='templates', static_folder='static')
  
myCursor = myDb.cursor()

def function1():
    flash("SSN Id should be of 9 digits!!")

@bp.route('/patientnew',methods=['POST','GET'])
def register():
    myresult2 = []
    patient_validation_ssnid=[]
    patient_ssn_new=''
    myc = 0
    date1 = ''
    patient_doj = ''
    type_room = ['------','General','Semi','Single']
    # updatesw_states = ['Maharashtra','MP', 'TN', 'Haryana','UP','Punjab']
    myCursor.execute("select distinct(district) from city where countrycode = 'IND' order by district")
    updatesw_states = list(map(lambda x: x[0],myCursor.fetchall()))
    updatesw_cities=[]
    udh = type(patient_doj)

    #Initializing date 
    msg = "E"
    p=date.today()
    if request.method == 'POST':
예제 #11
0
def fetchAllMedicines():
    myCursor = myDb.cursor()
    myCursor.execute("select med_name from medicinesmaster")
    myResult = myCursor.fetchall()
    return jsonify(myResult)
예제 #12
0
def patientBilling():
    myCursor = myDb.cursor()
    patient_info = []
    myResult = []
    myResult1 = []
    total = []

    if request.method == 'POST':
        ws_pat_id = int(request.form.get('ws_pat_id'))
        print(ws_pat_id)

        #patient related info
        myCursor.execute(
            """ SELECT ws_pat_id, ws_pat_name, ws_adrs, ws_age, ws_doj, ws_rtype FROM patient WHERE ws_pat_id = %s"""
            % (ws_pat_id))
        patient_info = myCursor.fetchone()
        print(patient_info)
        date1 = patient_info[4]
        f_date = date(int(date1[0:4]), int(date1[5:7]), int(date1[8:]))
        l_date = date.today()
        delta = l_date - f_date
        total_days = delta.days + 1
        total.append(total_days)
        if patient_info[5] == "Semi":
            total_amt = 4000
        elif patient_info[5] == "Single":
            total_amt = 8000
        else:
            total_amt = 2000
        sum_patient = total_days * total_amt
        print(sum_patient)
        total.append(sum_patient)

        #medicine related info
        myCursor = myDb.cursor()
        myCursor.execute(
            "select medicinesmaster.med_name, medicines.quan_issued, medicinesmaster.rate from medicines JOIN medicinesmaster on medicines.ws_med_id = medicinesmaster.med_id where medicines.ws_pat_id = %s order by medicinesmaster.med_name"
            % (ws_pat_id))
        myResult = myCursor.fetchall()
        myCursor.close()
        print(myResult)
        length = len(myResult)
        sum_medicine = 0
        for x in range(0, length):
            sum1 = myResult[x][1] * myResult[x][2]
            sum_medicine = sum_medicine + sum1
        print(sum_medicine)
        total.append(sum_medicine)

        #diagnosis related info
        myCursor = myDb.cursor()
        myCursor.execute(
            "select diagnosticsmaster.test_name, diagnosticsmaster.rate from diagnosticstable JOIN diagnosticsmaster on diagnosticstable.ws_test_id = diagnosticsmaster.test_id where diagnosticstable.ws_pat_id = %s order by diagnosticsmaster.test_name"
            % (ws_pat_id))
        myResult1 = myCursor.fetchall()
        myCursor.close()
        print(myResult1)
        length1 = len(myResult1)
        sum_diagnosis = 0
        for x in range(0, length1):
            sum_diagnosis = sum_diagnosis + myResult1[x][1]
        print(sum_diagnosis)
        total.append(sum_diagnosis)

        #grand related info
        grand_total = sum_patient + sum_medicine + sum_diagnosis
        total.append(grand_total)

    return render_template('printBill.html',
                           patient_info=patient_info,
                           myResult=myResult,
                           len1=len(myResult),
                           myResult1=myResult1,
                           len2=len(myResult1),
                           total=total)
예제 #13
0
def fetchAllTests():
    myCursor = myDb.cursor()
    myCursor.execute("select test_name from diagnosticsmaster")
    myResult = myCursor.fetchall()
    return jsonify(myResult)