コード例 #1
0
ファイル: provider.py プロジェクト: saurabh6790/phr
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['list']

    for patient in pateints['list']:
        pi = frappe.db.get_value("LinkedPHR Images",
                                 {"profile_id": patient['entityid']},
                                 "profile_image")
        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']
        ]])

    return {'rows': rows, 'listview': fields}
コード例 #2
0
def get_medication_data(data):
	print "################################################################################"
	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)

	medication_list=fetch_values_from_db(data)
	for d in medication_list:
		if d.status=='Active':
			rows.extend([["<a nohref class='medication' id='%s'><i class='icon-unlock' data-toggle='tooltip' data-placement='top' title='Deactivate'></i></a>"%d.name,d.medicine_name, d.dosage,formatted_date(d.from_date_time),formatted_date(d.to_date_time),d.additional_info,d.status]])
		else:
			rows.extend([["<i class='icon-lock' data-toggle='tooltip' data-placement='top'>",d.medicine_name, d.dosage,formatted_date(d.from_date_time),formatted_date(d.to_date_time),d.additional_info,d.status]])	

	return {
		'rows': rows,
		'listview': fields
	}
コード例 #3
0
ファイル: provider.py プロジェクト: pawaranand/phr
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['list']

	for patient in pateints['list']:
		pi=frappe.db.get_value("LinkedPHR Images",{"profile_id":patient['entityid']},"profile_image")
		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']]])
		

	return {
		'rows': rows,
		'listview': fields
	}
コード例 #4
0
ファイル: medication.py プロジェクト: pawaranand/phr
def get_medication_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) or  isinstance(data, str):
		data=json.loads(data)

	medication_list=fetch_values_from_db(data)
	for d in medication_list:
		if d.status=='Active':
			rows.extend([["<a nohref class='medication' id='%s'><i class='icon-unlock' data-toggle='tooltip' data-placement='top' title='Deactivate'></i></a>"%d.name,d.medicine_name, d.dosage,formatted_date(d.from_date_time),formatted_date(d.to_date_time),d.additional_info,d.status]])
		else:
			rows.extend([["<i class='icon-lock' data-toggle='tooltip' data-placement='top'>",d.medicine_name, d.dosage,formatted_date(d.from_date_time),formatted_date(d.to_date_time),d.additional_info,d.status]])	

	return {
		'rows': rows,
		'listview': fields
	}
コード例 #5
0
ファイル: event.py プロジェクト: pawaranand/phr_5_1
def get_visit_data(data):
    print "-----------", data
    request_type = "POST"
    # url="http://192.168.5.12:9090/phr/phrdata/getprofilevisit"
    url = "%s/phrdata/getprofilevisit" % get_base_url()
    # url="http://88.198.52.49:7974/phr/phrdata/getprofilevisit"
    from phr.phr.phr_api import get_response

    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

    data = json.loads(data)

    response = get_response(url,
                            json.dumps({"profileId": data.get('profile_id')}),
                            request_type)
    res_data = json.loads(response.text)

    # url="http://192.168.5.12:9090/phr-api/phrdata/getprofilevisitfilecount"
    url = "%s/phrdata/getprofilevisitfilecount" % get_base_url()
    # url="http://88.198.52.49:7974/phr-api/phrdata/getprofilevisitfilecount"
    response = get_response(url,
                            json.dumps({"profile_id": data.get('profile_id')}),
                            request_type)
    res_data1 = json.loads(response.text)

    event_count_dict = {}
    get_event_wise_count_dict(res_data1.get('FileCountData'), event_count_dict)

    if isinstance(type(res_data), dict):
        res_data = res_data.get('phr')

    else:
        res_data = json.loads(res_data.get('phr'))

    if res_data.get('visitList'):
        for visit in res_data.get('visitList'):

            count_list = [0, 0, 0, 0, 0]

            data = [
                '<input  type="radio" name="visit" id = "%s">' %
                visit['entityid'], visit['str_visit_date'],
                visit['visit_descripton'], 'DOC', visit['doctor_name']
            ]

            event_list_updater(visit['entityid'], event_count_dict, count_list,
                               data)

            rows.extend([data])

    return {'rows': rows, 'listview': fields, 'page_size': 5}
コード例 #6
0
ファイル: event.py プロジェクト: saurabh6790/phr
def get_visit_data(data):
	request_type="POST"
	url="%s/phrdata/getprofilevisit"%get_base_url()
	from phr.phr.phr_api import get_response

	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

	data=json.loads(data)

	response=get_response(url, json.dumps({"profileId":data.get('profile_id')}), request_type)
	res_data = json.loads(response.text)

	url = "%s/phrdata/getprofilevisitfilecount"%get_base_url()

	response=get_response(url, json.dumps({"profile_id":data.get('profile_id')}), request_type)
	res_data1 = json.loads(response.text)

	event_count_dict = {}
	get_event_wise_count_dict(res_data1.get('FileCountData'), event_count_dict)
	
	if isinstance(type(res_data), dict):
		res_data = res_data.get('phr')

	else:
		res_data = json.loads(res_data.get('phr'))	

	if res_data.get('visitList'):
		for visit in res_data.get('visitList'):

			count_list = [0, 0, 0, 0, 0]

			data = ['<input  type="radio" name="visit" id = "%s"><div style="display:none">%s</div>'%(visit['entityid'], visit['entityid']),
					visit['event']['event_title'], visit['str_visit_date'], 
					visit['visit_descripton'], visit['doctor_name']]

			event_list_updater(visit['entityid'], event_count_dict, count_list, data)
			
			rows.extend([data])
	
	return {
		'rows': rows,
		'listview': fields,
		'page_size': 5
	}
コード例 #7
0
ファイル: event.py プロジェクト: saurabh6790/phr
def get_event_data(data):
	fields, values, tab = get_data_to_render(data)

	request_type="POST"
	url="%s/phrdata/getprofileevent"%get_base_url()
	from phr.phr.phr_api import get_response

	pos = 0

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

	data=json.loads(data)
	profile_id = data.get('profile_id')
	response=get_response(url, json.dumps({"profileId":data.get('profile_id')}), request_type)
	res_data = json.loads(response.text)

	url = "%s/phrdata/getprofilefilecount"%get_base_url()
	response=get_response(url, json.dumps({"profile_id":data.get('profile_id')}), request_type)
	res_data1 = json.loads(response.text)

	event_count_dict = {}
	get_event_wise_count_dict(res_data1.get('FileCountData'), event_count_dict)

	if isinstance(type(res_data), dict):
		res_data = res_data.get('phr')

	else:
		res_data = json.loads(res_data.get('phr'))	

	if res_data.get('eventList'):
		for visit in res_data.get('eventList'):
			count_list = [0, 0, 0, 0, 0]
			if not visit.get("event_diseasemontoring"):
				data = ['<input type="radio" name="event" id = "%s" "><div style="display:none">%s</div>'%(visit['entityid'], visit['entityid']), 
						"""<a nohref id="%(entityid)s" onclick="Events.prototype.open_form('%(entityid)s', '%(event_title)s', '%(profile_id)s')"> %(event_title)s </a>"""%{"entityid": visit['entityid'],"event_title": visit['event_title'], "profile_id":profile_id}, 
						datetime.datetime.fromtimestamp(cint(visit['event_date'])/1000.0).strftime('%d/%m/%Y'), 
						"<div style='word-wrap: break-word;width:60%%;'>%s</div>"%' ,'.join(visit['event_symptoms'])]
				
				event_list_updater(visit['entityid'], event_count_dict, count_list, data)
				
				rows.extend([data])

	return {
		'rows': rows,
		'listview': fields,
		'page_size': 5
	}
コード例 #8
0
ファイル: appointments.py プロジェクト: pawaranand/phr_5_1
def get_appointments(data):
    print "################################################################################"
    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
    data = json.loads(data)
    apts_list = fetch_values_from_db(data)
    for d in apts_list:
        rows.extend([["", d.from_date_time, d.provider_name, d.reason]])

    return {'rows': rows, 'listview': fields}
コード例 #9
0
ファイル: event.py プロジェクト: pawaranand/phr
def get_event_data(data):
	fields, values, tab = get_data_to_render(data)

	request_type="POST"
	url="%s/searchEventByFilterParam"%get_base_url()
	from phr.phr.phr_api import get_response

	pos = 0

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

	data=json.loads(data)
	profile_id = data.get('profile_id')
	
	response=get_response(url, json.dumps({"profileId":data.get('profile_id'),"event_date_from":data.get('event_date_from'),"event_date_to":data.get('event_date_to')}), request_type)
	res_data = json.loads(response.text)

	url = "%s/phrdata/getprofilefilecount"%get_base_url()
	response=get_response(url, json.dumps({"profile_id":data.get('profile_id')}), request_type)
	res_data1 = json.loads(response.text)

	event_count_dict = {}
	get_event_wise_count_dict(res_data1.get('FileCountData'), event_count_dict)

	if res_data.get('list'):
		for visit in res_data.get('list'):
			count_list = [0, 0, 0, 0, 0]
			if not visit.get("event_diseasemontoring"):
				data = ['<input type="radio" name="event" id = "%s" "><div style="display:none">%s</div>'%(visit['entityid'], visit['entityid']), 
						"""<a nohref id="%(entityid)s" onclick="Events.prototype.open_form('%(entityid)s', '%(event_title)s', '%(profile_id)s')"> %(event_title)s </a>"""%{"entityid": visit['entityid'],"event_title": visit['event_title'], "profile_id":profile_id}, 
						datetime.datetime.fromtimestamp(cint(visit['event_date'])/1000.0).strftime('%d/%m/%Y'), 
						"<div style='word-wrap: break-word;width:60%%;'>%s</div>"%' ,'.join(visit['event_symptoms'])]
				
				event_list_updater(visit['entityid'], event_count_dict, count_list, data)
				
				rows.extend([data])

	return {
		'rows': rows,
		'listview': fields,
		'page_size': 5
	}
コード例 #10
0
ファイル: event.py プロジェクト: pawaranand/phr
def get_visit_data(data):
	request_type="POST"
	url="%s/searchVisitByFilterparam"%get_base_url()
	from phr.phr.phr_api import get_response

	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

	data=json.loads(data)

	response=get_response(url, json.dumps({"profileId":data.get('profile_id'), "visit_date_from": data.get('visit_date_from'), "visit_date_to": data.get('visit_date_to')}), request_type)
	res_data = json.loads(response.text)

	url = "%s/phrdata/getprofilevisitfilecount"%get_base_url()

	response=get_response(url, json.dumps({"profile_id":data.get('profile_id')}), request_type)
	res_data1 = json.loads(response.text)

	event_count_dict = {}
	get_event_wise_count_dict(res_data1.get('FileCountData'), event_count_dict)

	if res_data.get('list'):
		for visit in res_data.get('list'):

			count_list = [0, 0, 0, 0, 0]

			data = ['<input  type="radio" name="visit" id = "%s"><div style="display:none">%s</div>'%(visit['entityid'], visit['entityid']),
					visit['visit_title'], visit['str_visit_date'], 
					visit['visit_descripton'], visit['doctor_name']]

			event_list_updater(visit['entityid'], event_count_dict, count_list, data)
			
			rows.extend([data])
	
	return {
		'rows': rows,
		'listview': fields,
		'page_size': 5
	}
コード例 #11
0
def get_messages_list(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

	data=json.loads(data)
	log_list=fetch_values_from_db(data)
	for d in log_list:
		rows.extend([["",d.entity,d.operation,d.subject,d.creation]])

	return {
		'rows': rows,
		'listview': fields
	}
コード例 #12
0
ファイル: medication.py プロジェクト: pawaranand/phr_5_1
def get_medication_data(data):
    print "################################################################################"
    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
    data = json.loads(data)
    medication_list = fetch_values_from_db(data)
    for d in medication_list:
        rows.extend([[
            "", d.medicine_name, d.dosage, d.from_date_time, d.to_date_time,
            d.additional_info
        ]])

    return {'rows': rows, 'listview': fields}
コード例 #13
0
ファイル: messages.py プロジェクト: pawaranand/phr
def get_messages_list(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

	data=json.loads(data)
	log_list=fetch_values_from_db(data)
	for d in log_list:
		rows.extend([["",d.entity,d.operation,d.subject, datetime.datetime.strptime(d.creation, '%Y-%m-%d %H:%M:%S.%f').strftime('%d/%m/%Y %H:%M')]])

	return {
		'rows': rows,
		'listview': fields
	}
コード例 #14
0
ファイル: provider_page.py プロジェクト: pawaranand/phr_5_1
def get_profile_list(data):
    print "in provider page p1"
    print data

    fields, values, tab = get_data_to_render(data)

    print fields

    request_type = "POST"
    url = "http://192.168.5.11:9090/phr-api/sharephr/getprofilelistSharedFrom"
    from phr.phr.phr_api import get_response

    pos = 0

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

    data = json.loads(data)

    response = get_response(
        url, json.dumps({"to_profile_id": data.get('profile_id')}),
        request_type)
    res_data = json.loads(response.text)

    if res_data.get('visitshareProfileList'):
        for profile in res_data.get('visitshareProfileList'):
            print profile.get("entityid"), profile.get(
                "person_firstname"), profile.get("person_lastname")
            data = [
                '<a nohref id="%s"> %s %s </a>' %
                (profile.get("entityid"), profile.get("person_firstname"),
                 profile.get("person_lastname"))
            ]
            rows.extend([data])

    return {'rows': rows, 'listview': fields, 'page_size': 5}
コード例 #15
0
ファイル: event.py プロジェクト: pawaranand/phr_5_1
def get_event_data(data):
    frappe.errprint(data)

    fields, values, tab = get_data_to_render(data)

    print fields

    request_type = "POST"
    url = "%s/phrdata/getprofileevent" % get_base_url()
    from phr.phr.phr_api import get_response

    pos = 0

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

    data = json.loads(data)

    response = get_response(url,
                            json.dumps({"profileId": data.get('profile_id')}),
                            request_type)
    res_data = json.loads(response.text)

    url = "%s/phrdata/getprofilefilecount" % get_base_url()
    response = get_response(url,
                            json.dumps({"profile_id": data.get('profile_id')}),
                            request_type)
    res_data1 = json.loads(response.text)

    event_count_dict = {}
    get_event_wise_count_dict(res_data1.get('FileCountData'), event_count_dict)

    if isinstance(type(res_data), dict):
        res_data = res_data.get('phr')

    else:
        res_data = json.loads(res_data.get('phr'))

    if res_data.get('eventList'):
        for visit in res_data.get('eventList'):
            count_list = [0, 0, 0, 0, 0]

            data = [
                '<input type="radio" name="event" id = "%s">' %
                visit['entityid'],
                '<a nohref id="%s"> %s </a>' %
                (visit['entityid'], visit['event_title']),
                datetime.datetime.fromtimestamp(
                    cint(visit['event_date']) / 1000.0).strftime('%d/%m/%Y'),
                visit['event_symptoms']
            ]

            event_list_updater(visit['entityid'], event_count_dict, count_list,
                               data)

            rows.extend([data])

    return {'rows': rows, 'listview': fields, 'page_size': 5}
コード例 #16
0
ファイル: provider_page.py プロジェクト: pawaranand/phr_5_1
def get_patient_data(data):
    fields, values, tab = get_data_to_render(data)
    dms_files = []
    file_dict = {}
    request_type = "POST"
    url = "http://192.168.5.11:9090/phr-api/sharephr/searchsharedeventdata"
    from phr.phr.phr_api import get_response

    pos = 0

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

    data = json.loads(data)

    data_dict = {
        "to_profile_id": data.get('profile_id'),
        "received_from": "desktop",
        "from_profile_id": data.get('other_param').get('patient_profile_id')
    }

    print data_dict

    response = get_response(url, json.dumps(data_dict), request_type)
    res_data = json.loads(response.text)

    if res_data.get('Jsoneventlist'):
        for event_details in res_data.get('Jsoneventlist'):
            event = event_details.get('event')

            data = [
                '<a nohref id="%s"> %s </a>' %
                (event['entityid'], event['event_title']),
                datetime.datetime.fromtimestamp(
                    cint(event['event_date']) / 1000.0).strftime('%d/%m/%Y'),
                event['event_symptoms']
            ]

            rows.extend([data])

            # print event_details.get('visitList')

            # for visit_details in event_details.get('visitList'):
            # print "\n\n visit_details \n"
            # print visit_details
            # print "\n"
            # break

            # for file_deatils in visit_details.get('visit_files'):
            # 	print "\n\n\n\n\n\n\n iechya gavat "
            # 	print file_deatils
            # 	print "\n\n\n\n\n\n\n\n"

            # for file_info in file_deatils.get('file_location'):
            # 	tags = file_deatils.get('entityid').split('-')[-1:]

            # 	file_dict = {"entityid": visit_details.get('entityid'),
            # 		"profile_id": visit_details.get('profile_id'),
            # 		"event_id": event.get('entityid')}

            # 	file_dict['tag_id'] = file_deatils.get('entityid')
            # 	file_dict["file_id"] = file_info.split('/')[-1:]
            # 	file_dict['path'] = os.path.join(os.getcwd(), get_site_path().replace('.',"")
            # 								.replace('/', ""), 'public', 'files',
            # 								data.get('other_param').get('patient_profile_id'),
            # 								event.get('entityid'),
            # 								visit_details.get('tag_name') + '-' + tags[:2],
            # 								visit_details.get('sub_tag_name') + '_' + tags[-2:],
            # 								visit_details.get('entityid'))

            # 	dms_files.append(file_dict)
        print "\n\n\n --------------data--------------\n"
        print file_dict
        print "\n\n\n\n"

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