source: FOIAVistA/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSJCOM1.m@ 1713

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

initial load of FOIAVistA 6/30/08 version

File size: 7.1 KB
Line 
1PSJCOM1 ;BIR/CML3-DISPLAY COMPLEX ORDERS FOR DISCONTINUE ;02 Feb 2001 12:20 PM
2 ;;5.0; INPATIENT MEDICATIONS ;**110,127**;16 DEC 97
3 ;
4 ; Reference to ^VALM1 is supported by DBIA 10116.
5 ; Reference to ^PS(55 is supported by DBIA 2191.
6 ; Reference to ^%DTC is supported by DBIA 10000.
7 ; Reference to ^PS(51.2 is supported by DBIA 2178.
8 ; Reference to ^DIE is supported by DBIA 10018.
9 ; Reference to ^DIR is supported by DBIA 10026.
10 ;
11CMPLX(PSGP,ON,PSGORD) ;
12 D PAUSE K PSJCM
13 N PSJLINE,PSX,PSCM
14 S PSJLINE=1
15 I PSGORD["P" N PSJO S PSJO=0 F S PSJO=$O(^PS(53.1,"ACX",ON,PSJO)) Q:'PSJO D
16 .Q:PSJO=+PSGORD S PSJOO=PSGORD D DSPLORDU(PSGP,PSJO_"P") S PSJCM(PSJO_"P",PSJLINE)="",PSJLINE=PSJLINE+1
17 I PSGORD'["P" N PSJO,PSJOO S PSJOO="",PSJO=0 F S PSJO=$O(^PS(55,"ACX",ON,PSJO)) Q:'PSJO F S PSJOO=$O(^PS(55,"ACX",ON,PSJO,PSJOO)) Q:PSJOO="" D
18 .Q:PSJOO=PSGORD D:PSJOO["U" DSPLORDU(PSGP,PSJOO) D:PSJOO["V" DSPLORDV(PSGP,PSJOO) S PSJCM(PSJOO,PSJLINE)="",PSJLINE=PSJLINE+1
19 N ON S ON="" F S ON=$O(PSJCM(ON)) Q:ON="" D
20 .W ! F PSX=0:0 S PSX=$O(PSJCM(ON,PSX)) Q:'PSX D
21 ..W !,PSJCM(ON,PSX) D:'(PSX#6) PAUSE
22 W !
23 Q
24 ;
25CMPLX2(PSGP,ON,PSGORD) ;
26 Q:$G(PSGORD)'["U"
27 N PSJLINE S PSJLINE=0
28 D FULL^VALM1
29 D DSPLORDU(PSGP,PSGORD)
30 W ! S PSJLINE="" F S PSJLINE=$O(PSJCM(PSGORD,PSJLINE)) Q:PSJLINE="" W !,PSJCM(PSGORD,PSJLINE) D:'((PSJLINE+1)#6) PAUSE
31 D EN^PSGPEN(PSGORD)
32 W !
33 Q
34 ;
35UPDATE ; Refresh array, actions, & display.
36 D GETUD^PSJLMGUD(DFN,ON),INIT^PSJLMUDE(DFN,ON) S VALMBCK="R"
37 Q
38HOLDHDR ; Freeze header text while processing order actions
39 I $D(VALM("TM")) S IOTM=VALM("TM"),IOBM=IOSL W IOSC W @IOSTBM W IORC
40 Q
41 ;
42DSPLORDU(PSGP,ON) ; Display UD order for order check as in the Inpat Profile.
43 NEW DRUGNAME,F,NODE0,NODE2,PSJID,PSJX,SCH,SD,STAT,X,Y K PSJCM
44 S F=$S(ON["U":"^PS(55,PSGP,5,"_+ON_",",1:"^PS(53.1,"_+ON_",")
45 S NODE0=$G(@(F_"0)")),NODE2=$G(@(F_"2)"))
46 D DRGDISP^PSJLMUT1(PSGP,ON,39,54,.DRUGNAME,0)
47 I ON["P",$P(NODE0,U,4)="F" D DSPLORDV(PSGP,ON) Q
48 S SCH=$P(NODE0,U,7)
49 S STAT=$P(NODE0,U,9)
50 D NOW^%DTC I "A"[STAT I $P(NODE2,U,4)<% D EXPIRE S STAT="E"
51 I STAT="A",$P(NODE0,U,27)="R" S STAT="R"
52 I STAT'="P" S PSJID=$E($$ENDTC^PSGMI($P(NODE2,U,2)),1,5),SD=$E($$ENDTC^PSGMI($P(NODE2,U,4)),1,5)
53 I STAT="P" S (PSJID,SD)="*****",SCH="?"
54 F PSJX=0:0 S PSJX=$O(DRUGNAME(PSJX)) Q:'PSJX D
55 . S:PSJX=1 X=SCH_" "_PSJID_" "_SD_" "_$E(STAT,1)
56 . S:PSJX=1 DRUGNAME(1)=$$SETSTR^VALM1(X,$E(DRUGNAME(1),1,40),42,20)
57 . S PSJCM(ON,PSJLINE)=" "_DRUGNAME(PSJX)
58 . S PSJLINE=PSJLINE+1
59 Q
60DSPLORDV(DFN,ON) ; Display IV order for order check as in the Inpat Profile.
61 N DRG,DRGI,DRGT,DRGX,FIL,ND,ON55,P,PSJIVFLG,PSJORIFN,TYP,X,Y
62 S TYP="?" I ON["V" D
63 .S Y=$G(^PS(55,DFN,"IV",+ON,0)) F X=2,3,4,5,8,9,17,23 S P(X)=$P(Y,U,X)
64 .D NOW^%DTC I "A"[P(17) I P(3)<% D EXPIRE S P(17)="E"
65 .S TYP=$$ONE^PSJBCMA(DFN,ON,P(9),P(2),P(3)) I TYP'="O" S TYP="C"
66 .S ON55=ON,P("OT")=$S(P(4)="A":"F",P(4)="H":"H",1:"I") D GTDRG^PSIVORFB,GTOT^PSIVUTL(P(4))
67 S PSJCT=0,PSJL=""
68 I ON'["V" S (P(2),P(3))="",P(17)=$P($G(^PS(53.1,+ON,0)),U,9),Y=$G(^(8)),P(4)=$P(Y,U),P(8)=$P(Y,U,5),P(9)=$P($G(^(2)),U) D GTDRG^PSIVORFA,GTOT^PSIVUTL(P(4))
69 S PSJIVFLG=1 D PIVAD,SOL
70 Q
71SOL ;
72 S PSJL=$S($G(PSJIVFLG):PSJL,1:"")_" in"
73 S DRG=0 F S DRG=+$O(DRG("SOL",DRG)) Q:'DRG D NAME^PSIVUTL(DRG("SOL",DRG),39,.NAME,0) S DRGX=0 F S DRGX=$O(NAME(DRGX)) Q:'DRGX S PSJL=$$SETSTR^VALM1(NAME(DRGX),PSJL,12,60) D:$G(PSJIVFLG) PIV1 D SETTMP S PSJL=" "
74 Q
75PIVAD ; Print IV Additives.
76 F DRG=0:0 S DRG=$O(DRG("AD",DRG)) Q:'DRG D NAME^PSIVUTL(DRG("AD",DRG),39,.NAME,1) F DRGX=0:0 S DRGX=$O(NAME(DRGX)) Q:'DRGX S PSJL=$$SETSTR^VALM1(NAME(DRGX),PSJL,9,60) D:$G(PSJIVFLG) PIV1 D SETTMP
77 Q
78 ;
79PIV1 ; Print Sched type, start/stop dates, and status.
80 K PSJIVFLG
81 F X=2,3 S P(X)=$E($$ENDTC^PSGMI(P(X)),1,$S($D(PSJEXTP):8,1:5))
82 I '$D(PSJEXTP) S PSJL=$$SETSTR^VALM1(TYP,PSJL,50,1),PSJL=$$SETSTR^VALM1(P(2),PSJL,53,7),PSJL=$$SETSTR^VALM1(P(3),PSJL,60,7),PSJL=$$SETSTR^VALM1(P(17),PSJL,67,1)
83 E S PSJL=$$SETSTR^VALM1(TYP,PSJL,50,1),PSJL=$$SETSTR^VALM1(P(2),53,7),PSJL=$$SETSTR^VALM1(P(3),PSJL,63,7),PSJL=$$SETSTR^VALM1(P(17),PSJL,73,1)
84 Q
85SETTMP ;
86 S PSJCM(ON,PSJLINE)=PSJL,PSJLINE=PSJLINE+1
87 Q
88PAUSE ;
89 K DIR W ! S DIR(0)="EA",DIR("A")="Press Return to continue..." D ^DIR W !
90 Q
91NEW ;
92 Q:'PSJCOM
93 Q:PSGORD'["P"
94 M ^TMP("PSJCOM",$J,+PSGORD)=^PS(53.1,+PSGORD)
95 S PSGS0Y=PSGAT,PSGNESD=PSGSD,PSGNEFD=PSGFD,PSGOEPR=PSGPR,PSGPDRG=PSGPD,PSGPDRGN=PSGPDN,PSGOEE="E"
96 S $P(^TMP("PSJCOM",$J,+PSGORD,0),"^",27)="E",$P(^(0),"^",9)="DE"
97 W:'$D(PSGOEE)&'$D(PSGOES) !!,"...transcribing this ",$S($D(PSGOES):"",'PSGOEAV:"non-verified ",1:"active "),"order..." S PSGOETOF=1 S:PSGSM="" PSGSM=0
98 ;I PSGPR'=PSGOEPR D:'$D(^PS(55,PSGP,0)) ENSET0^PSGNE3(PSGP) S $P(^PS(55,PSGP,5.1),U,2)=PSGPR,PSGOEPR=PSGPR
99 K ND4,DA D NOW^%DTC S PSGDT=+$E(%,1,12),DA=+PSGORD
100 S PSJOWALL=+$G(^PS(55,PSGP,5.1))
101 I $D(^PS(51.2,+PSGMR,0)),$P(^(0),U,3)]"" S PSGMRN=$P(^(0),U,3)
102 I PSGS0XT="D",'PSGS0Y S PSGS0Y=$E(PSGNESD_"00011",9,12)
103 S ND=DA_U_PSGPR_U_PSGMR_"^U^"_PSGSM_U_PSGHSM_U_PSGST_"^^"_$S(PSGOEAV:"A",1:"N")_"^^^^^"_PSGDT_U_PSGP_U_PSGDT S:PSGNEDFD $P(ND,U,$P(PSGNEDFD,U)["L"+10)=+PSGNEDFD
104 S:$D(PSGOEE) $P(ND,U,24,25)=PSGOEE_U_PSGORD S:'PSGOEAV $P(ND,U,18)=DA S ND2=PSGSCH_U_$S(+PSGNESD=PSGNESD:+PSGNESD,1:"")_"^^"_+PSGNEFD_U_PSGS0Y_U_PSGS0XT_"^^^^"_+PSJPWD
105 ;I PSGOEAV S F=^PS(55,PSGP,0) I $P(F,"^",7)="" S $P(F,"^",7)=$P($P(ND,"^",16),"."),$P(F,"^",8)="A",^(0)=F
106 S $P(ND4,U,7)=DUZ I PSGOEAV,PSJSYSU D
107 .S $P(ND4,U,PSJSYSU,PSJSYSU+1)=DUZ_U_PSGDT,$P(ND4,U,+PSJSYSU=1+9)=1,$P(ND4,U,+PSJSYSU=3+9)=0
108 .S $P(ND4,U,9,10)=+$P(ND4,U,9)_U_+$P(ND4,U,10)
109 S F="^TMP(""PSJCOM2"","_$J_","_DA_",",@(F_"0)")=ND
110 ; Naked references below refers to full reference in F which is ^TMP("PSJCOM2",$J,DA,
111 S @(F_".2)")=PSGPDRG_U_PSGDO_U_PSJNOO S:$G(PSJDOSE("DO"))]"" $P(^(.2),U,5,6)=$P(PSJDOSE("DO"),U,1,2) S:PSJCOM]"" $P(^(.2),"^",8)=PSJCOM
112 I '$D(PSJDOSE("DO")),$D(PSGORD) S $P(@(F_".2)"),U,5,6)=$P(@("^PS("_$S(PSGORD["U":"55,"_PSGP_",5",1:53.1)_","_+PSGORD_",.2)"),U,5,6)
113 ; Naked references below refers to full reference in F which is ^TMP("PSJCOM2",$J,DA,
114 S @(F_"2)")=$P(ND2,"^",1,6),^(4)=ND4 S:PSGSI]"" ^(6)=PSGSI
115 ; Naked references below refers to full reference in F which is ^TMP("PSJCOM2",$J,DA,
116 S (C,X)=0 F S X=$O(^PS(53.45,PSJSYSP,2,X)) Q:'X S D=$G(^(X,0)) I D,$S('$P(D,U,3):1,1:$P(D,U,3)>DT) S C=C+1,@(F_"1,"_C_",0)")=$P(D,U,1,2),@(F_"1,""B"","_+D_","_C_")")=""
117 S:C @(F_"1,0)")=U_$S(PSGOEAV:55.07,1:53.11)_"P^"_C_U_C
118 ; Naked references below refers to full reference in F which is ^TMP("PSJCOM2",$J,DA,
119 S (C,Q)=0 F S Q=$O(^PS(53.45,PSJSYSP,1,Q)) Q:'Q S X=$G(^(Q,0)) S:X]"" C=C+1,@(F_"3,"_C_",0)")=X
120 S:C @(F_"3,0)")=U_$S(PSGOEAV:55.08,1:53.12)_U_C_U_C
121 S:C @(F_"12,0)")=U_$S(PSGOEAV:55.0612,1:53.1012)_U_C_U_C
122 W "."
123OUT ;
124 K PSGOETOF
125DONE ;
126 K C,D,ND,ND2,ND4,PSGDO,PSGDRG,PSGDRGN,PSGFOK,PSGHSM,PSGMR,PSGMRN,PSGNEDFD,PSGNEFD,PSGNESD,PSGPDRG,PSGPDRGN,PSGSI,PSGSTN,PSJDOSE
127 Q
128EXPIRE ;Change status of order to expired and send notice to OE/RR
129 N DA,DIE,DR,PSGPO,PSIVACT
130 Q:'$G(PSJOO)!($G(PSJOO)["P")
131 S STATUS="E",(PSGPO,PSIVACT)=1,DA=+PSJOO,DA(1)=PSGP,DIE=$S(PSJOO["V":"^PS(55,"_PSGP_",""IV"",",1:"^PS(55,"_PSGP_",5,"),DR=$S(PSJOO["V":"100////E",1:"28////E") D ^DIE
132 D EN1^PSJHL2(PSGP,"SC",PSJOO)
133 Q
Note: See TracBrowser for help on using the repository browser.