Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PSOLBL3

PSOLBL3.m

Go to the documentation of this file.
PSOLBL3 ;BHAM ISC/RTR-Label utility routine ;29-May-2012 14:51;PLS
 ;;7.0;OUTPATIENT PHARMACY;**117,1009,1015**;DEC 1997;Build 62
 ;External reference ^PS(55 supported by DBIA 2228
 ;
 ;RX must be defined (Internal), Check already done for OERR SIG
 ;Format OERR Sig for New and Old label stock
 ; Modified - IHS/CIA/PLS - 02/02/04 - PSOLBL3+9 and OTHL+1
 ;            IHS/MSC/PLS - 07/29/10 - PSOLBL3+12 and OTHL+1
 N CTCT,FFFF,LLIM,LLLL,LVAR,LVAR1,PPP,PPPP,SGCT,SIG9,OSIG,ZZZZ,PSLONG,PPPP
 I $P($G(^PS(55,DFN,"LAN")),"^") D OTHL G:$G(FND) FMSIG
 ;IHS/CIA/PLS - 02/02/04 - Use IHS Site parameter for wrap width
 ;S PSLONG=$S($P(PSOPAR,"^",28):46,1:34)
 ;IHS/MSC/PLS - 07/29/2010 - Fix for undefined %APSITE when tasked
 S PSLONG=$S($P(PSOPAR,"^",28):46,$$GET1^DIQ(9009033,PSOSITE,3):$$GET1^DIQ(9009033,PSOSITE,3),1:34)  ;1:$P(%APSITE,U,4))
 ; NEXT LINE IF SIG IS MOVED BACK TO MULTIPLE
 S PPPP=1 F PPP=0:0 S PPP=$O(^PSRX(RX,"SIG1",PPP)) Q:'PPP  I $G(^PSRX(RX,"SIG1",PPP,0))'="" S SIG9(PPPP)=^(0) S PPPP=PPPP+1
 ;NEXT LINE IF 1ST FRONT DOOR SIG LINE LIVES IN BACK DOOR SPOT
 ;S SIG9(1)=$P($G(^PSRX(RX,"SIG")),"^") S PPP=2 F PPPP=0:0 S PPPP=$O(^PSRX(RX,"SIG1",PPPP)) Q:'PPPP  I $G(^(PPPP,0))'="" S SIG9(PPP)=$G(^(0)),PPP=PPP+1
FMSIG S (LVAR,LVAR1)="",LLLL=1
 F FFFF=0:0 S FFFF=$O(SIG9(FFFF)) Q:'FFFF  S SGCT=0 F ZZZZ=1:1:$L(SIG9(FFFF)) I $E(SIG9(FFFF),ZZZZ)=" "!($L(SIG9(FFFF))=ZZZZ) S SGCT=SGCT+1 D  I $L(LVAR)>PSLONG S SGY(LLLL)=LLIM_" ",LLLL=LLLL+1,LVAR=LVAR1
 .S LVAR1=$P(SIG9(FFFF)," ",(SGCT))
 .S LLIM=LVAR
 .S LVAR=$S(LVAR="":LVAR1,1:LVAR_" "_LVAR1)
 I $G(LVAR)'="" S SGY(LLLL)=LVAR
 I '$P(PSOPAR,"^",28) S SGC=0 F CTCT=0:0 S CTCT=$O(SGY(CTCT)) Q:'CTCT  S SGC=SGC+1
 I $O(OSGY(0)) D
 .F I=0:0 S I=$O(SGY(I)) Q:'I  I $G(OSGY(I))']"" S OSGY(I)=" "
 .F I=0:0 S I=$O(OSGY(I)) Q:'I  I $G(SGY(I))']"" S SGY(I)=" "
 Q
OTHL ;other lang. mod
 ;IHS/CIA/PLS - 02/03/04 - Use IHS Site paramter for wrap width
 ;K P,PP,L,SPSIG,SIG9,OSIG,SIG2,OSGY S PSLONG=46,OI=$P(^PSRX(RX,"OR1"),"^")
 K P,PP,L,SPSIG,SIG9,OSIG,SIG2,OSGY S PSLONG=$S($$GET1^DIQ(9009033,PSOSITE,3):$$GET1^DIQ(9009033,PSOSITE,3),1:34),OI=$P(^PSRX(RX,"OR1"),"^")
 F I=0:0 S I=$O(^PSRX(RX,6,I)) Q:'I  S INST=^(I,0) D
 .S SPSIG("DOSE",I)=$S($G(^PSRX(RX,6,I,1))]"":^PSRX(RX,6,I,1),1:$P(INST,"^")),SPSIG("DOSE ORDERED",I)=$P(INST,"^",2),SPSIG("UNITS",I)=$P(INST,"^",3),SPSIG("NOUN",I)=$P(INST,"^",4)
 .I $P(INST,"^",5)]"" S SPSIG("DURATION",I)=$S($E($P(INST,"^",5),1)'?.N:$E($P(INST,"^",5),2,99)_$E($P(INST,"^",5),1),1:$P(INST,"^",5))
 .S SPSIG("ROUTE",I)=$P(INST,"^",7),SPSIG("SCHEDULE",I)=$P(INST,"^",8)
 .S SPSIG("CONJUNCTION",I)=$P(INST,"^",6),SPSIG("VERB",I)=$P(INST,"^",9)
 S SPSIG("SIG",1)=$S($G(^PSRX(RX,"INSS"))]"":^PSRX(RX,"INSS"),1:"")
NX K I,T S OTHL=1 D EN^PSOSPSIG(.SPSIG)
 S PP=1 F P=0:0 S P=$O(^PSRX(RX,"SIG1",P)) Q:'P  I $G(^PSRX(RX,"SIG1",P,0))'="" S OSIG(PP)=^(0) S PP=PP+1
 S (LVAR,LVAR1)="",L=1
 F F=0:0 S F=$O(OSIG(F)) Q:'F  S SGCT=0 F Z=1:1:$L(OSIG(F)) I $E(OSIG(F),Z)=" "!($L(OSIG(F))=Z) S SGCT=SGCT+1 D  I $L(LVAR)>PSLONG S OSGY(L)=LLIM_" ",L=L+1,LVAR=LVAR1
 .S LVAR1=$P(OSIG(F)," ",(SGCT)),LLIM=LVAR,LVAR=$S(LVAR="":LVAR1,1:LVAR_" "_LVAR1)
 I $G(LVAR)'="" S OSGY(L)=LVAR
 I '$P(PSOPAR,"^",28) S SGC=0 F CTCT=0:0 S CTCT=$O(OSGY(CTCT)) Q:'CTCT  S SGC=SGC+1
 K OI,SPSIG,INST,I,T,OTHL,L,PP,P,OSIG,F
 Q
OTHL1(RX) ;builds cmop other lang. sig for transmission
 D OTHL K SIG9,PSLONG,OI
 Q