def get_comments(patientid): """ Get info of a doctor in the system. :param doctorid: doctor's uid :returns: a status, a str ( doctor's info on success, err info on failure) """ # print(doctorid) logger.debug('in get_comments') resp_list = [] try: patient = PatientModel.get(PatientModel.email==patientid) for comment in CommentModel.select().where(CommentModel.patient==patient): logger.debug('comment_id: %s, comment: %s' % (comment.comment_id, comment.comment)) resp_dict = {} resp_dict['comment'] = comment.comment resp_dict['datetime'] = comment.datetime resp_dict['response_doctor'] = comment.response_doctor resp_list.append(resp_dict) logger.debug('comments:{}'.format(resp_list)) except Exception as ex: logger.error('Exception: ', ex) return 0, {'errinfo':'get comments failed'} else: return 1, resp_list
def get_discharges(patientid): """ Get info of a doctor in the system. :param doctorid: doctor's uid :returns: a status, a str ( doctor's info on success, err info on failure) """ # print(doctorid) logger.debug('in get_discharges') resp_list = [] try: patient = PatientModel.get(PatientModel.email==patientid) for discharge in DischargeModel.select().where(DischargeModel.patient==patient): logger.debug('discharge_id: %s, indate: %s' % (discharge.discharge_id, discharge.indate)) resp_dict = {} resp_dict['indate'] = discharge.indate resp_dict['outdate'] = discharge.outdate resp_dict['response_doctor'] = discharge.response_doctor resp_dict['description'] = discharge.description resp_dict['datetime'] = discharge.datetime resp_list.append(resp_dict) logger.debug('discharges:{}'.format(resp_list)) except Exception as ex: logger.error('Exception: ', ex) return 0, {'errinfo':'get discharges failed'} else: return 1, resp_list
def get_objs(patientid): """ Get info of a doctor in the system. :param doctorid: doctor's uid :returns: a status, a str ( doctor's info on success, err info on failure) """ # print(doctorid) logger.debug('in get_objs') resp_list = [] try: patient = PatientModel.get(PatientModel.email==patientid) for obj in ObjectModel.select().where(ObjectModel.patient==patient): logger.debug('objid: %s, descrip: %s' % (obj.objid, obj.description)) resp_dict = {} resp_dict['objid'] = obj.objid resp_dict['objname'] = obj.objname resp_dict['description'] = obj.description resp_dict['datetime'] = obj.datetime resp_list.append(resp_dict) logger.debug('objs:{}'.format(resp_list)) except Exception as ex: logger.error('Exception: ', ex) return 0, {'errinfo':'get objs failed'} else: return 1, resp_list
def get_prescriptions(patientid): """ Get info of a doctor in the system. :param doctorid: doctor's uid :returns: a status, a str ( doctor's info on success, err info on failure) """ # print(doctorid) logger.debug('in get_prescriptions') resp_list = [] try: patient = PatientModel.get(PatientModel.email==patientid) for prescription in PrescriptionModel.select().where(PrescriptionModel.patient==patient): logger.debug('drug_id: %s, descrip: %s' % (prescription.drug_id, prescription.description)) resp_dict = {} resp_dict['drug_name'] = prescription.drug_name resp_dict['after_meal'] = prescription.after_meal resp_dict['description'] = prescription.description resp_dict['datetime'] = prescription.datetime resp_dict['amount'] = prescription.amount resp_dict['dosage_per_day'] = prescription.dosage_per_day resp_dict['response_doctor'] = prescription.response_doctor resp_list.append(resp_dict) logger.debug('prescriptions:{}'.format(resp_list)) except Exception as ex: logger.error('Exception: ', ex) return 0, {'errinfo':'get prescriptions failed'} else: return 1, resp_list