source: WorldVistAEHR/trunk/r/PHARMACY_DATA_MANAGEMENT-PSS/PSSQOC.m@ 1306

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

revised back to 6/30/08 version

File size: 2.7 KB
Line 
1PSSQOC ;BIR/MLM-CONVERT PSJ 4.5 QUICK ORDERS FOR USE IN OE/RR 3.0 ;09/09/97
2 ;;1.0;PHARMACY DATA MANAGEMENT;*100*;9/30/97
3 ;External reference to ^ORD(101 supported by DBIA 872
4 ;External reference to ^PS(57.1 supported by DBIA 2139
5 ;
6EN(PROTIEN) ;
7 N DD,OI,ND0,ND1,PSJBAD,TVOLUME,X S (PSJBAD,TVOLUME)=0 K ^TMP("PSJQO",$J)
8 S PSJQOPTR=+$E($P($P($G(^ORD(101,+PROTIEN,0)),U)," "),5,99)
9 S ND0=$G(^PS(57.1,PSJQOPTR,0)),ND1=$G(^(1)) I ND0=""!(ND1="") Q
10 I $P(ND0,U,3)'=1,$P(ND0,U,3)'=2 Q
11 D @$P(ND0,U,3) Q:'OI
12 S ^TMP("PSJQO",$J,1)=$P(ND0,U)_U_$P(ND0,U,3)_U_OI_U_$P(ND1,U,2,6)
13 S:$G(DD) ^TMP("PSJQO",$J,"DD")=DD
14 D GTPC
15 ; check infusion rate
16 S X=$P(ND1,"^",5) I $G(X) D
17 .D ENI K FREQ I '$D(X) S PSJBAD=1
18 .E S $P(^TMP("PSJQO",$J,1),"^",7)=X
19 K:PSJBAD=1 ^TMP("PSJQO",$J)
20 Q
21 ;
221 ; Convert IV Fluid Quick Order
23 S CNT=0 F X=0:0 S X=$O(^PS(57.1,PSJQOPTR,3,X)) Q:'X D
24 .S Y=$G(^PS(52.6,+$G(^PS(57.1,PSJQOPTR,3,X,0)),0)),OI=$P(Y,U,11)
25 .S UNITS=$P("ML^LITER^MCG^MG^GM^UNITS^IU^MEQ^MM^MU^THOUU^MG-PE^NANOGRAM",U,+$P(Y,U,3))
26 .I OI]"" S CNT=CNT+1
27 .I S ^TMP("PSJQO",$J,"AD",CNT,0)=OI_U_+$P($G(^PS(57.1,PSJQOPTR,3,X,0)),"^",2)_U_UNITS
28 I CNT S ^TMP("PSJQO",$J,"AD",0)=CNT_U_CNT
29 S CNT=0 F X=0:0 S X=$O(^PS(57.1,PSJQOPTR,4,X)) Q:'X D
30 .S Y=$G(^PS(52.7,+$G(^PS(57.1,PSJQOPTR,4,X,0)),0)),OI=$P(Y,U,11)
31 .N VOL S VOL=$P($G(^PS(57.1,PSJQOPTR,4,X,0)),"^",2)
32 .S TVOLUME=TVOLUME++VOL
33 .I (VOL'=+VOL)&(VOL'?1.6N1" "1"ML") S PSJBAD=1
34 .I OI]"" S CNT=CNT+1
35 .I S ^TMP("PSJQO",$J,"SOL",CNT,0)=OI_U_VOL
36 I CNT S ^TMP("PSJQO",$J,"SOL",0)=CNT_U_CNT
37 Q
382 ;
39 S OI="",PD=+ND1
40 F DD=0:0 S DD=$O(^PSDRUG("AP",PD,DD)) Q:'DD I $G(^PSDRUG(DD,"I"))=""!($G(^PSDRUG(DD,"I"))>DT) S OI=+$G(^PSDRUG(DD,2))
41 I '$O(^PSDRUG("AP",PD,DD)) S ^TMP("PSJQO",$J,"DD")=DD Q
42 S MATCH=1 F S DD=$O(^PSDRUG("AP",PD,DD)) Q:'DD!'MATCH D
43 .I ($G(^PSDRUG(DD,"I"))=""!($G(^PSDRUG(DD,"I"))>DT))&(+$G(^PSDRUG(DD,2))'=OI) S MATCH=0 Q
44 S:'MATCH OI=""
45 Q
46 ;
47 ;
48GTPC ; Set up TMP for provider comments
49 I $O(^PS(57.1,+PSJQOPTR,2,0)) D
50 .S CNT=0 F X=0:0 S X=$O(^PS(57.1,+PSJQOPTR,2,X)) Q:'X D
51 ..S Y=$G(^PS(57.1,PSJQOPTR,2,X,0)) S:Y]"" CNT=CNT+1,^TMP("PSJQO",$J,"PC",CNT,0)=Y
52 .S:$O(^TMP("PSJQO",$J,"PC",0)) ^TMP("PSJQO",$J,"PC",0)=CNT_U_CNT
53 Q
54ENI ;Calculate Frequency for IV orders
55 K:$L(X)<1!($L(X)>30)!(X["""")!($A(X)=45) X I '$D(X) Q
56 I X'=+X,($P(X,"@",2,999)'=+$P(X,"@",2,999)!(+$P(X,"@",2,999)<0)),($P(X," ml/hr")'=+$P(X," ml/hr")!(+$P(X," ml/hr")<0)) K X Q
57 I X=+X S X=X_" ml/hr" D SPSOL S FREQ=$S('X:0,1:SPSOL\X*60+(SPSOL#X/X*60+.5)\1) K SPSOL Q
58 I X[" ml/hr" D SPSOL S FREQ=$S('X:0,1:SPSOL\X*60+(SPSOL#X/X*60+.5)\1) K SPSOL Q
59 S SPSOL=$P(X,"@",2) S:$P(X,"@")=+X $P(X,"@")=$P(X,"@")_" ml/hr" S FREQ=$S('SPSOL:0,1:1440/SPSOL\1) K SPSOL
60 Q
61SPSOL S SPSOL=+TVOLUME Q
Note: See TracBrowser for help on using the repository browser.