source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORQQXQA.m@ 1314

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

initial load of FOIAVistA 6/30/08 version

File size: 3.7 KB
Line 
1ORQQXQA ; slc/CLA - Functions which return patient/user alert and mailman data ;5/27/98
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**9**;Dec 17, 1997
3ALLPAT(ORY,ORPT) ;return all patient's alerts regardless of recipient
4 N STRTDATE,STOPDATE S STRTDATE="",STOPDATE=""
5 D PATIENT^XQALERT("^TMP(""ORB"",$J)",ORPT,STRTDATE,STOPDATE)
6 N ORX,ORTOT
7 S ORTOT=^TMP("ORB",$J)
8 I ORTOT=0 S ORY(1)="^No notifications found."
9 E F I=1:1:ORTOT S ORX=$P(^TMP("ORB",$J,I),U,2) I $P(ORX,";")["OR" D
10 .S ORY(I)=ORX_U_$P(^TMP("ORB",$J,I),U)_U_$P($P(ORX,";"),",",2)
11 K ^TMP("ORB",$J),I
12 Q
13PATIENT(ORY,ORPT) ;return current user's notifications for patient ORPT
14 Q:'$L($G(ORPT))
15 N STRTDATE,STOPDATE S STRTDATE="",STOPDATE=""
16 D USER^XQALERT("^TMP(""ORB"",$J)",DUZ,STRTDATE,STOPDATE)
17 N I,J,INFO,ORX,URG,ORN,ORPTN,SORT,SVAL,TVAL,MSG,ORNAME,INVDT,PT,NODE,ORT
18 N ORTOT
19 S ORTOT=^TMP("ORB",$J)
20 S J=0,NODE="",TVAL=""
21 F I=1:1:ORTOT S ORX=$P(^TMP("ORB",$J,I),U,2) I ($P(ORX,";")["OR"),($P(ORX,",",2)=ORPT) D
22 .S ORN=$P($P(ORX,";"),",",3)
23 .S INVDT=9999999-$P(ORX,";",3)
24 .D SORT^ORQORB(.SORT) S SORT=$S($L($G(SORT)):SORT,1:"P") ;sort method
25 .I SORT'="P" D
26 ..D URGENCY^ORQORB(.URG,ORN) S URG=$S($G(URG)>0:URG,1:2)
27 ..S ORNAME=$P(^ORD(100.9,ORN,0),U)
28 .S INFO=$P(^TMP("ORB",$J,I)," ")
29 .S MSG=$S(INFO="I":INFO,1:" ")_" "_$P($P(^TMP("ORB",$J,I),U),"):",2)
30 .I SORT="U" S SVAL=URG_U_ORNAME
31 .I SORT="T" S SVAL=ORNAME
32 .I SORT="P" S SVAL=""
33 .S ^TMP("ORB2",$J,SVAL_U_INVDT)=ORX_U_MSG_U_ORPT_U_$P(ORX,";",3)
34 F S NODE=$O(^TMP("ORB2",$J,NODE)) Q:NODE="" S J=J+1 D
35 .S SVAL=$P(NODE,U)
36 .I SORT'="P",(TVAL'=SVAL) D
37 ..S ORY(J)=U_$S(SORT="U":$S(SVAL=1:"HIGH",SVAL=3:"LOW",1:"MODERATE"),1:SVAL)_":",TVAL=SVAL,J=J+1
38 .S ORY(J)=^TMP("ORB2",$J,NODE)
39 I J=0 S ORY(1)="^No notifications found."
40 K ^TMP("ORB",$J),^TMP("ORB2",$J)
41 Q
42USER(ORY) ;return current user's notifications across all patients
43 N STRTDATE,STOPDATE S STRTDATE="",STOPDATE=""
44 D USER^XQALERT("^TMP(""ORB"",$J)",DUZ,STRTDATE,STOPDATE)
45 N I,J,INFO,ORX,URG,ORN,ORNAME,ORPT,ORPTN,SORT,SVAL,TVAL,SVAL2,TVAL2
46 N MSG,NODE,ORT,ORTOT,INVDT
47 S NODE="",TVAL="",TVAL2=""
48 D SORT^ORQORB(.SORT) S SORT=$S($L($G(SORT)):SORT,1:"P") ;sort method
49 S ORTOT=^TMP("ORB",$J)
50 F I=1:1:ORTOT S ORX=$P(^TMP("ORB",$J,I),U,2) I $P(ORX,";")["OR" D
51 .S ORN=$P($P(ORX,";"),",",3) ;type of notification (ien)
52 .S ORPT=$P($P(ORX,";"),",",2) ;DFN
53 .S INVDT=9999999-$P(ORX,";",3) ;reverse d/t
54 .D URGENCY^ORQORB(.URG,ORN) S URG=$S($G(URG)>0:URG,1:2) ;urgency of notification type
55 .S ORNAME=$P(^ORD(100.9,ORN,0),U) ;name of notification type (external)
56 .S ORPTN=$$LOWER^VALM1($P(^DPT(ORPT,0),U)) ;change patient's name to mixed case
57 .S INFO=$P(^TMP("ORB",$J,I)," ")
58 .S MSG=$S(INFO="I":INFO,1:" ")_" "_$P($P(^TMP("ORB",$J,I),U),"):",2)
59 .;sorting
60 .I SORT="U" S SVAL=URG_U_ORPTN_U_ORNAME ;by urgency
61 .I SORT="T" S SVAL=ORNAME_U_ORPTN ;by type
62 .I SORT="P" S SVAL=ORPTN_U_URG_U_ORNAME ;by patient
63 .;below is set to: XQAID^ notification name^DFN^date/time
64 .S ^TMP("ORB2",$J,SVAL_U_INVDT)=ORX_U_" "_MSG_U_ORPT_U_$P(ORX,";",3)
65 S J=0
66 F S NODE=$O(^TMP("ORB2",$J,NODE)) Q:NODE="" S J=J+1 D
67 .S SVAL=$P(NODE,U),SVAL2=$P(NODE,U,2)
68 .;set sorting heading
69 .I TVAL'=SVAL D
70 ..S ORY(J)=U_$S(SORT="U":$S(SVAL=1:"HIGH",SVAL=3:"LOW",1:"MODERATE"),1:SVAL)_":",TVAL=SVAL,TVAL2="",J=J+1
71 .I SORT'="P",TVAL2'=SVAL2 S ORY(J)=U_" "_SVAL2,TVAL2=SVAL2,J=J+1
72 .;set to alert information to return
73 .S ORY(J)=^TMP("ORB2",$J,NODE)
74 I J=0 S ORY(1)="^No notifications found."
75 K ^TMP("ORB",$J),^TMP("ORB2",$J)
76 Q
77MAILG(ORY) ; return mail groups in a system
78 N ORI S ORI=1
79 ;DIC access to MAIL GROUPS FILE [#3.8] granted via DBIA #10111
80 D LIST^DIC(3.8,"","","","","","","","","","ORBMG($J)")
81 F ORI=1:1:$P(ORBMG($J,"DILIST",0),U) S ORY(ORI)=ORBMG($J,"DILIST",2,ORI)_U_ORBMG($J,"DILIST",1,ORI)
82 D CLEAN^DILF
83 K ORBMG
84 Q
Note: See TracBrowser for help on using the repository browser.