3145 lines
90 KiB
Genshi
3145 lines
90 KiB
Genshi
KIDS Distribution saved on Oct 15, 2010@10:42:58
|
|
NHIN 1.0
|
|
**KIDS**:NHIN 1.0^
|
|
|
|
**INSTALL NAME**
|
|
NHIN 1.0
|
|
"BLD",7491,0)
|
|
NHIN 1.0^NATIONAL HEALTH INFO NETWORK^0^3101015^y
|
|
"BLD",7491,4,0)
|
|
^9.64PA^^
|
|
"BLD",7491,6.3)
|
|
14
|
|
"BLD",7491,"ABPKG")
|
|
n
|
|
"BLD",7491,"INIT")
|
|
POST^NHINPI
|
|
"BLD",7491,"KRN",0)
|
|
^9.67PA^779.2^20
|
|
"BLD",7491,"KRN",.4,0)
|
|
.4
|
|
"BLD",7491,"KRN",.401,0)
|
|
.401
|
|
"BLD",7491,"KRN",.402,0)
|
|
.402
|
|
"BLD",7491,"KRN",.403,0)
|
|
.403
|
|
"BLD",7491,"KRN",.5,0)
|
|
.5
|
|
"BLD",7491,"KRN",.84,0)
|
|
.84
|
|
"BLD",7491,"KRN",3.6,0)
|
|
3.6
|
|
"BLD",7491,"KRN",3.8,0)
|
|
3.8
|
|
"BLD",7491,"KRN",9.2,0)
|
|
9.2
|
|
"BLD",7491,"KRN",9.8,0)
|
|
9.8
|
|
"BLD",7491,"KRN",9.8,"NM",0)
|
|
^9.68A^12^11
|
|
"BLD",7491,"KRN",9.8,"NM",1,0)
|
|
NHINPI^^0^B313819
|
|
"BLD",7491,"KRN",9.8,"NM",3,0)
|
|
NHINV^^0^B13990789
|
|
"BLD",7491,"KRN",9.8,"NM",4,0)
|
|
NHINVART^^0^B28029452
|
|
"BLD",7491,"KRN",9.8,"NM",5,0)
|
|
NHINVIMM^^0^B8275429
|
|
"BLD",7491,"KRN",9.8,"NM",6,0)
|
|
NHINVIT^^0^B30108507
|
|
"BLD",7491,"KRN",9.8,"NM",7,0)
|
|
NHINVLR^^0^B23999856
|
|
"BLD",7491,"KRN",9.8,"NM",8,0)
|
|
NHINVPL^^0^B19630772
|
|
"BLD",7491,"KRN",9.8,"NM",9,0)
|
|
NHINVPS^^0^B13986678
|
|
"BLD",7491,"KRN",9.8,"NM",10,0)
|
|
NHINVPSI^^0^B32869468
|
|
"BLD",7491,"KRN",9.8,"NM",11,0)
|
|
NHINVPSO^^0^B66033397
|
|
"BLD",7491,"KRN",9.8,"NM",12,0)
|
|
NHINVPT^^0^B58401800
|
|
"BLD",7491,"KRN",9.8,"NM","B","NHINPI",1)
|
|
|
|
"BLD",7491,"KRN",9.8,"NM","B","NHINV",3)
|
|
|
|
"BLD",7491,"KRN",9.8,"NM","B","NHINVART",4)
|
|
|
|
"BLD",7491,"KRN",9.8,"NM","B","NHINVIMM",5)
|
|
|
|
"BLD",7491,"KRN",9.8,"NM","B","NHINVIT",6)
|
|
|
|
"BLD",7491,"KRN",9.8,"NM","B","NHINVLR",7)
|
|
|
|
"BLD",7491,"KRN",9.8,"NM","B","NHINVPL",8)
|
|
|
|
"BLD",7491,"KRN",9.8,"NM","B","NHINVPS",9)
|
|
|
|
"BLD",7491,"KRN",9.8,"NM","B","NHINVPSI",10)
|
|
|
|
"BLD",7491,"KRN",9.8,"NM","B","NHINVPSO",11)
|
|
|
|
"BLD",7491,"KRN",9.8,"NM","B","NHINVPT",12)
|
|
|
|
"BLD",7491,"KRN",19,0)
|
|
19
|
|
"BLD",7491,"KRN",19,"NM",0)
|
|
^9.68A^1^1
|
|
"BLD",7491,"KRN",19,"NM",1,0)
|
|
NHIN APPLICATION PROXY^^0
|
|
"BLD",7491,"KRN",19,"NM","B","NHIN APPLICATION PROXY",1)
|
|
|
|
"BLD",7491,"KRN",19.1,0)
|
|
19.1
|
|
"BLD",7491,"KRN",19.1,"NM",0)
|
|
^9.68A^^
|
|
"BLD",7491,"KRN",101,0)
|
|
101
|
|
"BLD",7491,"KRN",409.61,0)
|
|
409.61
|
|
"BLD",7491,"KRN",771,0)
|
|
771
|
|
"BLD",7491,"KRN",779.2,0)
|
|
779.2
|
|
"BLD",7491,"KRN",870,0)
|
|
870
|
|
"BLD",7491,"KRN",8989.51,0)
|
|
8989.51
|
|
"BLD",7491,"KRN",8989.52,0)
|
|
8989.52
|
|
"BLD",7491,"KRN",8994,0)
|
|
8994
|
|
"BLD",7491,"KRN",8994,"NM",0)
|
|
^9.68A^2^1
|
|
"BLD",7491,"KRN",8994,"NM",2,0)
|
|
NHIN GET VISTA DATA^^0
|
|
"BLD",7491,"KRN",8994,"NM","B","NHIN GET VISTA DATA",2)
|
|
|
|
"BLD",7491,"KRN","B",.4,.4)
|
|
|
|
"BLD",7491,"KRN","B",.401,.401)
|
|
|
|
"BLD",7491,"KRN","B",.402,.402)
|
|
|
|
"BLD",7491,"KRN","B",.403,.403)
|
|
|
|
"BLD",7491,"KRN","B",.5,.5)
|
|
|
|
"BLD",7491,"KRN","B",.84,.84)
|
|
|
|
"BLD",7491,"KRN","B",3.6,3.6)
|
|
|
|
"BLD",7491,"KRN","B",3.8,3.8)
|
|
|
|
"BLD",7491,"KRN","B",9.2,9.2)
|
|
|
|
"BLD",7491,"KRN","B",9.8,9.8)
|
|
|
|
"BLD",7491,"KRN","B",19,19)
|
|
|
|
"BLD",7491,"KRN","B",19.1,19.1)
|
|
|
|
"BLD",7491,"KRN","B",101,101)
|
|
|
|
"BLD",7491,"KRN","B",409.61,409.61)
|
|
|
|
"BLD",7491,"KRN","B",771,771)
|
|
|
|
"BLD",7491,"KRN","B",779.2,779.2)
|
|
|
|
"BLD",7491,"KRN","B",870,870)
|
|
|
|
"BLD",7491,"KRN","B",8989.51,8989.51)
|
|
|
|
"BLD",7491,"KRN","B",8989.52,8989.52)
|
|
|
|
"BLD",7491,"KRN","B",8994,8994)
|
|
|
|
"BLD",7491,"QUES",0)
|
|
^9.62^^
|
|
"BLD",7491,"REQB",0)
|
|
^9.611^^
|
|
"INIT")
|
|
POST^NHINPI
|
|
"KRN",19,10580,-1)
|
|
0^1
|
|
"KRN",19,10580,0)
|
|
NHIN APPLICATION PROXY^Nhin Application Proxy^^B^^^^^^^^
|
|
"KRN",19,10580,1,0)
|
|
^19.06^3^3^3091201^^^
|
|
"KRN",19,10580,1,1,0)
|
|
This option allows the NHIN connector proxy access to the VistA system.
|
|
"KRN",19,10580,1,2,0)
|
|
|
|
"KRN",19,10580,1,3,0)
|
|
|
|
"KRN",19,10580,"RPC",0)
|
|
^19.05P^2^1
|
|
"KRN",19,10580,"RPC",2,0)
|
|
NHIN GET VISTA DATA
|
|
"KRN",19,10580,"U")
|
|
NHIN APPLICATION PROXY
|
|
"KRN",8994,3140,-1)
|
|
0^2
|
|
"KRN",8994,3140,0)
|
|
NHIN GET VISTA DATA^GET^NHINV^4^S^^^1^^^1
|
|
"KRN",8994,3140,1,0)
|
|
^8994.01^2^2^3100329^^^
|
|
"KRN",8994,3140,1,1,0)
|
|
This RPC retrieves the requested data from VistA, and returns it in
|
|
"KRN",8994,3140,1,2,0)
|
|
^TMP($J,"NHINV",n) as XML.
|
|
"KRN",8994,3140,2,0)
|
|
^8994.02A^6^6
|
|
"KRN",8994,3140,2,1,0)
|
|
DFN^1^20^1^1
|
|
"KRN",8994,3140,2,1,1,0)
|
|
^8994.021^2^2^3100203^^
|
|
"KRN",8994,3140,2,1,1,1,0)
|
|
Internal entry number from Patient file #2
|
|
"KRN",8994,3140,2,1,1,2,0)
|
|
[optionally DFN;ICN for remote calls]
|
|
"KRN",8994,3140,2,2,0)
|
|
TYPE^1^100^0^2
|
|
"KRN",8994,3140,2,2,1,0)
|
|
^8994.021^3^3^3100203^^
|
|
"KRN",8994,3140,2,2,1,1,0)
|
|
The kind(s) of data to return, which may include:
|
|
"KRN",8994,3140,2,2,1,2,0)
|
|
patient;allergy;problem;vital;lab;med;xray;
|
|
"KRN",8994,3140,2,2,1,3,0)
|
|
consult;procedure;surgery;document;encounter
|
|
"KRN",8994,3140,2,3,0)
|
|
START^1^20^0^3
|
|
"KRN",8994,3140,2,3,1,0)
|
|
^8994.021^1^1^3100203^^
|
|
"KRN",8994,3140,2,3,1,1,0)
|
|
The date/time from which to begin searching for data [optional].
|
|
"KRN",8994,3140,2,4,0)
|
|
STOP^1^20^0^4
|
|
"KRN",8994,3140,2,4,1,0)
|
|
^8994.021^1^1^3100203^^
|
|
"KRN",8994,3140,2,4,1,1,0)
|
|
The date/time at which to end searching for data [optional].
|
|
"KRN",8994,3140,2,5,0)
|
|
MAX^1^7^0^5
|
|
"KRN",8994,3140,2,5,1,0)
|
|
^8994.021^1^1^3100203^^
|
|
"KRN",8994,3140,2,5,1,1,0)
|
|
The maximum number of items to return per data type [optional].
|
|
"KRN",8994,3140,2,6,0)
|
|
ITEM^1^30^0^6
|
|
"KRN",8994,3140,2,6,1,0)
|
|
^8994.021^2^2^3100329^^^
|
|
"KRN",8994,3140,2,6,1,1,0)
|
|
The identifier of a single item to return [optional, but TYPE must
|
|
"KRN",8994,3140,2,6,1,2,0)
|
|
also be defined when used].
|
|
"KRN",8994,3140,2,"B","DFN",1)
|
|
|
|
"KRN",8994,3140,2,"B","ITEM",6)
|
|
|
|
"KRN",8994,3140,2,"B","MAX",5)
|
|
|
|
"KRN",8994,3140,2,"B","START",3)
|
|
|
|
"KRN",8994,3140,2,"B","STOP",4)
|
|
|
|
"KRN",8994,3140,2,"B","TYPE",2)
|
|
|
|
"KRN",8994,3140,2,"PARAMSEQ",1,1)
|
|
|
|
"KRN",8994,3140,2,"PARAMSEQ",2,2)
|
|
|
|
"KRN",8994,3140,2,"PARAMSEQ",3,3)
|
|
|
|
"KRN",8994,3140,2,"PARAMSEQ",4,4)
|
|
|
|
"KRN",8994,3140,2,"PARAMSEQ",5,5)
|
|
|
|
"KRN",8994,3140,2,"PARAMSEQ",6,6)
|
|
|
|
"KRN",8994,3140,3,0)
|
|
^8994.03^1^1^3100329^^^^
|
|
"KRN",8994,3140,3,1,0)
|
|
Text array formatted as XML
|
|
"MBREQ")
|
|
0
|
|
"ORD",16,8994)
|
|
8994;16;1;;;;;;;RPCDEL^XPDIA1
|
|
"ORD",16,8994,0)
|
|
REMOTE PROCEDURE
|
|
"ORD",18,19)
|
|
19;18;;;OPT^XPDTA;OPTF1^XPDIA;OPTE1^XPDIA;OPTF2^XPDIA;;OPTDEL^XPDIA
|
|
"ORD",18,19,0)
|
|
OPTION
|
|
"PKG",407,-1)
|
|
1^1
|
|
"PKG",407,0)
|
|
NATIONAL HEALTH INFO NETWORK^NHIN^NATIONAL HEALTH INFORMATION NETWORK ADAPTER
|
|
"PKG",407,1,0)
|
|
^^22^22^3091217^
|
|
"PKG",407,1,1,0)
|
|
VA's NHIN product supports the VA's business initiatives for
|
|
"PKG",407,1,2,0)
|
|
the increased exchange of health information between VA and
|
|
"PKG",407,1,3,0)
|
|
non-VA providers (other government and private sector health
|
|
"PKG",407,1,4,0)
|
|
organizations) that are providing care to veterans because
|
|
"PKG",407,1,5,0)
|
|
it is estimated that 3 out of 4 veterans receive care from
|
|
"PKG",407,1,6,0)
|
|
non-VA providers.
|
|
"PKG",407,1,7,0)
|
|
|
|
"PKG",407,1,8,0)
|
|
The VA NHIN system provides VistaWeb with access to the
|
|
"PKG",407,1,9,0)
|
|
available patient medical information provided by the NHIN.
|
|
"PKG",407,1,10,0)
|
|
The VA NHIN system will access the VA MPI to retrieve
|
|
"PKG",407,1,11,0)
|
|
patient demographics and the VA Vista(s) to retrieve patient
|
|
"PKG",407,1,12,0)
|
|
medical information. Version 1.0 of the NHIN supports these
|
|
"PKG",407,1,13,0)
|
|
medical domains: Patient Problem List Patient Allergies
|
|
"PKG",407,1,14,0)
|
|
Patient Medications (Pharmacy All Out-Patient Pharmacy).
|
|
"PKG",407,1,15,0)
|
|
|
|
"PKG",407,1,16,0)
|
|
The VA NHIN system accesses this information in the form of
|
|
"PKG",407,1,17,0)
|
|
a HITSP CCD or (C32) Continuity of Care Document.
|
|
"PKG",407,1,18,0)
|
|
|
|
"PKG",407,1,19,0)
|
|
The VA NHIN also provides the VA ROI office with support for
|
|
"PKG",407,1,20,0)
|
|
the patient authorizations process with a web page for the
|
|
"PKG",407,1,21,0)
|
|
Consumer Preferences and Policy Management System.
|
|
"PKG",407,1,22,0)
|
|
|
|
"PKG",407,5)
|
|
SLC
|
|
"PKG",407,7)
|
|
^^I
|
|
"PKG",407,20,0)
|
|
^9.402P^^
|
|
"PKG",407,22,0)
|
|
^9.49I^1^1
|
|
"PKG",407,22,1,0)
|
|
1.0^3101015
|
|
"PKG",407,"DEV")
|
|
PULEO/SLC
|
|
"PKG",407,"VERSION")
|
|
1.0
|
|
"QUES","XPF1",0)
|
|
Y
|
|
"QUES","XPF1","??")
|
|
^D REP^XPDH
|
|
"QUES","XPF1","A")
|
|
Shall I write over your |FLAG| File
|
|
"QUES","XPF1","B")
|
|
YES
|
|
"QUES","XPF1","M")
|
|
D XPF1^XPDIQ
|
|
"QUES","XPF2",0)
|
|
Y
|
|
"QUES","XPF2","??")
|
|
^D DTA^XPDH
|
|
"QUES","XPF2","A")
|
|
Want my data |FLAG| yours
|
|
"QUES","XPF2","B")
|
|
YES
|
|
"QUES","XPF2","M")
|
|
D XPF2^XPDIQ
|
|
"QUES","XPI1",0)
|
|
YO
|
|
"QUES","XPI1","??")
|
|
^D INHIBIT^XPDH
|
|
"QUES","XPI1","A")
|
|
Want KIDS to INHIBIT LOGONs during the install
|
|
"QUES","XPI1","B")
|
|
NO
|
|
"QUES","XPI1","M")
|
|
D XPI1^XPDIQ
|
|
"QUES","XPM1",0)
|
|
PO^VA(200,:EM
|
|
"QUES","XPM1","??")
|
|
^D MG^XPDH
|
|
"QUES","XPM1","A")
|
|
Enter the Coordinator for Mail Group '|FLAG|'
|
|
"QUES","XPM1","B")
|
|
|
|
"QUES","XPM1","M")
|
|
D XPM1^XPDIQ
|
|
"QUES","XPO1",0)
|
|
Y
|
|
"QUES","XPO1","??")
|
|
^D MENU^XPDH
|
|
"QUES","XPO1","A")
|
|
Want KIDS to Rebuild Menu Trees Upon Completion of Install
|
|
"QUES","XPO1","B")
|
|
NO
|
|
"QUES","XPO1","M")
|
|
D XPO1^XPDIQ
|
|
"QUES","XPZ1",0)
|
|
Y
|
|
"QUES","XPZ1","??")
|
|
^D OPT^XPDH
|
|
"QUES","XPZ1","A")
|
|
Want to DISABLE Scheduled Options, Menu Options, and Protocols
|
|
"QUES","XPZ1","B")
|
|
NO
|
|
"QUES","XPZ1","M")
|
|
D XPZ1^XPDIQ
|
|
"QUES","XPZ2",0)
|
|
Y
|
|
"QUES","XPZ2","??")
|
|
^D RTN^XPDH
|
|
"QUES","XPZ2","A")
|
|
Want to MOVE routines to other CPUs
|
|
"QUES","XPZ2","B")
|
|
NO
|
|
"QUES","XPZ2","M")
|
|
D XPZ2^XPDIQ
|
|
"RTN")
|
|
11
|
|
"RTN","NHINPI")
|
|
0^1^B313819
|
|
"RTN","NHINPI",1,0)
|
|
NHINPI ; SLC/AGP - NHIN package post install ; 12/01/2009
|
|
"RTN","NHINPI",2,0)
|
|
;;1.0;NHIN;;Oct 25, 2010;Build 14
|
|
"RTN","NHINPI",3,0)
|
|
;
|
|
"RTN","NHINPI",4,0)
|
|
POST ;
|
|
"RTN","NHINPI",5,0)
|
|
; Create proxy user
|
|
"RTN","NHINPI",6,0)
|
|
Q:$O(^VA(200,"B","NHIN,APPLICATION PROXY",0))
|
|
"RTN","NHINPI",7,0)
|
|
N X
|
|
"RTN","NHINPI",8,0)
|
|
S X=$$CREATE^XUSAP("NHIN,APPLICATION PROXY","","NHIN APPLICATION PROXY")
|
|
"RTN","NHINPI",9,0)
|
|
Q
|
|
"RTN","NHINPI",10,0)
|
|
;
|
|
"RTN","NHINV")
|
|
0^3^B13990789
|
|
"RTN","NHINV",1,0)
|
|
NHINV ;SLC/MKB - Serve VistA data as XML via RPC
|
|
"RTN","NHINV",2,0)
|
|
;;1.0;NHIN;;Oct 25, 2010;Build 14
|
|
"RTN","NHINV",3,0)
|
|
;
|
|
"RTN","NHINV",4,0)
|
|
; External References DBIA#
|
|
"RTN","NHINV",5,0)
|
|
; ------------------- -----
|
|
"RTN","NHINV",6,0)
|
|
; ^DPT 10035
|
|
"RTN","NHINV",7,0)
|
|
; ^SC 10040
|
|
"RTN","NHINV",8,0)
|
|
; DIQ 2056
|
|
"RTN","NHINV",9,0)
|
|
; MPIF001 2701
|
|
"RTN","NHINV",10,0)
|
|
; VASITE 10112
|
|
"RTN","NHINV",11,0)
|
|
; XLFDT 10103
|
|
"RTN","NHINV",12,0)
|
|
; XLFSTR 10104
|
|
"RTN","NHINV",13,0)
|
|
; XUAF4 2171
|
|
"RTN","NHINV",14,0)
|
|
;
|
|
"RTN","NHINV",15,0)
|
|
GET(NHIN,DFN,TYPE,START,STOP,MAX,ID) ; -- Return search results as XML in @NHIN@(n)
|
|
"RTN","NHINV",16,0)
|
|
; RPC = NHIN GET VISTA DATA
|
|
"RTN","NHINV",17,0)
|
|
N ICN,NHINI
|
|
"RTN","NHINV",18,0)
|
|
S NHIN=$NA(^TMP($J,"NHINV")) K @NHIN
|
|
"RTN","NHINV",19,0)
|
|
;
|
|
"RTN","NHINV",20,0)
|
|
; parse & validate input parameters
|
|
"RTN","NHINV",21,0)
|
|
S ICN=+$P(DFN,";",2),DFN=+$G(DFN)
|
|
"RTN","NHINV",22,0)
|
|
I 'DFN S DFN=+$$GETDFN^MPIF001(ICN)
|
|
"RTN","NHINV",23,0)
|
|
I DFN<1!'$D(^DPT(DFN)) D ERR(1,DFN) G GTQ
|
|
"RTN","NHINV",24,0)
|
|
S TYPE=$G(TYPE) I TYPE="" S TYPE=$$ALL
|
|
"RTN","NHINV",25,0)
|
|
S START=$G(START),STOP=$G(STOP),MAX=$G(MAX),ID=$G(ID)
|
|
"RTN","NHINV",26,0)
|
|
S:'START START=1410101 S:'STOP STOP=9999998 S:'MAX MAX=999999
|
|
"RTN","NHINV",27,0)
|
|
I START,STOP,STOP<START N X S X=START,START=STOP,STOP=X ;switch
|
|
"RTN","NHINV",28,0)
|
|
I STOP,$L(STOP,".")<2 S STOP=STOP_".24"
|
|
"RTN","NHINV",29,0)
|
|
;
|
|
"RTN","NHINV",30,0)
|
|
; extract data
|
|
"RTN","NHINV",31,0)
|
|
N NHINTYPE,NHINP,RTN
|
|
"RTN","NHINV",32,0)
|
|
S NHINTYPE=TYPE D ADD("<results>")
|
|
"RTN","NHINV",33,0)
|
|
F NHINP=1:1:$L(NHINTYPE,";") S TYPE=$P(NHINTYPE,";",NHINP) I $L(TYPE) D
|
|
"RTN","NHINV",34,0)
|
|
. S RTN="EN^"_$$RTN(TYPE) Q:'$L($T(@RTN)) ;D ERR(2) Q
|
|
"RTN","NHINV",35,0)
|
|
. D @(RTN_"(DFN,START,STOP,MAX,ID)")
|
|
"RTN","NHINV",36,0)
|
|
D ADD("</results>")
|
|
"RTN","NHINV",37,0)
|
|
;
|
|
"RTN","NHINV",38,0)
|
|
GTQ ; end
|
|
"RTN","NHINV",39,0)
|
|
Q
|
|
"RTN","NHINV",40,0)
|
|
;
|
|
"RTN","NHINV",41,0)
|
|
UPD(DFN,TYPE,ID) ; -- send message that TYPE/ID has been updated
|
|
"RTN","NHINV",42,0)
|
|
Q
|
|
"RTN","NHINV",43,0)
|
|
;
|
|
"RTN","NHINV",44,0)
|
|
RTN(X) ; -- Return name of NHINVxxx routine for clinical type X
|
|
"RTN","NHINV",45,0)
|
|
S X=$$UP^XLFSTR(X),Y=""
|
|
"RTN","NHINV",46,0)
|
|
I X="ALLERGY" S Y="NHINVART"
|
|
"RTN","NHINV",47,0)
|
|
I X="CONSULT" S Y="NHINVCON"
|
|
"RTN","NHINV",48,0)
|
|
I X="DOCUMENT" S Y="NHINVTIU"
|
|
"RTN","NHINV",49,0)
|
|
I X="IMMUNIZATION" S Y="NHINVIMM"
|
|
"RTN","NHINV",50,0)
|
|
I X="LAB" S Y="NHINVLR"
|
|
"RTN","NHINV",51,0)
|
|
I X="MED" S Y="NHINVPS"
|
|
"RTN","NHINV",52,0)
|
|
I X="RX" S Y="NHINVPSO"
|
|
"RTN","NHINV",53,0)
|
|
I X="ORDER" S Y="NHINVOR"
|
|
"RTN","NHINV",54,0)
|
|
I X="PATIENT" S Y="NHINVPT"
|
|
"RTN","NHINV",55,0)
|
|
I X="PROBLEM" S Y="NHINVPL"
|
|
"RTN","NHINV",56,0)
|
|
I X="PROCEDURE" S Y="NHINVMC"
|
|
"RTN","NHINV",57,0)
|
|
I X="SURGERY" S Y="NHINVSR"
|
|
"RTN","NHINV",58,0)
|
|
I X="VISIT" S Y="NHINVSIT"
|
|
"RTN","NHINV",59,0)
|
|
; X="VISITDATA" S Y="NHINVPCE"
|
|
"RTN","NHINV",60,0)
|
|
I X="VITAL" S Y="NHINVIT"
|
|
"RTN","NHINV",61,0)
|
|
I X="XRAY" S Y="NHINVRA"
|
|
"RTN","NHINV",62,0)
|
|
Q Y
|
|
"RTN","NHINV",63,0)
|
|
;
|
|
"RTN","NHINV",64,0)
|
|
ALL() ; -- return string for all types of data
|
|
"RTN","NHINV",65,0)
|
|
Q "patient;allergy;problem;vital;lab;med;immunization;visit;document"
|
|
"RTN","NHINV",66,0)
|
|
;
|
|
"RTN","NHINV",67,0)
|
|
ERR(X,VAL) ; -- return error message
|
|
"RTN","NHINV",68,0)
|
|
N MSG
|
|
"RTN","NHINV",69,0)
|
|
I X=1 S MSG="Patient with dfn '"_$G(VAL)_"' not found"
|
|
"RTN","NHINV",70,0)
|
|
I X=2 S MSG="Requested data type '"_$G(VAL)_"' not found"
|
|
"RTN","NHINV",71,0)
|
|
I X=99 S MSG="Unknown request"
|
|
"RTN","NHINV",72,0)
|
|
;
|
|
"RTN","NHINV",73,0)
|
|
D ADD("<error>")
|
|
"RTN","NHINV",74,0)
|
|
D ADD("<message>"_MSG_"</message>")
|
|
"RTN","NHINV",75,0)
|
|
D ADD("</error>")
|
|
"RTN","NHINV",76,0)
|
|
Q
|
|
"RTN","NHINV",77,0)
|
|
;
|
|
"RTN","NHINV",78,0)
|
|
ESC(X) ; -- escape outgoing XML
|
|
"RTN","NHINV",79,0)
|
|
; Q $ZCONVERT(X,"O","HTML") ; uncomment for fastest performance on Cache
|
|
"RTN","NHINV",80,0)
|
|
;
|
|
"RTN","NHINV",81,0)
|
|
N I,Y,QOT S QOT=""""
|
|
"RTN","NHINV",82,0)
|
|
S Y=$P(X,"&") F I=2:1:$L(X,"&") S Y=Y_"&"_$P(X,"&",I)
|
|
"RTN","NHINV",83,0)
|
|
S X=Y,Y=$P(X,"<") F I=2:1:$L(X,"<") S Y=Y_"<"_$P(X,"<",I)
|
|
"RTN","NHINV",84,0)
|
|
S X=Y,Y=$P(X,">") F I=2:1:$L(X,">") S Y=Y_">"_$P(X,">",I)
|
|
"RTN","NHINV",85,0)
|
|
S X=Y,Y=$P(X,"'") F I=2:1:$L(X,"'") S Y=Y_"'"_$P(X,"'",I)
|
|
"RTN","NHINV",86,0)
|
|
S X=Y,Y=$P(X,QOT) F I=2:1:$L(X,QOT) S Y=Y_"""_$P(X,QOT,I)
|
|
"RTN","NHINV",87,0)
|
|
Q Y
|
|
"RTN","NHINV",88,0)
|
|
;
|
|
"RTN","NHINV",89,0)
|
|
ADD(X) ; Add a line @NHIN@(n)=X
|
|
"RTN","NHINV",90,0)
|
|
S NHINI=$G(NHINI)+1
|
|
"RTN","NHINV",91,0)
|
|
S @NHIN@(NHINI)=X
|
|
"RTN","NHINV",92,0)
|
|
Q
|
|
"RTN","NHINV",93,0)
|
|
;
|
|
"RTN","NHINV",94,0)
|
|
STRING(ARRAY) ; -- Return text in ARRAY(n) or ARRAY(n,0) as a string
|
|
"RTN","NHINV",95,0)
|
|
N I,X,Y S Y=""
|
|
"RTN","NHINV",96,0)
|
|
S I=+$O(ARRAY("")) I I=0 S I=+$O(ARRAY(0))
|
|
"RTN","NHINV",97,0)
|
|
S Y=$S($D(ARRAY(I,0)):ARRAY(I,0),1:$G(ARRAY(I)))
|
|
"RTN","NHINV",98,0)
|
|
F S I=$O(ARRAY(I)) Q:I<1 D
|
|
"RTN","NHINV",99,0)
|
|
. S X=$S($D(ARRAY(I,0)):ARRAY(I,0),1:ARRAY(I))
|
|
"RTN","NHINV",100,0)
|
|
. S Y=Y_$C(13,10)_X
|
|
"RTN","NHINV",101,0)
|
|
Q Y
|
|
"RTN","NHINV",102,0)
|
|
;
|
|
"RTN","NHINV",103,0)
|
|
FAC(X) ; -- return Institution file station# for location X
|
|
"RTN","NHINV",104,0)
|
|
N HLOC,FAC,Y0,Y S Y=""
|
|
"RTN","NHINV",105,0)
|
|
S HLOC=$G(^SC(+$G(X),0)),FAC=$P(HLOC,U,4) ;Institution ien
|
|
"RTN","NHINV",106,0)
|
|
; Get P4 via Med Ctr Div, if not directly linked
|
|
"RTN","NHINV",107,0)
|
|
I 'FAC,$P(HLOC,U,15) S FAC=$$GET1^DIQ(40.8,+$P(HLOC,U,15)_",",.07,"I")
|
|
"RTN","NHINV",108,0)
|
|
S Y0=$S(FAC:$$NS^XUAF4(FAC),1:$P($$SITE^VASITE,U,2,3)) ;name^stn#
|
|
"RTN","NHINV",109,0)
|
|
S:$L(Y0) Y=$P(Y0,U,2)_U_$P(Y0,U) ;switch to stn#^name
|
|
"RTN","NHINV",110,0)
|
|
I $L(Y),'Y S $P(Y,U)=FAC
|
|
"RTN","NHINV",111,0)
|
|
Q Y
|
|
"RTN","NHINV",112,0)
|
|
;
|
|
"RTN","NHINV",113,0)
|
|
VUID(IEN,FILE) ; -- Return VUID for item
|
|
"RTN","NHINV",114,0)
|
|
Q $$GET1^DIQ(FILE,IEN_",",99.99)
|
|
"RTN","NHINVART")
|
|
0^4^B28029452
|
|
"RTN","NHINVART",1,0)
|
|
NHINVART ;SLC/MKB -- Allergy/Reaction extract
|
|
"RTN","NHINVART",2,0)
|
|
;;1.0;NHIN;;Oct 25, 2010;Build 14
|
|
"RTN","NHINVART",3,0)
|
|
;
|
|
"RTN","NHINVART",4,0)
|
|
; External References DBIA#
|
|
"RTN","NHINVART",5,0)
|
|
; ------------------- -----
|
|
"RTN","NHINVART",6,0)
|
|
; %DT 10003
|
|
"RTN","NHINVART",7,0)
|
|
; GMRADPT 10099
|
|
"RTN","NHINVART",8,0)
|
|
; EN1^GMRAOR2 2422
|
|
"RTN","NHINVART",9,0)
|
|
; PSN50P41 4531
|
|
"RTN","NHINVART",10,0)
|
|
; PSN50P65 4543
|
|
"RTN","NHINVART",11,0)
|
|
;
|
|
"RTN","NHINVART",12,0)
|
|
; ------------ Get reactions from VistA ------------
|
|
"RTN","NHINVART",13,0)
|
|
;
|
|
"RTN","NHINVART",14,0)
|
|
EN(DFN,BEG,END,MAX,IFN) ; -- find patient's allergies/reactions
|
|
"RTN","NHINVART",15,0)
|
|
N GMRA,GMRAL,NHI,NHITM,NHICNT
|
|
"RTN","NHINVART",16,0)
|
|
S DFN=+$G(DFN) Q:DFN<1
|
|
"RTN","NHINVART",17,0)
|
|
S BEG=$G(BEG,1410101),END=$G(END,9999998),MAX=$G(MAX,999999),NHICNT=0
|
|
"RTN","NHINVART",18,0)
|
|
D EN1^GMRADPT
|
|
"RTN","NHINVART",19,0)
|
|
;
|
|
"RTN","NHINVART",20,0)
|
|
; get one reaction
|
|
"RTN","NHINVART",21,0)
|
|
I $G(IFN) D EN1(IFN,.NHITM),XML(.NHITM) Q
|
|
"RTN","NHINVART",22,0)
|
|
;
|
|
"RTN","NHINVART",23,0)
|
|
; get all reactions
|
|
"RTN","NHINVART",24,0)
|
|
I 'GMRAL S NHITM("assessment")=$S(GMRAL=0:"nka",1:"not done") D XML(.NHITM) Q
|
|
"RTN","NHINVART",25,0)
|
|
S NHI=0 F S NHI=+$O(GMRAL(NHI)) Q:NHI<1 D Q:NHICNT'<MAX
|
|
"RTN","NHINVART",26,0)
|
|
. K NHITM D EN1(NHI,.NHITM) Q:'$D(NHITM)
|
|
"RTN","NHINVART",27,0)
|
|
. D XML(.NHITM) S NHICNT=NHICNT+1
|
|
"RTN","NHINVART",28,0)
|
|
Q
|
|
"RTN","NHINVART",29,0)
|
|
;
|
|
"RTN","NHINVART",30,0)
|
|
EN1(ID,REAC) ; -- return a reaction in REAC("attribute")=value
|
|
"RTN","NHINVART",31,0)
|
|
; from EN: expects GMRAL(ID)
|
|
"RTN","NHINVART",32,0)
|
|
N NHY,GMRA,I,J,X,Y,SEV,TXT,SYMP,NM,SEV K REAC
|
|
"RTN","NHINVART",33,0)
|
|
S GMRA=$G(GMRAL(ID)) D EN1^GMRAOR2(ID,"NHY")
|
|
"RTN","NHINVART",34,0)
|
|
S X=$P(NHY,U,10) I $L(X) S X=$$DATE(X) Q:X<BEG Q:X>END S REAC("entered")=X
|
|
"RTN","NHINVART",35,0)
|
|
S REAC("facility")=$$FAC^NHINV ;local stn#^name
|
|
"RTN","NHINVART",36,0)
|
|
S REAC("id")=ID,REAC("name")=$P(GMRA,U,2) D
|
|
"RTN","NHINVART",37,0)
|
|
. S X=$P(GMRA,U,9),Y=+$P(X,"(",2) I 'Y,X["PSDRUG" S Y=50
|
|
"RTN","NHINVART",38,0)
|
|
. S REAC("localCode")=X,REAC("vuid")=$$VUID^NHINV(+X,Y)
|
|
"RTN","NHINVART",39,0)
|
|
;S X=$P(GMRA,U,8) S:$L(X) REAC("mechanism")=$P(X,";")
|
|
"RTN","NHINVART",40,0)
|
|
S X=$P(NHY,U,5),REAC("source")=$E(X)
|
|
"RTN","NHINVART",41,0)
|
|
S REAC("adverseEventType")=$P(GMRA,U,7)
|
|
"RTN","NHINVART",42,0)
|
|
I $P(GMRA,U,4),$P(NHY,U,9) S REAC("verified")=$P(NHY,U,9)
|
|
"RTN","NHINVART",43,0)
|
|
S I=0,SEV="" F S I=$O(NHY("O",I)) Q:I<1 S X=$P(NHY("O",I),U,2) S:X]SEV SEV=X ;find highest severity
|
|
"RTN","NHINVART",44,0)
|
|
S:$L(SEV) REAC("severity")=SEV
|
|
"RTN","NHINVART",45,0)
|
|
; reactions [index first]
|
|
"RTN","NHINVART",46,0)
|
|
S I=0 F S I=$O(GMRAL(ID,"S",I)) Q:I<1 S X=$G(GMRAL(ID,"S",I)),Y=+$P(X,";",2),SYMP($P(X,";"))=Y
|
|
"RTN","NHINVART",47,0)
|
|
S I=0 F S I=$O(NHY("S",I)) Q:I<1 D
|
|
"RTN","NHINVART",48,0)
|
|
. S X=NHY("S",I),NM=$P(X," ("),Y=+$G(SYMP(NM))
|
|
"RTN","NHINVART",49,0)
|
|
. S REAC("reaction",I)=NM_U_$$VUID^NHINV(Y,120.83)
|
|
"RTN","NHINVART",50,0)
|
|
; comments
|
|
"RTN","NHINVART",51,0)
|
|
S I=0 F S I=$O(NHY("C",I)) Q:I<1 D
|
|
"RTN","NHINVART",52,0)
|
|
. S X=$G(NHY("C",I)) K TXT
|
|
"RTN","NHINVART",53,0)
|
|
. S Y=$$VA200($P(X,U,3))_U_$P(X,U)
|
|
"RTN","NHINVART",54,0)
|
|
. S Y=Y_U_$S($L($P(X,U,2)):$E($P(X,U,2)),1:"E")
|
|
"RTN","NHINVART",55,0)
|
|
. S J=0 F S J=$O(NHY("C",I,J)) Q:J<1 S X=$G(NHY("C",I,J,0)),TXT(J)=X
|
|
"RTN","NHINVART",56,0)
|
|
. K X S X=$$STRING^NHINV(.TXT)
|
|
"RTN","NHINVART",57,0)
|
|
. S REAC("comment",I)=Y_U_X ;ien^name^date^type^text
|
|
"RTN","NHINVART",58,0)
|
|
; drug info
|
|
"RTN","NHINVART",59,0)
|
|
I $D(NHY("I")) D
|
|
"RTN","NHINVART",60,0)
|
|
. N ROOT S ROOT=$$B^PSN50P41
|
|
"RTN","NHINVART",61,0)
|
|
. S I=0 F S I=$O(NHY("I",I)) Q:I<1 S X=$G(NHY("I",I)) D
|
|
"RTN","NHINVART",62,0)
|
|
.. N IEN S IEN=$O(@ROOT@(X,0))
|
|
"RTN","NHINVART",63,0)
|
|
.. S REAC("drugIngredient",I)=X_U_$$VUID^NHINV(IEN,50.416)
|
|
"RTN","NHINVART",64,0)
|
|
I $D(NHY("V")) D
|
|
"RTN","NHINVART",65,0)
|
|
. S I=0 F S I=$O(NHY("V",I)) Q:I<1 S X=$G(NHY("V",I)) D
|
|
"RTN","NHINVART",66,0)
|
|
.. D C^PSN50P65("",$P(X,U,2),"PSN")
|
|
"RTN","NHINVART",67,0)
|
|
.. N IEN S IEN=+$O(^TMP($J,"PSN","C",$P(X,U),0))
|
|
"RTN","NHINVART",68,0)
|
|
.. S REAC("drugClass",I)=$P(X,U,2)_U_$$VUID^NHINV(IEN,50.605)
|
|
"RTN","NHINVART",69,0)
|
|
Q
|
|
"RTN","NHINVART",70,0)
|
|
;
|
|
"RTN","NHINVART",71,0)
|
|
VA200(NAME) ; -- Return ien^name from #200
|
|
"RTN","NHINVART",72,0)
|
|
N Y S NAME=$G(NAME),Y="^"
|
|
"RTN","NHINVART",73,0)
|
|
I $L(NAME) S Y=+$O(^VA(200,"B",NAME,0))_U_NAME
|
|
"RTN","NHINVART",74,0)
|
|
Q Y
|
|
"RTN","NHINVART",75,0)
|
|
;
|
|
"RTN","NHINVART",76,0)
|
|
DATE(X) ; -- Return internal form of date X
|
|
"RTN","NHINVART",77,0)
|
|
N %DT,Y
|
|
"RTN","NHINVART",78,0)
|
|
S %DT="TX" D ^%DT
|
|
"RTN","NHINVART",79,0)
|
|
Q Y
|
|
"RTN","NHINVART",80,0)
|
|
;
|
|
"RTN","NHINVART",81,0)
|
|
; ------------ Return data to middle tier ------------
|
|
"RTN","NHINVART",82,0)
|
|
;
|
|
"RTN","NHINVART",83,0)
|
|
XML(REAC) ; -- Return patient reaction as XML
|
|
"RTN","NHINVART",84,0)
|
|
; as <element code='123' displayName='ABC' />
|
|
"RTN","NHINVART",85,0)
|
|
N ATT,X,Y,I,P,NM,TAG
|
|
"RTN","NHINVART",86,0)
|
|
D ADD("<allergy>")
|
|
"RTN","NHINVART",87,0)
|
|
S ATT="" F S ATT=$O(REAC(ATT)) Q:ATT="" D D:$L(Y) ADD(Y)
|
|
"RTN","NHINVART",88,0)
|
|
. I ATT="comment" D S Y="" Q
|
|
"RTN","NHINVART",89,0)
|
|
.. S I=0,Y="<comments>" D ADD(Y)
|
|
"RTN","NHINVART",90,0)
|
|
.. F S I=$O(REAC(ATT,I)) Q:I<1 S X=$G(REAC(ATT,I)) D
|
|
"RTN","NHINVART",91,0)
|
|
... S Y="<comment id='"_I
|
|
"RTN","NHINVART",92,0)
|
|
... S:$L($P(X,U,3)) Y=Y_"' entered='"_$P(X,U,3)
|
|
"RTN","NHINVART",93,0)
|
|
... S:$L($P(X,U,2)) Y=Y_"' enteredBy='"_$$ESC^NHINV($P(X,U,2))
|
|
"RTN","NHINVART",94,0)
|
|
... S:$L($P(X,U,4)) Y=Y_"' commentType='"_$P(X,U,4)
|
|
"RTN","NHINVART",95,0)
|
|
... S:$L($P(X,U,5)) Y=Y_"' commentText='"_$$ESC^NHINV($P(X,U,5))
|
|
"RTN","NHINVART",96,0)
|
|
... S Y=Y_"' />" D ADD(Y)
|
|
"RTN","NHINVART",97,0)
|
|
.. D ADD("</comments>")
|
|
"RTN","NHINVART",98,0)
|
|
. I $O(REAC(ATT,0)) D S Y="" Q
|
|
"RTN","NHINVART",99,0)
|
|
.. S NM=ATT_$S($E(ATT,$L(ATT))="s":"es",1:"s") D ADD("<"_NM_">")
|
|
"RTN","NHINVART",100,0)
|
|
.. S I=0 F S I=$O(REAC(ATT,I)) Q:I<1 D
|
|
"RTN","NHINVART",101,0)
|
|
... S X=$G(REAC(ATT,I)),Y="<"_ATT_" "
|
|
"RTN","NHINVART",102,0)
|
|
... F P=1:1 S TAG=$P("name^vuid^severity^Z",U,P) Q:TAG="Z" I $L($P(X,U,P)) S Y=Y_TAG_"='"_$$ESC^NHINV($P(X,U,P))_"' "
|
|
"RTN","NHINVART",103,0)
|
|
... S Y=Y_"/>" D ADD(Y)
|
|
"RTN","NHINVART",104,0)
|
|
.. D ADD("</"_NM_">")
|
|
"RTN","NHINVART",105,0)
|
|
. S X=$G(REAC(ATT)),Y="" Q:'$L(X)
|
|
"RTN","NHINVART",106,0)
|
|
. I X'["^" S Y="<"_ATT_" value='"_$$ESC^NHINV(X)_"' />" Q
|
|
"RTN","NHINVART",107,0)
|
|
. I $L(X)>1 D S Y=""
|
|
"RTN","NHINVART",108,0)
|
|
.. S Y="<"_ATT_" "
|
|
"RTN","NHINVART",109,0)
|
|
.. F P=1:1 S TAG=$P("code^name^Z",U,P) Q:TAG="Z" I $L($P(X,U,P)) S Y=Y_TAG_"='"_$$ESC^NHINV($P(X,U,P))_"' "
|
|
"RTN","NHINVART",110,0)
|
|
.. S Y=Y_"/>" D ADD(Y)
|
|
"RTN","NHINVART",111,0)
|
|
D ADD("</allergy>")
|
|
"RTN","NHINVART",112,0)
|
|
Q
|
|
"RTN","NHINVART",113,0)
|
|
;
|
|
"RTN","NHINVART",114,0)
|
|
ADD(X) ; Add a line @NHIN@(n)=X
|
|
"RTN","NHINVART",115,0)
|
|
S NHINI=$G(NHINI)+1
|
|
"RTN","NHINVART",116,0)
|
|
S @NHIN@(NHINI)=X
|
|
"RTN","NHINVART",117,0)
|
|
Q
|
|
"RTN","NHINVART",118,0)
|
|
;
|
|
"RTN","NHINVART",119,0)
|
|
C32(REAC) ; -- convert iens to C32 codes
|
|
"RTN","NHINVART",120,0)
|
|
N X,Y,I
|
|
"RTN","NHINVART",121,0)
|
|
S X=$G(REAC("product")) I X S $P(REAC("product"),U)=$$VUID^NHINV(+X,120.82)
|
|
"RTN","NHINVART",122,0)
|
|
S X=$P($G(REAC("type")),U),Y=$P($G(REAC("mechanism")),U)
|
|
"RTN","NHINVART",123,0)
|
|
I $L(X) D S $P(REAC("type"),U)=I
|
|
"RTN","NHINVART",124,0)
|
|
. I Y="A" S I=$S(X["D":416098002,X["F":414285001,1:419199007) Q
|
|
"RTN","NHINVART",125,0)
|
|
. I Y="P" S I=$S(X["D":59037007,X["F":235719002,1:420134006) Q
|
|
"RTN","NHINVART",126,0)
|
|
. S I=$S(X["D":419511003,X["F":418471000,1:418038007)
|
|
"RTN","NHINVART",127,0)
|
|
S X=+$G(REAC("severity")) I X D
|
|
"RTN","NHINVART",128,0)
|
|
. S X=$S(X=1:255604002,X=2:6736007,X=3:24484000,1:X)
|
|
"RTN","NHINVART",129,0)
|
|
. S $P(REAC("severity"),U)=X
|
|
"RTN","NHINVART",130,0)
|
|
S I=0 F S I=$O(REAC("reaction",I)) Q:I<1 D
|
|
"RTN","NHINVART",131,0)
|
|
. S X=$G(REAC("reaction",I)) Q:'X
|
|
"RTN","NHINVART",132,0)
|
|
. S $P(REAC("reaction",I),U)=$$VUID^NHINV(+X,120.83)
|
|
"RTN","NHINVART",133,0)
|
|
S I=0 F S I=$O(REAC("drugClass",I)) Q:I<1 D
|
|
"RTN","NHINVART",134,0)
|
|
. S X=$G(REAC("drugClass",I)) Q:'X
|
|
"RTN","NHINVART",135,0)
|
|
. S $P(REAC("drugClass",I),U)=$$VUID^NHINV(+X,50.605)
|
|
"RTN","NHINVART",136,0)
|
|
S I=0 F S I=$O(REAC("drugIngredient",I)) Q:I<1 D
|
|
"RTN","NHINVART",137,0)
|
|
. S X=$G(REAC("drugIngredient",I)) Q:'X
|
|
"RTN","NHINVART",138,0)
|
|
. S $P(REAC("drugIngredient",I),U)=$$VUID^NHINV(+X,50.416)
|
|
"RTN","NHINVART",139,0)
|
|
Q
|
|
"RTN","NHINVIMM")
|
|
0^5^B8275429
|
|
"RTN","NHINVIMM",1,0)
|
|
NHINVIMM ;SLC/MKB -- Immunizations extract
|
|
"RTN","NHINVIMM",2,0)
|
|
;;1.0;NHIN;;Oct 25, 2010;Build 14
|
|
"RTN","NHINVIMM",3,0)
|
|
;
|
|
"RTN","NHINVIMM",4,0)
|
|
; External References DBIA#
|
|
"RTN","NHINVIMM",5,0)
|
|
; ------------------- -----
|
|
"RTN","NHINVIMM",6,0)
|
|
; ^DIC(4 10090
|
|
"RTN","NHINVIMM",7,0)
|
|
; ^VA(200 10060
|
|
"RTN","NHINVIMM",8,0)
|
|
; DIC 2051
|
|
"RTN","NHINVIMM",9,0)
|
|
; DIQ 2056
|
|
"RTN","NHINVIMM",10,0)
|
|
; PXRHS03,^TMP("PXI",$J) 1239
|
|
"RTN","NHINVIMM",11,0)
|
|
; XUAF4 2171
|
|
"RTN","NHINVIMM",12,0)
|
|
;
|
|
"RTN","NHINVIMM",13,0)
|
|
; ------------ Get immunizations from VistA ------------
|
|
"RTN","NHINVIMM",14,0)
|
|
;
|
|
"RTN","NHINVIMM",15,0)
|
|
EN(DFN,BEG,END,MAX,IFN) ; -- find patient's immunizations
|
|
"RTN","NHINVIMM",16,0)
|
|
N NHITM,NHICNT,NM,IDT
|
|
"RTN","NHINVIMM",17,0)
|
|
S DFN=+$G(DFN) Q:DFN<1 ;invalid patient
|
|
"RTN","NHINVIMM",18,0)
|
|
S BEG=$G(BEG,1410101),END=$G(END,9999998),MAX=$G(MAX,999999),NHICNT=0
|
|
"RTN","NHINVIMM",19,0)
|
|
K ^TMP("PXI",$J) D IMMUN^PXRHS03(DFN)
|
|
"RTN","NHINVIMM",20,0)
|
|
;
|
|
"RTN","NHINVIMM",21,0)
|
|
; get one immunization
|
|
"RTN","NHINVIMM",22,0)
|
|
I $G(IFN) D Q
|
|
"RTN","NHINVIMM",23,0)
|
|
. N DONE S DONE=0
|
|
"RTN","NHINVIMM",24,0)
|
|
. S NM="" F S NM=$O(^TMP("PXI",$J,NM)) Q:NM="" D Q:DONE
|
|
"RTN","NHINVIMM",25,0)
|
|
.. S IDT=0 F S IDT=$O(^TMP("PXI",$J,NM,IDT)) Q:IDT<1 I $D(^(IDT,IFN)) D Q
|
|
"RTN","NHINVIMM",26,0)
|
|
... D EN1(.NHITM),XML(.NHITM)
|
|
"RTN","NHINVIMM",27,0)
|
|
... S DONE=1
|
|
"RTN","NHINVIMM",28,0)
|
|
. K ^TMP("PXI",$J)
|
|
"RTN","NHINVIMM",29,0)
|
|
;
|
|
"RTN","NHINVIMM",30,0)
|
|
; get all immunizations
|
|
"RTN","NHINVIMM",31,0)
|
|
S NM="" F S NM=$O(^TMP("PXI",$J,NM)) Q:NM="" D
|
|
"RTN","NHINVIMM",32,0)
|
|
. S IDT=0 F S IDT=$O(^TMP("PXI",$J,NM,IDT)) Q:IDT<1 D
|
|
"RTN","NHINVIMM",33,0)
|
|
.. S IFN=0 F S IFN=$O(^TMP("PXI",$J,NM,IDT,IFN)) Q:IFN<1 D Q:NHICNT'<MAX
|
|
"RTN","NHINVIMM",34,0)
|
|
... K NHITM D EN1(.NHITM),XML(.NHITM)
|
|
"RTN","NHINVIMM",35,0)
|
|
... S NHICNT=NHICNT+1
|
|
"RTN","NHINVIMM",36,0)
|
|
K ^TMP("PXI",$J)
|
|
"RTN","NHINVIMM",37,0)
|
|
Q
|
|
"RTN","NHINVIMM",38,0)
|
|
;
|
|
"RTN","NHINVIMM",39,0)
|
|
EN1(IMM) ; -- return an immunization in IMM("attribute")=value
|
|
"RTN","NHINVIMM",40,0)
|
|
; Expects ^TMP("PXI",$J,NM,IDT,IFN) from IMMUN^PXRHS03
|
|
"RTN","NHINVIMM",41,0)
|
|
N X0,X1,CPT,DA,X,Y K IMM
|
|
"RTN","NHINVIMM",42,0)
|
|
S X0=$G(^TMP("PXI",$J,NM,IDT,IFN,0)),X1=$G(^(1)),X=$G(^("COM"))
|
|
"RTN","NHINVIMM",43,0)
|
|
S:$L(X) IMM("comment")=X
|
|
"RTN","NHINVIMM",44,0)
|
|
S IMM("id")=IFN,IMM("name")=$P(X0,U)
|
|
"RTN","NHINVIMM",45,0)
|
|
S IMM("administered")=+$P(X0,U,3)
|
|
"RTN","NHINVIMM",46,0)
|
|
S IMM("series")=$P(X0,U,5)
|
|
"RTN","NHINVIMM",47,0)
|
|
S IMM("reaction")=$P(X0,U,6)
|
|
"RTN","NHINVIMM",48,0)
|
|
S IMM("contraindicated")=+$P(X0,U,7)
|
|
"RTN","NHINVIMM",49,0)
|
|
S IMM("location")=$P(X1,U)
|
|
"RTN","NHINVIMM",50,0)
|
|
S X=$P(X1,U,3) I $L(X) D
|
|
"RTN","NHINVIMM",51,0)
|
|
. S Y=$$LKUP^XUAF4(X) ;ien
|
|
"RTN","NHINVIMM",52,0)
|
|
. I Y<1 S Y=+$O(^DIC(4,"B",X,0)) ;dupl -> get 1st
|
|
"RTN","NHINVIMM",53,0)
|
|
. S IMM("facility")=$$STA^XUAF4(Y)_U_X
|
|
"RTN","NHINVIMM",54,0)
|
|
S X=$P(X0,U,9) S:'$L(X) X=$P(X0,U,8)
|
|
"RTN","NHINVIMM",55,0)
|
|
I $L(X) S IMM("provider")=+$O(^VA(200,"B",X,0))_U_X
|
|
"RTN","NHINVIMM",56,0)
|
|
;
|
|
"RTN","NHINVIMM",57,0)
|
|
S DA=+$$GET1^DIQ(9000010.11,IFN_",",.01,"I") Q:'DA
|
|
"RTN","NHINVIMM",58,0)
|
|
S X=+$$FIND1^DIC(811.1,,"QX",DA_";AUTTIMM(","B") I X>0 D
|
|
"RTN","NHINVIMM",59,0)
|
|
. S Y=$$GET1^DIQ(811.1,X_",",.02,"I") Q:Y<1
|
|
"RTN","NHINVIMM",60,0)
|
|
. S CPT=$G(@(U_$P(Y,";",2)_+Y_",0)"))
|
|
"RTN","NHINVIMM",61,0)
|
|
. S IMM("cpt")=$P(CPT,U,1,2)
|
|
"RTN","NHINVIMM",62,0)
|
|
Q
|
|
"RTN","NHINVIMM",63,0)
|
|
;
|
|
"RTN","NHINVIMM",64,0)
|
|
; ------------ Return data to middle tier ------------
|
|
"RTN","NHINVIMM",65,0)
|
|
;
|
|
"RTN","NHINVIMM",66,0)
|
|
XML(IMM) ; -- Return immunizations as XML
|
|
"RTN","NHINVIMM",67,0)
|
|
N ATT,X,Y,I,P,NAMES,TAG
|
|
"RTN","NHINVIMM",68,0)
|
|
D ADD("<immunization>")
|
|
"RTN","NHINVIMM",69,0)
|
|
S ATT="" F S ATT=$O(IMM(ATT)) Q:ATT="" D
|
|
"RTN","NHINVIMM",70,0)
|
|
. S X=$G(IMM(ATT)),Y="" Q:'$L(X)
|
|
"RTN","NHINVIMM",71,0)
|
|
. I X'["^" S Y="<"_ATT_" value='"_$$ESC^NHINV(X)_"' />" D ADD(Y) Q
|
|
"RTN","NHINVIMM",72,0)
|
|
. I $L(X)>1 D
|
|
"RTN","NHINVIMM",73,0)
|
|
.. S Y="<"_ATT_" "
|
|
"RTN","NHINVIMM",74,0)
|
|
.. F P=1:1 S TAG=$P("code^name^Z",U,P) Q:TAG="Z" I $L($P(X,U,P)) S Y=Y_TAG_"='"_$$ESC^NHINV($P(X,U,P))_"' "
|
|
"RTN","NHINVIMM",75,0)
|
|
.. S Y=Y_"/>" D ADD(Y)
|
|
"RTN","NHINVIMM",76,0)
|
|
D ADD("</immunization>")
|
|
"RTN","NHINVIMM",77,0)
|
|
Q
|
|
"RTN","NHINVIMM",78,0)
|
|
;
|
|
"RTN","NHINVIMM",79,0)
|
|
ADD(X) ; -- Add a line @NHIN@(n)=X
|
|
"RTN","NHINVIMM",80,0)
|
|
S NHINI=$G(NHINI)+1
|
|
"RTN","NHINVIMM",81,0)
|
|
S @NHIN@(NHINI)=X
|
|
"RTN","NHINVIMM",82,0)
|
|
Q
|
|
"RTN","NHINVIT")
|
|
0^6^B30108507
|
|
"RTN","NHINVIT",1,0)
|
|
NHINVIT ;SLC/MKB -- Vitals extract
|
|
"RTN","NHINVIT",2,0)
|
|
;;1.0;NHIN;;Oct 25, 2010;Build 14
|
|
"RTN","NHINVIT",3,0)
|
|
;
|
|
"RTN","NHINVIT",4,0)
|
|
; External References DBIA#
|
|
"RTN","NHINVIT",5,0)
|
|
; ------------------- -----
|
|
"RTN","NHINVIT",6,0)
|
|
; ^SC 10040
|
|
"RTN","NHINVIT",7,0)
|
|
; ^VA(200 10060
|
|
"RTN","NHINVIT",8,0)
|
|
; DIC 2051
|
|
"RTN","NHINVIT",9,0)
|
|
; DIQ 2056
|
|
"RTN","NHINVIT",10,0)
|
|
; GMRVUT0,^UTILITY($J,"GMRVD") 1446
|
|
"RTN","NHINVIT",11,0)
|
|
; GMVPXRM 3647
|
|
"RTN","NHINVIT",12,0)
|
|
;
|
|
"RTN","NHINVIT",13,0)
|
|
; ------------ Get vitals from VistA ------------
|
|
"RTN","NHINVIT",14,0)
|
|
;
|
|
"RTN","NHINVIT",15,0)
|
|
EN(DFN,BEG,END,MAX,IFN) ; -- find patient's vitals
|
|
"RTN","NHINVIT",16,0)
|
|
N NHITM,NHIPRM,GMRVSTR,IDT,TYPE,VIT,CNT,X0,X,Y,I,N
|
|
"RTN","NHINVIT",17,0)
|
|
S DFN=+$G(DFN) Q:DFN<1
|
|
"RTN","NHINVIT",18,0)
|
|
;
|
|
"RTN","NHINVIT",19,0)
|
|
; get one measurement
|
|
"RTN","NHINVIT",20,0)
|
|
I $G(IFN) D EN1(IFN,.NHITM),XML(.NHITM) Q
|
|
"RTN","NHINVIT",21,0)
|
|
;
|
|
"RTN","NHINVIT",22,0)
|
|
; get all measurements
|
|
"RTN","NHINVIT",23,0)
|
|
S BEG=$G(BEG,1410101),END=$G(END,9999998),MAX=$G(MAX,999999)
|
|
"RTN","NHINVIT",24,0)
|
|
S GMRVSTR="BP;T;R;P;HT;WT;CVP;CG;PO2;PN",GMRVSTR(0)=BEG_U_END_U_MAX_"^1"
|
|
"RTN","NHINVIT",25,0)
|
|
K ^UTILITY($J,"GMRVD") D EN1^GMRVUT0
|
|
"RTN","NHINVIT",26,0)
|
|
S (IDT,CNT)=0 F S IDT=$O(^UTILITY($J,"GMRVD",IDT)) Q:IDT<1 D Q:CNT'<MAX
|
|
"RTN","NHINVIT",27,0)
|
|
. K VIT S VIT("taken")=9999999-IDT,CNT=CNT+1,N=0
|
|
"RTN","NHINVIT",28,0)
|
|
. S TYPE="" F S TYPE=$O(^UTILITY($J,"GMRVD",IDT,TYPE)) Q:TYPE="" D
|
|
"RTN","NHINVIT",29,0)
|
|
.. N NAME,VUID,RESULT,UNIT,MRES,MUNT,HIGH,LOW,QUAL
|
|
"RTN","NHINVIT",30,0)
|
|
.. S IFN=+$O(^UTILITY($J,"GMRVD",IDT,TYPE,0)),X0=$G(^(IFN))
|
|
"RTN","NHINVIT",31,0)
|
|
.. S X=+$P(X0,U,3),NAME=$$GET1^DIQ(120.5,IFN_",",.03)
|
|
"RTN","NHINVIT",32,0)
|
|
.. S VUID=$$VUID^NHINV(X,120.51),RESULT=$P(X0,U,8)
|
|
"RTN","NHINVIT",33,0)
|
|
.. S UNIT=$S(TYPE="T":"F",TYPE="HT":"in",TYPE="WT":"lb",TYPE="CVP":"cmH2O",TYPE="CG":"in",1:"")
|
|
"RTN","NHINVIT",34,0)
|
|
.. S (MRES,MUNT)="" I $L($P(X0,U,13)) D
|
|
"RTN","NHINVIT",35,0)
|
|
... S X=$S(TYPE="T":"C",TYPE="HT":"cm",TYPE="WT":"kg",TYPE="CG":"cm",1:"")
|
|
"RTN","NHINVIT",36,0)
|
|
... S MRES=$P(X0,U,13) S:$L(X) MUNT=X
|
|
"RTN","NHINVIT",37,0)
|
|
.. S X=$$RANGE(TYPE),(HIGH,LOW)="" I $L(X) S HIGH=$P(X,U),LOW=$P(X,U,2)
|
|
"RTN","NHINVIT",38,0)
|
|
.. S N=N+1,VIT("measurement",N)=IFN_U_VUID_U_NAME_U_RESULT_U_UNIT_U_MRES_U_MUNT_U_HIGH_U_LOW
|
|
"RTN","NHINVIT",39,0)
|
|
.. S QUAL=$P(X0,U,17) I $L(QUAL) F I=1:1:$L(QUAL,";") D
|
|
"RTN","NHINVIT",40,0)
|
|
... S X=$P(QUAL,";",I),Y=$$FIND1^DIC(120.52,,"QX",X)
|
|
"RTN","NHINVIT",41,0)
|
|
... I Y S VIT("measurement",N,"qualifier",I)=X_U_$$VUID^NHINV(Y,120.52)
|
|
"RTN","NHINVIT",42,0)
|
|
. S VIT("entered")=$P($G(X0),U,4) ;use last one
|
|
"RTN","NHINVIT",43,0)
|
|
. S VIT("facility")=$$FAC^NHINV($P($G(X0),U,5))
|
|
"RTN","NHINVIT",44,0)
|
|
. D XML(.VIT)
|
|
"RTN","NHINVIT",45,0)
|
|
K ^UTILITY($J,"GMRVD")
|
|
"RTN","NHINVIT",46,0)
|
|
Q
|
|
"RTN","NHINVIT",47,0)
|
|
;
|
|
"RTN","NHINVIT",48,0)
|
|
EN1(ID,VIT) ; -- return a vital/measurement in VIT("attribute")
|
|
"RTN","NHINVIT",49,0)
|
|
K VIT S ID=+$G(ID) Q:ID<1 ;invalid ien
|
|
"RTN","NHINVIT",50,0)
|
|
N NHY,DFN,TYPE,X,Y,NAME,VUID,RESULT,UNIT,MRES,MUNT,HIGH,LOW,I
|
|
"RTN","NHINVIT",51,0)
|
|
D EN^GMVPXRM(.NHY,ID,"B")
|
|
"RTN","NHINVIT",52,0)
|
|
S DFN=+$G(NHY(2)) Q:DFN<1
|
|
"RTN","NHINVIT",53,0)
|
|
S TYPE=$$GET1^DIQ(120.51,+NHY(3)_",",1)
|
|
"RTN","NHINVIT",54,0)
|
|
S VIT("facility")=$$FAC^NHINV(+NHY(5)),VIT("taken")=+NHY(1)
|
|
"RTN","NHINVIT",55,0)
|
|
S NAME=$P(NHY(3),U,2),VUID=$$VUID^NHINV(+NHY(3),120.51)
|
|
"RTN","NHINVIT",56,0)
|
|
S X=$P(NHY(7),U,2),RESULT=X,(UNIT,MRES,MUNT)=""
|
|
"RTN","NHINVIT",57,0)
|
|
I TYPE="T" S UNIT="F",MUNT="C" S MRES=$J(X-32*5/9,0,1) ; EN1^GMRVUTL
|
|
"RTN","NHINVIT",58,0)
|
|
I TYPE="HT" S UNIT="in",MUNT="cm" S MRES=$J(2.54*X,0,2) ; EN2^GMRVUTL
|
|
"RTN","NHINVIT",59,0)
|
|
I TYPE="WT" S UNIT="lb",MUNT="kg" S MRES=$J(X/2.2,0,2) ; EN3^GMRVUTL
|
|
"RTN","NHINVIT",60,0)
|
|
I TYPE="CG" S UNIT="in",MUNT="cm" S MRES=$J(2.54*X,0,2)
|
|
"RTN","NHINVIT",61,0)
|
|
I TYPE="CVP" S UNIT="cmH2O"
|
|
"RTN","NHINVIT",62,0)
|
|
S VIT("entered")=+NHY(4),(HIGH,LOW)=""
|
|
"RTN","NHINVIT",63,0)
|
|
S X=$$RANGE(TYPE) I $L(X) S HIGH=$P(X,U),LOW=$P(X,U,2)
|
|
"RTN","NHINVIT",64,0)
|
|
S VIT("measurement",1)=ID_U_VUID_U_NAME_U_RESULT_U_UNIT_U_MRES_U_MUNT_U_HIGH_U_LOW
|
|
"RTN","NHINVIT",65,0)
|
|
S I=0 F S I=$O(NHY(12,I)) Q:I<1 S X=$G(NHY(12,I)),VIT("measurement",1,"qualifier",I)=$P(X,U,2)_U_$$VUID^NHINV(+X,120.52)
|
|
"RTN","NHINVIT",66,0)
|
|
Q
|
|
"RTN","NHINVIT",67,0)
|
|
;
|
|
"RTN","NHINVIT",68,0)
|
|
USER(X) ; -- Return ien^name for person# X
|
|
"RTN","NHINVIT",69,0)
|
|
N Y S X=+$G(X)
|
|
"RTN","NHINVIT",70,0)
|
|
S Y=$S(X:X_U_$P($G(^VA(200,X,0)),U),1:"^")
|
|
"RTN","NHINVIT",71,0)
|
|
Q Y
|
|
"RTN","NHINVIT",72,0)
|
|
;
|
|
"RTN","NHINVIT",73,0)
|
|
LOC(X) ; -- Return ien^name for hospital location X
|
|
"RTN","NHINVIT",74,0)
|
|
N Y S X=+$G(X)
|
|
"RTN","NHINVIT",75,0)
|
|
S Y=$S(X:X_U_$P($G(^SC(X,0)),U),1:"^")
|
|
"RTN","NHINVIT",76,0)
|
|
Q Y
|
|
"RTN","NHINVIT",77,0)
|
|
;
|
|
"RTN","NHINVIT",78,0)
|
|
RANGE(TYPE) ; -- return high^low range of values for TYPE
|
|
"RTN","NHINVIT",79,0)
|
|
N Y S Y="" I '$D(NHIPRM) D ;get parameter values
|
|
"RTN","NHINVIT",80,0)
|
|
. N VAL D GETS^DIQ(120.57,"1,","5:7","","VAL")
|
|
"RTN","NHINVIT",81,0)
|
|
. M NHIPRM=VAL(120.57,"1,")
|
|
"RTN","NHINVIT",82,0)
|
|
I TYPE="T" S Y=$G(NHIPRM(5.1))_U_$G(NHIPRM(5.2))
|
|
"RTN","NHINVIT",83,0)
|
|
I TYPE="P" S Y=$G(NHIPRM(5.3))_U_$G(NHIPRM(5.4))
|
|
"RTN","NHINVIT",84,0)
|
|
I TYPE="R" S Y=$G(NHIPRM(5.5))_U_$G(NHIPRM(5.6))
|
|
"RTN","NHINVIT",85,0)
|
|
I TYPE="CVP" S Y=$G(NHIPRM(6.1))_U_$G(NHIPRM(6.2))
|
|
"RTN","NHINVIT",86,0)
|
|
I TYPE="PO2" S Y="100^"_$G(NHIPRM(6.3))
|
|
"RTN","NHINVIT",87,0)
|
|
I TYPE="BP" D
|
|
"RTN","NHINVIT",88,0)
|
|
. S Y=$G(NHIPRM(5.7))_"/"_$G(NHIPRM(5.71))_U
|
|
"RTN","NHINVIT",89,0)
|
|
. S Y=Y_$G(NHIPRM(5.8))_"/"_$G(NHIPRM(5.81))
|
|
"RTN","NHINVIT",90,0)
|
|
Q Y
|
|
"RTN","NHINVIT",91,0)
|
|
;
|
|
"RTN","NHINVIT",92,0)
|
|
; ------------ Return data to middle tier ------------
|
|
"RTN","NHINVIT",93,0)
|
|
;
|
|
"RTN","NHINVIT",94,0)
|
|
NAME(X) ; -- Return name of measurement type X for XML element
|
|
"RTN","NHINVIT",95,0)
|
|
N Y S X=$G(X),Y=""
|
|
"RTN","NHINVIT",96,0)
|
|
S Y=$S(X="BP":"bloodPressure",X="T":"temperature",X="R":"respiration",X="P":"pulse",X="HT":"height",X="WT":"weight",X="CVP":"centralVenousPressure",X="CG":"circumferenceGirth",X="PO2":"pulseOximetry",X="PN":"pain",1:"")
|
|
"RTN","NHINVIT",97,0)
|
|
Q Y
|
|
"RTN","NHINVIT",98,0)
|
|
;
|
|
"RTN","NHINVIT",99,0)
|
|
XML(VIT) ; -- Return vital measurement as XML in @NHIN@(#)
|
|
"RTN","NHINVIT",100,0)
|
|
N ATT,X,Y,I,J,P,NAMES,TAG
|
|
"RTN","NHINVIT",101,0)
|
|
D ADD("<vital>")
|
|
"RTN","NHINVIT",102,0)
|
|
S ATT="" F S ATT=$O(VIT(ATT)) Q:ATT="" D
|
|
"RTN","NHINVIT",103,0)
|
|
. I ATT="measurement" D Q
|
|
"RTN","NHINVIT",104,0)
|
|
.. D ADD("<measurements>")
|
|
"RTN","NHINVIT",105,0)
|
|
.. S NAMES="id^vuid^name^value^units^metricValue^metricUnits^high^low^Z"
|
|
"RTN","NHINVIT",106,0)
|
|
.. S I=0 F S I=$O(VIT(ATT,I)) Q:I<1 D
|
|
"RTN","NHINVIT",107,0)
|
|
... S X=$G(VIT(ATT,I)),Y="<"_ATT_" "
|
|
"RTN","NHINVIT",108,0)
|
|
... F P=1:1 S TAG=$P(NAMES,U,P) Q:TAG="Z" I $L($P(X,U,P)) S Y=Y_TAG_"='"_$$ESC^NHINV($P(X,U,P))_"' "
|
|
"RTN","NHINVIT",109,0)
|
|
... I '$D(VIT(ATT,I,"qualifier")) S Y=Y_"/>" D ADD(Y) Q
|
|
"RTN","NHINVIT",110,0)
|
|
... S Y=Y_">" D ADD(Y),ADD("<qualifiers>")
|
|
"RTN","NHINVIT",111,0)
|
|
... S J=0 F S J=$O(VIT(ATT,I,"qualifier",J)) Q:J<1 D
|
|
"RTN","NHINVIT",112,0)
|
|
.... S Y="<qualifier ",X=$G(VIT(ATT,I,"qualifier",J))
|
|
"RTN","NHINVIT",113,0)
|
|
.... F P=1:1 S TAG=$P("name^vuid^Z",U,P) Q:TAG="Z" I $L($P(X,U,P)) S Y=Y_TAG_"='"_$$ESC^NHINV($P(X,U,P))_"' "
|
|
"RTN","NHINVIT",114,0)
|
|
.... S Y=Y_"/>" D ADD(Y)
|
|
"RTN","NHINVIT",115,0)
|
|
... D ADD("</qualifiers>"),ADD("</measurement>")
|
|
"RTN","NHINVIT",116,0)
|
|
.. D ADD("</measurements>")
|
|
"RTN","NHINVIT",117,0)
|
|
. S X=$G(VIT(ATT)),Y="" Q:'$L(X)
|
|
"RTN","NHINVIT",118,0)
|
|
. I X'["^" S Y="<"_ATT_" value='"_$$ESC^NHINV(X)_"' />" D ADD(Y) Q
|
|
"RTN","NHINVIT",119,0)
|
|
. I $L(X)>1 D
|
|
"RTN","NHINVIT",120,0)
|
|
.. S Y="<"_ATT_" "
|
|
"RTN","NHINVIT",121,0)
|
|
.. F P=1:1 S TAG=$P("code^name^Z",U,P) Q:TAG="Z" I $L($P(X,U,P)) S Y=Y_TAG_"='"_$$ESC^NHINV($P(X,U,P))_"' "
|
|
"RTN","NHINVIT",122,0)
|
|
.. S Y=Y_"/>" D ADD(Y)
|
|
"RTN","NHINVIT",123,0)
|
|
D ADD("</vital>")
|
|
"RTN","NHINVIT",124,0)
|
|
Q
|
|
"RTN","NHINVIT",125,0)
|
|
;
|
|
"RTN","NHINVIT",126,0)
|
|
ADD(X) ; Add a line @NHIN@(n)=X
|
|
"RTN","NHINVIT",127,0)
|
|
S NHINI=$G(NHINI)+1
|
|
"RTN","NHINVIT",128,0)
|
|
S @NHIN@(NHINI)=X
|
|
"RTN","NHINVIT",129,0)
|
|
Q
|
|
"RTN","NHINVLR")
|
|
0^7^B23999856
|
|
"RTN","NHINVLR",1,0)
|
|
NHINVLR ;SLC/MKB -- Laboratory extract
|
|
"RTN","NHINVLR",2,0)
|
|
;;1.0;NHIN;;Oct 25, 2010;Build 14
|
|
"RTN","NHINVLR",3,0)
|
|
;
|
|
"RTN","NHINVLR",4,0)
|
|
; External References DBIA#
|
|
"RTN","NHINVLR",5,0)
|
|
; ------------------- -----
|
|
"RTN","NHINVLR",6,0)
|
|
; ^DPT 10035
|
|
"RTN","NHINVLR",7,0)
|
|
; ^LAB(60 10054
|
|
"RTN","NHINVLR",8,0)
|
|
; ^LRO(69 2407
|
|
"RTN","NHINVLR",9,0)
|
|
; ^LR 525
|
|
"RTN","NHINVLR",10,0)
|
|
; DIC 2051
|
|
"RTN","NHINVLR",11,0)
|
|
; DIQ 2056
|
|
"RTN","NHINVLR",12,0)
|
|
; LR7OR1,^TMP("LRRR",$J) 2503
|
|
"RTN","NHINVLR",13,0)
|
|
;
|
|
"RTN","NHINVLR",14,0)
|
|
; ------------ Get results from VistA ------------
|
|
"RTN","NHINVLR",15,0)
|
|
;
|
|
"RTN","NHINVLR",16,0)
|
|
EN(DFN,BEG,END,MAX,ID) ; -- find patient's lab results
|
|
"RTN","NHINVLR",17,0)
|
|
N NHSUB,NHIDT,NHI,NHITM,LRDFN,SUB
|
|
"RTN","NHINVLR",18,0)
|
|
S DFN=+$G(DFN) Q:$G(DFN)<1
|
|
"RTN","NHINVLR",19,0)
|
|
S BEG=$G(BEG,1410101),END=$G(END,9999998),MAX=$G(MAX,999999)
|
|
"RTN","NHINVLR",20,0)
|
|
K ^TMP("LRRR",$J,DFN) S LRDFN=$G(^DPT(DFN,"LR")),NHSUB="CH"
|
|
"RTN","NHINVLR",21,0)
|
|
;
|
|
"RTN","NHINVLR",22,0)
|
|
; get result(s)
|
|
"RTN","NHINVLR",23,0)
|
|
I $L($G(ID)) D Q:NHI ;done
|
|
"RTN","NHINVLR",24,0)
|
|
. S NHSUB=$P(ID,";"),NHIDT=+$P(ID,";",2),(BEG,END)=9999999-NHIDT
|
|
"RTN","NHINVLR",25,0)
|
|
. S NHI=$P(ID,";",3) I NHI D ;skip loop - single result
|
|
"RTN","NHINVLR",26,0)
|
|
.. D RR^LR7OR1(DFN,,BEG,END,NHSUB)
|
|
"RTN","NHINVLR",27,0)
|
|
.. S SUB=$S("CH^MI"[NHSUB:NHSUB,1:"AP")_"(.NHITM)"
|
|
"RTN","NHINVLR",28,0)
|
|
.. D @SUB,XML(.NHITM)
|
|
"RTN","NHINVLR",29,0)
|
|
.. K ^TMP("LRRR",$J,DFN)
|
|
"RTN","NHINVLR",30,0)
|
|
D RR^LR7OR1(DFN,,BEG,END,NHSUB,,,MAX)
|
|
"RTN","NHINVLR",31,0)
|
|
;
|
|
"RTN","NHINVLR",32,0)
|
|
S NHSUB="" F S NHSUB=$O(^TMP("LRRR",$J,DFN,NHSUB)) Q:NHSUB="" D
|
|
"RTN","NHINVLR",33,0)
|
|
. S NHIDT=0 F S NHIDT=$O(^TMP("LRRR",$J,DFN,NHSUB,NHIDT)) Q:NHIDT<1 D
|
|
"RTN","NHINVLR",34,0)
|
|
.. S NHI=0 F S NHI=$O(^TMP("LRRR",$J,DFN,NHSUB,NHIDT,NHI)) Q:NHI<1 D
|
|
"RTN","NHINVLR",35,0)
|
|
... K NHITM S SUB=$S("CH^MI"[NHSUB:NHSUB,1:"AP")_"(.NHITM)"
|
|
"RTN","NHINVLR",36,0)
|
|
... D @SUB,XML(.NHITM)
|
|
"RTN","NHINVLR",37,0)
|
|
K ^TMP("LRRR",$J,DFN)
|
|
"RTN","NHINVLR",38,0)
|
|
Q
|
|
"RTN","NHINVLR",39,0)
|
|
;
|
|
"RTN","NHINVLR",40,0)
|
|
CH(LAB) ; -- return a Chemistry result in LAB("attribute")=value
|
|
"RTN","NHINVLR",41,0)
|
|
; Expects ^TMP("LRRR",$J,DFN,"CH",NHIDT,NHI),LRDFN
|
|
"RTN","NHINVLR",42,0)
|
|
N ID,CDT,X0,X,NUM,ORD,CMMT,LR0,LOINC K LAB
|
|
"RTN","NHINVLR",43,0)
|
|
S ID="CH;"_NHIDT_";"_NHI,LAB("id")=ID
|
|
"RTN","NHINVLR",44,0)
|
|
S CDT=9999999-NHIDT,LAB("collected")=CDT,LAB("status")="completed"
|
|
"RTN","NHINVLR",45,0)
|
|
S LR0=$G(^LR(LRDFN,"CH",NHIDT,0)),LAB("resulted")=$P(LR0,U,3)
|
|
"RTN","NHINVLR",46,0)
|
|
S X0=$G(^TMP("LRRR",$J,DFN,"CH",NHIDT,NHI))
|
|
"RTN","NHINVLR",47,0)
|
|
S LAB("test")=$P($G(^LAB(60,+X0,0)),U) ;$P(X0,U,10)?
|
|
"RTN","NHINVLR",48,0)
|
|
S:$L($P(X0,U,2)) LAB("result")=$P(X0,U,2)
|
|
"RTN","NHINVLR",49,0)
|
|
S:$L($P(X0,U,4)) LAB("units")=$P(X0,U,4)
|
|
"RTN","NHINVLR",50,0)
|
|
S:$L($P(X0,U,3)) LAB("interpretation")=$P(X0,U,3)
|
|
"RTN","NHINVLR",51,0)
|
|
S X=$P(X0,U,5) I $L(X),X["-" S LAB("low")=$P(X,"-"),LAB("high")=$P(X,"-",2)
|
|
"RTN","NHINVLR",52,0)
|
|
S LAB("localName")=$S($L($P(X0,U,15)):$P(X0,U,15),1:LAB("test"))
|
|
"RTN","NHINVLR",53,0)
|
|
S NUM=$P(X0,U,16),LAB("groupID")=NUM
|
|
"RTN","NHINVLR",54,0)
|
|
S X=$P(NUM," "),LAB("type")=$$TYPE(X)
|
|
"RTN","NHINVLR",55,0)
|
|
S X=$P($P(LR0,U,3),"!",3) S:X LOINC=$$GET1^DIQ(95.3,X_",",.01)
|
|
"RTN","NHINVLR",56,0)
|
|
S X=+$P(X0,U,19) I X D ;specimen
|
|
"RTN","NHINVLR",57,0)
|
|
. N VUID S VUID=""
|
|
"RTN","NHINVLR",58,0)
|
|
. S LAB("specimen")=$$GET1^DIQ(61,X_",",2) ;SNOMED
|
|
"RTN","NHINVLR",59,0)
|
|
. S LAB("sample")=$$GET1^DIQ(61,X_",",4.1)
|
|
"RTN","NHINVLR",60,0)
|
|
. ; LOINC=+$G(^LAB(60,+X0,1,X,95.3))
|
|
"RTN","NHINVLR",61,0)
|
|
. S:'$G(LOINC) LOINC=$$GET1^DIQ(60.01,X_","_+X0_",",95.3)
|
|
"RTN","NHINVLR",62,0)
|
|
. I LOINC S LAB("loinc")=LOINC,VUID=$$VUID^NHINV(+LOINC,95.3)
|
|
"RTN","NHINVLR",63,0)
|
|
. S:VUID LAB("vuid")=VUID
|
|
"RTN","NHINVLR",64,0)
|
|
S ORD=+$P(X0,U,17) S:ORD LAB("labOrderID")=ORD
|
|
"RTN","NHINVLR",65,0)
|
|
S X=$$ORDER(ORD,+X0) S:X LAB("orderID")=X
|
|
"RTN","NHINVLR",66,0)
|
|
S X=$P(LR0,U,14)
|
|
"RTN","NHINVLR",67,0)
|
|
S:X LAB("facility")=$$STA^XUAF4(X)_U_$P($$NS^XUAF4(X),U)
|
|
"RTN","NHINVLR",68,0)
|
|
I 'X S LAB("facility")=$$FAC^NHINV ;local stn#^name
|
|
"RTN","NHINVLR",69,0)
|
|
I $D(^TMP("LRRR",$J,DFN,"CH",NHIDT,"N")) M CMMT=^("N") S LAB("comment")=$$STRING^NHINV(.CMMT)
|
|
"RTN","NHINVLR",70,0)
|
|
Q
|
|
"RTN","NHINVLR",71,0)
|
|
;
|
|
"RTN","NHINVLR",72,0)
|
|
ORDER(LABORD,TEST) ; -- return #100 order for Lab order# & Test
|
|
"RTN","NHINVLR",73,0)
|
|
N Y,D,S,T S Y=""
|
|
"RTN","NHINVLR",74,0)
|
|
S D=$O(^LRO(69,"C",LABORD,0)) I D D
|
|
"RTN","NHINVLR",75,0)
|
|
. S S=0 F S S=$O(^LRO(69,"C",LABORD,D,S)) Q:S<1 D
|
|
"RTN","NHINVLR",76,0)
|
|
.. S T=0 F S T=$O(^LRO(69,D,1,S,2,T)) Q:T<1 I +$G(^(T,0))=TEST S Y=+$P(^(0),U,7)
|
|
"RTN","NHINVLR",77,0)
|
|
Q Y
|
|
"RTN","NHINVLR",78,0)
|
|
;
|
|
"RTN","NHINVLR",79,0)
|
|
MI(LAB) ; -- return a Microbiology result in LAB("attribute")=value
|
|
"RTN","NHINVLR",80,0)
|
|
; Expects ^TMP("LRRR",$J,DFN,"MI",NHIDT,NHI),LRDFN
|
|
"RTN","NHINVLR",81,0)
|
|
N ID,CDT,X0,X,CMMT,LR0 K LAB
|
|
"RTN","NHINVLR",82,0)
|
|
S X0=$G(^TMP("LRRR",$J,DFN,"MI",NHIDT,NHI)) Q:$L($P(X0,U))'>1
|
|
"RTN","NHINVLR",83,0)
|
|
S ID="MI;"_NHIDT_"#"_NHI,LAB("id")=ID,LAB("status")="completed"
|
|
"RTN","NHINVLR",84,0)
|
|
S LAB("type")="MICROBIOLOGY",CDT=9999999-NHIDT,LAB("collected")=CDT
|
|
"RTN","NHINVLR",85,0)
|
|
S LR0=$G(^LR(LRDFN,"MI",NHIDT,0)),LAB("resulted")=$P(LR0,U,3)
|
|
"RTN","NHINVLR",86,0)
|
|
S:$L($P(X0,U,2)) LAB("result")=$P(X0,U,2)
|
|
"RTN","NHINVLR",87,0)
|
|
S:$L($P(X0,U,4)) LAB("units")=$P(X0,U,4)
|
|
"RTN","NHINVLR",88,0)
|
|
S:$L($P(X0,U,3)) LAB("interpretation")=$P(X0,U,3)
|
|
"RTN","NHINVLR",89,0)
|
|
S (LAB("test"),LAB("localName"))=$P(X0,U,15)
|
|
"RTN","NHINVLR",90,0)
|
|
S X=+$P(X0,U,19) I X D ;specimen
|
|
"RTN","NHINVLR",91,0)
|
|
. S LAB("specimen")=$$GET1^DIQ(61,X_",",2) ;SNOMED
|
|
"RTN","NHINVLR",92,0)
|
|
. S LAB("sample")=$$GET1^DIQ(61,X_",",4.1) ;name
|
|
"RTN","NHINVLR",93,0)
|
|
S X=$P(LR0,U,14)
|
|
"RTN","NHINVLR",94,0)
|
|
S:X LAB("facility")=$$STA^XUAF4(X)_U_$P($$NS^XUAF4(X),U)
|
|
"RTN","NHINVLR",95,0)
|
|
I 'X S LAB("facility")=$$FAC^NHINV ;local stn#^name
|
|
"RTN","NHINVLR",96,0)
|
|
I $D(^TMP("LRRR",$J,DFN,"MI",NHIDT,"N")) M CMMT=^("N") S LAB("comment")=$$STRING^NHINV(.CMMT)
|
|
"RTN","NHINVLR",97,0)
|
|
Q
|
|
"RTN","NHINVLR",98,0)
|
|
;
|
|
"RTN","NHINVLR",99,0)
|
|
AP(LAB) ; -- return a Pathology result in LAB("attribute")=value
|
|
"RTN","NHINVLR",100,0)
|
|
K LAB ;not implemented yet
|
|
"RTN","NHINVLR",101,0)
|
|
Q
|
|
"RTN","NHINVLR",102,0)
|
|
;
|
|
"RTN","NHINVLR",103,0)
|
|
TYPE(X) ; -- Return name of lab section
|
|
"RTN","NHINVLR",104,0)
|
|
N NHIY,Y S Y=X
|
|
"RTN","NHINVLR",105,0)
|
|
D FIND^DIC(68,,.01,"PQX",X,,"B",,,"NHIY")
|
|
"RTN","NHINVLR",106,0)
|
|
S:$G(NHIY("DILIST",1,0)) Y=$P(NHIY("DILIST",1,0),U,2) ;name
|
|
"RTN","NHINVLR",107,0)
|
|
Q Y
|
|
"RTN","NHINVLR",108,0)
|
|
;
|
|
"RTN","NHINVLR",109,0)
|
|
; ------------ Return data to middle tier ------------
|
|
"RTN","NHINVLR",110,0)
|
|
;
|
|
"RTN","NHINVLR",111,0)
|
|
XML(LAB) ; -- Return result as XML in @NHIN@(#)
|
|
"RTN","NHINVLR",112,0)
|
|
N ATT,X,Y,P,NAMES,TAG
|
|
"RTN","NHINVLR",113,0)
|
|
D ADD("<lab>")
|
|
"RTN","NHINVLR",114,0)
|
|
S ATT="" F S ATT=$O(LAB(ATT)) Q:ATT="" D D:$L(Y) ADD(Y)
|
|
"RTN","NHINVLR",115,0)
|
|
. S X=$G(LAB(ATT)),Y="" Q:'$L(X)
|
|
"RTN","NHINVLR",116,0)
|
|
. I ATT="comment" S Y="<"_ATT_" xml:space='preserve'>"_$$ESC^NHINV(X)_"</"_ATT_">" Q
|
|
"RTN","NHINVLR",117,0)
|
|
. I X'["^" S Y="<"_ATT_" value='"_$$ESC^NHINV(X)_"' />" Q
|
|
"RTN","NHINVLR",118,0)
|
|
. I $L(X)>1 D S Y=""
|
|
"RTN","NHINVLR",119,0)
|
|
.. S Y="<"_ATT_" ",NAMES="code^name^Z"
|
|
"RTN","NHINVLR",120,0)
|
|
.. F P=1:1 S TAG=$P(NAMES,U,P) Q:TAG="Z" I $L($P(X,U,P)) S Y=Y_TAG_"='"_$$ESC^NHINV($P(X,U,P))_"' "
|
|
"RTN","NHINVLR",121,0)
|
|
.. S Y=Y_"/>" D ADD(Y)
|
|
"RTN","NHINVLR",122,0)
|
|
D ADD("</lab>")
|
|
"RTN","NHINVLR",123,0)
|
|
Q
|
|
"RTN","NHINVLR",124,0)
|
|
;
|
|
"RTN","NHINVLR",125,0)
|
|
ADD(X) ; -- Add a line @NHIN@(n)=X
|
|
"RTN","NHINVLR",126,0)
|
|
S NHINI=$G(NHINI)+1
|
|
"RTN","NHINVLR",127,0)
|
|
S @NHIN@(NHINI)=X
|
|
"RTN","NHINVLR",128,0)
|
|
Q
|
|
"RTN","NHINVPL")
|
|
0^8^B19630772
|
|
"RTN","NHINVPL",1,0)
|
|
NHINVPL ;SLC/MKB -- Problem extract
|
|
"RTN","NHINVPL",2,0)
|
|
;;1.0;NHIN;;Oct 25, 2010;Build 14
|
|
"RTN","NHINVPL",3,0)
|
|
;
|
|
"RTN","NHINVPL",4,0)
|
|
; External References DBIA#
|
|
"RTN","NHINVPL",5,0)
|
|
; ------------------- -----
|
|
"RTN","NHINVPL",6,0)
|
|
; ^VA(200 10060
|
|
"RTN","NHINVPL",7,0)
|
|
; %DT 10003
|
|
"RTN","NHINVPL",8,0)
|
|
; DIQ 2056
|
|
"RTN","NHINVPL",9,0)
|
|
; GMPLUTL2 2741
|
|
"RTN","NHINVPL",10,0)
|
|
; XUAF4 2171
|
|
"RTN","NHINVPL",11,0)
|
|
;
|
|
"RTN","NHINVPL",12,0)
|
|
; ------------ Get problems from VistA ------------
|
|
"RTN","NHINVPL",13,0)
|
|
;
|
|
"RTN","NHINVPL",14,0)
|
|
EN(DFN,BEG,END,MAX,IFN) ; -- find patient's problems
|
|
"RTN","NHINVPL",15,0)
|
|
N NHIPROB,NHI,NHITM,NHICNT,X
|
|
"RTN","NHINVPL",16,0)
|
|
;
|
|
"RTN","NHINVPL",17,0)
|
|
; get one problem
|
|
"RTN","NHINVPL",18,0)
|
|
I $G(IFN) D EN1(IFN,.NHITM),XML(.NHITM) Q
|
|
"RTN","NHINVPL",19,0)
|
|
;
|
|
"RTN","NHINVPL",20,0)
|
|
; get all patient problems
|
|
"RTN","NHINVPL",21,0)
|
|
S DFN=+$G(DFN) Q:DFN<1
|
|
"RTN","NHINVPL",22,0)
|
|
S BEG=$G(BEG,1410101),END=$G(END,9999998),MAX=$G(MAX,999999),NHICNT=0
|
|
"RTN","NHINVPL",23,0)
|
|
D LIST^GMPLUTL2(.NHIPROB,DFN,"") ;all problems
|
|
"RTN","NHINVPL",24,0)
|
|
S NHI=0 F S NHI=$O(NHIPROB(NHI)) Q:(NHI<1)!(NHICNT'<MAX) D
|
|
"RTN","NHINVPL",25,0)
|
|
. S X=$P(NHIPROB(NHI),U,5) I X,(X<BEG)!(X>END) Q ;onset
|
|
"RTN","NHINVPL",26,0)
|
|
. S X=+NHIPROB(NHI) K NHITM ;ien
|
|
"RTN","NHINVPL",27,0)
|
|
. D EN1(X,.NHITM),XML(.NHITM)
|
|
"RTN","NHINVPL",28,0)
|
|
. S NHICNT=NHICNT+1
|
|
"RTN","NHINVPL",29,0)
|
|
Q
|
|
"RTN","NHINVPL",30,0)
|
|
;
|
|
"RTN","NHINVPL",31,0)
|
|
EN1(ID,PROB) ; -- return a problem in PROB("attribute")=value
|
|
"RTN","NHINVPL",32,0)
|
|
N NHPL,X,I,J K PROB
|
|
"RTN","NHINVPL",33,0)
|
|
S ID=+$G(ID) Q:ID<1 ;invalid ien
|
|
"RTN","NHINVPL",34,0)
|
|
D DETAIL^GMPLUTL2(ID,.NHPL) Q:'$D(NHPL) ;doesn't exist
|
|
"RTN","NHINVPL",35,0)
|
|
S PROB("id")=ID ;,PROB("lexiconID")=+X1 ;SNOMED?
|
|
"RTN","NHINVPL",36,0)
|
|
S PROB("name")=$G(NHPL("NARRATIVE"))
|
|
"RTN","NHINVPL",37,0)
|
|
S X=$G(NHPL("MODIFIED")) S:$L(X) PROB("updated")=$$DATE(X)
|
|
"RTN","NHINVPL",38,0)
|
|
S PROB("icd")=$G(NHPL("DIAGNOSIS"))
|
|
"RTN","NHINVPL",39,0)
|
|
S X=$G(NHPL("STATUS")) S:$L(X) PROB("status")=$E(X)
|
|
"RTN","NHINVPL",40,0)
|
|
S X=$G(NHPL("HISTORY")) S:$L(X) PROB("history")=$E(X)
|
|
"RTN","NHINVPL",41,0)
|
|
S X=$G(NHPL("PRIORITY")) S:$L(X) PROB("acuity")=$E(X)
|
|
"RTN","NHINVPL",42,0)
|
|
S X=$G(NHPL("ONSET")) S:$L(X) PROB("onset")=$$DATE(X)
|
|
"RTN","NHINVPL",43,0)
|
|
S X=$$GET1^DIQ(9000011,ID_",",1.07,"I") S:X PROB("resolved")=X
|
|
"RTN","NHINVPL",44,0)
|
|
S X=$P($G(NHPL("ENTERED")),U) S:$L(X) PROB("entered")=$$DATE(X)
|
|
"RTN","NHINVPL",45,0)
|
|
S X=$$GET1^DIQ(9000011,ID_",",1.02,"I")
|
|
"RTN","NHINVPL",46,0)
|
|
S:X="P" PROB("unverified")=0,PROB("removed")=0
|
|
"RTN","NHINVPL",47,0)
|
|
S:X="T" PROB("unverified")=1,PROB("removed")=0
|
|
"RTN","NHINVPL",48,0)
|
|
S:X="H" PROB("unverified")=0,PROB("removed")=1
|
|
"RTN","NHINVPL",49,0)
|
|
S X=$G(NHPL("SC")),X=$S(X="YES":1,X="NO":0,1:"")
|
|
"RTN","NHINVPL",50,0)
|
|
S:$L(X) PROB("sc")=X I $G(NHPL("EXPOSURE")) D ;ao^rad^pgulf^hnc^mst^cv
|
|
"RTN","NHINVPL",51,0)
|
|
. S I=0 F S I=$O(NHPL("EXPOSURE",I)) Q:I<1 D
|
|
"RTN","NHINVPL",52,0)
|
|
.. S X=$G(NHPL("EXPOSURE",I))
|
|
"RTN","NHINVPL",53,0)
|
|
.. S PROB("exposure",I)=$$EXP(X)
|
|
"RTN","NHINVPL",54,0)
|
|
S X=$G(NHPL("PROVIDER")) S:$L(X) PROB("provider")=$$VA200(X)_U_X
|
|
"RTN","NHINVPL",55,0)
|
|
S X=$$GET1^DIQ(9000011,ID_",",1.06) S:$L(X) PROB("service")=X
|
|
"RTN","NHINVPL",56,0)
|
|
S X=$G(NHPL("CLINIC")) S:$L(X) PROB("location")=X
|
|
"RTN","NHINVPL",57,0)
|
|
S X=+$$GET1^DIQ(9000011,ID_",",.06,"I")
|
|
"RTN","NHINVPL",58,0)
|
|
S:X PROB("facility")=$$STA^XUAF4(X)_U_$P($$NS^XUAF4(X),U)
|
|
"RTN","NHINVPL",59,0)
|
|
I 'X S PROB("facility")=$$FAC^NHINV ;local stn#^name
|
|
"RTN","NHINVPL",60,0)
|
|
CMT ; comments
|
|
"RTN","NHINVPL",61,0)
|
|
Q:'$G(NHPL("COMMENT"))
|
|
"RTN","NHINVPL",62,0)
|
|
S I=0 F S I=$O(NHPL("COMMENT",I)) Q:I<1 D
|
|
"RTN","NHINVPL",63,0)
|
|
. S X=$G(NHPL("COMMENT",I))
|
|
"RTN","NHINVPL",64,0)
|
|
. S PROB("comment",I)=$$DATE($P(X,U))_U_$P(X,U,2,3)
|
|
"RTN","NHINVPL",65,0)
|
|
. ; = date ^ name of author ^ text
|
|
"RTN","NHINVPL",66,0)
|
|
Q
|
|
"RTN","NHINVPL",67,0)
|
|
;
|
|
"RTN","NHINVPL",68,0)
|
|
DATE(X) ; -- Return internal form of date X
|
|
"RTN","NHINVPL",69,0)
|
|
N %DT,Y
|
|
"RTN","NHINVPL",70,0)
|
|
S %DT="" D ^%DT S:Y<1 Y=X
|
|
"RTN","NHINVPL",71,0)
|
|
Q Y
|
|
"RTN","NHINVPL",72,0)
|
|
;
|
|
"RTN","NHINVPL",73,0)
|
|
VA200(X) ; -- Return ien of New Person X
|
|
"RTN","NHINVPL",74,0)
|
|
N Y S Y=$S($L($G(X)):+$O(^VA(200,"B",X,0)),1:"")
|
|
"RTN","NHINVPL",75,0)
|
|
Q Y
|
|
"RTN","NHINVPL",76,0)
|
|
;
|
|
"RTN","NHINVPL",77,0)
|
|
EXP(X) ; -- Return code for exposure name X
|
|
"RTN","NHINVPL",78,0)
|
|
N Y S Y="",X=$E($G(X))
|
|
"RTN","NHINVPL",79,0)
|
|
I X="A" S Y="AO" ;agent orange
|
|
"RTN","NHINVPL",80,0)
|
|
I X="R" S Y="IR" ;ionizing radiation
|
|
"RTN","NHINVPL",81,0)
|
|
I X="E" S Y="PG" ;persian gulf
|
|
"RTN","NHINVPL",82,0)
|
|
I X="H" S Y="HNC" ;head/neck cancer
|
|
"RTN","NHINVPL",83,0)
|
|
I X="M" S Y="MST" ;military sexual trauma
|
|
"RTN","NHINVPL",84,0)
|
|
I X="C" S Y="CV" ;combat vet
|
|
"RTN","NHINVPL",85,0)
|
|
I X="S" S Y="SHAD"
|
|
"RTN","NHINVPL",86,0)
|
|
Q Y
|
|
"RTN","NHINVPL",87,0)
|
|
;
|
|
"RTN","NHINVPL",88,0)
|
|
; ------------ Return data to middle tier ------------
|
|
"RTN","NHINVPL",89,0)
|
|
;
|
|
"RTN","NHINVPL",90,0)
|
|
XML(PROB) ; -- Return patient problem as XML in @NHIN@(I)
|
|
"RTN","NHINVPL",91,0)
|
|
N ATT,I,X,Y,P,TAG
|
|
"RTN","NHINVPL",92,0)
|
|
D ADD("<problem>")
|
|
"RTN","NHINVPL",93,0)
|
|
S ATT="" F S ATT=$O(PROB(ATT)) Q:ATT="" D D:$L(Y) ADD(Y)
|
|
"RTN","NHINVPL",94,0)
|
|
. I ATT="exposure" D S Y="" Q
|
|
"RTN","NHINVPL",95,0)
|
|
.. S Y="<exposures>" D ADD(Y)
|
|
"RTN","NHINVPL",96,0)
|
|
.. S I=0 F S I=$O(PROB(ATT,I)) Q:I<1 S X=$G(PROB(ATT,I)) S:$L(X) Y="<exposure value='"_X_"' />" D ADD(Y)
|
|
"RTN","NHINVPL",97,0)
|
|
.. D ADD("</exposures>")
|
|
"RTN","NHINVPL",98,0)
|
|
. I ATT="comment" D S Y="" Q
|
|
"RTN","NHINVPL",99,0)
|
|
.. D ADD("<comments>")
|
|
"RTN","NHINVPL",100,0)
|
|
.. S I=0 F S I=$O(PROB(ATT,I)) Q:I<1 S X=$G(PROB(ATT,I)) D
|
|
"RTN","NHINVPL",101,0)
|
|
... S Y="<comment id='"_I
|
|
"RTN","NHINVPL",102,0)
|
|
... S:$L($P(X,U,1)) Y=Y_"' entered='"_$P(X,U)
|
|
"RTN","NHINVPL",103,0)
|
|
... S:$L($P(X,U,2)) Y=Y_"' enteredBy='"_$$ESC^NHINV($P(X,U,2))
|
|
"RTN","NHINVPL",104,0)
|
|
... S:$L($P(X,U,3)) Y=Y_"' commentText='"_$$ESC^NHINV($P(X,U,3))
|
|
"RTN","NHINVPL",105,0)
|
|
... S Y=Y_"' />" D ADD(Y)
|
|
"RTN","NHINVPL",106,0)
|
|
.. D ADD("</comments>")
|
|
"RTN","NHINVPL",107,0)
|
|
. S X=$G(PROB(ATT)),Y="" Q:'$L(X)
|
|
"RTN","NHINVPL",108,0)
|
|
. I X'["^" S Y="<"_ATT_" value='"_$$ESC^NHINV(X)_"' />" Q
|
|
"RTN","NHINVPL",109,0)
|
|
. I $L(X)>1 D S Y=""
|
|
"RTN","NHINVPL",110,0)
|
|
.. S Y="<"_ATT_" "
|
|
"RTN","NHINVPL",111,0)
|
|
.. F P=1:1 S TAG=$P("code^name^Z",U,P) Q:TAG="Z" I $L($P(X,U,P)) S Y=Y_TAG_"='"_$$ESC^NHINV($P(X,U,P))_"' "
|
|
"RTN","NHINVPL",112,0)
|
|
.. S Y=Y_"/>" D ADD(Y)
|
|
"RTN","NHINVPL",113,0)
|
|
D ADD("</problem>")
|
|
"RTN","NHINVPL",114,0)
|
|
Q
|
|
"RTN","NHINVPL",115,0)
|
|
;
|
|
"RTN","NHINVPL",116,0)
|
|
ADD(X) ; Add a line @NHIN@(n)=X
|
|
"RTN","NHINVPL",117,0)
|
|
S NHINI=$G(NHINI)+1
|
|
"RTN","NHINVPL",118,0)
|
|
S @NHIN@(NHINI)=X
|
|
"RTN","NHINVPL",119,0)
|
|
Q
|
|
"RTN","NHINVPS")
|
|
0^9^B13986678
|
|
"RTN","NHINVPS",1,0)
|
|
NHINVPS ;SLC/MKB -- Pharmacy extract
|
|
"RTN","NHINVPS",2,0)
|
|
;;1.0;NHIN;;Oct 25, 2010;Build 14
|
|
"RTN","NHINVPS",3,0)
|
|
;
|
|
"RTN","NHINVPS",4,0)
|
|
; External References DBIA#
|
|
"RTN","NHINVPS",5,0)
|
|
; ------------------- -----
|
|
"RTN","NHINVPS",6,0)
|
|
; DIQ 2056
|
|
"RTN","NHINVPS",7,0)
|
|
; PSOORRL,^TMP("PS",$J) 2400
|
|
"RTN","NHINVPS",8,0)
|
|
; PSS50,^TMP($J 4483
|
|
"RTN","NHINVPS",9,0)
|
|
;
|
|
"RTN","NHINVPS",10,0)
|
|
; ------------ Get medications from VistA ------------
|
|
"RTN","NHINVPS",11,0)
|
|
;
|
|
"RTN","NHINVPS",12,0)
|
|
EN(DFN,BEG,END,MAX,ID) ; -- find patient's meds
|
|
"RTN","NHINVPS",13,0)
|
|
N PS0,NHI,NHITM,IV K ^TMP("PS",$J)
|
|
"RTN","NHINVPS",14,0)
|
|
S DFN=+$G(DFN) Q:DFN<1
|
|
"RTN","NHINVPS",15,0)
|
|
S BEG=$G(BEG,1410101),END=$G(END,9999998),MAX=$G(MAX,999999)
|
|
"RTN","NHINVPS",16,0)
|
|
;
|
|
"RTN","NHINVPS",17,0)
|
|
; get one med
|
|
"RTN","NHINVPS",18,0)
|
|
I $G(ID) D D:$D(NHITM)>9 XML(.NHITM) K ^TMP("PS",$J) Q
|
|
"RTN","NHINVPS",19,0)
|
|
. I ID["N" D NVA^NHINVPSO(ID,.NHITM) Q
|
|
"RTN","NHINVPS",20,0)
|
|
. I ID["O",(ID'["P")&(ID'["S") D RX^NHINVPSO(ID,.NHITM) Q
|
|
"RTN","NHINVPS",21,0)
|
|
. D OEL^PSOORRL(DFN,ID)
|
|
"RTN","NHINVPS",22,0)
|
|
. I ID["O",(ID["P")!(ID["S") D PEN1^NHINVPSO(ID,.NHITM) Q
|
|
"RTN","NHINVPS",23,0)
|
|
. S IV=$S(ID["V":1,$G(^TMP("PS",$J,"B",0)):1,1:0)
|
|
"RTN","NHINVPS",24,0)
|
|
. D @($S(IV:"IV1",1:"IN1")_"^NHINVPSI(ID,.NHITM)")
|
|
"RTN","NHINVPS",25,0)
|
|
;
|
|
"RTN","NHINVPS",26,0)
|
|
; get all meds
|
|
"RTN","NHINVPS",27,0)
|
|
D OCL^PSOORRL(DFN,BEG,END)
|
|
"RTN","NHINVPS",28,0)
|
|
S NHI=0 F S NHI=$O(^TMP("PS",$J,NHI)) Q:NHI<1!(NHI>MAX) S PS0=$G(^(NHI,0)) D I $D(NHITM)>9 D XML(.NHITM)
|
|
"RTN","NHINVPS",29,0)
|
|
. S ID=$P(PS0,U) K NHITM
|
|
"RTN","NHINVPS",30,0)
|
|
. I ID["N" D NVA^NHINVPSO(ID,.NHITM) Q
|
|
"RTN","NHINVPS",31,0)
|
|
. I ID["O" D RX^NHINVPSO(ID,.NHITM) Q
|
|
"RTN","NHINVPS",32,0)
|
|
. S IV=$S(ID["V":1,$G(^TMP("PS",$J,NHI,"B",0)):1,1:0)
|
|
"RTN","NHINVPS",33,0)
|
|
. D @($S(IV:"IV",1:"IN")_"^NHINVPSI(ID,.NHITM)")
|
|
"RTN","NHINVPS",34,0)
|
|
K ^TMP("PS",$J)
|
|
"RTN","NHINVPS",35,0)
|
|
Q
|
|
"RTN","NHINVPS",36,0)
|
|
;
|
|
"RTN","NHINVPS",37,0)
|
|
NDF(DRUG,I) ; -- Set NDF data for dispense DRUG ien
|
|
"RTN","NHINVPS",38,0)
|
|
N VUID,X
|
|
"RTN","NHINVPS",39,0)
|
|
S DRUG=+$G(DRUG) Q:'DRUG
|
|
"RTN","NHINVPS",40,0)
|
|
D NDF^PSS50(DRUG,,,,,"NDF") S I=+$G(I)+1
|
|
"RTN","NHINVPS",41,0)
|
|
S MED("product",I)=DRUG_U_$G(^TMP($J,"NDF",DRUG,.01))_"^^D" ;Drug
|
|
"RTN","NHINVPS",42,0)
|
|
S X=$G(^TMP($J,"NDF",DRUG,20)),VUID=$$GET1^DIQ(50.6,+X_",",99.99)
|
|
"RTN","NHINVPS",43,0)
|
|
S MED("product",I,"G")=X_U_VUID ;VA Generic
|
|
"RTN","NHINVPS",44,0)
|
|
S X=$G(^TMP($J,"NDF",DRUG,22)),VUID=$$GET1^DIQ(50.68,+X_",",99.99)
|
|
"RTN","NHINVPS",45,0)
|
|
S MED("product",I,"P")=X_U_VUID ;VA Product
|
|
"RTN","NHINVPS",46,0)
|
|
S MED("product",I,"C")=$P($G(^TMP($J,"NDF",+DRUG,25)),U,3) ;display name
|
|
"RTN","NHINVPS",47,0)
|
|
K ^TMP($J,"NDF",DRUG)
|
|
"RTN","NHINVPS",48,0)
|
|
Q
|
|
"RTN","NHINVPS",49,0)
|
|
;
|
|
"RTN","NHINVPS",50,0)
|
|
; ------------ Return data to middle tier ------------
|
|
"RTN","NHINVPS",51,0)
|
|
;
|
|
"RTN","NHINVPS",52,0)
|
|
XML(MED) ; -- Return patient meds as XML
|
|
"RTN","NHINVPS",53,0)
|
|
N ATT,X,Y,I,NAMES
|
|
"RTN","NHINVPS",54,0)
|
|
D ADD("<med>")
|
|
"RTN","NHINVPS",55,0)
|
|
S ATT="" F S ATT=$O(MED(ATT)) Q:ATT="" D I $L(Y) D ADD(Y)
|
|
"RTN","NHINVPS",56,0)
|
|
. I $O(MED(ATT,0)) D S Y="" Q ;multiples
|
|
"RTN","NHINVPS",57,0)
|
|
.. D ADD("<"_ATT_"s>")
|
|
"RTN","NHINVPS",58,0)
|
|
.. S I=0 F S I=$O(MED(ATT,I)) Q:I<1 D
|
|
"RTN","NHINVPS",59,0)
|
|
... S X=$G(MED(ATT,I)),NAMES=""
|
|
"RTN","NHINVPS",60,0)
|
|
... I ATT="dose" S NAMES="dose^units^unitsPerDose^noun^route^schedule^duration^conjunction^doseStart^doseStop^Z"
|
|
"RTN","NHINVPS",61,0)
|
|
... I ATT="fill" S NAMES="fillDate^fillRouting^releaseDate^fillQuantity^fillDaysSupply^partial^Z"
|
|
"RTN","NHINVPS",62,0)
|
|
... I ATT="product" S NAMES="code^name^vuid^role^concentration^Z"
|
|
"RTN","NHINVPS",63,0)
|
|
... S Y="<"_ATT_" "_$$LOOP_$S(ATT'="product":"/>",1:">") D ADD(Y)
|
|
"RTN","NHINVPS",64,0)
|
|
... Q:ATT'="product"
|
|
"RTN","NHINVPS",65,0)
|
|
... S X=$G(MED(ATT,I,"C")) I $L(X) S Y="<class "_$$LOOP_"/>" D ADD(Y)
|
|
"RTN","NHINVPS",66,0)
|
|
... S X=$G(MED(ATT,I,"G")) I $L(X) S Y="<vaGeneric "_$$LOOP_"/>" D ADD(Y)
|
|
"RTN","NHINVPS",67,0)
|
|
... S X=$G(MED(ATT,I,"P")) I $L(X) S Y="<vaProduct "_$$LOOP_"/>" D ADD(Y)
|
|
"RTN","NHINVPS",68,0)
|
|
... D ADD("</product>")
|
|
"RTN","NHINVPS",69,0)
|
|
.. D ADD("</"_ATT_"s>")
|
|
"RTN","NHINVPS",70,0)
|
|
. S X=$G(MED(ATT)),Y="" Q:'$L(X)
|
|
"RTN","NHINVPS",71,0)
|
|
. I ATT="sig"!(ATT?1"ptIn"1.A) S Y="<"_ATT_" xml:space='preserve'>"_$$ESC^NHINV(X)_"</"_ATT_">" Q
|
|
"RTN","NHINVPS",72,0)
|
|
. I X'["^" S Y="<"_ATT_" value='"_$$ESC^NHINV(X)_"' />" Q
|
|
"RTN","NHINVPS",73,0)
|
|
. I $L(X)>1 S NAMES="code^name^Z",Y="<"_ATT_" "_$$LOOP_"/>"
|
|
"RTN","NHINVPS",74,0)
|
|
D ADD("</med>")
|
|
"RTN","NHINVPS",75,0)
|
|
Q
|
|
"RTN","NHINVPS",76,0)
|
|
;
|
|
"RTN","NHINVPS",77,0)
|
|
LOOP() ; -- build sub-items string from NAMES and X
|
|
"RTN","NHINVPS",78,0)
|
|
N STR,P,TAG S STR=""
|
|
"RTN","NHINVPS",79,0)
|
|
F P=1:1 S TAG=$P(NAMES,U,P) Q:TAG="Z" I $L($P(X,U,P)) S STR=STR_TAG_"='"_$$ESC^NHINV($P(X,U,P))_"' "
|
|
"RTN","NHINVPS",80,0)
|
|
Q STR
|
|
"RTN","NHINVPS",81,0)
|
|
;
|
|
"RTN","NHINVPS",82,0)
|
|
ADD(X) ; Add a line @NHIN@(n)=X
|
|
"RTN","NHINVPS",83,0)
|
|
S NHINI=$G(NHINI)+1
|
|
"RTN","NHINVPS",84,0)
|
|
S @NHIN@(NHINI)=X
|
|
"RTN","NHINVPS",85,0)
|
|
Q
|
|
"RTN","NHINVPSI")
|
|
0^10^B32869468
|
|
"RTN","NHINVPSI",1,0)
|
|
NHINVPSI ;SLC/MKB -- Inpatient Pharmacy extract
|
|
"RTN","NHINVPSI",2,0)
|
|
;;1.0;NHIN;;Oct 25, 2010;Build 14
|
|
"RTN","NHINVPSI",3,0)
|
|
;
|
|
"RTN","NHINVPSI",4,0)
|
|
; External References DBIA#
|
|
"RTN","NHINVPSI",5,0)
|
|
; ------------------- -----
|
|
"RTN","NHINVPSI",6,0)
|
|
; ^SC 10040
|
|
"RTN","NHINVPSI",7,0)
|
|
; DIQ 2056
|
|
"RTN","NHINVPSI",8,0)
|
|
; ORX8 2467
|
|
"RTN","NHINVPSI",9,0)
|
|
; PSOORRL,^TMP("PS",$J) 2400
|
|
"RTN","NHINVPSI",10,0)
|
|
; PSS50P7 4662
|
|
"RTN","NHINVPSI",11,0)
|
|
; XLFSTR 10104
|
|
"RTN","NHINVPSI",12,0)
|
|
;
|
|
"RTN","NHINVPSI",13,0)
|
|
; ------------ Get medications from VistA ------------
|
|
"RTN","NHINVPSI",14,0)
|
|
;
|
|
"RTN","NHINVPSI",15,0)
|
|
EN(DFN,BEG,END,MAX,ID) ; -- find patient's UD/IV meds
|
|
"RTN","NHINVPSI",16,0)
|
|
N PS0,NHI,NHITM,IV K ^TMP("PS",$J)
|
|
"RTN","NHINVPSI",17,0)
|
|
S DFN=+$G(DFN) Q:DFN<1
|
|
"RTN","NHINVPSI",18,0)
|
|
S BEG=$G(BEG,1410101),END=$G(END,9999998),MAX=$G(MAX,999999)
|
|
"RTN","NHINVPSI",19,0)
|
|
;
|
|
"RTN","NHINVPSI",20,0)
|
|
; get one med
|
|
"RTN","NHINVPSI",21,0)
|
|
I $G(ID) D Q
|
|
"RTN","NHINVPSI",22,0)
|
|
. Q:ID["N" Q:ID["O" ;inpatient only
|
|
"RTN","NHINVPSI",23,0)
|
|
. D OEL^PSOORRL(DFN,ID)
|
|
"RTN","NHINVPSI",24,0)
|
|
. S IV=$S(ID["V":1,$G(^TMP("PS",$J,"B",0)):1,1:0)
|
|
"RTN","NHINVPSI",25,0)
|
|
. D @($S(IV:"IV1",1:"IN1")_"(ID,.NHITM)")
|
|
"RTN","NHINVPSI",26,0)
|
|
. I $D(NHITM)>9 D XML^NHINVPS(.NHITM)
|
|
"RTN","NHINVPSI",27,0)
|
|
. K ^TMP("PS",$J)
|
|
"RTN","NHINVPSI",28,0)
|
|
;
|
|
"RTN","NHINVPSI",29,0)
|
|
; get all meds
|
|
"RTN","NHINVPSI",30,0)
|
|
D OCL^PSOORRL(DFN,BEG,END)
|
|
"RTN","NHINVPSI",31,0)
|
|
S NHI=0 F S NHI=$O(^TMP("PS",$J,NHI)) Q:NHI<1!(NHI>MAX) S PS0=$G(^(NHI,0)) D
|
|
"RTN","NHINVPSI",32,0)
|
|
. S ID=$P(PS0,U) K NHITM
|
|
"RTN","NHINVPSI",33,0)
|
|
. Q:ID["N" Q:ID["O" ;inpatient only
|
|
"RTN","NHINVPSI",34,0)
|
|
. S IV=$S(ID["V":1,$G(^TMP("PS",$J,NHI,"B",0)):1,1:0)
|
|
"RTN","NHINVPSI",35,0)
|
|
. D @($S(IV:"IV",1:"IN")_"(ID,.NHITM)")
|
|
"RTN","NHINVPSI",36,0)
|
|
. I $D(NHITM)>9 D XML^NHINVPS(.NHITM)
|
|
"RTN","NHINVPSI",37,0)
|
|
K ^TMP("PS",$J)
|
|
"RTN","NHINVPSI",38,0)
|
|
Q
|
|
"RTN","NHINVPSI",39,0)
|
|
;
|
|
"RTN","NHINVPSI",40,0)
|
|
IN(ID,MED) ; -- return a medication in MED("attribute")=value
|
|
"RTN","NHINVPSI",41,0)
|
|
; [expects PS0,OCL^PSOORRL data]
|
|
"RTN","NHINVPSI",42,0)
|
|
N X,PS,ORDER,DOSE,UNTS,RTE,SCH,OI,PSOI,LOC K MED
|
|
"RTN","NHINVPSI",43,0)
|
|
M PS=^TMP("PS",$J,NHI)
|
|
"RTN","NHINVPSI",44,0)
|
|
S MED("id")=ID,MED("vaType")="I"
|
|
"RTN","NHINVPSI",45,0)
|
|
S X=$P(PS0,U,15) S:X MED("start")=X
|
|
"RTN","NHINVPSI",46,0)
|
|
S X=$P(PS0,U,4) S:X MED("stop")=X
|
|
"RTN","NHINVPSI",47,0)
|
|
S MED("name")=$P(PS0,U,2),X=$P(PS0,U,9),MED("vaStatus")=X,X=$E(X,1,3)
|
|
"RTN","NHINVPSI",48,0)
|
|
S MED("status")=$S(X="DIS"!(X="PEN"):"not active",X="EXP"!(X="REN"):"historical",X="REI":"active",1:$$LOW^XLFSTR($P(PS0,U,9)))
|
|
"RTN","NHINVPSI",49,0)
|
|
S DOSE=$P(PS0,U,6) S:DOSE="" DOSE=$G(PS("SIG",1,0))
|
|
"RTN","NHINVPSI",50,0)
|
|
S RTE=$G(PS("MDR",1,0)),SCH=$P($G(PS("SCH",1,0)),U)
|
|
"RTN","NHINVPSI",51,0)
|
|
S MED("dose",1)=DOSE_"^^^^"_RTE_U_SCH
|
|
"RTN","NHINVPSI",52,0)
|
|
S MED("sig")="Give: "_DOSE_" "_RTE_" "_SCH I $G(PS("SIO",0)) D
|
|
"RTN","NHINVPSI",53,0)
|
|
. N SIO M SIO=PS("SIO")
|
|
"RTN","NHINVPSI",54,0)
|
|
. S MED("sig")=MED("sig")_$C(13,10)_$$STRING^NHINV(.SIO)
|
|
"RTN","NHINVPSI",55,0)
|
|
I $D(PS("P",0)) S MED("orderingProvider")=PS("P",0)
|
|
"RTN","NHINVPSI",56,0)
|
|
S MED("facility")=$$FAC^NHINV ;local stn#^name
|
|
"RTN","NHINVPSI",57,0)
|
|
S ORDER=+$P(PS0,U,8) D:ORDER ORD
|
|
"RTN","NHINVPSI",58,0)
|
|
Q
|
|
"RTN","NHINVPSI",59,0)
|
|
;
|
|
"RTN","NHINVPSI",60,0)
|
|
IN1(ID,MED) ; -- return a medication in MED("attribute")=value
|
|
"RTN","NHINVPSI",61,0)
|
|
; [expects OEL^PSOORRL data]
|
|
"RTN","NHINVPSI",62,0)
|
|
N X,PS,PS0,ORDER,DOSE,UNTS,RTE,SCH,OI,PSOI,LOC K MED
|
|
"RTN","NHINVPSI",63,0)
|
|
M PS=^TMP("PS",$J) S PS0=PS(0)
|
|
"RTN","NHINVPSI",64,0)
|
|
S MED("id")=ID,MED("vaType")="I"
|
|
"RTN","NHINVPSI",65,0)
|
|
S X=$P(PS0,U,5) S:X MED("start")=X
|
|
"RTN","NHINVPSI",66,0)
|
|
S X=$P(PS0,U,3) S:X MED("stop")=X
|
|
"RTN","NHINVPSI",67,0)
|
|
S MED("name")=$P(PS0,U),X=$P(PS0,U,6),MED("vaStatus")=X,X=$E(X,1,3)
|
|
"RTN","NHINVPSI",68,0)
|
|
S MED("status")=$S(X="DIS"!(X="PEN"):"not active",X="EXP"!(X="REN"):"historical",X="REI":"active",1:$$LOW^XLFSTR($P(PS0,U,9)))
|
|
"RTN","NHINVPSI",69,0)
|
|
S DOSE=$P(PS0,U,9) S:DOSE="" DOSE=$G(PS("SIG",1,0))
|
|
"RTN","NHINVPSI",70,0)
|
|
S RTE=$G(PS("MDR",1,0)),SCH=$P($G(PS("SCH",1,0)),U)
|
|
"RTN","NHINVPSI",71,0)
|
|
S MED("dose",1)=DOSE_"^^^^"_RTE_U_SCH
|
|
"RTN","NHINVPSI",72,0)
|
|
S MED("sig")="Give: "_DOSE_" "_RTE_" "_SCH I $G(PS("SIO",0)) D
|
|
"RTN","NHINVPSI",73,0)
|
|
. N SIO M SIO=PS("SIO")
|
|
"RTN","NHINVPSI",74,0)
|
|
. S MED("sig")=MED("sig")_$C(13,10)_$$STRING^NHINV(.SIO)
|
|
"RTN","NHINVPSI",75,0)
|
|
I $D(PS("P",0)) S MED("orderingProvider")=PS("P",0)
|
|
"RTN","NHINVPSI",76,0)
|
|
S MED("facility")=$$FAC^NHINV ;local stn#^name
|
|
"RTN","NHINVPSI",77,0)
|
|
S ORDER=+$P(PS0,U,11) D:ORDER ORD
|
|
"RTN","NHINVPSI",78,0)
|
|
Q
|
|
"RTN","NHINVPSI",79,0)
|
|
;
|
|
"RTN","NHINVPSI",80,0)
|
|
ORD ; get rest of inpatient data from ORDER
|
|
"RTN","NHINVPSI",81,0)
|
|
S MED("orderID")=ORDER
|
|
"RTN","NHINVPSI",82,0)
|
|
S OI=$$OI^ORX8(ORDER),PSOI=+$P(OI,U,3)
|
|
"RTN","NHINVPSI",83,0)
|
|
S MED("name")=$P(OI,U,2) I PSOI D
|
|
"RTN","NHINVPSI",84,0)
|
|
. D ZERO^PSS50P7(PSOI,,,"OI")
|
|
"RTN","NHINVPSI",85,0)
|
|
. S MED("form")=$P($G(^TMP($J,"OI",PSOI,.02)),U,2)
|
|
"RTN","NHINVPSI",86,0)
|
|
S X=$$VALUE^ORX8(ORDER,"DOSE"),DOSE=DOSE_"^^^"
|
|
"RTN","NHINVPSI",87,0)
|
|
S DRUG="" I X'="",X["&" D
|
|
"RTN","NHINVPSI",88,0)
|
|
. S DRUG=+$P(X,"&",6)
|
|
"RTN","NHINVPSI",89,0)
|
|
. S DOSE=$TR($P(X,"&",1,4),"&","^")
|
|
"RTN","NHINVPSI",90,0)
|
|
. S $P(MED("dose",1),U,1,4)=DOSE
|
|
"RTN","NHINVPSI",91,0)
|
|
S:'DRUG DRUG=+$$VALUE^ORX8(ORDER,"DRUG")
|
|
"RTN","NHINVPSI",92,0)
|
|
D:DRUG NDF^NHINVPS(DRUG)
|
|
"RTN","NHINVPSI",93,0)
|
|
S LOC=+$$GET1^DIQ(100,ORDER_",",6,"I") I LOC D
|
|
"RTN","NHINVPSI",94,0)
|
|
. S MED("location")=$P($G(^SC(LOC,0)),U)
|
|
"RTN","NHINVPSI",95,0)
|
|
. S MED("facility")=$$FAC^NHINV(LOC)
|
|
"RTN","NHINVPSI",96,0)
|
|
K ^TMP($J,"OI")
|
|
"RTN","NHINVPSI",97,0)
|
|
Q
|
|
"RTN","NHINVPSI",98,0)
|
|
;
|
|
"RTN","NHINVPSI",99,0)
|
|
IV(ID,MED) ; -- return an infusion in MED("attribute")=value
|
|
"RTN","NHINVPSI",100,0)
|
|
; [expects PS0,OCL^PSOORRL data]
|
|
"RTN","NHINVPSI",101,0)
|
|
N PS,X K MED
|
|
"RTN","NHINVPSI",102,0)
|
|
M PS=^TMP("PS",$J,NHI)
|
|
"RTN","NHINVPSI",103,0)
|
|
S MED("id")=ID,MED("vaType")="V",MED("name")=$P(PS0,U,2)
|
|
"RTN","NHINVPSI",104,0)
|
|
S X=$P(PS0,U,15) S:X MED("start")=X
|
|
"RTN","NHINVPSI",105,0)
|
|
S X=$P(PS0,U,4) S:X MED("stop")=X
|
|
"RTN","NHINVPSI",106,0)
|
|
S MED("vaStatus")=$P(PS0,U,9),X=$E($P(PS0,U,9),1,3)
|
|
"RTN","NHINVPSI",107,0)
|
|
S MED("status")=$S(X="DIS"!(X="PEN"):"not active",X="EXP"!(X="PUR"):"historical",X="HOL":"hold",1:"active")
|
|
"RTN","NHINVPSI",108,0)
|
|
S MED("dose",1)=$P(PS0,U,3)_"^^^^"_$G(PS("MDR",1,0))_U_$P($G(PS("SCH",1,0)),U)
|
|
"RTN","NHINVPSI",109,0)
|
|
S MED("facility")=$$FAC^NHINV ;local stn#^name
|
|
"RTN","NHINVPSI",110,0)
|
|
I $G(PS("P",0)) S MED("orderingProvider")=PS("P",0)
|
|
"RTN","NHINVPSI",111,0)
|
|
D IVP
|
|
"RTN","NHINVPSI",112,0)
|
|
Q
|
|
"RTN","NHINVPSI",113,0)
|
|
;
|
|
"RTN","NHINVPSI",114,0)
|
|
IV1(ID,MED) ; -- return an infusion in MED("attribute")=value
|
|
"RTN","NHINVPSI",115,0)
|
|
; [expects OEL^PSOORRL data]
|
|
"RTN","NHINVPSI",116,0)
|
|
N PS,PS0,X K MED
|
|
"RTN","NHINVPSI",117,0)
|
|
M PS=^TMP("PS",$J) S PS0=PS(0)
|
|
"RTN","NHINVPSI",118,0)
|
|
S MED("id")=ID,MED("vaType")="V",MED("name")=$P(PS0,U)
|
|
"RTN","NHINVPSI",119,0)
|
|
S X=$P(PS0,U,5) S:X MED("start")=X
|
|
"RTN","NHINVPSI",120,0)
|
|
S X=$P(PS0,U,3) S:X MED("stop")=X
|
|
"RTN","NHINVPSI",121,0)
|
|
S MED("vaStatus")=$P(PS0,U,6),X=$E($P(PS0,U,6),1,3)
|
|
"RTN","NHINVPSI",122,0)
|
|
S MED("status")=$S(X="DIS"!(X="PEN"):"not active",X="EXP"!(X="PUR"):"historical",X="HOL":"hold",1:"active")
|
|
"RTN","NHINVPSI",123,0)
|
|
S MED("dose",1)=$P(PS0,U,2)_"^^^^"_$G(PS("MDR",1,0))_U_$P($G(PS("SCH",1,0)),U)
|
|
"RTN","NHINVPSI",124,0)
|
|
S MED("facility")=$$FAC^NHINV ;local stn#^name
|
|
"RTN","NHINVPSI",125,0)
|
|
I $G(PS("P",0)) S MED("orderingProvider")=PS("P",0)
|
|
"RTN","NHINVPSI",126,0)
|
|
D IVP
|
|
"RTN","NHINVPSI",127,0)
|
|
Q
|
|
"RTN","NHINVPSI",128,0)
|
|
;
|
|
"RTN","NHINVPSI",129,0)
|
|
IVP ; -- add IV products for ID,DFN
|
|
"RTN","NHINVPSI",130,0)
|
|
N I,N,FILE,IENS,NHIN,LIST,IEN,DRUG,STR
|
|
"RTN","NHINVPSI",131,0)
|
|
S FILE=$S(ID["P":53.157,1:55.02),N=0
|
|
"RTN","NHINVPSI",132,0)
|
|
S IENS=","_+ID_","_$S(ID["P":"",1:DFN_",")
|
|
"RTN","NHINVPSI",133,0)
|
|
F I=1:1 K NHIN D GETS^DIQ(FILE,I_IENS,"*","IE","NHIN") Q:'$D(NHIN) D
|
|
"RTN","NHINVPSI",134,0)
|
|
. K LIST M LIST=NHIN(FILE,I_IENS)
|
|
"RTN","NHINVPSI",135,0)
|
|
. S IEN=LIST(.01,"I"),DRUG=$$GET1^DIQ(52.6,IEN_",",1,"I")
|
|
"RTN","NHINVPSI",136,0)
|
|
. D:DRUG NDF^NHINVPS(DRUG,.N) S:'DRUG N=N+1
|
|
"RTN","NHINVPSI",137,0)
|
|
. S STR=$S(FILE=53.157:LIST(1,"E"),1:LIST(.02,"E"))
|
|
"RTN","NHINVPSI",138,0)
|
|
. S MED("product",N)=IEN_U_LIST(.01,"E")_"^^A^"_STR
|
|
"RTN","NHINVPSI",139,0)
|
|
S FILE=$S(ID["P":53.158,1:55.11)
|
|
"RTN","NHINVPSI",140,0)
|
|
F I=1:1 K NHIN D GETS^DIQ(FILE,I_IENS,"*","IE","NHIN") Q:'$D(NHIN) D
|
|
"RTN","NHINVPSI",141,0)
|
|
. K LIST M LIST=NHIN(FILE,I_IENS)
|
|
"RTN","NHINVPSI",142,0)
|
|
. S IEN=LIST(.01,"I"),DRUG=$$GET1^DIQ(52.7,IEN_",",1,"I")
|
|
"RTN","NHINVPSI",143,0)
|
|
. D:DRUG NDF^NHINVPS(DRUG,.N) S:'DRUG N=N+1
|
|
"RTN","NHINVPSI",144,0)
|
|
. S MED("product",N)=IEN_U_LIST(.01,"E")_"^^B^"_LIST(1,"E")
|
|
"RTN","NHINVPSI",145,0)
|
|
Q
|
|
"RTN","NHINVPSO")
|
|
0^11^B66033397
|
|
"RTN","NHINVPSO",1,0)
|
|
NHINVPSO ;SLC/MKB -- Outpatient Pharmacy extract
|
|
"RTN","NHINVPSO",2,0)
|
|
;;1.0;NHIN;;Oct 25, 2010;Build 14
|
|
"RTN","NHINVPSO",3,0)
|
|
;
|
|
"RTN","NHINVPSO",4,0)
|
|
; External References DBIA#
|
|
"RTN","NHINVPSO",5,0)
|
|
; ------------------- -----
|
|
"RTN","NHINVPSO",6,0)
|
|
; ^SC 10040
|
|
"RTN","NHINVPSO",7,0)
|
|
; ^VA(200) 10060
|
|
"RTN","NHINVPSO",8,0)
|
|
; DIQ 2056
|
|
"RTN","NHINVPSO",9,0)
|
|
; ORX8 2467
|
|
"RTN","NHINVPSO",10,0)
|
|
; PSO5241 4821
|
|
"RTN","NHINVPSO",11,0)
|
|
; PSOORDER,^TMP("PSOR",$J) 1878
|
|
"RTN","NHINVPSO",12,0)
|
|
; PSOORRL,^TMP("PS",$J) 2400
|
|
"RTN","NHINVPSO",13,0)
|
|
; PSS50P7 4662
|
|
"RTN","NHINVPSO",14,0)
|
|
; PSS51P2 4548
|
|
"RTN","NHINVPSO",15,0)
|
|
; XLFDT 10103
|
|
"RTN","NHINVPSO",16,0)
|
|
;
|
|
"RTN","NHINVPSO",17,0)
|
|
; ------------ Get medications from VistA ------------
|
|
"RTN","NHINVPSO",18,0)
|
|
;
|
|
"RTN","NHINVPSO",19,0)
|
|
EN(DFN,BEG,END,MAX,ID) ; -- find patient's meds
|
|
"RTN","NHINVPSO",20,0)
|
|
N PS0,NHI,NHITM K ^TMP("PS",$J)
|
|
"RTN","NHINVPSO",21,0)
|
|
S DFN=+$G(DFN) Q:DFN<1
|
|
"RTN","NHINVPSO",22,0)
|
|
S BEG=$G(BEG,1410101),END=$G(END,9999998),MAX=$G(MAX,999999)
|
|
"RTN","NHINVPSO",23,0)
|
|
;
|
|
"RTN","NHINVPSO",24,0)
|
|
; get one med
|
|
"RTN","NHINVPSO",25,0)
|
|
I $G(ID) D D:$D(NHITM)>9 XML^NHINVPS(.NHITM) Q
|
|
"RTN","NHINVPSO",26,0)
|
|
. Q:ID["I"
|
|
"RTN","NHINVPSO",27,0)
|
|
. I ID["N" D NVA(ID,.NHITM) Q
|
|
"RTN","NHINVPSO",28,0)
|
|
. I ID'["P",ID'["S" D RX(ID,.NHITM) Q
|
|
"RTN","NHINVPSO",29,0)
|
|
. D OEL^PSOORRL(DFN,ID),PEN1(ID,.NHITM)
|
|
"RTN","NHINVPSO",30,0)
|
|
. K ^TMP("PS",$J)
|
|
"RTN","NHINVPSO",31,0)
|
|
;
|
|
"RTN","NHINVPSO",32,0)
|
|
; get all meds
|
|
"RTN","NHINVPSO",33,0)
|
|
D OCL^PSOORRL(DFN,BEG,END)
|
|
"RTN","NHINVPSO",34,0)
|
|
S NHI=0 F S NHI=$O(^TMP("PS",$J,NHI)) Q:NHI<1!(NHI>MAX) S PS0=$G(^(NHI,0)) D I $D(NHITM)>9 D XML^NHINVPS(.NHITM)
|
|
"RTN","NHINVPSO",35,0)
|
|
. S ID=$P(PS0,U) K NHITM Q:ID["I"
|
|
"RTN","NHINVPSO",36,0)
|
|
. I ID["N" D NVA(ID,.NHITM) Q
|
|
"RTN","NHINVPSO",37,0)
|
|
. I ID["O" D RX(ID,.NHITM) Q
|
|
"RTN","NHINVPSO",38,0)
|
|
K ^TMP("PS",$J)
|
|
"RTN","NHINVPSO",39,0)
|
|
Q
|
|
"RTN","NHINVPSO",40,0)
|
|
;
|
|
"RTN","NHINVPSO",41,0)
|
|
RX(ID,MED) ; -- return a prescription in MED("attribute")=value
|
|
"RTN","NHINVPSO",42,0)
|
|
I ID["P"!(ID["S") G PEND ;pending order
|
|
"RTN","NHINVPSO",43,0)
|
|
N RX0,RX1,DRUG,PSOI,X,I,START,STOP,ORIFN,FILL,RFD,PRV K MED
|
|
"RTN","NHINVPSO",44,0)
|
|
K ^TMP("PSOR",$J) D EN^PSOORDER(DFN,+ID)
|
|
"RTN","NHINVPSO",45,0)
|
|
S RX0=$G(^TMP("PSOR",$J,+ID,0)),RX1=$G(^(1)),DRUG=$G(^("DRUG",0))
|
|
"RTN","NHINVPSO",46,0)
|
|
S MED("id")=ID,MED("vaType")="O",MED("type")="Prescription"
|
|
"RTN","NHINVPSO",47,0)
|
|
S ORIFN=+$P(RX1,U,8) S:ORIFN MED("orderID")=ORIFN
|
|
"RTN","NHINVPSO",48,0)
|
|
S PSOI=$G(^TMP("PSOR",$J,+ID,"DRUGOI",0)) I PSOI D
|
|
"RTN","NHINVPSO",49,0)
|
|
. S MED("name")=$P(PSOI,";",2)
|
|
"RTN","NHINVPSO",50,0)
|
|
. D ZERO^PSS50P7(+PSOI,,,"OI")
|
|
"RTN","NHINVPSO",51,0)
|
|
. S MED("form")=$P($G(^TMP($J,"OI",+PSOI,.02)),U,2)
|
|
"RTN","NHINVPSO",52,0)
|
|
D:DRUG NDF^NHINVPS(+DRUG) ;add NDF data
|
|
"RTN","NHINVPSO",53,0)
|
|
S START=$P(RX0,U) S:START MED("start")=START
|
|
"RTN","NHINVPSO",54,0)
|
|
S STOP=$P(RX0,U,12) S:STOP MED("stop")=STOP ;_".2359"?
|
|
"RTN","NHINVPSO",55,0)
|
|
S X=$$GET1^DIQ(52,+ID_",",26,"I") S:X MED("expires")=X
|
|
"RTN","NHINVPSO",56,0)
|
|
S X=$P(RX0,U,17) S:X MED("ordered")=X
|
|
"RTN","NHINVPSO",57,0)
|
|
S MED("vaStatus")=$P($P(RX0,U,4),";",2)
|
|
"RTN","NHINVPSO",58,0)
|
|
S X=$$GET1^DIQ(52,+ID_",",100,"I"),MED("status")=$S(X=3!(X=16):"hold",X>9:"not active",1:"active")
|
|
"RTN","NHINVPSO",59,0)
|
|
S MED("quantity")=$P(RX0,U,6),MED("daysSupply")=$P(RX0,U,7)
|
|
"RTN","NHINVPSO",60,0)
|
|
S MED("fillsAllowed")=$P(RX0,U,8),MED("fillsRemaining")=$P(RX0,U,9)
|
|
"RTN","NHINVPSO",61,0)
|
|
S MED("routing")=$P($P(RX1,U,6),";"),MED("prescription")=$P(RX0,U,5)
|
|
"RTN","NHINVPSO",62,0)
|
|
S MED("lastFilled")=$P(RX0,U,3) K FILL
|
|
"RTN","NHINVPSO",63,0)
|
|
S I=0 F S I=$O(^TMP("PSOR",$J,+ID,"REF",I)) Q:I<1 S X=$G(^(I,0)),FILL(+X)=X
|
|
"RTN","NHINVPSO",64,0)
|
|
S I=0 F S I=$O(^TMP("PSOR",$J,+ID,"RPAR",I)) Q:I<1 S X=$G(^(I,0)),$P(X,U,14)=1,FILL(+X)=X
|
|
"RTN","NHINVPSO",65,0)
|
|
S (I,RFD,PRV)=0 F S RFD=$O(FILL(RFD)) Q:RFD<1 S X=$G(FILL(RFD)) D ;sort 1st
|
|
"RTN","NHINVPSO",66,0)
|
|
. N MW,REL S I=I+1
|
|
"RTN","NHINVPSO",67,0)
|
|
. S RFD=$P(RFD,"."),MW=$P($P(X,U,10),";"),REL=$P($P(X,U,8),".")
|
|
"RTN","NHINVPSO",68,0)
|
|
. S MED("fill",I)=RFD_U_MW_U_REL_U_$P(X,U,4,5)_$S($P(X,U,14):"^1",1:"")
|
|
"RTN","NHINVPSO",69,0)
|
|
. S:$P(X,U,2) PRV=$P(X,U,2) ;save last provider
|
|
"RTN","NHINVPSO",70,0)
|
|
. ; fill comments?
|
|
"RTN","NHINVPSO",71,0)
|
|
S X=$S($P(RX0,U,11):$P(RX0,U,11),$P(RX0,U,10):$P(RX0,U,10),1:0)
|
|
"RTN","NHINVPSO",72,0)
|
|
S:X MED("fillCost")=X
|
|
"RTN","NHINVPSO",73,0)
|
|
S X=$G(^TMP("PSOR",$J,+ID,"SIG",1,0)),I=1
|
|
"RTN","NHINVPSO",74,0)
|
|
F S I=$O(^TMP("PSOR",$J,+ID,"SIG",I)) Q:I<1 S X=X_$G(^(I,0))
|
|
"RTN","NHINVPSO",75,0)
|
|
S MED("sig")=X
|
|
"RTN","NHINVPSO",76,0)
|
|
S X=$G(^TMP("PSOR",$J,+ID,"PI",1,0)),I=1
|
|
"RTN","NHINVPSO",77,0)
|
|
F S I=$O(^TMP("PSOR",$J,+ID,"PI",I)) Q:I<1 S X=X_$G(^(I,0))
|
|
"RTN","NHINVPSO",78,0)
|
|
S:$L(X) MED("ptInstructions")=X
|
|
"RTN","NHINVPSO",79,0)
|
|
S I=0 F S I=$O(^TMP("PSOR",$J,+ID,"MI",I)) Q:I<1 S X=$G(^(I,0)) D
|
|
"RTN","NHINVPSO",80,0)
|
|
. N UD,NOUN,DOSE,UNIT,RTE,SCH,DUR,CONJ,END
|
|
"RTN","NHINVPSO",81,0)
|
|
. S UD=$P(X,U,2),NOUN=$P(X,U,4)
|
|
"RTN","NHINVPSO",82,0)
|
|
. S DOSE=$P(X,U),UNIT=$P($P(X,U,3),";",2)
|
|
"RTN","NHINVPSO",83,0)
|
|
. S RTE=+$P(X,U,7) D ALL^PSS51P2(RTE,,,,"MR")
|
|
"RTN","NHINVPSO",84,0)
|
|
. S RTE=$G(^TMP($J,"MR",RTE,1))
|
|
"RTN","NHINVPSO",85,0)
|
|
. S DUR=$P(X,U,5),CONJ=$P(X,U,6),SCH=$P(X,U,8)
|
|
"RTN","NHINVPSO",86,0)
|
|
. S END=$S(DUR:$$STOP(START,DUR),1:STOP)
|
|
"RTN","NHINVPSO",87,0)
|
|
. S MED("dose",I)=DOSE_U_UNIT_U_UD_U_NOUN_U_RTE_U_SCH_U_DUR_U_CONJ_U_START_U_STOP
|
|
"RTN","NHINVPSO",88,0)
|
|
. I $E(CONJ)="T",DUR S START=END
|
|
"RTN","NHINVPSO",89,0)
|
|
S:RX1 X=$TR($P(RX1,U),";","^"),MED("orderingProvider")=X,MED("currentProvider")=X
|
|
"RTN","NHINVPSO",90,0)
|
|
S:$G(PRV) MED("currentProvider")=$TR(PRV,";","^")
|
|
"RTN","NHINVPSO",91,0)
|
|
S:$P(RX1,U,9) MED("pharmacist")=$TR($P(RX1,U,9),";","^")
|
|
"RTN","NHINVPSO",92,0)
|
|
S:$P(RX1,U,4) MED("location")=$TR($P(RX1,U,4),";","^")
|
|
"RTN","NHINVPSO",93,0)
|
|
S MED("facility")=$$FAC^NHINV(+$P(RX1,U,4))
|
|
"RTN","NHINVPSO",94,0)
|
|
K ^TMP("PSOR",$J),^TMP($J,"MR"),^TMP($J,"NDF"),^TMP($J,"OI")
|
|
"RTN","NHINVPSO",95,0)
|
|
Q
|
|
"RTN","NHINVPSO",96,0)
|
|
;
|
|
"RTN","NHINVPSO",97,0)
|
|
PEND ; -- pending prescription
|
|
"RTN","NHINVPSO",98,0)
|
|
; [expects PS0,OCL^PSOORRL data]
|
|
"RTN","NHINVPSO",99,0)
|
|
N I,X,NHIN K MED
|
|
"RTN","NHINVPSO",100,0)
|
|
S MED("id")=ID,MED("vaType")="O",MED("type")="Prescription"
|
|
"RTN","NHINVPSO",101,0)
|
|
S MED("vaStatus")=$P(PS0,U,9),MED("status")="not active" ;??
|
|
"RTN","NHINVPSO",102,0)
|
|
S X=+$P(PS0,U,8) S:X MED("orderID")=X
|
|
"RTN","NHINVPSO",103,0)
|
|
S X=+$P(PS0,U,12) S:X MED("quantity")=X
|
|
"RTN","NHINVPSO",104,0)
|
|
D GETS^DIQ(52.41,+ID_",","101;13;19;15;5;1.1","I","NHIN")
|
|
"RTN","NHINVPSO",105,0)
|
|
S X=NHIN(52.41,+ID_",",101,"I") S:X MED("daysSupply")=X
|
|
"RTN","NHINVPSO",106,0)
|
|
S X=NHIN(52.41,+ID_",",13,"I") S:X MED("fillsAllowed")=X
|
|
"RTN","NHINVPSO",107,0)
|
|
S X=NHIN(52.41,+ID_",",19,"I") S:$L(X) MED("routing")=X
|
|
"RTN","NHINVPSO",108,0)
|
|
S X=NHIN(52.41,+ID_",",15,"I") S:X MED("ordered")=X
|
|
"RTN","NHINVPSO",109,0)
|
|
S X=NHIN(52.41,+ID_",",5,"I") S:X MED("orderingProvider")=X_U_$P($G(^VA(200,X,0)),U)
|
|
"RTN","NHINVPSO",110,0)
|
|
S X=NHIN(52.41,+ID_",",1.1,"I") S:X MED("location")=X_U_$P($G(^SC(X,0)),U)
|
|
"RTN","NHINVPSO",111,0)
|
|
S MED("facility")=$$FAC^NHINV(X)
|
|
"RTN","NHINVPSO",112,0)
|
|
S X=$G(^TMP("PS",$J,NHI,"SIG",1,0)),I=1
|
|
"RTN","NHINVPSO",113,0)
|
|
F S I=$O(^TMP("PS",$J,NHI,"SIG",I)) Q:I<1 S X=X_$C(13,10)_$G(^(I,0))
|
|
"RTN","NHINVPSO",114,0)
|
|
S MED("sig")=X
|
|
"RTN","NHINVPSO",115,0)
|
|
D PEN^PSO5241(DFN,"NHIN",+ID)
|
|
"RTN","NHINVPSO",116,0)
|
|
S X=$G(^TMP($J,"NHIN",DFN,+ID,8)) I X D ;Pharmacy OI
|
|
"RTN","NHINVPSO",117,0)
|
|
. S MED("name")=$P(X,U,2)_" "_$P(X,U,4),MED("form")=$P(X,U,4)
|
|
"RTN","NHINVPSO",118,0)
|
|
S X=$G(^TMP($J,"NHIN",DFN,+ID,11)) D:X NDF^NHINVPS(+X) ;Dispense Drug
|
|
"RTN","NHINVPSO",119,0)
|
|
D PDOSE K ^TMP($J,"NHIN")
|
|
"RTN","NHINVPSO",120,0)
|
|
Q
|
|
"RTN","NHINVPSO",121,0)
|
|
;
|
|
"RTN","NHINVPSO",122,0)
|
|
PEN1(ID,MED) ; -- return a pending Rx in MED("attribute")=value
|
|
"RTN","NHINVPSO",123,0)
|
|
; [expects OEL^PSOORRL data]
|
|
"RTN","NHINVPSO",124,0)
|
|
N PS,PS0,I,X,NHIN K MED
|
|
"RTN","NHINVPSO",125,0)
|
|
M PS=^TMP("PS",$J) S PS0=PS(0)
|
|
"RTN","NHINVPSO",126,0)
|
|
S MED("id")=ID,MED("vaType")="O",MED("type")="Prescription"
|
|
"RTN","NHINVPSO",127,0)
|
|
S MED("vaStatus")=$P(PS0,U,6),MED("status")="not active" ;??
|
|
"RTN","NHINVPSO",128,0)
|
|
S X=+$P(PS0,U,11) S:X MED("orderID")=X
|
|
"RTN","NHINVPSO",129,0)
|
|
S X=+$P(PS0,U,8) S:X MED("quantity")=X
|
|
"RTN","NHINVPSO",130,0)
|
|
S X=+$P(PS0,U,4) S:X MED("fillsAllowed")=X
|
|
"RTN","NHINVPSO",131,0)
|
|
S X=+$P(PS0,U,5) S:X MED("ordered")=X
|
|
"RTN","NHINVPSO",132,0)
|
|
S X=$G(PS("DD",1,0)) D:X NDF^NHINVPS(+X) ;Dispense Drug
|
|
"RTN","NHINVPSO",133,0)
|
|
D GETS^DIQ(52.41,+ID_",","101;19;5;1.1","I","NHIN")
|
|
"RTN","NHINVPSO",134,0)
|
|
S X=NHIN(52.41,+ID_",",101,"I") S:X MED("daysSupply")=X
|
|
"RTN","NHINVPSO",135,0)
|
|
S X=NHIN(52.41,+ID_",",19,"I") S:$L(X) MED("routing")=X
|
|
"RTN","NHINVPSO",136,0)
|
|
S X=NHIN(52.41,+ID_",",5,"I") S:X MED("orderingProvider")=X_U_$P($G(^VA(200,X,0)),U)
|
|
"RTN","NHINVPSO",137,0)
|
|
S X=NHIN(52.41,+ID_",",1.1,"I") S:X MED("location")=X_U_$P($G(^SC(X,0)),U)
|
|
"RTN","NHINVPSO",138,0)
|
|
S MED("facility")=$$FAC^NHINV(X)
|
|
"RTN","NHINVPSO",139,0)
|
|
S X=$G(PS("SIG",1,0)),I=1
|
|
"RTN","NHINVPSO",140,0)
|
|
F S I=$O(PS("SIG",I)) Q:I<1 S X=X_$C(13,10)_$G(PS("SIG",I,0))
|
|
"RTN","NHINVPSO",141,0)
|
|
S MED("sig")=X
|
|
"RTN","NHINVPSO",142,0)
|
|
D PEN^PSO5241(DFN,"NHIN",+ID)
|
|
"RTN","NHINVPSO",143,0)
|
|
S X=$G(^TMP($J,"NHIN",DFN,+ID,8)) I X D ;Pharmacy OI
|
|
"RTN","NHINVPSO",144,0)
|
|
. S MED("name")=$P(X,U,2)_" "_$P(X,U,4),MED("form")=$P(X,U,4)
|
|
"RTN","NHINVPSO",145,0)
|
|
D PDOSE K ^TMP($J,"NHIN")
|
|
"RTN","NHINVPSO",146,0)
|
|
Q
|
|
"RTN","NHINVPSO",147,0)
|
|
;
|
|
"RTN","NHINVPSO",148,0)
|
|
PDOSE ; Pending file doses
|
|
"RTN","NHINVPSO",149,0)
|
|
N QT,UNIT,UD,NOUN,DOSE,RTE,SCH,DUR,CONJ,BEG,END
|
|
"RTN","NHINVPSO",150,0)
|
|
F I=1:1 K NHIN D GETS^DIQ(52.413,I_","_+ID_",","*",,"NHIN") Q:'$D(NHIN) D
|
|
"RTN","NHINVPSO",151,0)
|
|
. K QT M QT=NHIN(52.413,I_","_+ID_",")
|
|
"RTN","NHINVPSO",152,0)
|
|
. S (UNIT,UD,NOUN)="",(DOSE,X)=QT(.01) I X["&" D
|
|
"RTN","NHINVPSO",153,0)
|
|
.. S DOSE=$P(X,"&"),UNIT=$P(X,"&",2)
|
|
"RTN","NHINVPSO",154,0)
|
|
.. S UD=$P(X,"&",3),NOUN=$P(X,"&",4)
|
|
"RTN","NHINVPSO",155,0)
|
|
. S SCH=QT(1),DUR=QT(2),CONJ=QT(6),BEG=QT(3),END=QT(4)
|
|
"RTN","NHINVPSO",156,0)
|
|
. S RTE=$$GET1^DIQ(52.413,I_","_+ID_",","10:1")
|
|
"RTN","NHINVPSO",157,0)
|
|
. S MED("dose",I)=DOSE_U_UNIT_U_UD_U_NOUN_U_RTE_U_SCH_U_DUR_U_CONJ_U_BEG_U_END
|
|
"RTN","NHINVPSO",158,0)
|
|
Q
|
|
"RTN","NHINVPSO",159,0)
|
|
;
|
|
"RTN","NHINVPSO",160,0)
|
|
STOP(BEG,X) ; -- Return date after adding X to BEG
|
|
"RTN","NHINVPSO",161,0)
|
|
N D,H,M,S,UNT,Y
|
|
"RTN","NHINVPSO",162,0)
|
|
S Y=BEG,(D,H,M,S)=0,UNT=$P(X," ",2),X=+X
|
|
"RTN","NHINVPSO",163,0)
|
|
S:UNT?1"MON".E D=30*X
|
|
"RTN","NHINVPSO",164,0)
|
|
S:UNT?1"WEE".E D=7*X
|
|
"RTN","NHINVPSO",165,0)
|
|
S:UNT?1"DAY".E D=X
|
|
"RTN","NHINVPSO",166,0)
|
|
S:UNT?1"HOU".E H=X
|
|
"RTN","NHINVPSO",167,0)
|
|
S:UNT?1"MIN".E M=X
|
|
"RTN","NHINVPSO",168,0)
|
|
S:UNT?1"SEC".E S=X
|
|
"RTN","NHINVPSO",169,0)
|
|
S Y=$$FMADD^XLFDT(BEG,D,H,M,S)
|
|
"RTN","NHINVPSO",170,0)
|
|
Q Y
|
|
"RTN","NHINVPSO",171,0)
|
|
;
|
|
"RTN","NHINVPSO",172,0)
|
|
NVA(ID,MED) ; -- return a non-VA med in MED("attribute")=value
|
|
"RTN","NHINVPSO",173,0)
|
|
N NVA,NHZ,ORIFN,DOSE,X K MED
|
|
"RTN","NHINVPSO",174,0)
|
|
D GETS^DIQ(55.05,+ID_","_DFN_",",".01:8;11:13","IE","NHZ")
|
|
"RTN","NHINVPSO",175,0)
|
|
M NVA=NHZ(55.05,+ID_","_DFN_",") K NHZ
|
|
"RTN","NHINVPSO",176,0)
|
|
S MED("id")=ID,MED("type")="OTC",MED("vaType")="N"
|
|
"RTN","NHINVPSO",177,0)
|
|
S ORIFN=+NVA(7,"I") S:ORIFN MED("orderID")=ORIFN
|
|
"RTN","NHINVPSO",178,0)
|
|
I NVA(.01,"I") D ;orderable item
|
|
"RTN","NHINVPSO",179,0)
|
|
. N FORM
|
|
"RTN","NHINVPSO",180,0)
|
|
. S X=NVA(.01,"I") D ZERO^PSS50P7(+X,,,"PSOI")
|
|
"RTN","NHINVPSO",181,0)
|
|
. S FORM=$P($G(^TMP($J,"PSOI",+X,.02)),U,2),MED("form")=FORM
|
|
"RTN","NHINVPSO",182,0)
|
|
. S MED("name")=NVA(.01,"E")_" "_FORM
|
|
"RTN","NHINVPSO",183,0)
|
|
S X=NVA(1,"I") D:X NDF^NHINVPS(+X) ;dispense drug
|
|
"RTN","NHINVPSO",184,0)
|
|
S MED("sig")=NVA(2,"E")_" BY "_NVA(3,"E")_" "_NVA(4,"E")
|
|
"RTN","NHINVPSO",185,0)
|
|
S X=NVA(2,"I"),NVA(2,"I")=+X_U_$P(X,+X,2) ;amt^unit
|
|
"RTN","NHINVPSO",186,0)
|
|
S DOSE=NVA(2,"I")_"^^" I ORIFN D ;reformat from order
|
|
"RTN","NHINVPSO",187,0)
|
|
. S X=$$VALUE^ORX8(ORIFN,"ROUTE") S:X NVA(3,"E")=$$GET1^DIQ(51.2,+X_",",1)
|
|
"RTN","NHINVPSO",188,0)
|
|
. S X=$$VALUE^ORX8(ORIFN,"SCHEDULE") S:$L(X) NVA(4,"E")=X
|
|
"RTN","NHINVPSO",189,0)
|
|
. S X=$$VALUE^ORX8(ORIFN,"DOSE"),DOSE=$TR($P(X,"&",1,4),"&","^")
|
|
"RTN","NHINVPSO",190,0)
|
|
S MED("dose",1)=DOSE_U_NVA(3,"E")_U_NVA(4,"E")
|
|
"RTN","NHINVPSO",191,0)
|
|
S:NVA(8,"I") MED("start")=NVA(8,"I")
|
|
"RTN","NHINVPSO",192,0)
|
|
S:NVA(6,"I") MED("stop")=NVA(6,"I")
|
|
"RTN","NHINVPSO",193,0)
|
|
S:NVA(11,"I") MED("ordered")=NVA(11,"I")
|
|
"RTN","NHINVPSO",194,0)
|
|
S MED("status")=$S($G(NVA(5,"E")):"not active",1:"active")
|
|
"RTN","NHINVPSO",195,0)
|
|
S:NVA(12,"I") MED("orderingProvider")=NVA(12,"I")_U_NVA(12,"E")
|
|
"RTN","NHINVPSO",196,0)
|
|
S:NVA(13,"I") MED("location")=NVA(13,"I")_U_NVA(13,"E")
|
|
"RTN","NHINVPSO",197,0)
|
|
S MED("facility")=$$FAC^NHINV(NVA(13,"I"))
|
|
"RTN","NHINVPSO",198,0)
|
|
K ^TMP($J,"PSOI"),^TMP($J,"NDF")
|
|
"RTN","NHINVPSO",199,0)
|
|
Q
|
|
"RTN","NHINVPSO",200,0)
|
|
;
|
|
"RTN","NHINVPSO",201,0)
|
|
ACTIVE(X) ; -- return 1 or 0, if X is an active status
|
|
"RTN","NHINVPSO",202,0)
|
|
N Y S Y=1
|
|
"RTN","NHINVPSO",203,0)
|
|
I X="PURGE" S Y=0
|
|
"RTN","NHINVPSO",204,0)
|
|
I X="DELETED" S Y=0
|
|
"RTN","NHINVPSO",205,0)
|
|
I X="EXPIRED" S Y=0 ;keep, to renew?
|
|
"RTN","NHINVPSO",206,0)
|
|
I $P(X," ")="DISCONTINUED" S Y=0
|
|
"RTN","NHINVPSO",207,0)
|
|
Q Y
|
|
"RTN","NHINVPT")
|
|
0^12^B58401800
|
|
"RTN","NHINVPT",1,0)
|
|
NHINVPT ;SLC/MKB -- Patient demographics extract
|
|
"RTN","NHINVPT",2,0)
|
|
;;1.0;NHIN;;Oct 25, 2010;Build 14
|
|
"RTN","NHINVPT",3,0)
|
|
;
|
|
"RTN","NHINVPT",4,0)
|
|
; External References DBIA#
|
|
"RTN","NHINVPT",5,0)
|
|
; ------------------- -----
|
|
"RTN","NHINVPT",6,0)
|
|
; ^DIC(42 10039
|
|
"RTN","NHINVPT",7,0)
|
|
; ^DPT 10035
|
|
"RTN","NHINVPT",8,0)
|
|
; DGCV 4156
|
|
"RTN","NHINVPT",9,0)
|
|
; DGMSTAPI 2716
|
|
"RTN","NHINVPT",10,0)
|
|
; DGNTAPI 3457
|
|
"RTN","NHINVPT",11,0)
|
|
; DGPFAPI 3860
|
|
"RTN","NHINVPT",12,0)
|
|
; DILFD 2055
|
|
"RTN","NHINVPT",13,0)
|
|
; DIQ 2056
|
|
"RTN","NHINVPT",14,0)
|
|
; MPIF001 2701
|
|
"RTN","NHINVPT",15,0)
|
|
; SDUTL3 1252
|
|
"RTN","NHINVPT",16,0)
|
|
; VADPT 10061
|
|
"RTN","NHINVPT",17,0)
|
|
; VAFCTFU1 2990
|
|
"RTN","NHINVPT",18,0)
|
|
; VASITE 10112
|
|
"RTN","NHINVPT",19,0)
|
|
; XUAF4 2171
|
|
"RTN","NHINVPT",20,0)
|
|
;
|
|
"RTN","NHINVPT",21,0)
|
|
; ------------ Get data from VistA ------------
|
|
"RTN","NHINVPT",22,0)
|
|
;
|
|
"RTN","NHINVPT",23,0)
|
|
EN(DFN,BEG,END,MAX,ID) ; -- find current patient demographics
|
|
"RTN","NHINVPT",24,0)
|
|
; [BEG,END,MAX,ID not currently used]
|
|
"RTN","NHINVPT",25,0)
|
|
S DFN=+$G(DFN) Q:DFN<1 ;invalid patient
|
|
"RTN","NHINVPT",26,0)
|
|
N PAT,SYS S SYS=$$SITE^VASITE
|
|
"RTN","NHINVPT",27,0)
|
|
D DEM,SVC,PRF,ATC,SUPP,ALIAS,FAC
|
|
"RTN","NHINVPT",28,0)
|
|
I $D(PAT)>9 D XML(.PAT)
|
|
"RTN","NHINVPT",29,0)
|
|
Q
|
|
"RTN","NHINVPT",30,0)
|
|
;
|
|
"RTN","NHINVPT",31,0)
|
|
DEM ;-demographic data
|
|
"RTN","NHINVPT",32,0)
|
|
N VADM,VA,VAERR,X
|
|
"RTN","NHINVPT",33,0)
|
|
S PAT("id")=DFN,PAT("icn")=+$$GETICN^MPIF001(DFN)
|
|
"RTN","NHINVPT",34,0)
|
|
D DEM^VADPT S X=VADM(1),PAT("fullName")=X
|
|
"RTN","NHINVPT",35,0)
|
|
S PAT("familyName")=$P(X,","),PAT("givenNames")=$P(X,",",2,99)
|
|
"RTN","NHINVPT",36,0)
|
|
S PAT("ssn")=$P(VADM(2),U)
|
|
"RTN","NHINVPT",37,0)
|
|
S:$D(VA("BID")) PAT("bid")=$E(X)_VA("BID")
|
|
"RTN","NHINVPT",38,0)
|
|
S PAT("dob")=+$P($P(VADM(3),U),".")
|
|
"RTN","NHINVPT",39,0)
|
|
S PAT("gender")=$P(VADM(5),U)
|
|
"RTN","NHINVPT",40,0)
|
|
S PAT("lrdfn")=+$G(^DPT(DFN,"LR"))
|
|
"RTN","NHINVPT",41,0)
|
|
S X=+$P($P(VADM(6),U),".") S:X PAT("died")=X
|
|
"RTN","NHINVPT",42,0)
|
|
S X=$$GET1^DIQ(38.1,DFN_",",2,"I") S:$L(X) PAT("sensitive")=X
|
|
"RTN","NHINVPT",43,0)
|
|
S X=+VADM(9) S:X PAT("religion")=X
|
|
"RTN","NHINVPT",44,0)
|
|
S X=$P(VADM(10),U,2) S:$L(X) PAT("maritalStatus")=$E(X)
|
|
"RTN","NHINVPT",45,0)
|
|
I VADM(11) D
|
|
"RTN","NHINVPT",46,0)
|
|
. N I S I=0
|
|
"RTN","NHINVPT",47,0)
|
|
. F S I=$O(VADM(11,I)) Q:I<1 S X=+VADM(11,I),PAT("ethnicity",X)=$$GET1^DIQ(10.2,X_",",4)
|
|
"RTN","NHINVPT",48,0)
|
|
I VADM(12) D
|
|
"RTN","NHINVPT",49,0)
|
|
. N I S I=0
|
|
"RTN","NHINVPT",50,0)
|
|
. F S I=$O(VADM(12,I)) Q:I<1 S X=+VADM(12,I),PAT("race",X)=$$GET1^DIQ(10,X_",",4)
|
|
"RTN","NHINVPT",51,0)
|
|
Q
|
|
"RTN","NHINVPT",52,0)
|
|
SVC ;-service data
|
|
"RTN","NHINVPT",53,0)
|
|
N VAEL,VASV,VAERR,X,Y,I,AO,IR,PGF,HNC,MST,CV
|
|
"RTN","NHINVPT",54,0)
|
|
D 7^VADPT
|
|
"RTN","NHINVPT",55,0)
|
|
S PAT("veteran")=VAEL(4)
|
|
"RTN","NHINVPT",56,0)
|
|
S PAT("sc")=+VAEL(3) S:VAEL(3) PAT("scPercent")=+$P(VAEL(3),U,2)
|
|
"RTN","NHINVPT",57,0)
|
|
;
|
|
"RTN","NHINVPT",58,0)
|
|
; exposures
|
|
"RTN","NHINVPT",59,0)
|
|
S AO=VASV(2),IR=VASV(3)
|
|
"RTN","NHINVPT",60,0)
|
|
S X=$P($G(^DPT(DFN,.322)),U,10),PGF=$S(X="Y":1,X="N":0,1:"")
|
|
"RTN","NHINVPT",61,0)
|
|
S X=$$GETCUR^DGNTAPI(DFN,"HNC"),X=+($G(HNC("STAT")))
|
|
"RTN","NHINVPT",62,0)
|
|
S HNC=$S(X=4:1,X=5:1,X=1:0,X=6:0,1:"")
|
|
"RTN","NHINVPT",63,0)
|
|
S X=$P($$GETSTAT^DGMSTAPI(DFN),U,2),MST=$S(X="Y":1,X="N":0,1:"")
|
|
"RTN","NHINVPT",64,0)
|
|
S X=$$CVEDT^DGCV(DFN),CV=$S(+X<0:"",+X=0:0,$P(X,U,3):1,1:0)
|
|
"RTN","NHINVPT",65,0)
|
|
S PAT("exposures")=AO_U_IR_U_PGF_U_HNC_U_MST_U_CV
|
|
"RTN","NHINVPT",66,0)
|
|
;
|
|
"RTN","NHINVPT",67,0)
|
|
; rated disabilities [see DGRPDB]
|
|
"RTN","NHINVPT",68,0)
|
|
S I=0 F S I=$O(^DPT(DFN,.372,I)) Q:I<1 D
|
|
"RTN","NHINVPT",69,0)
|
|
. N DIS S DIS=$G(^DPT(DFN,.372,I,0))
|
|
"RTN","NHINVPT",70,0)
|
|
. S Y=$$GET1^DIQ(31,+DIS_",",.01)
|
|
"RTN","NHINVPT",71,0)
|
|
. S PAT("disability",+DIS)=Y_U_$P(DIS,U,2,3) ;name^%^sc
|
|
"RTN","NHINVPT",72,0)
|
|
Q
|
|
"RTN","NHINVPT",73,0)
|
|
PRF ;-patient record flags
|
|
"RTN","NHINVPT",74,0)
|
|
N NHINPF,I,NAME,TEXT
|
|
"RTN","NHINVPT",75,0)
|
|
Q:'$$GETACT^DGPFAPI(DFN,"NHINPF")
|
|
"RTN","NHINVPT",76,0)
|
|
S I=0 F S I=$O(NHINPF(I)) Q:I<1 D
|
|
"RTN","NHINVPT",77,0)
|
|
. S NAME=$P(NHINPF(I,"FLAG"),U,2)
|
|
"RTN","NHINVPT",78,0)
|
|
. M TEXT=NHINPF(I,"NARR")
|
|
"RTN","NHINVPT",79,0)
|
|
. S PAT("flag",I)=NAME_U_$$STRING^NHINV(.TEXT)
|
|
"RTN","NHINVPT",80,0)
|
|
Q
|
|
"RTN","NHINVPT",81,0)
|
|
ATC ;-address & telecom
|
|
"RTN","NHINVPT",82,0)
|
|
N VAPA,I,X
|
|
"RTN","NHINVPT",83,0)
|
|
S VAPA("P")="" D ADD^VADPT ;permanent address
|
|
"RTN","NHINVPT",84,0)
|
|
S X="" F I=1:1:4 S X=X_VAPA(I)_U
|
|
"RTN","NHINVPT",85,0)
|
|
S X=X_$P(VAPA(5),U,2)_U_$P(VAPA(11),U,2)
|
|
"RTN","NHINVPT",86,0)
|
|
S PAT("address")=X ;street1^st2^st3^city^state^zip
|
|
"RTN","NHINVPT",87,0)
|
|
S X=VAPA(8)_U_$$GET1^DIQ(2,DFN_",",.134)_U_$$GET1^DIQ(2,DFN_",",.132)
|
|
"RTN","NHINVPT",88,0)
|
|
S PAT("telecom")=X ;home^cell^work phones
|
|
"RTN","NHINVPT",89,0)
|
|
Q
|
|
"RTN","NHINVPT",90,0)
|
|
SUPP ;-support contacts
|
|
"RTN","NHINVPT",91,0)
|
|
N VAOA,A,I,X,TYPE
|
|
"RTN","NHINVPT",92,0)
|
|
F A="",1 K VAOA D
|
|
"RTN","NHINVPT",93,0)
|
|
. S:A VAOA("A")=A D OAD^VADPT Q:'$L($G(VAOA(9)))
|
|
"RTN","NHINVPT",94,0)
|
|
. S TYPE=$S(A=1:"ECON",1:"NOK")
|
|
"RTN","NHINVPT",95,0)
|
|
. S PAT("support",TYPE)=VAOA(9)_U_VAOA(10) ;name^relationship
|
|
"RTN","NHINVPT",96,0)
|
|
. S X="" F I=1:1:4 S X=X_VAOA(I)_U
|
|
"RTN","NHINVPT",97,0)
|
|
. S X=X_$P(VAOA(5),U,2)_U_$P(VAOA(11),U,2)
|
|
"RTN","NHINVPT",98,0)
|
|
. S PAT("support",TYPE,"address")=X ;street1^st2^st3^city^state^zip
|
|
"RTN","NHINVPT",99,0)
|
|
. S I=$S(A=1:.33011,1:.21011),X=VAOA(8)_U_U_$$GET1^DIQ(2,DFN_",",I)
|
|
"RTN","NHINVPT",100,0)
|
|
. S PAT("support",TYPE,"telecom")=X ;home^cell^work phones
|
|
"RTN","NHINVPT",101,0)
|
|
Q
|
|
"RTN","NHINVPT",102,0)
|
|
ALIAS ;-other names used
|
|
"RTN","NHINVPT",103,0)
|
|
N I,X
|
|
"RTN","NHINVPT",104,0)
|
|
S I=0 F S I=$O(^DPT(DFN,.01,I)) Q:I<1 S X=$G(^(I,0)) D
|
|
"RTN","NHINVPT",105,0)
|
|
. S PAT("alias",I)=$P(X,U)
|
|
"RTN","NHINVPT",106,0)
|
|
Q
|
|
"RTN","NHINVPT",107,0)
|
|
FAC ;-treating facilities [see FACLIST^ORWCIRN]
|
|
"RTN","NHINVPT",108,0)
|
|
N IFN S DFN=+$G(DFN) Q:DFN<1
|
|
"RTN","NHINVPT",109,0)
|
|
N NHINY,HOME,I,X,IEN
|
|
"RTN","NHINVPT",110,0)
|
|
I $L($T(TFL^VAFCTFU1)) D TFL^VAFCTFU1(.NHINY,DFN)
|
|
"RTN","NHINVPT",111,0)
|
|
Q:$P($G(NHINY(1)),U)<0 ;not setup
|
|
"RTN","NHINVPT",112,0)
|
|
S HOME=+$P($G(^DPT(DFN,"MPI")),U,3) ;home facility
|
|
"RTN","NHINVPT",113,0)
|
|
S I=0 F S I=$O(NHINY(I)) Q:I<1 D
|
|
"RTN","NHINVPT",114,0)
|
|
. S X=NHINY(I) Q:$P(X,U)="" ;unknown
|
|
"RTN","NHINVPT",115,0)
|
|
. S IEN=+$$IEN^XUAF4($P(X,U))
|
|
"RTN","NHINVPT",116,0)
|
|
. I +X=776!(+X=200) S $P(X,U,2)="DEPT. OF DEFENSE"
|
|
"RTN","NHINVPT",117,0)
|
|
. S PAT("facility",IEN)=$P(X,U,1,3) ;stn# ^ name ^ last date
|
|
"RTN","NHINVPT",118,0)
|
|
. I IEN=HOME S $P(PAT("facility",IEN),U,4)=1
|
|
"RTN","NHINVPT",119,0)
|
|
Q
|
|
"RTN","NHINVPT",120,0)
|
|
;
|
|
"RTN","NHINVPT",121,0)
|
|
INPT ;-current inpt status data
|
|
"RTN","NHINVPT",122,0)
|
|
N ADM,X
|
|
"RTN","NHINVPT",123,0)
|
|
S ADM=+$G(^DPT(DFN,.105)) I ADM D
|
|
"RTN","NHINVPT",124,0)
|
|
. N VAIN,VAERR,HLOC,SVC
|
|
"RTN","NHINVPT",125,0)
|
|
. D INP^VADPT S PAT("admitted")=ADM_U_+VAIN(7)
|
|
"RTN","NHINVPT",126,0)
|
|
. S PAT("ward")=VAIN(4),PAT("roomBed")=VAIN(5)
|
|
"RTN","NHINVPT",127,0)
|
|
. S HLOC=+$G(^DIC(42,+VAIN(4),44)),SVC=$P($G(^(0)),U,3)
|
|
"RTN","NHINVPT",128,0)
|
|
. S PAT("location")=HLOC_U_$P(VAIN(4),U,2)
|
|
"RTN","NHINVPT",129,0)
|
|
. S:$L(SVC) PAT("locSvc")=SVC_U_$$EXTERNAL^DILFD(42,.03,,SVC)
|
|
"RTN","NHINVPT",130,0)
|
|
. S PAT("specialty")=VAIN(3)
|
|
"RTN","NHINVPT",131,0)
|
|
. S PAT("attending")=VAIN(11)
|
|
"RTN","NHINVPT",132,0)
|
|
. S X=$$FAC^NHINV(HLOC),PAT("site")=X
|
|
"RTN","NHINVPT",133,0)
|
|
S PAT("inpatient")=$S(ADM:"true",1:"false")
|
|
"RTN","NHINVPT",134,0)
|
|
S X=$$OUTPTPR^SDUTL3(DFN) S:X PAT("pcProvider")=X
|
|
"RTN","NHINVPT",135,0)
|
|
S X=$$OUTPTTM^SDUTL3(DFN) S:X PAT("pcTeam")=X
|
|
"RTN","NHINVPT",136,0)
|
|
Q
|
|
"RTN","NHINVPT",137,0)
|
|
;
|
|
"RTN","NHINVPT",138,0)
|
|
; ------------ Return data to middle tier ------------
|
|
"RTN","NHINVPT",139,0)
|
|
;
|
|
"RTN","NHINVPT",140,0)
|
|
XML(ITEM) ; -- Return patient data as XML in @NHIN@(n)
|
|
"RTN","NHINVPT",141,0)
|
|
; as <element code='123' displayName='ABC' />
|
|
"RTN","NHINVPT",142,0)
|
|
N ATT,X,Y,I,ID
|
|
"RTN","NHINVPT",143,0)
|
|
D ADD("<patient>")
|
|
"RTN","NHINVPT",144,0)
|
|
S ATT="" F S ATT=$O(ITEM(ATT)) Q:ATT="" D D:$L(Y) ADD(Y)
|
|
"RTN","NHINVPT",145,0)
|
|
. I ATT="exposures" D:X["1" S Y="" Q
|
|
"RTN","NHINVPT",146,0)
|
|
.. S I=0,Y="<exposures>" D ADD(Y)
|
|
"RTN","NHINVPT",147,0)
|
|
.. F ID="AO","IR","PG","HNC","MST","CV" S I=I+1 I $P(X,U,I) S Y="<exposure value='"_ID_"' />" D ADD(Y)
|
|
"RTN","NHINVPT",148,0)
|
|
.. D ADD("</exposures>")
|
|
"RTN","NHINVPT",149,0)
|
|
. I $L($O(ITEM(ATT,""))) D Q ;multiples
|
|
"RTN","NHINVPT",150,0)
|
|
.. S ID=$S($E(ATT,$L(ATT))="s":ATT_"es",$E(ATT,$L(ATT))="y":$E(ATT,1,$L(ATT)-1)_"ies",1:ATT_"s")
|
|
"RTN","NHINVPT",151,0)
|
|
.. D ADD("<"_ID_">")
|
|
"RTN","NHINVPT",152,0)
|
|
.. S I="" F S I=$O(ITEM(ATT,I)) Q:I="" D D:$L(Y) ADD(Y)
|
|
"RTN","NHINVPT",153,0)
|
|
... S X=ITEM(ATT,I),Y="<"_ATT_" "
|
|
"RTN","NHINVPT",154,0)
|
|
... I ATT="support" D S Y="" Q
|
|
"RTN","NHINVPT",155,0)
|
|
.... S Y=Y_"contactType='"_I_"' name='"_$$ESC^NHINV($P(X,U))_$S($L($P(X,U,2)):"' relationship='"_$$ESC^NHINV($P(X,U,2)),1:"")_"' >" D ADD(Y)
|
|
"RTN","NHINVPT",156,0)
|
|
.... S X=$G(ITEM(ATT,I,"address")) I $L(X) D ADDR(X)
|
|
"RTN","NHINVPT",157,0)
|
|
.... S X=$G(ITEM(ATT,I,"telecom")) I $L(X) D PHONE(X)
|
|
"RTN","NHINVPT",158,0)
|
|
.... D ADD("</support>")
|
|
"RTN","NHINVPT",159,0)
|
|
... I ATT="alias" S Y=Y_"fullName='"_$$ESC^NHINV(X)_$S(X[",":"' familyName='"_$$ESC^NHINV($P(X,","))_"' givenNames='"_$$ESC^NHINV($P(X,",",2,99)),1:"")_"' />" Q
|
|
"RTN","NHINVPT",160,0)
|
|
... I ATT="flag" S Y=Y_"name='"_$$ESC^NHINV($P(X,U))_"' text='"_$$ESC^NHINV($P(X,U,2))_"' />" Q
|
|
"RTN","NHINVPT",161,0)
|
|
... I ATT="facility" S Y=Y_"code='"_$P(X,U)_"' name='"_$$ESC^NHINV($P(X,U,2))_$S($P(X,U,3):"' latestDate='"_$P($P(X,U,3),"."),1:"")_$S($P(X,U,4):"' homeSite='1",1:"")_"' />" Q
|
|
"RTN","NHINVPT",162,0)
|
|
... I ATT="disability" S Y=Y_"vaCode='"_I_"' printName='"_$$ESC^NHINV($P(X,U))_$S($P(X,U,2):"' sc='"_$P(X,U,2)_"' scPercent='"_$P(X,U,3),1:"")_"' />" Q
|
|
"RTN","NHINVPT",163,0)
|
|
... S Y=Y_"value='"_$$ESC^NHINV(ITEM(ATT,I))_"' />"
|
|
"RTN","NHINVPT",164,0)
|
|
.. D ADD("</"_ID_">") S Y=""
|
|
"RTN","NHINVPT",165,0)
|
|
. S X=$G(ITEM(ATT)),Y="" Q:'$L(X)
|
|
"RTN","NHINVPT",166,0)
|
|
. I ATT="address" D ADDR(X) S Y="" Q
|
|
"RTN","NHINVPT",167,0)
|
|
. I ATT="telecom" D PHONE(X) S Y="" Q
|
|
"RTN","NHINVPT",168,0)
|
|
. I X'["^" S Y="<"_ATT_" value='"_$$ESC^NHINV(X)_"' />" Q
|
|
"RTN","NHINVPT",169,0)
|
|
. S Y="<"_ATT_" code='"_$P(X,U)_"' name='"_$$ESC^NHINV($P(X,U,2))_"' />"
|
|
"RTN","NHINVPT",170,0)
|
|
D ADD("</patient>")
|
|
"RTN","NHINVPT",171,0)
|
|
Q
|
|
"RTN","NHINVPT",172,0)
|
|
;
|
|
"RTN","NHINVPT",173,0)
|
|
ADDR(X) ; -- XML address node from X=street1^st2^st3^city^state^zip
|
|
"RTN","NHINVPT",174,0)
|
|
N I,Y Q:$L(X)'>5 ;no data
|
|
"RTN","NHINVPT",175,0)
|
|
S Y="<address"
|
|
"RTN","NHINVPT",176,0)
|
|
F I=1,2,3 I $L($P(X,U,I)) S Y=Y_" streetLine"_I_"='"_$$ESC^NHINV($P(X,U,I))_"'"
|
|
"RTN","NHINVPT",177,0)
|
|
I $L($P(X,U,4)) S Y=Y_" city='"_$$ESC^NHINV($P(X,U,4))_"'"
|
|
"RTN","NHINVPT",178,0)
|
|
I $L($P(X,U,5)) S Y=Y_" stateProvince='"_$P(X,U,5)_"'"
|
|
"RTN","NHINVPT",179,0)
|
|
I $L($P(X,U,6)) S Y=Y_" postalCode='"_$P(X,U,6)_"'"
|
|
"RTN","NHINVPT",180,0)
|
|
S Y=Y_" />" D ADD(Y)
|
|
"RTN","NHINVPT",181,0)
|
|
Q
|
|
"RTN","NHINVPT",182,0)
|
|
;
|
|
"RTN","NHINVPT",183,0)
|
|
PHONE(X) ; -- XML telecom node from X=home^cell^work numbers
|
|
"RTN","NHINVPT",184,0)
|
|
N I,Y Q:$L(X)'>2 ;no data
|
|
"RTN","NHINVPT",185,0)
|
|
D ADD("<telecomList>")
|
|
"RTN","NHINVPT",186,0)
|
|
I $L($P(X,U,1)) S Y="<telecom usageType='H' value='"_$P(X,U,1)_"' />" D ADD(Y)
|
|
"RTN","NHINVPT",187,0)
|
|
I $L($P(X,U,2)) S Y="<telecom usageType='MC' value='"_$P(X,U,2)_"' />" D ADD(Y)
|
|
"RTN","NHINVPT",188,0)
|
|
I $L($P(X,U,3)) S Y="<telecom usageType='WP' value='"_$P(X,U,3)_"' />" D ADD(Y)
|
|
"RTN","NHINVPT",189,0)
|
|
D ADD("</telecomList>")
|
|
"RTN","NHINVPT",190,0)
|
|
Q
|
|
"RTN","NHINVPT",191,0)
|
|
;
|
|
"RTN","NHINVPT",192,0)
|
|
ADD(X) ; Add a line @NHIN@(n)=X
|
|
"RTN","NHINVPT",193,0)
|
|
S NHINI=$G(NHINI)+1
|
|
"RTN","NHINVPT",194,0)
|
|
S @NHIN@(NHINI)=X
|
|
"RTN","NHINVPT",195,0)
|
|
Q
|
|
"VER")
|
|
8.0^22.0
|
|
**END**
|
|
**END**
|