コード例 #1
0
def get_doctor_by_patient(patientId):
    patient_id = patientId
    s = SelectQuery()
    doctor = s.select_doctor_by_patient(patient_id)
    if doctor is False:
        return jsonify(False)
    return jsonify(row2dict(doctor))
コード例 #2
0
def get_patient_events(patientId):
    s = SelectQuery()
    events = s.get_event_by_patient(patientId)
    row_list = []
    for row in events:
        row_list.append(row2dict(row))
    return jsonify(row_list)
コード例 #3
0
def get_all_doctors():
    s = SelectQuery()
    events = s.get_all_doctor()
    row_list = []
    for row in events:
        row_list.append(row2dict(row))
    return jsonify(row_list)
コード例 #4
0
def get_all_prescritions(patientId):
    s = SelectQuery()
    prescriptions = s.get_all_patient_prescriptions(patientId)
    row_list = []
    for row in prescriptions:
        row_list.append(row2dict(row))
    return jsonify(row_list)
コード例 #5
0
def get_all_measures(patientId):
    s = SelectQuery()
    measures = s.get_all_patient_measures(patientId)
    row_list = []
    for row in measures:
        row_list.append(row2dict(row))
    return jsonify(row_list)
コード例 #6
0
def get_patient_list_from_doctor(doctorId):
    s = SelectQuery()
    patients = s.get_patient_list_from_doctor(doctorId)
    row_list = []
    for row in patients:
        row_list.append(row2dict(row))
    return jsonify(row_list)
コード例 #7
0
def get_patient(patientId):
    patient_id = patientId
    s = SelectQuery()
    # request.cookies.get('remember_token').split('|')[0])  # instruction to get googleID from request
    patient = s.get_patient(patient_id)
    if patient is False:
        return jsonify(False)
    return jsonify(row2dict(patient))
コード例 #8
0
def index():
    doctor_id = request.args.get('doctorId')
    s = SelectQuery()
    events = s.select_event_by_doctor(doctor_id)
    row_list = []
    for row in events:
        row_list.append(row2dict(row))
    return jsonify(row_list)
コード例 #9
0
def get_doctor(doctorId):
    doctor_id = doctorId
    s = SelectQuery()
    # request.cookies.get('remember_token').split('|')[0])  # instruction to get googleID from request
    doctor = s.get_doctor(doctor_id)
    if doctor is False:
        return jsonify(False)
    return jsonify(row2dict(doctor))
コード例 #10
0
def get_doctor_image(doctorId):
    s = SelectQuery()
    image = s.get_doctor_image(doctorId)
    if image is not None:
        my_file = Path("doctor_image/" + image)
        if my_file.is_file():
            # file exists
            return send_file("doctor_image/" + image, mimetype='image/gif')
    return send_file("doctor_image/empty_user.png", mimetype='image/gif')
コード例 #11
0
 def get(self, ):
     s = SelectQuery()
     account = s.get_user_by_id(current_user.id)
     return jsonify({
         'googleId': account.id,
         'username': account.username,
         'email': account.email,
         'userType': account.userType,
         'pushToken': account.pushToken
     })
コード例 #12
0
def get_prescription_file(pathFileSystem, patientId):
    s = SelectQuery()
    #patientId = request.cookies.get('remember_token').split('|')[0]  # instruction to get googleID from request
    image = s.get_prescription_file(patientId, pathFileSystem)
    if image is not None:
        my_file = Path("prescriptions/" + patientId + "/" + image)
        if my_file.is_file():
            # file exists
            return send_file("prescriptions/" + patientId + "/" + image)
    return make_response(jsonify("prescription not found"), 404)
コード例 #13
0
 def insertUserOrNothing(self,googleId,username,email,accountType,pushToken):
     s = SelectQuery()
     i = InsertQuery()
     # controllare accountType not null
     user = s.get_user_by_id(googleId)
     if(user == None): # new user
         print(f"[server] New User {username}")
         i.create_account(email,username,accountType,googleId,pushToken) # push token ?
         # controllare se ritorna True
     user = User(googleId,username,email,accountType,pushToken)
     return user
コード例 #14
0
 def post(self, action):
     u = UpdateQuery()
     i = InsertQuery()
     s = SelectQuery()
     if action == "submitFirstAccess":
         userType = request.form.get("userType")
         id = request.form.get("googleId")
         if userType == "patient":
             cf = request.form.get("cf")
         name = request.form.get("name")
         surname = request.form.get("surname")
         date = request.form.get("birthday")
         cf = request.form.get("cf")
         googleId = request.form.get("googleId")
         print(date)
         print(f"id : {id}")
         if not u.update_user_type(id, userType):
             return "Error", HTTPStatus.INTERNAL_SERVER_ERROR
         if userType == "Patient":
             i.insert_patient(name, surname, "", date, cf, googleId)
         elif userType == "Doctor":
             i.insert_doctor(name, surname, date, googleId)
         return "OK", HTTPStatus.OK
     if action == "insertToken":
         id = request.form.get("googleId")
         pushToken = request.form.get("pushToken")
         # get all pushToken from the googleId
         allPushToken = s.get_push_token(id)
         print(f"push token : {pushToken} ")
         if allPushToken is None or allPushToken == "":
             allPushToken = pushToken + ","
         else:
             if pushToken not in allPushToken:
                 allPushToken = allPushToken + pushToken + ","
         if (not u.update_push_token(id, allPushToken)):
             return "Error", HTTPStatus.INTERNAL_SERVER_ERROR
         return "OK", HTTPStatus.OK
     else:
         print(f"action : {action}")
         return "PAGE NOT FOUND", HTTPStatus.NOT_FOUND
コード例 #15
0
def get_last_patient_comment(patientId):
    s = SelectQuery()
    comment = s.get_last_patient_comment(patientId)
    if comment.description is not None:
        return jsonify(row2dict(comment))
    return make_response(jsonify("comment not found"), 404)
コード例 #16
0
 def lookup_user(self, id):
     s = SelectQuery()
     r = s.get_user_by_id(id)
     # controllare se user not null
     u  = User(r.id,r.username,r.email,r.userType,r.pushToken)
     return u