1 | PSOSUPOE ;BIR/RTR - Suspense pull via Listman ;3/1/96
|
---|
2 | ;;7.0;OUTPATIENT PHARMACY;**8,21,27,34,130,148,281**;DEC 1997;Build 41
|
---|
3 | ;External references PSOL and PSOUL^PSSLOCK supported by DBIA 2789
|
---|
4 | SEL I '$G(PSOCNT) S VALMSG="This patient has no Prescriptions!" S VALMBCK="" Q
|
---|
5 | N PSOGETF,PSOGET,PSOGETFN,ORD,ORN,MW,PDUZ,PSLST,PSOSQ,PSOSQRTE,PSOSQMTH,PSPOP,PSOX1,PSOX2,RXLTOP,RXREC,SFN,SORD,SORN,VALMCNT
|
---|
6 | K DIR,DUOUT,DTOUT S DIR("A")="Select Orders by number",DIR(0)="LO^1:"_PSOCNT D ^DIR K DIR I $D(DTOUT)!($D(DUOUT))!('Y) S VALMSG="Nothing pulled from suspense!",VALMBCK="" Q
|
---|
7 | S PSLST=Y
|
---|
8 | SELQ D FULL^VALM1
|
---|
9 | K DIR S DIR("A")="Select routing for Rx(s)",DIR(0)="S^M:MAIL;W:WINDOW",DIR("B")="WINDOW" D ^DIR K DIR I Y["^"!($D(DTOUT))!($D(DUOUT)) G END
|
---|
10 | S PSOSQRTE=Y I $G(PSOSQRTE)="W",$P(PSOPAR,"^",12) K DIR S DIR(0)="FO^2:60",DIR("A")="METHOD OF PICK-UP" D ^DIR S PSOSQMTH=$G(Y) K DIR I Y["^"!($D(DTOUT))!($D(DUOUT)) G END
|
---|
11 | W ! K DIR S DIR(0)="Y",DIR("A")="Pull Rx(s) and delete from suspense",DIR("B")="YES" D D ^DIR K DIR I Y'=1 G END
|
---|
12 | .S DIR("?",1)="Enter Yes to pull selected Rx(s) from suspense. Since(Rx(s) pulled early from",DIR("?",2)="suspense are not associated with a printed batch, these Rx(s) cannot be"
|
---|
13 | .S DIR("?",3)="reprinted from suspense using the 'Reprint batches from suspense' option.",DIR("?")="Therefore, any Rx(s) pulled early from suspense will be deleted from suspense."
|
---|
14 | Q:$G(PULLONE)
|
---|
15 | F SORD=1:1:$L(PSLST,",") Q:$P(PSLST,",",SORD)']"" S SORN=$P(PSLST,",",SORD) D:+PSOLST(SORN)=52 BEG
|
---|
16 | S VALMBCK="R"
|
---|
17 | I '$G(PSOSQ) S VALMSG="No Rx's pulled from suspense!"
|
---|
18 | Q
|
---|
19 | BEG ;
|
---|
20 | S RXREC=$P(PSOLST(SORN),"^",2)
|
---|
21 | BEGQ Q:'$D(^PSRX(+$G(RXREC),0))
|
---|
22 | D PSOL^PSSLOCK(RXREC) I '$G(PSOMSG) W !!,$S($P($G(PSOMSG),"^",2)'="":$P($G(PSOMSG),"^",2),1:"Another person is editing Rx "_$P($G(^PSRX(RXREC,0)),"^")),! K PSOMSG D DIR Q
|
---|
23 | K PSOMSG I $P($G(^PSRX(RXREC,"STA")),"^")'=5 W !!,"Rx# ",$P(^PSRX(RXREC,0),"^")," is not on Suspense!" D DIR,ULRX Q
|
---|
24 | S SFN=$O(^PS(52.5,"B",RXREC,0)) I 'SFN D DIR,ULRX Q
|
---|
25 | S PDUZ=DUZ I +$G(^PS(52.5,SFN,"P")) W !,">>> Rx #",$P(^PSRX(+$P(^(0),"^"),0),"^")," ALREADY PRINTED FROM SUSPENSE.",!,?5,"USE THE REPRINT OPTION TO REPRINT LABEL." D DIR,ULRX Q
|
---|
26 | I +$P($G(^PSRX(RXREC,2)),"^",6)<DT,+$P($G(^("STA")),"^")<11 D S DIE=52,DA=RXREC,DR="100///11" D ^DIE S DA=SFN,DIK="^PS(52.5," D ^DIK K DIE,DA,DIK W !,"Rx # "_$P(^PSRX(RXREC,0),"^")_" has expired!" D DIR,ULRX Q
|
---|
27 | .N PSCOU,AAA,VVV,QQQ,PSOPRT,PSOEXPI D EX^PSOSUTL
|
---|
28 | I $D(RXRP(RXREC)) W !!,"A reprint has already been requested for Rx # ",$P($G(^PSRX(RXREC,0)),"^") D DIR,ULRX Q
|
---|
29 | I $D(RXPR(RXREC)) W !!,"A partial has already been requested for Rx # ",$P($G(^PSRX(RXREC,0)),"^") D DIR,ULRX Q
|
---|
30 | S PSPOP=0 I $G(PSODIV),$P($G(^PS(52.5,SFN,0)),"^",6)'=$G(PSOSITE) D CKDIV I $G(PSPOP) D DIR,ULRX Q
|
---|
31 | S:$P(^PS(52.5,SFN,0),"^",5) RXPR(RXREC)=$P(^(0),"^",5) S:$P(^PS(52.5,SFN,0),"^",12) RXRP(RXREC)=1
|
---|
32 | S RXFL(RXREC)=$P($G(^PS(52.5,SFN,0)),"^",13),RXRS(RXREC)=$G(PSODFN),RXLTOP=1
|
---|
33 | S RXRS(RXREC)=$G(RXRS(RXREC))_"^"_$S($P($G(^PS(52.5,SFN,0)),"^",4)="W":"W",1:"M")_"^"_$P($G(^PSRX(RXREC,"MP")),"^") S PSOGET="M" D GETMW
|
---|
34 | S RXRS(RXREC)=$G(RXRS(RXREC))_"^"_$G(PSOGETF)_"^"_$G(PSOGETFN)_"^"_$S($G(PSOGET)="W":"W",1:"M")
|
---|
35 | S $P(^PS(52.5,SFN,0),"^",4)=$G(PSOSQRTE) S MW=$G(PSOSQRTE) N RR,RFCNT D MAILS^PSOSUPAT I $D(PSOSQMTH) S $P(^PSRX(RXREC,"MP"),"^")=$G(PSOSQMTH)
|
---|
36 | S PSOSQ=1
|
---|
37 | ;
|
---|
38 | ; - Submitting Rx to ECME for 3rd Party Billing
|
---|
39 | I '$D(RXPR(RXREC)) D
|
---|
40 | . N ACTION,RFL S RFL=$G(RXFL(RXREC)) I RFL="" S RFL=$$LSTRFL^PSOBPSU1(RXREC)
|
---|
41 | . D ECMESND^PSOBPSU1(RXREC,RFL,,"PP")
|
---|
42 | . I $$FIND^PSOREJUT(RXREC,RFL) D
|
---|
43 | . . S ACTION=$$HDLG^PSOREJU1(RXREC,RFL,"79,88","PP","IOQ","Q")
|
---|
44 | ;
|
---|
45 | D ULRX K PSOGET,PSOGETF
|
---|
46 | Q
|
---|
47 | WIND ;
|
---|
48 | N RRT,RRTT,XXXX,JJJJ,PSINTRX,RTETEST,PSOPSO,SSSS
|
---|
49 | S PBINGRTE=0,PSINTRX=RXREC
|
---|
50 | I $G(RXPR(RXREC)) S RTETEST=$P($G(^PSRX(RXREC,"P",RXPR(PSINTRX),0)),"^",2) S:RTETEST="W" PBINGRTE=1 Q
|
---|
51 | S PSOPSO=0 F SSSS=0:0 S SSSS=$O(^PSRX(PSINTRX,1,SSSS)) Q:'SSSS S PSOPSO=SSSS
|
---|
52 | I 'PSOPSO S RTETEST=$P($G(^PSRX(PSINTRX,0)),"^",11) S:RTETEST="W" PBINGRTE=1 Q
|
---|
53 | I PSOPSO S RTETEST=$P($G(^PSRX(PSINTRX,1,PSOPSO,0)),"^",2) S:RTETEST="W" PBINGRTE=1 Q
|
---|
54 | Q
|
---|
55 | DIR ;
|
---|
56 | W ! K DIR S DIR(0)="E",DIR("A")="Press Return to Continue" D ^DIR K DIR Q
|
---|
57 | END S VALMSG="Nothing pulled from suspense!",VALMBCK="R" S:$G(PULLONE)=1 PULLONE=2 Q
|
---|
58 | ADD ;Add Rx to SPSORX array
|
---|
59 | I $G(SPSORX("PSOL",1))']"" S SPSORX("PSOL",1)=RXREC_"," Q
|
---|
60 | F PSOX1=0:0 S PSOX1=$O(SPSORX("PSOL",PSOX1)) Q:'PSOX1 S PSOX2=PSOX1
|
---|
61 | I $L(SPSORX("PSOL",PSOX2))+$L(RXREC)<220 S SPSORX("PSOL",PSOX2)=SPSORX("PSOL",PSOX2)_RXREC_"," Q
|
---|
62 | S SPSORX("PSOL",PSOX2+1)=RXREC_","
|
---|
63 | Q
|
---|
64 | BBADD ;
|
---|
65 | N PSOX1,PSOX2
|
---|
66 | I $G(BBRX(1))']"" S BBRX(1)=RXREC_"," Q
|
---|
67 | F PSOX1=0:0 S PSOX1=$O(BBRX(PSOX1)) Q:'PSOX1 S PSOX2=PSOX1
|
---|
68 | I $L(BBRX(PSOX2))+$L(RXREC)<220 S BBRX(PSOX2)=BBRX(PSOX2)_RXREC_"," Q
|
---|
69 | S BBRX(PSOX2+1)=RXREC_","
|
---|
70 | Q
|
---|
71 | PPLADD ;
|
---|
72 | N SZZ,SPSOX1,SPSOX2,LSFN
|
---|
73 | I $G(PPL)'="",$E(PPL,$L(PPL))'="," S PPL=PPL_","
|
---|
74 | F SZZ=0:0 S SZZ=$O(RXRS(SZZ)) Q:'SZZ D
|
---|
75 | .S LSFN=$O(^PS(52.5,"B",SZZ,0))
|
---|
76 | .Q:'$G(LSFN)
|
---|
77 | .Q:$G(^PS(52.5,LSFN,"P"))
|
---|
78 | .I $G(PPL)="" S PPL=SZZ_"," Q
|
---|
79 | .I $L(PPL)+$L(SZZ)<220 S PPL=PPL_SZZ_"," Q
|
---|
80 | .I $G(PSORX("PSOL",2))']"" S PSORX("PSOL",2)=SZZ_"," Q
|
---|
81 | .F SPSOX1=1:0 S SPSOX1=$O(PSORX("PSOL",SPSOX1)) Q:'SPSOX1 S SPSOX2=SPSOX1
|
---|
82 | .I $L(PSORX("PSOL",SPSOX2))+$L(SZZ)<220 S PSORX("PSOL",SPSOX2)=PSORX("PSOL",SPSOX2)_SZZ_"," Q
|
---|
83 | .S PSORX("PSOL",SPSOX2+1)=SZZ_","
|
---|
84 | Q
|
---|
85 | CKDIV ;
|
---|
86 | I '$P($G(PSOSYS),"^",2) W !!?10,"Rx # ",$P(^PSRX(RXREC,0),"^")," is not a valid choice (Different Division)" S PSPOP=1 Q
|
---|
87 | I $P($G(PSOSYS),"^",3) W !!?10 K DIR S DIR("A")="Rx # "_$P(^PSRX(RXREC,0),"^")_" is from another division. OK to Pull",DIR(0)="Y",DIR("B")="YES" D ^DIR K DIR I $G(DIRUT)!('Y) S PSPOP=1
|
---|
88 | Q
|
---|
89 | SELONE ;Pull one Rx through Listman
|
---|
90 | I $G(PSOBEDT) W $C(7),$C(7) S VALMSG="Invalid Action at this time !",VALMBCK="" Q
|
---|
91 | N ORD,MW,PDUZ,PSLST,PSOSQ,PSOSQRTE,PSOSQMTH,PSPOP,PSOX1,PSOX2,PULLONE,RXLTOP,RXREC,SFN,SORD,SORN,VALMCNT
|
---|
92 | S PULLONE=1
|
---|
93 | I +PSOLST(ORN)'=52 S VALMBCK="" Q
|
---|
94 | I +PSOLST(ORN)=52,$P($G(^PSRX($P(PSOLST(ORN),"^",2),"STA")),"^")'=5 S VALMSG="Rx is not on Suspense!",VALMBCK="" Q
|
---|
95 | I +PSOLST(ORN)=52,$D(RXRS($P(PSOLST(ORN),"^",2))) S VALMSG="Pull early has already been requested!",VALMBCK="" Q
|
---|
96 | D SELQ I $G(PULLONE)=2 S VALMSG="Rx# "_$P($G(^PSRX($P(PSOLST(ORN),"^",2),0)),"^")_" not pulled from suspense!" Q
|
---|
97 | I +PSOLST(ORN)=52 S RXREC=$P(PSOLST(ORN),"^",2) D BEGQ S VALMSG="Rx# "_$P($G(^PSRX(+$G(RXREC),0)),"^")_$S($G(PSOSQ):" pulled",1:" not pulled")_" from Suspense!"
|
---|
98 | S VALMBCK="R"
|
---|
99 | Q
|
---|
100 | RESET ;
|
---|
101 | N RSDA,RXMW,RXMP,RXSP,RXR,DA,RXPSRX,RXFILL,RXFILLN
|
---|
102 | F RSDA=0:0 S RSDA=$O(RXRS(RSDA)) Q:'RSDA D
|
---|
103 | .S RXSP=$O(^PS(52.5,"B",RSDA,0)) Q:'RXSP
|
---|
104 | .Q:'$D(^PS(52.5,RXSP,0))
|
---|
105 | .S RXMW=$S($P($G(RXRS(RSDA)),"^",2)="":"M",1:$P($G(RXRS(RSDA)),"^",2)),RXMP=$P($G(RXRS(RSDA)),"^",3),RXFILL=$P($G(RXRS(RSDA)),"^",4),RXFILLN=$P($G(RXRS(RSDA)),"^",5),RXPSRX=$S($P($G(RXRS(RSDA)),"^",6)="":"M",1:$P($G(RXRS(RSDA)),"^",6))
|
---|
106 | .I RXMW'="" S $P(^PS(52.5,RXSP,0),"^",4)=RXMW D
|
---|
107 | ..I RXFILL="P" D Q
|
---|
108 | ...I $D(^PSRX(RSDA,"P",+$G(RXFILLN),0)) S $P(^PSRX(RSDA,"P",+$G(RXFILLN),0),"^",2)=$G(RXPSRX),$P(^PSRX(RSDA,"MP"),"^")=RXMP
|
---|
109 | ..I RXFILL="R",$G(RXFILLN) S DA(1)=RSDA,DA=RXFILLN,DIE="^PSRX("_DA(1)_",1,",DR="2////"_RXPSRX D ^DIE K DIE
|
---|
110 | ..I RXFILL="O" S DA=RSDA,DIE="^PSRX(",DR="11////"_RXPSRX D ^DIE K DIE
|
---|
111 | ..S $P(^PSRX(RSDA,"MP"),"^")=RXMP
|
---|
112 | Q
|
---|
113 | GETMW ;
|
---|
114 | N GETPAR,GETRX,GETCNT
|
---|
115 | S PSOGETF="O",PSOGETFN=""
|
---|
116 | S GETPAR=$P($G(^PS(52.5,SFN,0)),"^",5)
|
---|
117 | I GETPAR S PSOGET=$P($G(^PSRX(RXREC,"P",GETPAR,0)),"^",2),PSOGETF="P",PSOGETFN=GETPAR Q
|
---|
118 | I '$O(^PSRX(RXREC,1,0)) S PSOGET=$P($G(^PSRX(RXREC,0)),"^",11) Q
|
---|
119 | S GETRX=0 F GETCNT=0:0 S GETCNT=$O(^PSRX(RXREC,1,GETCNT)) Q:'GETCNT S GETRX=GETCNT
|
---|
120 | S PSOGET=$P($G(^PSRX(RXREC,1,+$G(GETRX),0)),"^",2),PSOGETF="R",PSOGETFN=+$G(GETRX)
|
---|
121 | Q
|
---|
122 | ULRX ;
|
---|
123 | I '$G(RXREC) Q
|
---|
124 | D PSOUL^PSSLOCK(RXREC)
|
---|
125 | Q
|
---|