PSOLBL3 ;BHAM ISC/RTR - Label utility routine ;Nov 17, 2022@08:18:47
;;7.0;OUTPATIENT PHARMACY;**117,441,709**;DEC 1997;Build 4
;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
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
S PSLONG=$S($P(PSOPAR,"^",28):46,1:34)
; 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
K P,PP,L,SPSIG,SIG9,OSIG,SIG2,OSGY S PSLONG=46,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)
;*709
S SPSIG("SIG",1)=""
I $P($G(^PSRX(RX,"IND")),"^",2),$P($G(^PSRX(RX,"IND")),"^",3)]"" S SPSIG("SIG",1)=$P(^PSRX(RX,"IND"),"^",3)
S SPSIG("SIG",1)=$S(SPSIG("SIG",1)]"":SPSIG("SIG",1)_" ",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
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSOLBL3 3008 printed Oct 16, 2024@18:31:01 Page 2
PSOLBL3 ;BHAM ISC/RTR - Label utility routine ;Nov 17, 2022@08:18:47
+1 ;;7.0;OUTPATIENT PHARMACY;**117,441,709**;DEC 1997;Build 4
+2 ;External reference ^PS(55 supported by DBIA 2228
+3 ;
+4 ;RX must be defined (Internal), Check already done for OERR SIG
+5 ;Format OERR Sig for New and Old label stock
+6 NEW CTCT,FFFF,LLIM,LLLL,LVAR,LVAR1,PPP,PPPP,SGCT,SIG9,OSIG,ZZZZ,PSLONG,PPPP
+7 IF $PIECE($GET(^PS(55,DFN,"LAN")),"^")
DO OTHL
if $GET(FND)
GOTO FMSIG
+8 SET PSLONG=$SELECT($PIECE(PSOPAR,"^",28):46,1:34)
+9 ; NEXT LINE IF SIG IS MOVED BACK TO MULTIPLE
+10 SET PPPP=1
FOR PPP=0:0
SET PPP=$ORDER(^PSRX(RX,"SIG1",PPP))
if 'PPP
QUIT
IF $GET(^PSRX(RX,"SIG1",PPP,0))'=""
SET SIG9(PPPP)=^(0)
SET PPPP=PPPP+1
+11 ;NEXT LINE IF 1ST FRONT DOOR SIG LINE LIVES IN BACK DOOR SPOT
+12 ;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 SET (LVAR,LVAR1)=""
SET LLLL=1
+1 FOR FFFF=0:0
SET FFFF=$ORDER(SIG9(FFFF))
if 'FFFF
QUIT
SET SGCT=0
FOR ZZZZ=1:1:$LENGTH(SIG9(FFFF))
IF $EXTRACT(SIG9(FFFF),ZZZZ)=" "!($LENGTH(SIG9(FFFF))=ZZZZ)
SET SGCT=SGCT+1
Begin DoDot:1
+2 SET LVAR1=$PIECE(SIG9(FFFF)," ",(SGCT))
+3 SET LLIM=LVAR
+4 SET LVAR=$SELECT(LVAR="":LVAR1,1:LVAR_" "_LVAR1)
End DoDot:1
IF $LENGTH(LVAR)>PSLONG
SET SGY(LLLL)=LLIM_" "
SET LLLL=LLLL+1
SET LVAR=LVAR1
+5 IF $GET(LVAR)'=""
SET SGY(LLLL)=LVAR
+6 IF '$PIECE(PSOPAR,"^",28)
SET SGC=0
FOR CTCT=0:0
SET CTCT=$ORDER(SGY(CTCT))
if 'CTCT
QUIT
SET SGC=SGC+1
+7 IF $ORDER(OSGY(0))
Begin DoDot:1
+8 FOR I=0:0
SET I=$ORDER(SGY(I))
if 'I
QUIT
IF $GET(OSGY(I))']""
SET OSGY(I)=" "
+9 FOR I=0:0
SET I=$ORDER(OSGY(I))
if 'I
QUIT
IF $GET(SGY(I))']""
SET SGY(I)=" "
End DoDot:1
+10 QUIT
OTHL ;other lang mod
+1 KILL P,PP,L,SPSIG,SIG9,OSIG,SIG2,OSGY
SET PSLONG=46
SET OI=$PIECE(^PSRX(RX,"OR1"),"^")
+2 FOR I=0:0
SET I=$ORDER(^PSRX(RX,6,I))
if 'I
QUIT
SET INST=^(I,0)
Begin DoDot:1
+3 SET SPSIG("DOSE",I)=$SELECT($GET(^PSRX(RX,6,I,1))]"":^PSRX(RX,6,I,1),1:$PIECE(INST,"^"))
SET SPSIG("DOSE ORDERED",I)=$PIECE(INST,"^",2)
SET SPSIG("UNITS",I)=$PIECE(INST,"^",3)
SET SPSIG("NOUN",I)=$PIECE(INST,"^",4)
+4 IF $PIECE(INST,"^",5)]""
SET SPSIG("DURATION",I)=$SELECT($EXTRACT($PIECE(INST,"^",5),1)'?.N:$EXTRACT($PIECE(INST,"^",5),2,99)_$EXTRACT($PIECE(INST,"^",5),1),1:$PIECE(INST,"^",5))
+5 SET SPSIG("ROUTE",I)=$PIECE(INST,"^",7)
SET SPSIG("SCHEDULE",I)=$PIECE(INST,"^",8)
+6 SET SPSIG("CONJUNCTION",I)=$PIECE(INST,"^",6)
SET SPSIG("VERB",I)=$PIECE(INST,"^",9)
End DoDot:1
+7 ;*709
+8 SET SPSIG("SIG",1)=""
+9 IF $PIECE($GET(^PSRX(RX,"IND")),"^",2)
IF $PIECE($GET(^PSRX(RX,"IND")),"^",3)]""
SET SPSIG("SIG",1)=$PIECE(^PSRX(RX,"IND"),"^",3)
+10 SET SPSIG("SIG",1)=$SELECT(SPSIG("SIG",1)]"":SPSIG("SIG",1)_" ",1:"")_$SELECT($GET(^PSRX(RX,"INSS"))]"":^PSRX(RX,"INSS"),1:"")
NX KILL I,T
SET OTHL=1
DO EN^PSOSPSIG(.SPSIG)
+1 SET PP=1
FOR P=0:0
SET P=$ORDER(^PSRX(RX,"SIG1",P))
if 'P
QUIT
IF $GET(^PSRX(RX,"SIG1",P,0))'=""
SET OSIG(PP)=^(0)
SET PP=PP+1
+2 SET (LVAR,LVAR1)=""
SET L=1
+3 FOR F=0:0
SET F=$ORDER(OSIG(F))
if 'F
QUIT
SET SGCT=0
FOR Z=1:1:$LENGTH(OSIG(F))
IF $EXTRACT(OSIG(F),Z)=" "!($LENGTH(OSIG(F))=Z)
SET SGCT=SGCT+1
Begin DoDot:1
+4 SET LVAR1=$PIECE(OSIG(F)," ",(SGCT))
SET LLIM=LVAR
SET LVAR=$SELECT(LVAR="":LVAR1,1:LVAR_" "_LVAR1)
End DoDot:1
IF $LENGTH(LVAR)>PSLONG
SET OSGY(L)=LLIM_" "
SET L=L+1
SET LVAR=LVAR1
+5 IF $GET(LVAR)'=""
SET OSGY(L)=LVAR
+6 IF '$PIECE(PSOPAR,"^",28)
SET SGC=0
FOR CTCT=0:0
SET CTCT=$ORDER(OSGY(CTCT))
if 'CTCT
QUIT
SET SGC=SGC+1
+7 KILL OI,SPSIG,INST,I,T,OTHL,L,PP,P,OSIG,F
+8 QUIT
OTHL1(RX) ;builds cmop other lang. sig for transmission
+1 DO OTHL
KILL SIG9,PSLONG,OI
+2 QUIT