source: WorldVistAEHR/trunk/r/CLINICAL_REMINDERS-PXRM/PXRMLPP.m@ 1306

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

revised back to 6/30/08 version

File size: 6.5 KB
Line 
1PXRMLPP ; SLC/PKR/PJH - Reminder Patient List Patients ;01/06/2006
2 ;;2.0;CLINICAL REMINDERS;**4**;Feb 04, 2005;Build 21
3 ;
4 ;Main entry point for PXRM PATIENT LIST
5START(IEN) ;
6 N CDATE,CLASS,CREATOR,LDATA,LNAME,PXRMVIEW,SNAME,SOURCE,TYPE
7 N VALMBCK,VALMBG,VALMCNT,VALMSG,X,XMZ,XQORM,XQORNOD
8 ;Get Patient List record and associated data.
9 S LDATA=$G(^PXRMXP(810.5,IEN,0))
10 S LNAME=$P(LDATA,U,1)
11 S CDATE=$P(LDATA,U,4)
12 S SOURCE=$P(LDATA,U,5),SNAME=""
13 ;Check if generated from #810.2
14 I SOURCE S SNAME="Extract Parameter - "_$P($G(^PXRM(810.2,SOURCE,0)),U)
15 ;If not check if generated from #810.4
16 I SNAME="" D
17 . S SOURCE=$P(LDATA,U,6)
18 . I SOURCE'="" S SNAME="List Rule - "_$P($G(^PXRM(810.4,SOURCE,0)),U)
19 ;If still no source check for created from Reminder Due Report.
20 I SNAME="" D
21 . S SOURCE=$P(LDATA,U,9)
22 . I SOURCE'="" S SNAME="Reminder Due Report"
23 ;If there still is no source then assume it was generated in the
24 ;past by a Reminder Due Report.
25 I SNAME="" S SNAME="Reminder Due Report"
26 ;Creator
27 S CREATOR=+$P(LDATA,U,7)
28 S CREATOR=$S(CREATOR>0:$$GET1^DIQ(200,CREATOR,.01),1:"None")
29 ;Type
30 S TYPE=$P(LDATA,U,8)
31 S TYPE=$$EXTERNAL^DILFD(810.5,.08,"",TYPE,.EM)
32 ;Class
33 S CLASS=$P($G(^PXRMXP(810.5,IEN,100)),U)
34 S CLASS=$S(CLASS="N":"National",CLASS="V":"VISN",1:"Local")
35 ;Default view by name.
36 S PXRMVIEW="N"
37 S VALMCNT=0
38 D EN^VALM("PXRM PATIENT LIST PATIENTS")
39 Q
40 ;
41BLDLIST(IEN) ;Build a list of all patients
42 N IND,INCINST
43 S INCINST=+$P(^PXRMXP(810.5,IEN,0),U,10)
44 I 'INCINST D CHGCAP^VALM("HEADER3","")
45 K ^TMP("PXRMLPP",$J),^TMP("PXRMLPPA",$J),^TMP("PXRMLPPI",$J)
46 D LIST(.VALMCNT,.IEN,INCINST)
47 F IND=1:1:VALMCNT D
48 .S ^TMP("PXRMLPP",$J,"IDX",IND,IND)=^TMP("PXRMLPPI",$J,IND)
49 K ^TMP("PXRMLPPI",$J)
50 Q
51DEM ;
52 D FULL^VALM1
53 D EN^PXRMPDR(IEN)
54 S VALMBCK="R"
55 Q
56 ;
57EDIT ;Edit selected patient list fields.
58 N DA,DIE,DR,TEMP
59 S DA=IEN,DIE="^PXRMXP(810.5,"
60 S DR=".01;.08"
61 I $D(^XUSEC("PXRM MANAGER",DUZ)) S DR=DR_";.07"
62 D ^DIE
63 S TEMP=^PXRMXP(810.5,IEN,0)
64 S LNAME=$P(TEMP,U,1),CREATOR=$P(TEMP,U,7),TYPE=$P(TEMP,U,8)
65 S CREATOR=$P(^VA(200,CREATOR,0),U,1)
66 D HDR^PXRMLPP
67 S VALMBCK="R"
68 Q
69 ;
70EDITOK(IEN) ;Screen for protocol PXRM PATIENT LIST EDIT, return true if
71 ;the user is permitted to edit the selected patient list.
72 I $D(^XUSEC("PXRM MANAGER",DUZ)) Q 1
73 N CREATOR
74 S CREATOR=$P(^PXRMXP(810.5,IEN,0),U,7)
75 Q $S(CREATOR=DUZ:1,1:0)
76 ;
77ENTRY ;Entry code
78 D BLDLIST(IEN)
79 D XQORM
80 Q
81 ;
82EXIT ;Exit code
83 K ^TMP("PXRMLPP",$J)
84 K ^TMP("PXRMLPPH",$J)
85 D CLEAN^VALM10
86 D FULL^VALM1
87 S VALMBCK="R"
88 Q
89 ;
90FRE(NUMBER,NAME,INST,DFN) ;Format entry number, name and primary station
91 N TEMP,TNAME,TSOURCE
92 S TEMP=$$RJ^XLFSTR(NUMBER,5," ")
93 S TNAME=$E(NAME,1,30)
94 S TEMP=TEMP_" "_$$LJ^XLFSTR(TNAME,32," ")
95 S TEMP=TEMP_" "_$$LJ^XLFSTR(DFN,15," ")
96 I INST'="" S TEMP=TEMP_" "_INST
97 Q TEMP
98 ;
99HDR ; Header code
100 S VALMHDR(1)="List Name: "_LNAME_" ("_VALMCNT_" patients)"
101 S VALMHDR(2)=" Created: "_$$FMTE^XLFDT(CDATE,"5Z")
102 S VALMHDR(2)=$$LJ^XLFSTR(VALMHDR(2),40)_"Creator: "_CREATOR
103 S VALMHDR(3)=" Class: "_CLASS
104 S VALMHDR(3)=$$LJ^XLFSTR(VALMHDR(3),40)_"Type: "_TYPE
105 S VALMHDR(4)=" Source: "_SNAME
106 S VALMSG="+ Next Screen - Prev Screen ?? More Actions"
107 Q
108 ;
109HLP ;Help code
110 N ORU,ORUPRMT,SUB,XQORM
111 S SUB="PXRMLPPH"
112 D EN^VALM("PXRM PATIENT LIST HELP")
113 Q
114HSA ;Print Health Summary for all patients on list
115 D HSA^PXRMLPHS(IEN)
116 S VALMBCK="R"
117 Q
118 ;
119HSI ;Print Health Summary for selected patients.
120 ;Full Screen
121 W IORESET
122 N IND,DFN,PLNODE,PNAME,VALMY
123 D EN^VALM2(XQORNOD(0))
124 ;If there is no list quit.
125 I '$D(VALMY) Q
126 S PLNODE="PXRMLPHS"_$J_$$NOW^XLFDT
127 K ^XTMP(PLNODE)
128 S ^XTMP(PLNODE,0)=$$FMADD^XLFDT(DT,2)_U_DT_"HSI LIST"
129 S IND="",PXRMDONE=0
130 F S IND=$O(VALMY(IND)) Q:(+IND=0)!(PXRMDONE) D
131 .;Get the patient list ien.
132 .S DFN=^TMP("PXRMLPP",$J,"IDX",IND,IND)
133 .;DBIA #10035
134 .S PNAME=$P(^DPT(DFN,0),U,1)
135 .S ^XTMP(PLNODE,PNAME)=DFN
136 D HSI^PXRMLPHS(PLNODE)
137 S VALMBCK="R"
138 Q
139 ;
140INIT ;Init
141 S VALMCNT=0
142 Q
143 ;
144LIST(VALMCNT,IEN,INCINST) ;Build a list of patients.
145 N DATA,DFN,IND,INST,NEXT,PNAME,SUB
146 ;Build the ordered list.
147 S IND=0,SUB="NAME"
148 F S IND=$O(^PXRMXP(810.5,IEN,30,IND)) Q:'IND D
149 .S DATA=$G(^PXRMXP(810.5,IEN,30,IND,0)) Q:DATA=""
150 .S DFN=$P(DATA,U) Q:'DFN
151 .;#DBIA 10035
152 .S PNAME=$P($G(^DPT(DFN,0)),U,1)
153 .S INSTNUM=$P(DATA,U,2) S:INSTNUM="" INSTNUM="NONE"
154 .S INST=$P(DATA,U,3)
155 .;Lists built before PXRM*2*4 will only have the Institution ien.
156 .I INST="" S INST=$P(DATA,U,2)
157 .I INST="" S INST="NONE"
158 .I PXRMVIEW="I" S SUB=INST
159 .S ^TMP("PXRMLPPA",$J,SUB,PNAME,DFN)=INST
160 ;Transfer to list manager array
161 S SUB="",VALMCNT=0
162 F S SUB=$O(^TMP("PXRMLPPA",$J,SUB)) Q:SUB="" D
163 .S (INST,PNAME)=""
164 .F S PNAME=$O(^TMP("PXRMLPPA",$J,SUB,PNAME)) Q:PNAME="" D
165 ..S DFN=""
166 ..F S DFN=$O(^TMP("PXRMLPPA",$J,SUB,PNAME,DFN)) Q:DFN="" D
167 ...I INCINST S INST=^TMP("PXRMLPPA",$J,SUB,PNAME,DFN)
168 ...S VALMCNT=VALMCNT+1
169 ...S ^TMP("PXRMLPP",$J,VALMCNT,0)=$$FRE(VALMCNT,PNAME,INST,DFN)
170 ...S ^TMP("PXRMLPPI",$J,VALMCNT)=DFN
171 K ^TMP("PXRMLPPA",$J)
172 Q
173 ;
174PEXIT ;PXRM PATIENT LIST PATIENTS MENU protocol exit code
175 S VALMSG="+ Next Screen - Prev Screen ?? More Actions"
176 D XQORM
177 Q
178 ;
179USER ;
180 I $P($G(^PXRMXP(810.5,IEN,0)),U,8)="PUB" D FULL^VALM1 W !,"This option is locked for Public Lists." H 2 Q
181 D FULL^VALM1
182 D START^PXRMLPAU(IEN)
183 S VALMBCK="R"
184 Q
185 ;
186USR(IEN) ;Screen for protocol PXRM PATIENT LIST AUTH USER
187 N TYPE
188 S TYPE=$P(^PXRMXP(810.5,IEN,0),U,8)
189 ;Public lists cannot have individual user access.
190 I TYPE="PUB" Q "N"
191 Q $$ACCESS^PXRMLPU(IEN)
192 ;
193VIEW ;Select view
194 W IORESET
195 S VALMBCK="R",VALMBG=1
196 N X,Y,CODE,DIR
197 K DIROUT,DIRUT,DTOUT,DUOUT
198 S DIR(0)="S"_U_"I:Sort by Institution and Name;"
199 S DIR(0)=DIR(0)_"N:Sort by Name;"
200 S DIR("A")="TYPE OF VIEW"
201 S DIR("B")=$S(PXRMVIEW="N":"I",1:"N")
202 S DIR("?")="Select from the codes displayed."
203 D ^DIR K DIR
204 I $D(DIROUT) S DTOUT=1
205 I $D(DTOUT)!($D(DUOUT)) Q
206 ;Change display type
207 S PXRMVIEW=Y
208 ;Rebuild Workfile
209 D BLDLIST^PXRMLPP(IEN),HDR
210 Q
211 ;
212XSEL ;PXRM PATIENT LIST PATIENT SELECT validation
213 N EPIEN,DFN,SEL
214 S SEL=$P(XQORNOD(0),"=",2)
215 ;Remove trailing ,
216 I $E(SEL,$L(SEL))="," S SEL=$E(SEL,1,$L(SEL)-1)
217 ;Invalid selection
218 I SEL["," D Q
219 .W $C(7),!,"Only one item number allowed." H 2
220 .S VALMBCK="R"
221 I ('SEL)!(SEL>VALMCNT)!('$D(@VALMAR@("IDX",SEL))) D Q
222 .W $C(7),!,SEL_" is not a valid item number." H 2
223 .S VALMBCK="R"
224 ;
225 ;Get the patient list ien
226 S DFN=^TMP("PXRMLPP",$J,"IDX",SEL,SEL)
227 ;Full screen mode
228 D FULL^VALM1
229 ;Print individual Health Summary
230 D HSI^PXRMLPHS(DFN)
231 S VALMBCK="R"
232 Q
233 ;
234XQORM S XQORM("#")=$O(^ORD(101,"B","PXRM PATIENT LIST PATIENT SELECT",0))_U_"1:"_VALMCNT
235 S XQORM("A")="Select Item: "
236 Q
237 ;
Note: See TracBrowser for help on using the repository browser.