Esempio n. 1
0
def get_patient_data(data):
	fields, values, tab = get_data_to_render(data)

	pos = 0
	for filed_dict in fields:
		pos =+ 1
		if 'rows' in filed_dict.keys():
			rows = filed_dict.get('rows')
			break

	if isinstance(data, unicode):
		data=json.loads(data)

	pateints = get_linked_phrs(data["profile_id"])
	print pateints

	if pateints:
		for patient in pateints['list']:
			pi = frappe.db.get_value("LinkedPHR Images",{"profile_id":patient['entityid']},"profile_image")
			import datetime
			creation_time = datetime.datetime.fromtimestamp(float(patient['entityid'].split('-',1)[0])/1000).strftime('%d/%m/%Y %H:%M')
			rows.extend([["""<a nohref class='popen' onclick="open_patient('%(entityid)s','%(name)s')" id='%(entityid)s'><img class='user-picture' src='%(pi)s' style='min-width: 20px; max-height: 20px; border-radius: 4px'/> %(name)s %(lname)s</i></a>"""%{"entityid":patient['entityid'],"pi":pi,"name":patient['person_firstname'],"lname":patient['person_lastname']},patient["email"],patient['mobile'],creation_time]])


	return {
		'rows': rows,
		'listview': fields
	}
Esempio n. 2
0
def get_linked_patients(profile_id=None):
	if profile_id:
		pateints = get_linked_phrs(profile_id)
		
		if pateints:
			for patient in pateints['list']:
				name = ' '.join([patient["person_firstname"],patient["person_lastname"]])
				patient.update({'label': name, 'value': name})

			return pateints['list']
Esempio n. 3
0
def get_linked_patients(profile_id=None):
    if profile_id:
        pateints = get_linked_phrs(profile_id)

        if pateints:
            for patient in pateints['list']:
                name = ' '.join(
                    [patient["person_firstname"], patient["person_lastname"]])
                patient.update({'label': name, 'value': name})

            return pateints['list']
Esempio n. 4
0
def get_profile_data(filters):
    profile_id = frappe.db.get_value("User", {"email": filters.user_name},
                                     "profile_id")
    profile_data = get_linked_phrs(profile_id)
    profile_list = []
    if profile_data:
        data = profile_data['list']
        for profile in data:
            profile_dic = {}
            profile_dic = {
                "first_name": profile["person_firstname"],
                "middle_name": profile["person_middlename"],
                "last_name": profile["person_lastname"],
                "email": profile["email"],
                "relationship": profile["relationship"],
                "mobile": profile["mobile"]
            }
            profile_list.append(profile_dic)
    return profile_list
Esempio n. 5
0
def get_patient_data(data):
    fields, values, tab = get_data_to_render(data)

    pos = 0
    for filed_dict in fields:
        pos = +1
        if 'rows' in filed_dict.keys():
            rows = filed_dict.get('rows')
            break

    if isinstance(data, unicode):
        data = json.loads(data)

    pateints = get_linked_phrs(data["profile_id"])
    print pateints

    if pateints:
        for patient in pateints['list']:
            pi = frappe.db.get_value("LinkedPHR Images",
                                     {"profile_id": patient['entityid']},
                                     "profile_image")
            import datetime
            creation_time = datetime.datetime.fromtimestamp(
                float(patient['entityid'].split('-', 1)[0]) /
                1000).strftime('%d/%m/%Y %H:%M')
            rows.extend([[
                """<a nohref class='popen' onclick="open_patient('%(entityid)s','%(name)s')" id='%(entityid)s'><img class='user-picture' src='%(pi)s' style='min-width: 20px; max-height: 20px; border-radius: 4px'/> %(name)s %(lname)s</i></a>"""
                % {
                    "entityid": patient['entityid'],
                    "pi": pi,
                    "name": patient['person_firstname'],
                    "lname": patient['person_lastname']
                }, patient["email"], patient['mobile'], creation_time
            ]])

    return {'rows': rows, 'listview': fields}