source: WorldVistAEHR/trunk/r/DIETETICS-FH/FHORR.m@ 1284

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

initial load of WorldVistAEHR

File size: 2.0 KB
Line 
1FHORR ; HISC/NCA/JH - Diet Order Utilities For OE/RR Interface ;10/10/00 14:54
2 ;;5.5;DIETETICS;;Jan 28, 2005
3OE ; File OE/RR Diet Order For Re-instated Diet Order
4 Q:$P(FHNO1,"^",7)="X"!($P(FHNO1,"^",7)="P")
5 S FHO=$P(FHNO1,"^",2,6),VAL="" D VAL^FHWORP(FHO,.VAL) Q:VAL=""
6 S FHNEW=$S($P(FHNO1,"^",7)'="":"N",1:"D")_";"_ADM_";"_FHORD1_";"_D2_";"_$P(FHNO1,"^",10)_";"_$P(FHNO1,"^",7)_";"_FHNO2_";"_$P(FHNO1,"^",8)_";"_0_";"_VAL
7 S (FHSTS,FHDU)=$S(D2>NOW:8,1:6) S FHDIE=FHORD
8 I $P(FHNO1,"^",7)="N" D NPO D:$D(MSG) MSG^XQOR("FH EVSEND OR",.MSG) K MSG S FHORD=FHDIE K FHDIE G SAV
9 I $P(FHNO1,"^",7)="" D DO D:$D(MSG) MSG^XQOR("FH EVSEND OR",.MSG) K MSG
10 S FHORD=FHDIE K FHDIE
11SAV S:FHDU $P(^FHPT(FHDFN,"A",ADM,"DI",FHORD1,0),"^",15)=FHDU Q
12DO ; Code Re-instated Diet Orders
13 K MSG S FILL=$G(FHNEW)
14 S SDT=D2,DATE1="" D SET
15 ; Code MSH, PID, and PV1
16 D MSH^FHWOR
17 ; code ORC
18 S MSG(4)="ORC|SN||"_FILL_"^FH||||^^^"_SDT_"^"_DATE1_"|||"_DUZ_"||"_FHPV_"|||"_DATE
19 ; Code ODS
20 F A7=5:1 S A8=$P(FHNO1,"^",A7-3) Q:'A8 D
21 .S MSG(A7)="ODS|ZT||^^^"_A8_"^"_$P($G(^FH(111,+A8,0)),"^",1)_"^99FHD" Q
22 K A7,A8,DATE,DATE1,FILL,FHWRD,HOSP,RM,SITE,SDT,VAL
23 Q
24NPO ; Code Re-instated NPO Order
25 K MSG S FILL=$G(FHNEW) Q:FILL=""
26 S SDT=D2,DATE1="" D SET
27 ; Code MSH, PID, and PV1
28 D MSH^FHWOR
29 ; code ORC
30 S MSG(4)="ORC|SN||"_FILL_"^FH||||^^^"_SDT_"^"_DATE1_"|||"_DUZ_"||"_FHPV_"|||"_DATE
31 ; Code ODS
32 S MSG(5)="ODS|D||^^^FH-5^NPO^99OTH|"_COM
33 K DATE,DATE1,FILL,FHWRD,HOSP,RM,SITE,SDT
34 Q
35SET ; Set Date/Time in HL7 format
36 S DATR=$S($P(FHNO1,"^",10):$P(FHNO1,"^",10),1:"")
37 S:SDT SDT=$$FMTHL7^XLFDT(SDT)
38 S:NOW DATE=$$FMTHL7^XLFDT(NOW)
39 S:DATR DATE1=$$FMTHL7^XLFDT(DATR) S:'DATE1 DATE1="" K DATR
40 Q
41ORD ; Get next order # for re-instate diet order
42 L +^FHPT(FHDFN,"A",ADM,"DI",0)
43 I '$D(^FHPT(FHDFN,"A",ADM,"DI",0)) S ^FHPT(FHDFN,"A",ADM,"DI",0)="^115.02A^^"
44 S X=^FHPT(FHDFN,"A",ADM,"DI",0),FHORD1=$P(X,"^",3)+1,^(0)=$P(X,"^",1,2)_"^"_FHORD1_"^"_($P(X,"^",4)+1)
45 L -^FHPT(FHDFN,"A",ADM,"DI",0) Q:'$D(^FHPT(FHDFN,"A",ADM,"DI",FHORD1)) G ORD
Note: See TracBrowser for help on using the repository browser.