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

PSJNEWOA.m

Go to the documentation of this file.
PSJNEWOA ;BIR/SAB - STORES BACKDOOR ORDER CHECKS IN FILE #100.05 ;11/08/2012
 ;;5.0;INPATIENT MEDICATIONS;**281**;16 DEC 97;Build 113
 ;External reference to ^TMP("PSODAOC",$J is supported by DBIA# 6071
 ;External reference to GETOC4^OROCAPI1 supported by DBIA 5729
 ;External reference to ^ORD(100.05 supported by DBIA 5731
 ;External reference to ^PS(55 supported by DBIA 2191
 ;
 ;Inpatient: When verifying order within the same session, pull allergies from non-verified order to verified order
 ;called from VF1^PSJLIACT and PSJHL3
VF ;unit dose or pending
 Q:'$G(^TMP("PSODAOC",$J,"IP IEN"))
 N PSJORET,PSJZORN,RXORDER,PSJDGVER,PSJOORD,ON55
 S (PSJZORN,PSJORET,PSJOORD,PSJORET)="",PSJDGVER=1,PSJOORD=$G(^TMP("PSODAOC",$J,"IP IEN"))
 I $G(PSJSPEED) S PSJOORD=$G(ON55)
 S (ON55,RXORDER)=$G(^TMP("PSODAOC",$J,"IP NEW IEN"))
 D VF2
 Q
VF1 ;IV or edit
 N PSJDGORD,PSJORET,PSJZORN,RXORDER,ON55
 I $G(PSIVCOPY),($G(ON55)["V") K ^TMP("PSODAOC",$J,"ALLERGY")
 S (PSJZORN,PSJORET)="",(ON55,RXORDER)=$G(^TMP("PSODAOC",$J,"IP NEW IEN"))
 S PSJDGORD=$G(^TMP("PSODAOC",$J,"IP IEN"))
VF2 ;
 I $G(PSJDGVER)&($G(PSJOORD)) D
 .I PSJOORD["P"!(PSJOORD["N") S PSJZORN=+$P(^PS(53.1,+PSJOORD,0),U,21) Q
 ;
 I '$G(PSJREN)&('$G(PSJDGVER))&($G(PSJDGORD)) D
 .I PSJDGORD["P"!(PSJDGORD["N") S PSJZORN=+$P($G(^PS(53.1,+PSJDGORD,0)),U,21) Q
 .S PSJZORN=$S(PSJDGORD["V":$P($G(^PS(55,DFN,"IV",+PSJDGORD,0)),"^",21),PSJDGORD["U":$P($G(^PS(55,DFN,5,+PSJDGORD,0)),"^",21),1:"")
 I $G(PSJREN)&('$G(PSJDGVER))&($G(PSJDGORD)) S PSJZORN=$S(PSJDGORD["V":$P($G(^PS(55,DFN,"IV",+PSJDGORD,0)),"^",21),PSJDGORD["U":$P($G(^PS(55,DFN,5,+PSJDGORD,0)),"^",21),1:"")
 Q:'PSJZORN
 D GETOC4^OROCAPI1(PSJZORN,.PSJORET)
 I $O(PSJORET(PSJZORN,"DATA",""))="" K ^TMP("PSODAOC",$J) Q
 ;
VF3 ;
 N PSJZI,PSJZIIEN,PSJNRET,PSJACNT,PSJACNT1,PSJACNT2,PSJIEN60,PSJIEN70,PSJRETI,PSJDFLAG,PSJZERO,PSOZH,PSJOZI
 S (PSJACNT,PSJACNT1)=0
 F PSJZI=0:0 S PSJZI=$O(PSJORET(PSJZORN,"DATA",PSJZI)) Q:'PSJZI  I $D(PSJORET(PSJZORN,"DATA",PSJZI,1)) D
 .Q:+$P(PSJORET(PSJZORN,"DATA",PSJZI,1),";",2)'=3
 .K PSJAIENS
 .I $G(PSJOZI)'=PSJZI S PSJZIIEN=0
 .S PSJOZI=PSJZI,PSJACNT=PSJACNT+1
 .F  S PSJZIIEN=$O(^ORD(100.05,PSJZI,4,PSJZIIEN)) Q:PSJZIIEN=""  I $D(^ORD(100.05,PSJZI,4,PSJZIIEN,0)) D
 ..Q:$P(^ORD(100.05,PSJZI,0),"^",3)["CPRS"
 ..D GETS^DIQ(100.05,PSJZI,"60*","I","PSJIEN60"),GETS^DIQ(100.05,PSJZI,"70*","I","PSJIEN70")
 ..S PSJDFLAG="",PSJDFLAG=$$GETORD(PSJZI,$S($G(PSJDGVER):$G(PSJOORD),1:PSJDGORD),PSJDFLAG)
 ..Q:'$G(PSJDFLAG)
 ..;
 ..S PSJACNT1=PSJACNT1+1
 ..S ^TMP("PSODAOC",$J,"ALLERGY",PSJACNT,"ALLERGY PKG")="IP^"_$S($G(PSJOCFG)]"":$P(PSJOCFG," ")_" ",1:"")_"^"_ON55_"^"_PSJZORN
 ..;S:$D(^ORD(100.05,PSJZI,8)) ^TMP("PSODAOC",$J,"ALLERGY",PSJACNT,"INTERVENTION")=^ORD(100.05,PSJZI,8)
 ..S ^TMP("PSODAOC",$J,"ALLERGY","PROVR")=$G(PSJORET(PSJZI,"DATA",PSJZIIEN,"OR",1,0))
 ..;
 ..D SETTMP
 ;
VF4 ;
 S PSOZH="Allergy",RXORDER=ON55,PSJAOC1=1
 S (ON55,RXORDER)=$G(^TMP("PSODAOC",$J,"IP NEW IEN"))
 I $D(^TMP("PSODAOC",$J,"ALLERGY")) D VF2^PSJNEWOC
 K ^TMP("PSODAOC",$J,"ALLERGY")
 Q
 ;
SETTMP ;
 N PSJSUBS,PSJACNT2
 S ^TMP("PSODAOC",$J,"ALLERGY",PSJACNT,4,PSJZIIEN,0)=$G(^ORD(100.05,PSJZI,4,PSJZIIEN,0))
 ;
 I $D(^ORD(100.05,PSJZI,4,PSJZIIEN,1,0)) S PSJSUBS=1 D SET1
 I $D(^ORD(100.05,PSJZI,4,PSJZIIEN,2,0)) S PSJSUBS=2 D SET1
 I $D(^ORD(100.05,PSJZI,4,PSJZIIEN,3,0)) S PSJSUBS=3 D SET1
 I $D(^ORD(100.05,PSJZI,5,0)) S PSJSUBS=5 D SET2
 I $D(^ORD(100.05,PSJZI,11,0)) S ^TMP("PSODAOC",$J,"ALLERGY",PSJACNT,"PHARM")=^ORD(100.05,PSJZI,11,0)
 ;WILL NEED TO SET PHARM INFO 100.05
 Q
 ;
SET1 ;
 F PSJACNT2=0:0 S PSJACNT2=$O(^ORD(100.05,PSJZI,4,PSJZIIEN,PSJSUBS,PSJACNT2)) Q:PSJACNT2'?1N.N  D
 .I $D(^ORD(100.05,PSJZI,4,PSJZIIEN,PSJSUBS,PSJACNT2,0)) D
 ..S ^TMP("PSODAOC",$J,"ALLERGY",PSJACNT,4,PSJZIIEN,PSJSUBS,PSJACNT2,0)=^ORD(100.05,PSJZI,4,PSJZIIEN,PSJSUBS,PSJACNT2,0)
 Q
 ;
SET2 ;
 F PSJACNT2=0:0 S PSJACNT2=$O(^ORD(100.05,PSJZI,PSJSUBS,PSJACNT2)) Q:PSJACNT2'?1N.N  D
 .I $D(^ORD(100.05,PSJZI,PSJSUBS,PSJACNT2,0)) D
 ..S ^TMP("PSODAOC",$J,"ALLERGY",PSJACNT,"ALLERGY DD",PSJSUBS,PSJACNT2,0)=^ORD(100.05,PSJZI,PSJSUBS,PSJACNT2,0)
 Q
 ;
GETORD(PSJSUBS,PSJORDR,PSJTRUE) ;
 I PSJORDR["U"!(PSJORDR["V") D
 .I $D(PSJIEN70(100.11,"1,"_PSJSUBS_",",.01,"I")) S PSJRETI=PSJIEN70(100.11,"1,"_PSJSUBS_",",.01,"I") S:PSJORDR=($P(PSJRETI,";",2)_$P(PSJRETI,";")) PSJTRUE=1 Q
 .I $D(PSJIEN70(100.07,"1,"_PSJSUBS_",",.01,"I")) S PSJRETI=PSJIEN70(100.07,"1,"_PSJSUBS_",",.01,"I") S:PSJORDR=($P(PSJRETI,";",2)_$P(PSJRETI,";")) PSJTRUE=1
 I PSJORDR["P"!(PSJORDR["N") D 
 .I $D(PSJIEN60(100.517,"1,"_PSJSUBS_",",.01,"I")) S PSJRETI=PSJIEN60(100.517,"1,"_PSJSUBS_",",.01,"I") I PSJRETI["PS(53.1" S:+PSJORDR=$P(PSJRETI,";") PSJTRUE=1 Q
 .I $D(PSJIEN60(100.07,"1,"_PSJSUBS_",",.01,"I")) S PSJRETI=PSJIEN60(100.07,"1,"_PSJSUBS_",",.01,"I") I PSJRETI["PS(53.1" S:+PSJORDR=$P(PSJRETI,";") PSJTRUE=1
 Q PSJTRUE