1 | PXRMXTE ; SLC/PJH - Reminder Reports Template Edit ;08/03/2006
|
---|
2 | ;;2.0;CLINICAL REMINDERS;**4**;Feb 04, 2005;Build 21
|
---|
3 | ;
|
---|
4 | ; Called from PXRMYD,PXRMXD
|
---|
5 | ;
|
---|
6 | ;Option to Edit
|
---|
7 | ;--------------
|
---|
8 | EDIT ;
|
---|
9 | N DIDEL,DIE,DR K DTOUT,DUOUT
|
---|
10 | ;Edit report name, title and PXRMSEL (patient sample)
|
---|
11 | S DIE=810.1,DA=$P(PXRMTMP,U),DR=".01T;1.9;1.2",DIDEL=810.1
|
---|
12 | D ^DIE I $D(Y) S DUOUT=1 Q
|
---|
13 | ;Check if template has been deleted
|
---|
14 | I '$D(DA) Q
|
---|
15 | ;Get updated value of PXRMXSEL
|
---|
16 | N PXRMSEL,PXRMFUT S PXRMSEL=X
|
---|
17 | ;Needed for 1.6 validation - Prior/Future or Current/Admissions
|
---|
18 | ;N PXRMINP
|
---|
19 | ;Further fields depend on value in PXRMXSEL
|
---|
20 | I PXRMSEL="I" S DR="6T~R",PXRMINP=0
|
---|
21 | I PXRMSEL="R" S DR="14T",PXRMINP=0
|
---|
22 | I PXRMSEL="L" D Q:$D(DUOUT)
|
---|
23 | .;Get location report type
|
---|
24 | .S DR="3T;1.5R" D ^DIE I $D(Y) S DUOUT=1 Q
|
---|
25 | .N PXRMLCSC S PXRMLCSC=X,DR="",PXRMINP=0
|
---|
26 | .;All location reports - prompt for prior/future/current/admissions
|
---|
27 | .I PXRMLCSC="HAI" S PXRMINP=1,DR="1.6" Q
|
---|
28 | .I PXRMLCSC="HA" S PXRMINP=0,DR="1.6"
|
---|
29 | .I PXRMLCSC="CA" S PXRMINP=0,DR="1.6"
|
---|
30 | .D ^DIE I $D(Y) S DUOUT=1 Q
|
---|
31 | .S PXRMFUT=X,DR=""
|
---|
32 | .;Selected Location/Stop Code/Clinic Group fields
|
---|
33 | .I PXRMLCSC="HS" D Q:$D(DUOUT)
|
---|
34 | ..S DR="10T~R"
|
---|
35 | ..D ^DIE I $D(Y) S DUOUT=1 Q
|
---|
36 | ..;Determine if locations input are all wards
|
---|
37 | ..S PXRMINP=$$INP^PXRMXAP(PXRMLCSC,.PXRMLOCN)
|
---|
38 | ..;Select Prior/Future or Current Inpatient/Admissions
|
---|
39 | ..S DR="1.6"
|
---|
40 | ..D ^DIE I $D(Y) S DUOUT=1 Q
|
---|
41 | ..S PXRMFUT=X,DR=""
|
---|
42 | .;Clinic Stop input and prior/future
|
---|
43 | .I PXRMLCSC="CS" S PXRMINP=0,DR="11T~R;1.6" D I $G(DUOUT)=1 Q
|
---|
44 | ..D ^DIE I $D(Y) S DUOUT=1 Q
|
---|
45 | ..S PXRMFUT=X,DR=""
|
---|
46 | .;Clinic Group input and prior/future
|
---|
47 | .I PXRMLCSC="GS" S PXRMINP=0,DR="12T~R;1.6" D I $G(DUOUT)=1 Q
|
---|
48 | ..D ^DIE I $D(Y) S DUOUT=1 Q
|
---|
49 | ..S PXRMFUT=X,DR=""
|
---|
50 | .;Service categories (except for inpatient reports)
|
---|
51 | .I PXRMINP=0,PXRMFUT'="F",PXRMFUT'="C" S DR=DR_";9T~R"
|
---|
52 | ;OE/RR teams
|
---|
53 | I PXRMSEL="O" S DR="7T~R"
|
---|
54 | ;PCMM Provider and Primary care/All
|
---|
55 | I PXRMSEL="P" S DR="4T~R;1.3"
|
---|
56 | ;PCMM teams
|
---|
57 | I PXRMSEL="T" S DR="3T~R;8T~R"
|
---|
58 | ;Report type (detail or summary)
|
---|
59 | S DR=DR_";1.4"
|
---|
60 | ;Reminder Categories
|
---|
61 | I $D(^PXRMPT(810.1,DA,12,0))>0 D
|
---|
62 | .N IEN,CNT,NODE
|
---|
63 | .S CNT=0,IEN=0 F S IEN=$O(^PXRMPT(810.1,DA,12,IEN)) Q:IEN'>0 D
|
---|
64 | ..S CNT=CNT+1,NODE=$G(^PXRMPT(810.1,DA,12,IEN,0))
|
---|
65 | ..S PXRMTCAT(DA,CNT)=$P(NODE,U)_U_$P($G(^PXRMD(811.7,$P(NODE,U),0)),U)_U_$P(NODE,U,2)
|
---|
66 | S DR=DR_";13T"
|
---|
67 | ;Reminders
|
---|
68 | I $D(^PXRMPT(810.1,DA,1,0))>0 D
|
---|
69 | .N IEN,CNT,NODE,REMNODE
|
---|
70 | .S CNT=0,IEN=0 F S IEN=$O(^PXRMPT(810.1,DA,1,IEN)) Q:IEN'>0 D
|
---|
71 | ..S CNT=CNT+1,NODE=$G(^PXRMPT(810.1,DA,1,IEN,0))
|
---|
72 | ..S REMNODE=$G(^PXD(811.9,$P(NODE,U),0))
|
---|
73 | ..S PXRMTREM(DA,CNT)=$P(NODE,U)_U_$P(REMNODE,U)_U_$P(NODE,U,2)_U_$P($G(REMNODE),U,3)
|
---|
74 | S DR=DR_";2T"
|
---|
75 | ;
|
---|
76 | ;Strip of any leading semi-colons
|
---|
77 | I $E(DR)=";" S DR=$P(DR,";",2,99)
|
---|
78 | ;
|
---|
79 | D ^DIE I $D(Y) S DUOUT=1 Q
|
---|
80 | ;
|
---|
81 | ;If all reminders have been deleted from the template disallow save
|
---|
82 | I +$P($G(^PXRMPT(810.1,DA,1,0)),U,4)=0 D
|
---|
83 | .;Check categories also
|
---|
84 | .I +$P($G(^PXRMPT(810.1,DA,12,0)),U,4)>0 D Q
|
---|
85 | .. N CAT,CATIEN
|
---|
86 | .. S CAT=0 F S CAT=$O(^PXRMPT(810.1,DA,12,CAT)) Q:+CAT'>0 D
|
---|
87 | ... S CATIEN=$P($G(^PXRMPT(810.1,DA,12,CAT,0)),U)
|
---|
88 | ... I +$P($G(^PXRMD(811.7,CATIEN,2,0)),U,4)<1 W !!,"** WARNING **",!,"Reminder Category "_$P($G(^PXRMD(811.7,CATIEN,0)),U)_" does not have any reminders assigned to it"
|
---|
89 | .S DUOUT=1
|
---|
90 | .W !!,"No reminders defined"
|
---|
91 | Q
|
---|
92 | ;
|
---|