-
Notifications
You must be signed in to change notification settings - Fork 0
/
touchGetPatientInfo.py
106 lines (78 loc) · 2.42 KB
/
touchGetPatientInfo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import json
import http.client
import urllib.parse
import sys
#url for the ga
import touchworksinit as touch
uc = touch.init()
print("UC=", uc)
PARAMS = {}
PATIENT = {}
PATIENT['firstname'] = 'Alannah'
PATIENT['lastname'] = 'De Bernales'
PATIENT['search'] = 'De*,Al*'
def getPatientInfo(uc, pt):
touch.initParams(PARAMS)
action = 'SearchPatients'
print (pt)
#PARAMS[1] = '*' + pt['lastname'] + '*'
#PARAMS[1] = pt['firstname']
PARAMS[1] = pt['lastname']
PARAMS[1] = pt['search']
#PARAMS[1] = 'De*,Al*'
jsonstr = touch.buildjson(action, uc, PARAMS, '')
uout = touch.unityaction(uc, jsonstr)
touch.uoutPrint(action, uout)
#Retrive the patient id
parsed_json = json.loads(uout)
pinfo = parsed_json[0]['searchpatientsinfo']
ID = pinfo[0]['ID']
PATIENT['ID'] = ID
def getClinicalSummary(uc, pt):
touch.initParams(PARAMS)
action = 'GetClinicalSummary'
PARAMS[0] = PATIENT['ID']
PARAMS[1] = 'Medications'
PARAMS[2] = '' #Encounter
PARAMS[3] = 'Y'
jsonstr = touch.buildjson(action, uc, PARAMS, '')
uout = touch.unityaction(uc, jsonstr)
touch.uoutPrint(action, uout)
#Retrieve the GetClinical Summary
parsed_json = json.loads(uout)
cinfo = parsed_json[0]['getclinicalsummaryinfo']
totalRx = len(cinfo)
medAttrib = { 'transid', 'code', 'entrycode', 'status', 'displaydate', 'description', 'detail' }
for i in range(0, totalRx):
rx = cinfo[i]
print( "%10s %-8s %-8s %-10s %-10s %-40.40s === [%-40s]" % (
rx['transid'],
rx['code'],
rx['entrycode'],
rx['status'],
rx['displaydate'],
rx['description'],
rx['detail']
))
meds = ""
meds = rx['transid']
meds = meds + " " + rx['code']
meds = meds + " " + rx['entrycode']
meds = meds + " " + rx['status']
meds = meds + " " + rx['displaydate']
meds = meds + " " + rx['description']
meds = meds + " " + rx['detail']
#print (meds)
return
medications = ""
for attr in medAttrib:
medications = medications + " " + c0[attr]
#print(attr)
print("%s" % (medications))
#print("cinfo=", cinfo)
getPatientInfo(uc, PATIENT)
getClinicalSummary(uc, PATIENT)
def getPatientByMRN(uc):
touch.initParams(PARAMS)
action = 'GetPatientByMRN'
PARAMS[1] = '12345678'