source: WorldVistAEHR/trunk/r/GEN_MED_OTHER-GMV/GMVRPCP.m@ 642

Last change on this file since 642 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 5.5 KB
Line 
1GMVRPCP ;HOIFO/DP-RPC for GMV_PtSelect.pas ; 7/8/05 8:05am
2 ;;5.0;GEN. MED. REC. - VITALS;**1,3**;Oct 31, 2002
3 ; Integration Agreements:
4 ; IA# 510 [Controlled] Calls to set ^DISV
5 ; IA# 3027 [Supported] Calls to DGSEC4
6 ; IA# 3266 [Controlled] Calls to DOB^DPTLK1
7 ; IA# 3267 [Controlled] Calls to SSN^DPTLK1
8 ; IA# 3593 [Supported] Calls to DPTLK6
9 ; IA# 4440 [Supported] XUPROD calls
10 ; IA# 10035 [Supported] Calls for FILE 2 references.
11 ; IA# 10039 [Supported] Reads of ^DIC(42,#,44)
12 ; IA# 10040 [Supported] Reads of ^SC(
13 ; IA# 10061 [Supported] Calls to VADPT
14 ; IA# 10112 [Supported] VASITE calls
15 ;
16ADD(X) ; [Procedure] Add line to @RESULTS@(...
17 ; Input parameters
18 ; 1. X [Literal/Required] Data to add to @RESULTS@(...
19 S @RESULTS@(+$O(@RESULTS@(""),-1)+1)=X
20 Q
21 ;
22LOGSEC ; [Procedure] Log Security
23 D NOTICE^DGSEC4(.GMVRET,DFN,DATA,1)
24 S @RESULTS@(0)=$S(GMVRET:"1^Logged",1:"-1^Unable to log")
25 Q
26 ;
27RPC(RESULTS,OPTION,DFN,DATA) ; [Procedure] Main RPC call tag
28 ; RPC: [GMV PTSELECT]
29 ; Input parameters
30 ; 1. RESULTS [Literal/Required] RPC return array
31 ; 2. OPTION [Literal/Required] Call method for RPC
32 ; 3. DFN [Literal/Required] Patient IEN
33 ; 4. DATA [Literal/Optional] Other data as required for call
34 S RESULTS=$NA(^TMP("GMVPTSELECT",$J)) K @RESULTS
35 D:$T(@OPTION)]"" @OPTION
36 D:'$D(@RESULTS)
37 .S @RESULTS@(0)="-1^No results returned"
38 D CLEAN^DILF
39 Q
40 ;
41HOSPLOC ; [Procedure] Return location as ptr to 44 or ""
42 N VAIN
43 D INP^VADPT S @RESULTS@(0)=+$G(^DIC(42,+VAIN(4),44),"")
44 Q
45 ;
46PTHDR ; [Procedure] Patient Info for Header Displays
47 I '$D(^DPT(+$G(DFN),0)) D Q
48 .S @RESULTS@(0)="-1^No Such DFN ["_$G(DFN,"<Null>")_"]"
49 N GMVIENS
50 S @RESULTS@(0)=+DFN,GMVIENS=(+DFN)_","
51 S @RESULTS@(1)=$$GET1^DIQ(2,GMVIENS,.01)_" "_$$GET1^DIQ(2,GMVIENS,.09)
52 S @RESULTS@(2)="DOB: "_$$GET1^DIQ(2,GMVIENS,.03)_" "_$$GET1^DIQ(2,GMVIENS,.02)_", Age: "_$$GET1^DIQ(2,GMVIENS,.033)
53 Q
54 ;
55PTLKUP ; [Procedure] Patient lookup handled separately for security
56 N GMVIDX
57 S GMVIDX=$S(DATA?9N.1"P":"SSN",1:"B^BS^BS5")
58 D FIND^DIC(2,"","@;.01;.02;.03;.09","MP",DATA,60,GMVIDX)
59 I $P(^TMP("DILIST",$J,0),U,3) D Q
60 .S @RESULTS@(0)="-1^Too many patients found matching '"_DATA_"'. Please be more specific."
61 F GMV=0:0 S GMV=$O(^TMP("DILIST",$J,GMV)) Q:'GMV D
62 .S @RESULTS@(GMV)=$$PTREC(+^TMP("DILIST",$J,GMV,0))
63 I '$D(@RESULTS) S @RESULTS@(0)="-1^No patients matching '"_DATA_"'"
64 E S @RESULTS@(0)=+$O(@RESULTS@(""),-1)
65 Q
66 ;
67PTREC(DFN) ;
68 ; Extrinsic to return a Pt Rec in standard list format
69 N GMV
70 S GMV=$G(^DPT(DFN,0))
71 S GMV="2;"_DFN_U_$P(GMV,U,1)_U_$P(GMV,U,2)_U_$P(GMV,U,3)_U_$P(GMV,U,9)
72 S $P(GMV,U,10)=$$DOB^DPTLK1(DFN)
73 S $P(GMV,U,11)=$$SSN^DPTLK1(DFN)
74 Q GMV
75 ;
76SELECT ; [Procedure] Select patient
77 ; Calls required utilities to check security and
78 ; return associated warnings/alerts about a
79 ; patient being selected.
80 ; Variables:
81 ; IENS: [Private] Fileman IENS
82 ; GMVDFN: [Private] Scratch
83 ; GMVFLD: [Private] FIeld number
84 ; GMVID: [Private] Identifier array
85 ; GMVRET: [Private] Scratch
86 ; GMVX: [Private] Scratch
87 ; New private variables
88 NEW IENS,GMVDFN,GMVFLD,GMVID,GMVIDIEN,GMVIDS,GMVRET,GMVX
89 I '$D(^DPT(+$G(DFN),0))#2 S @RESULTS@(0)="-1^No such patient" Q
90 S ^DISV(DUZ,"^DPT(")=DFN ;spacebar return
91 S @RESULTS@(0)="1^Required Identifiers & messages"
92 S IENS=DFN_","
93 D FILE^DID(2,,"REQUIRED IDENTIFIERS","GMVIDS")
94 F GMVX=0:0 S GMVX=$O(GMVIDS("REQUIRED IDENTIFIERS",GMVX)) Q:'GMVX D
95 .S GMVFLD=GMVIDS("REQUIRED IDENTIFIERS",GMVX,"FIELD")
96 .S GMVID="$$PTID^"_$$GET1^DID(2,GMVFLD,"","LABEL")
97 .S GMVID=GMVID_U_$$GET1^DIQ(2,IENS,GMVFLD)
98 .D:GMVFLD=.03
99 ..S GMVID=GMVID_" ("_$$GET1^DIQ(2,IENS,.033)_")"
100 ..S GMVID=GMVID_U_$$DOB^DPTLK1(+IENS)
101 .D:GMVFLD=.09
102 ..S X=$P(GMVID,U,3),X=$E(X,1,3)_"-"_$E(X,4,5)_"-"_$E(X,6,10)
103 ..S $P(GMVID,U,3)=X,$P(GMVID,U,4)=$$SSN^DPTLK1(+IENS)
104 .S @RESULTS@($O(@RESULTS@(""),-1)+1)=GMVID
105 ; Add ward and Room/Bed
106 S GMVID="$$PTID^"_$$GET1^DID(2,.1,"","LABEL")
107 S GMVID=GMVID_U_$$GET1^DIQ(2,IENS,.1)
108 S GMVIDIEN=$P(GMVID,U,3)
109 S GMVIDIEN=$$IDIEN(GMVIDIEN)
110 S GMVID=GMVID_U_GMVIDIEN
111 S @RESULTS@($O(@RESULTS@(""),-1)+1)=GMVID
112 S GMVID="$$PTID^"_$$GET1^DID(2,.101,"","LABEL")
113 S GMVID=GMVID_U_$$GET1^DIQ(2,IENS,.101)
114 S @RESULTS@($O(@RESULTS@(""),-1)+1)=GMVID
115 ; ------- Clevland Alert -------
116 K GMVRET
117 D GUIBS5A^DPTLK6(.GMVRET,DFN) D:GMVRET(1)=1
118 .D ADD("$$MSGHDR^2^SAME LAST NAME AND LAST 4")
119 .S GMVX=1
120 .F S GMVX=$O(GMVRET(GMVX)) Q:'GMVX!(+$G(GMVRET(GMVX))) D
121 ..D ADD($P(GMVRET(GMVX),U,2))
122 .D ADD(" ")
123 .S GMVX=1
124 .F S GMVX=$O(GMVRET(GMVX)) Q:'GMVX D:+GMVRET(GMVX)
125 ..S GMVDFN=+$P(GMVRET(GMVX),U,2)
126 ..D ADD($$GET1^DIQ(2,GMVDFN_",",.01)_" "_$$DOB^DPTLK1(GMVDFN)_" "_$$SSN^DPTLK1(GMVDFN))
127 .D ADD(" ")
128 .D ADD("Please review carefully before continuing")
129 .D ADD("$$MSGEND")
130 ; ------- Sensitive Record? -------
131 K GMVRET
132 D PTSEC^DGSEC4(.GMVRET,DFN) D:GMVRET(1)'=0
133 .D:GMVRET(1)=3
134 ..D ADD("$$MSGHDR^0^CAN'T ACCESS YOUR OWN RECORD!!")
135 .D:GMVRET(1)=-1
136 ..D ADD("$$MSGHDR^0^INCOMPLETE INFORMATION - CAN'T PROCEED")
137 .D:GMVRET(1)=1
138 ..D ADD("$$MSGHDR^1^SENSITIVE RECORD ACCESS")
139 .D:GMVRET(1)'=-1&(GMVRET(1)'=3)&(GMVRET(1)'=1)
140 ..D ADD("$$MSGHDR^3^SENSITIVE RECORD ACCESS")
141 .S GMVX=1
142 .F S GMVX=$O(GMVRET(GMVX)) Q:'GMVX D ADD($TR(GMVRET(GMVX),"*"," "))
143 .D ADD("$$MSGEND")
144 ; ------- Means Test Information? -------
145 D GUIMTD^DPTLK6(.GMVRET,DFN) D:GMVRET(1)=1
146 .D ADD("$$MSGHDR^1^NOTICE")
147 .F GMVX=1:0 S GMVX=$O(GMVRET(GMVX)) Q:'GMVX D ADD(GMVRET(GMVX))
148 .D ADD("$$MSGEND")
149 Q
150 ;
151IDIEN(GMVIEN) ;
152 S GMVIEN=$G(GMVIEN)
153 I GMVIEN="" Q ""
154 S GMVIEN=$O(^SC("B",GMVIEN,0))
155 Q GMVIEN
156 ;
157CCOW ; Return CCOW site and production indicator
158 S @RESULTS@(0)=$P($$SITE^VASITE(),"^",3)_"^"_$$PROD^XUPROD()
159 Q
160 ;
Note: See TracBrowser for help on using the repository browser.