source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORB3FN.m@ 789

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

initial load of WorldVistAEHR

File size: 2.5 KB
Line 
1ORB3FN ; slc/CLA - Functions which return OE/RR Notification information ;1/13/03
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**31,74,91,170**;Dec 17, 1997
3 Q
4ONOFF(ORBN) ;extrinsic function returns '1' if notif is to be processed
5 N ORBERR,ORBE,ORBX,ORBV
6 S ORBX=0
7 K ^TMP("ORBP",$J)
8 D ENVAL^XPAR($NA(^TMP("ORBP",$J)),"ORB PROCESSING FLAG",ORBN,.ORBERR,1)
9 I 'ORBERR,$G(^TMP("ORBP",$J))>0 D
10 .S ORBE="" F S ORBE=$O(^TMP("ORBP",$J,ORBE)) Q:'ORBE!ORBX>0 D
11 ..S ORBV=$G(^TMP("ORBP",$J,ORBE,ORBN))
12 ..S:ORBV="M" ORBX=1
13 ..S:ORBV="E" ORBX=2
14 K ^TMP("ORBP",$J),ORBERR
15 I ORBX=1 Q "1^Mandatory Entity(s) exist."
16 I ORBX=2 Q "1^Enabled Entity(s) exist."
17 D ENVAL^XPAR($NA(^TMP("ORBP",$J)),"ORB DEFAULT RECIPIENT DEVICES",ORBN,.ORBERR,1)
18 I 'ORBERR,$G(^TMP("ORBP",$J))>0 Q "1^Default Recipient Device(s) exist."
19 K ^TMP("ORBP",$J),ORBERR
20 S ORBX=0
21 D ENVAL^XPAR($NA(^TMP("ORBP",$J)),"ORB DEFAULT RECIPIENTS",ORBN,.ORBERR,1)
22 I 'ORBERR,$G(^TMP("ORBP",$J))>0 D
23 .S ORBE="" F S ORBE=$O(^TMP("ORBP",$J,ORBE)) Q:'ORBE!ORBX>0 D
24 ..S ORBV=$G(^TMP("ORBP",$J,ORBE,ORBN))
25 ..S:ORBV=1 ORBX=1
26 K ^TMP("ORBP",$J)
27 I ORBX=1 Q "1^Default Recipient(s) exist."
28 Q "0^No Mandatory or enabled entities and no default recipients."
29LIST(Y) ;return list of notifications from Notification File [#100.9]
30 ; RETURN IEN^NAME^URGENCY
31 N I,J,V
32 S I=1
33 S J=0 F S J=$O(^ORD(100.9,"B",J)) Q:J="" S V=0,V=$O(^ORD(100.9,"B",J,V)) S Y(I)=V_"^"_J_"^"_^ORD(100.9,V,3),I=I+1
34 Q
35LISTON(ORY,ORBUSR) ;return notifications the user has turned On or OFF
36 ; RETURN NOTIF IEN^NOTIF NAME^ON/OFF FLAG
37 N ORSX,ORUX,ORMX,ORBNAM,ORBIEN,ORYI
38 S ORYI=0
39 ;see if notification system is disabled:
40 S ORSX=$$GET^XPAR("DIV^SYS^PKG","ORB SYSTEM ENABLE/DISABLE",1,"I")
41 I ORSX="D" S ORMX="OFF"
42 ;
43 ;loop thru all notifications and determine recipient status:
44 S ORBNAM="" F S ORBNAM=$O(^ORD(100.9,"B",ORBNAM)) Q:ORBNAM="" D
45 .S ORBIEN=0,ORBIEN=$O(^ORD(100.9,"B",ORBNAM,ORBIEN)) I +$G(ORBIEN)>0 D
46 ..I $G(ORSX)'="D" D
47 ...S ORUX="",ORUX=$$ONOFF^ORB3USER(ORBIEN,ORBUSR,"","")
48 ...I $L(ORUX) S ORMX=$P(ORUX,U)
49 ..S ORYI=ORYI+1
50 ..S ORY(ORYI)=ORBIEN_U_ORBNAM_U_ORMX
51 ;
52 Q
53PTLOC(ORBPT) ;get patient's location (INPATIENT ONLY - outpt locations
54 ;cannot be reliably determined, and many simultaneous outpt locations
55 ;can occur) - returns pt location in format: location ien^location name
56 ;outpatients return "0^Outpt"
57 N ORBLOC,ORBLOCN,ORBRES
58 S ORBRES="0^Outpt"
59 I +$G(ORBPT)>0 D
60 .N DFN S DFN=ORBPT,VA200="" D OERR^VADPT
61 .S ORBLOC=+$G(^DIC(42,+VAIN(4),44)) I +$G(ORBLOC)>0 D
62 ..S ORBLOCN=$P(^SC(+ORBLOC,0),U)
63 ..S ORBRES=ORBLOC_U_ORBLOCN
64 K VA200,VAIN
65 Q ORBRES
Note: See TracBrowser for help on using the repository browser.