source: WorldVistAEHR/trunk/r/DIETETICS-FH/FHWORR.m@ 623

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

initial load of WorldVistAEHR

File size: 4.0 KB
Line 
1FHWORR ; HISC/NCA - Decode HL7 Utility (Cont.) ;1/30/97 14:22
2 ;;5.5;DIETETICS;**2**;Jan 28, 2005
3GETOR ; Call to Get FHORN
4 F FHD=0:0 S FHD=$O(FHMSG(FHD)) Q:FHD<1 S XX=$G(FHMSG(FHD)) S FHD1=$$RETURN(XX) I FHD1'="" Q
5 S FHORN=FHD1
6 Q
7MSH ; Code MSH message
8 D SITE^FH
9 S MSG(1)="MSH|^~\&|DIETETICS|"_SITE(1)_"|||||ORM"
10 ; code PID
11 S MSG(2)="PID|||"_DFN_"||"_$P($G(^DPT(DFN,0)),"^",1)
12 ; code PV1
13 S WARD=$G(^DPT(DFN,.1)) Q:WARD="" S FHWRD=$O(^DIC(42,"B",WARD,0)) Q:'FHWRD S HOSP=+$P($G(^DIC(42,+FHWRD,44)),"^",1) Q:'HOSP S RM=$G(^DPT(DFN,.108)) S:RM RM=$P($G(^DG(405.4,+RM,0)),"^",1)
14 S MSG(3)="PV1||I|"_HOSP_"^"_RM_"||||||||||||||||"
15 Q
16GADM ; Get the correct Admission number with order.
17 S:ADM'=$P(FILL,";",2) ADM=+$P(FILL,";",2)
18 Q
19RETURN(FHDOR) ; Return FHORN
20 S FHD2=""
21 I $E(FHDOR,1,3)="ORC" S FHD2=$P(FHDOR,"|",3)
22 Q FHD2
23CHK ; Check if Cancelling Discharged
24 S CHK=0 S FHC=$G(FHMSG(3)) I $E(FHC,1,3)'="ORC" Q
25 I $P(FHC,"|",2)="DC"!($P(FHC,"|",2)="CA") S CHK=1,X=$G(FHMSG(3)),ADM=$P(X,"|",4),ADM=+$P(ADM,";",2)
26 Q
27STATUS ; Send Status As Requested
28 I FOR=1 G KIL
29 I FOR=2 D NOW^%DTC S NOW=% S FHORN1=+FHORN D OEU^FHORD71 G KIL
30 I FOR=3 S FHSTS=$P(DATA,"|",6) I FHSTS="IP" S FHSTS="ZE" D STS G KIL
31 I FOR=4 D NOW^%DTC S NOW=% S FHORN1=+FHORN D OEU^FHORD71 G KIL
32 I FOR=5 G KIL
33 G KIL
34STS ; Send Early/Late Tray Status
35 D MSH^FHWOR S $P(MSG(1),"|",9)="ORR"
36 S MSG(3)="ORC|SR|"_FHORN_"|"_FILL_"^FH||"_FHSTS
37 D MSG^XQOR("FH EVSEND OR",.MSG) K MSG
38 Q
39OMSTAT ; Send Outpatient Meals Status
40 S FHORN=$P($P(MSG(4),"|",3),"^",1),FILL=$P(MSG(4),"|",4),FHSTTS="IP"
41 S FHORNTMP=FHORN,FHCNORS="" D NOW^%DTC S FHTDAT=$P(%,".",1)
42 I $E(FILL,1)="R" S FHREND=$P(FILL,";",4),FHMPNUM=$P(FILL,";",2) I FHTDAT>FHREND S FHSTTS="ZE",FHCNORS=FHCNORS_"^"_FHORN K MSG D MSHSS^FHOMUTL,MSG^XQOR("FH EVSEND OR",.MSG) K MSG D
43 .F FHRM=0:0 S FHRM=$O(^FHPT(FHDFN,"OP","C",FHMPNUM,FHRM)) Q:FHRM'>0 D
44 ..I $D(^FHPT(FHDFN,"OP",FHRM,1)) S FHORN=$P(^FHPT(FHDFN,"OP",FHRM,1),U,4) I FHCNORS'[FHORN S FHCNORS=FHCNORS_"^"_FHORN D MSHSS^FHOMUTL,MSG^XQOR("FH EVSEND OR",.MSG) K MSG
45 ..I $D(^FHPT(FHDFN,"OP",FHRM,2)) S FHORN=$P(^FHPT(FHDFN,"OP",FHRM,2),U,5) I FHCNORS'[FHORN S FHCNORS=FHCNORS_"^"_FHORN D MSHSS^FHOMUTL,MSG^XQOR("FH EVSEND OR",.MSG) K MSG
46 ..I $D(^FHPT(FHDFN,"OP",FHRM,3)) S FHORN=$P(^FHPT(FHDFN,"OP",FHRM,3),U,4) I FHCNORS'[FHORN S FHCNORS=FHCNORS_"^"_FHORN D MSHSS^FHOMUTL,MSG^XQOR("FH EVSEND OR",.MSG) K MSG
47 .Q
48 I $E(FILL,1)="S" S FHSEND=$P($P(FILL,";",2),"^",1) I FHTDAT>FHSEND S FHSTTS="ZE" D MSHSS^FHOMUTL,MSG^XQOR("FH EVSEND OR",.MSG) K MSG D
49 .I $D(^FHPT(FHDFN,"SM",FHSEND,1)) S FHORN=$P(^FHPT(FHDFN,"SM",FHSEND,1),U,4) D MSHSS^FHOMUTL,MSG^XQOR("FH EVSEND OR",.MSG)
50 .Q
51 K ACT,FILL,FHORN,MSG S FHORN=FHORNTMP Q
52RESUME(DFN) ; Check whether to prompt resume tray
53 ; Return Null for No Current Diet Order in file
54 ; Return 0 for not to prompt the user
55 ; Return 1 to prompt the user
56 ; Return 2 to prompt the user and notify that it's a WITHHOLD SERVICE
57 N ADM,A1,A2,D1,D2,FHLD,FHOR,FHORD,K1,TIM,WARD,X,X1,X2,Y
58 S Y=0 S WARD=$G(^DPT(DFN,.1)) G:WARD="" EXIT
59 S ADM=$G(^DPT("CN",WARD,DFN)) G:ADM<1 EXIT
60 ; Get Diet
61 S FHZ115="P"_DFN D CHECK^FHOMDPA I FHDFN="" Q
62 S X1=^FHPT(FHDFN,"A",ADM,0),FHORD=$P(X1,"^",2),X1=$P(X1,"^",3),(FHLD,FHOR,X)="",Y=""
63 G:'FHORD EXIT G:'$D(^FHPT(FHDFN,"A",ADM,"DI",FHORD,0)) EXIT
64 ; Set FHOR & FHLD variables
65 S X=^FHPT(FHDFN,"A",ADM,"DI",FHORD,0),FHOR=$P(X,"^",2,6),FHLD=$P(X,"^",7),Y=0
66 G:"^^^^"'[FHOR EXIT
67 G:FHLD="" EXIT
68 D NOW^%DTC S TIM=%
69 S (D1,FHORD)=0 F K1=0:0 S K1=$O(^FHPT(FHDFN,"A",ADM,"AC",K1)) Q:K1<1!(K1>TIM) S D1=K1
70 G:'D1 EXIT
71S0 ; Set AC cross-ref data field
72 S X2=D1,D2=$O(^FHPT(FHDFN,"A",ADM,"AC",D1)) S:D2<1 D2=""
73S1 S A2=0 F A1=0:0 S A1=$O(^FHPT(FHDFN,"A",ADM,"AC",A1)) Q:A1<1!(A1'<X2) S A2=A1
74 I A2 S X2=A2,A2=$P(^FHPT(FHDFN,"A",ADM,"AC",A2,0),"^",2),X1=$P(^FHPT(FHDFN,"A",ADM,"DI",A2,0),"^",10) I X1'="",X1'>D1 G S1
75 G:'A2 EXIT
76 S X=$G(^FHPT(FHDFN,"A",ADM,"DI",A2,0)),FHOR=$P(X,"^",2,6),FHLD=$P(X,"^",7)
77 I "^^^^"'[FHOR S Y=1 G EXIT
78 I FHLD="N" S Y=2 G EXIT
79EXIT Q Y
80KIL D KIL^FHWOR K FHORN1,FHSTS Q
Note: See TracBrowser for help on using the repository browser.