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

PSOHLINL.m

Go to the documentation of this file.
PSOHLINL ;BIR/RTR-Process HL7 segments greater than 245 ;07/12/02
 ;;7.0;OUTPATIENT PHARMACY;**111**;DEC 1997
 ;
ORC ;Process multiple ORC segments
 S PSOHLTAG="ORCP"
 D PROC
 K PSOHLTAG
 Q
PROC ;Process segments
 N PSOHPVR,PSOHPVR1,PSOHNNCK,PSOHNNN,PSOHNNNN,PSOHIII,PSOHAA,PSOHLIM,PSOHBX
 D RESET
 I $G(PSOHLTAG)="ORCP" S PSOHY("PRIOR")="R" D NOW^%DTC S PSOHY("EDT")=%
 S (PSOHPVR,PSOHPVR1)="",(PSOHNNCK,PSOHNNN,PSOHNNNN)=0,PSOHIII=1
 S PSOHAA="" F  S PSOHAA=$O(PSOHBX(PSOHAA)) Q:PSOHAA=""  S PSOHNNN=0 F PSOHOO=1:1:$L(PSOHBX(PSOHAA)) S PSOHNNN=PSOHNNN+1 D  D:$G(PSOHPVR1)=HL("FS") @PSOHLTAG
 .I $E(PSOHBX(PSOHAA),PSOHOO)=HL("FS") S PSOHNNNN=PSOHNNNN+1
 .S PSOHPVR1=$E(PSOHBX(PSOHAA),PSOHOO)
 .S PSOHLIM=PSOHPVR
 .S PSOHPVR=$S(PSOHPVR="":PSOHPVR1,1:PSOHPVR_PSOHPVR1)
 I $G(PSOHPVR)'="" S PSOHLIM=PSOHPVR S PSOHNNNN=PSOHNNNN+1 D @PSOHLTAG
 Q
ORCP ;
 S PSOHLMIS("ORC")=""
 I PSOHNNNN=1 S PSOHY("OCC")=$G(PSOHLIM) G ORCPQ
 I PSOHNNNN=2 S PSOHY("CHNUM")=$P(PSOHLIM,PSOHFSP) G ORCPQ
 I PSOHNNNN=9 S X=$G(PSOHLIM) D  G ORCPQ
 .I X S PSOHY("SDT")=$$HL7TFM^XLFDT(X) Q
 .S PSOHY("SDT")=$G(PSOHY("EDT"))
 I PSOHNNNN=10 S PSOHY("ENTER")=+$G(PSOHLIM)
 I PSOHNNNN=12 S PSOHY("PROV")=+$G(PSOHLIM)
ORCPQ S (PSOHPVR,PSOHLIM)=""
 Q
RXOP ;
 S PSOHLMIS("RXO")=""
 I PSOHNNNN=10 S PSOHY("DRUG")=+$G(PSOHLIM) G RXOPQ
 I PSOHNNNN=11 S PSOHY("QTY")=$G(PSOHLIM) G RXOPQ
 I PSOHNNNN=13 S PSOHY("REF")=$G(PSOHLIM)
RXOPQ S (PSOHPVR,PSOHLIM)=""
 Q
RESET ;reset array
 K PSOHBX
 S PSOHX="" F  S PSOHX=$O(PSOHB(PSOHX)) Q:PSOHX=""  S PSOHBX((+$G(PSOHX)+1))=PSOHB(PSOHX)
 S PSOHBX(0)=PSOHB
 Q
RXO ;Process multiple RXO segments
 S PSOHLTAG="RXOP"
 D PROC
 K PSOHLTAG
 Q
COMM ;Process multiple NTE 6 (Provider comments)
 K ^UTILITY($J,"W")
 S X=$P(PSOHB,HL("FS"),3,999),DIWL=1,DIWR=70,DIWF="" D LTH Q:PSOXLONG  D ^DIWP
 S PSOHLZ="" F  S PSOHLZ=$O(PSOHB("")) Q:PSOHLZ=""!(PSOXLONG)  I $G(PSOHB(PSOHLZ))'="" S X=PSOHB(PSOHLZ),DIWL=1,DIWR=70,DIWF="" D LTH Q:PSOXLONG  D ^DIWP
 I PSOXLONG K ^UTILITY($J,"W") Q
 D ENCOMM
 K ^UTILITY($J,"W")
 Q
SIG ;Process multiple NTE 7 (Sig)
 K ^UTILITY($J,"W")
 S X=$P(PSOHB,HL("FS"),3,999),DIWL=1,DIWR=70,DIWF="" D LTH Q:PSOXLONG  D ^DIWP
 S PSOHLZ="" F  S PSOHLZ=$O(PSOHB("")) Q:PSOHLZ=""!(PSOXLONG)  I $G(PSOHB(PSOHLZ))'="" S X=PSOHB(PSOHLZ),DIWL=1,DIWR=70,DIWF="" D LTH Q:PSOXLONG  D ^DIWP
 I PSOXLONG K ^UTILITY($J,"W") Q
 D ENSIG
 K ^UTILITY($J,"W")
 Q
ENCOMM ;Enter provider comments into PSOHY array
 S PSOHLZC=1
 S PSOHLZ="" F  S PSOHLZ=$O(^UTILITY($J,"W",1,PSOHLZ)) Q:PSOHLZ=""  I $G(^(PSOHLZ,0))'="" D
 .S PSOHY("PRCOM",PSOHLZC)=$G(^UTILITY($J,"W",1,PSOHLZ,0)),PSOHLZC=PSOHLZC+1
 Q
ENSIG ;Enter Sig into PSOHY array
 S PSOHLZC=1
 S PSOHLZ="" F  S PSOHLZ=$O(^UTILITY($J,"W",1,PSOHLZ)) Q:PSOHLZ=""  I $G(^(PSOHLZ,0))'="" D
 .S PSOHY("SIG",PSOHLZC)=$G(^UTILITY($J,"W",1,PSOHLZ,0)),PSOHLZC=PSOHLZC+1
 Q
LTH ;
 I $L(X)>245 S PSOXLONG=1
 Q