source: FOIAVistA/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSORDS.m@ 677

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

initial load of FOIAVistA 6/30/08 version

File size: 2.6 KB
Line 
1PSORDS ;BHAM ISC/LC - BUILD RDS MESSAGE ; 02/22/95
2 ;;7.0;OUTPATIENT PHARMACY;**11**;DEC 1997
3 ;
4 ;^UTILITY($J,"PSOPCE",COUNTER)= 6 pieces, which are:
5 ; Piece one -> Internal Rx number
6 ; Piece two -> Quantity
7 ; Piece three -> File 50 pointer
8 ; Piece four -> 1 for Release 0 for Return to stock
9 ; Piece five -> 0 for original, 1 for refill, 2 for partial
10 ; Piece six -> Date/Time or Date
11 ;
12MSG ;
13 F PSOAAA=0:0 S PSOAAA=$O(^UTILITY($J,"PSOPCE",PSOAAA)) Q:'PSOAAA S PCENODE=^(PSOAAA) D SEND
14 G END
15SEND ;
16 K MSG S RXP=+$P(PCENODE,"^"),RXDRUG=+$P(PCENODE,"^",3),PSORE=$P(PCENODE,"^",4),PSOFILL=$P(PCENODE,"^",5),PSODTIME=$P(PCENODE,"^",6)
17 Q:'$D(^PSRX(RXP,0))!('RXP)
18 S PSORXEXT=$P($G(^PSRX(RXP,0)),"^"),PSFLAG=0,PSORINST=$P($G(^DIC(4,+$P($G(^XMB(1,1,"XUS")),"^",17),99)),"^"),NULLFLDS="F JJ=0:1:LIMIT S FIELD(JJ)="""""
19 S LIMIT=15 X NULLFLDS K X
20 S X=PSODTIME S:'X X=DT S FIELD(3)=$$HLDATE^HLFNC(X)
21 S PSND1=$P($G(^PSDRUG(RXDRUG,"ND")),"^"),PSND2=$P($G(^("ND")),"^",2),PSND3=$P($G(^("ND")),"^",3) I PSND1,PSND3 S PSFLAG=1
22 S FIELD(2)=$S(PSFLAG:PSND1_"."_PSND3_"^"_PSND2_"^"_"99NDF",1:"^^")_"^"_RXDRUG_"^"_$P($G(^PSDRUG(RXDRUG,0)),"^")_"^"_"99PSD"
23 S FIELD(4)=$P(PCENODE,"^",2)
24 S FIELD(7)=$P(^PSRX(RXP,0),"^")
25 S FIELD(9)=$S(PSORE=0&(PSOFILL=2):"PARTIAL RETURN TO STOCK",PSORE=0:"RETURN TO STOCK",PSOFILL=2:"PARTIAL RELEASE",1:"RELEASE")
26 S POIPTR=+$P($G(^PSRX(RXP,"OR1")),"^") I POIPTR S PODOSE=+$P($G(^PS(50.7,POIPTR,0)),"^",2),PODOSENM=$P($G(^PS(50.606,PODOSE,0)),"^")
27 S FIELD(6)=$S(POIPTR:"^^^"_$G(PODOSE)_"^"_$G(PODOSENM)_"^"_"99PSF",1:"")
28 S MSG(1)="MSH|^~\&|PHARMACY|"_PSORINST_"|||||RDS"
29 S MSG(2)="PID|||"_$P(^PSRX(RXP,0),"^",2)_"||"_$P($G(^DPT(+$P($G(^(0)),"^",2),0)),"^")
30 S MSG(3)="ORC|OR||"_$G(RXP)
31 K FSIG,BSIG I $P($G(^PSRX(RXP,"SIG")),"^",2) D FSIG^PSOUTLA("R",RXP,245) F PSREV=1:1 Q:'$D(FSIG(PSREV)) S BSIG(PSREV)=FSIG(PSREV)
32 K FSIG,PSREV I '$P($G(^PSRX(RXP,"SIG")),"^",2) D EN3^PSOUTLA1(RXP,245)
33 S FIELD(15)=$G(BSIG(1))
34 S FIELD(0)="RXD",COUNT=3 D SEGPAR^PSOHLSN K COUNT,PVAR,PLIM,PVAR1,FIELD,SUBCOUNT,SEG1
35 K LSIG I $O(BSIG(1)) D
36 .S LASTSIG=$O(BSIG(1)) S LSIG=$G(BSIG(LASTSIG))
37 I $G(LSIG)'="",$O(MSG(4,0)) D
38 .N LAST S LAST=0 F ZZZ=0:0 S ZZZ=$O(MSG(4,ZZZ)) Q:'ZZZ S LAST=ZZZ
39 .S LTH=$L(MSG(4,LAST)) S LTH=245-LTH
40 .I LTH S MSG(4,LAST)=MSG(4,LAST)_$E(LSIG,1,LTH) S LTH=LTH+1,LSIG=$E(LSIG,LTH,245)
41 .S LAST=LAST+1 S:$G(LSIG)'="" MSG(4,LAST)=$G(LSIG)
42 ;D MSG^XQOR("PS EVSEND OR",.MSG)
43 Q
44END K ^UTILITY($J,"PSOPCE"),BSIG,COUNT,FIELD,FSIG,JJ,LAST,LASTSIG,LIMIT,LTH,MSG,NULLFLDS,PODOSE,PODOSENM,POIPTR,PSFLAG,PSND1,PSND2,PSND3,PSORINST,PSORXEXT,RXP,PSREV,RXDRUG,ZZZ,PSORE,PSOFILL,PSOAAA,PCENODE S ZTREQ="@" Q
Note: See TracBrowser for help on using the repository browser.