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

BPCIMDSP.m

Go to the documentation of this file.
BPCIMDSP ; IHS/OIT/MJL - IMMUN HISTORY DISP GUI RPC ROUTINE ;
 ;;1.5;BPC;;MAY 26, 2005
 ;
GETIHDSP(BGUARRAY,BPCPIEN) ;EP CALL FROM REMOTE PROC: BPC GET IMM HISTORY DATA
 ;
ENH ;
 ;Return array format
 ;  1=visit date
 ;  2=dose-vac or skin test name
 ;  3=imm reaction
 ;  4=skin result
 ;  5=location
 ;  6=skin reading
 ;  7=skin reading date fm format
 ;  8=imm or skin long name
 ;  9=imm or skin IEN
 ;  10=visit IEN
 ;  11=I or S for type
 ;  12=V File IEN
 ;  13=encounter provider
 ;  14=Visit date in fm format
 S BPCGUI=1,X="",XWBWRAP=1 K ^TMP($J)
 S BGUARRAY="^TMP("_$J_")"
 ;S BPCPIEN=25241,DUZ=1 ;TESTING
 I $P($G(^BISITE(DUZ(2),0)),U,15)\1'=7 S ^TMP($J,1)=-1,^TMP($J,2)="IMMUNIZATION VERSION INCORRECT!" D KILL Q
 I $G(BPCPIEN)="" S ^TMP($J,1)=-1,^TMP($J,2)="PATIENT IEN NOT SENT!" D KILL Q
 S X="BILOGO",BPCBIOS="" X ^%ZOSF("TEST") I $T S BPCX=$$VER^BILOGO I BPCX["8." S BPCBIOS=1  ;FJE
 D IMMHX^BIRPC(.X,BPCPIEN)
FJ S BPCCTR=1
 S X1="" F J=1:1 S X1=$P(X,U,J) Q:'$L(X1)!($A($E(X1,1))=31)!(X1["NO RECORDS")  D
 . S BPCCTR=BPCCTR+1
 . F I=1:1:15 S X(I)=$P(X1,"|",I)
 . S ^TMP($J,BPCCTR)=X(7)
 . F K=3,13,8,5,9,10 S ^TMP($J,BPCCTR)=^TMP($J,BPCCTR)_U_X(K)
 . S $P(^TMP($J,BPCCTR),U,11)=X(1),$P(^TMP($J,BPCCTR),U,12)=X(4)
 . I +X(15) S $P(^TMP($J,BPCCTR),U,13)=$P($G(^VA(200,X(15),0)),U,1)
 . I X(1)="I" D
 .. S X(16)="",X(16)=$O(^AUTTIMM("D",X(2),X(16))) I +X(16) S X(17)=$P($G(^AUTTIMM(X(16),0)),U,1),$P(^TMP($J,BPCCTR),U,8)=X(17)
 .. S Y=$P($G(^AUPNVIMM(X(4),0)),U,1),$P(^TMP($J,BPCCTR),U,9)=+Y
 .. S Y=$P($G(^AUPNVIMM(X(4),0)),U,3),$P(^TMP($J,BPCCTR),U,10)=+Y
 .. S Y=$P($G(^AUPNVSIT(+Y,0)),U,1),$P(^TMP($J,BPCCTR),U,14)=Y
 .. I BPCBIOS S $P(^TMP($J,BPCCTR),U,2)=X(2) ;FJE
 . I X(1)="S" D
 .. S $P(^TMP($J,BPCCTR),U,2)=X(11)
 .. I +X(12) S Y=$P($G(^AUTTSK(X(12),0)),U,1),$P(^TMP($J,BPCCTR),U,8)=Y
 .. S Y=$P($G(^AUPNVSK(X(4),0)),U,1),$P(^TMP($J,BPCCTR),U,9)=+Y
 .. S Y=$P($G(^AUPNVSK(X(4),0)),U,3),$P(^TMP($J,BPCCTR),U,10)=+Y
 .. S Y=$P($G(^AUPNVSIT(+Y,0)),U,1),$P(^TMP($J,BPCCTR),U,14)=Y
 D CONTRAS^BIRPC5(.X,BPCPIEN)
 S X1="" F J=1:1 S X1=$P(X,U,J) Q:'$L(X1)!($A($E(X1,1))=31)!(X1["NO RECORDS")  D
 . S BPCCTR=BPCCTR+1
 . F I=1:1:4 S X(I)=$P(X1,"|",I)
 . S ^TMP($J,BPCCTR)=X(4)_U_X(2)_U_"Contraindication"_U_X(3)
 . S $P(^TMP($J,BPCCTR),U,11)="C"
 I BPCCTR=1 S ^TMP($J,1)="1",^TMP($J,2)="No Data Available" D KILL Q
 S ^TMP($J,1)=BPCCTR
 D KILL
 Q
GETIFDSP(BGUARRAY,BPCPIEN) ;EP CALL FROM REMOTE PROC: BPC GET IMM FORECAST DATA
 ;
ENF ;
 S BPCGUI=1,XWBWRAP=1 K ^TMP($J)
 S BGUARRAY="^TMP("_$J_")"
 I $P($G(^BISITE(DUZ(2),0)),U,15)\1'=7 S ^TMP($J,1)=-1,^TMP($J,2)="IMMUNIZATION VERSION INCORRECT!" D KILL Q
 ;S BPCPIEN=25241,DUZ=1,DUZ(0)=4585 TESTING D ENF^BPCIMDSP
 ;S BPCPIEN=1,DUZ=1,DUZ(0)=4585
 I $G(BPCPIEN)="" S ^TMP($J,1)=-1,^TMP($J,2)="PATIENT IEN NOT SENT!" D KILL Q
 K X S X=""
 D IMMFORC^BIRPC(.X,BPCPIEN)
 I X["Forecasting disabled" S ^TMP($J,1)="1",^TMP($J,2)=$P(X,$C(31),3) D KILL Q
 I X["Forecasting disabled" S ^TMP($J,1)="1",^TMP($J,2)=$P(X,".") D KILL Q
 ;I X["No immunizations due" S ^TMP($J,1)="1",^TMP($J,2)=$P(X,$C(31),3) D KILL Q
 I X["No immunizations due" S ^TMP($J,1)="1",^TMP($J,2)=$P(X,".") D KILL Q
 S BPCCTR=1
 S X1=0 F I=1:1 S X1=$P(X,U,I) Q:$A($E(X1,2))=31  D
 . S BPCCTR=BPCCTR+1
 . S X2=$P(X1,"|",1),X6=$E(X2,3,99)
 . S X3=$P(X1,"|",2),X4=$P(X1,"|",3)
 . S X7="",X7=$O(^AUTTIMM("D",X6,X7))
 . S X5="" I +X7 S X5=$G(^AUTTIMM(X7,0)),X5=$P(X5,U,1)
 . S X8=+X2 S:X8=0 X8=""
 . S ^TMP($J,BPCCTR)=X2_U_X3_U_X4_U_X5_U_X8_U_X7
 I BPCCTR=1 S ^TMP($J,1)="1",^TMP($J,2)="No Data Available" D KILL Q
 S ^TMP($J,1)=BPCCTR
 D KILL
 Q
TESTF ;TESTS FOR SEVERAL PATIENTS
 S XX=0 F  S XX=$O(^DPT(XX)) Q:+XX=0  D
 . S BPCPIEN=XX,DUZ=1,DUZ(2)=4585
 . D ENF
 . W !,X
 Q
TESTH ;TESTS FOR SEVERAL PATIENTS
 S XX=0 F  S XX=$O(^DPT(XX)) Q:+XX=0  D
 . S BPCPIEN=XX,DUZ=1,DUZ(2)=4585
 . D ENH
 . W !,X
 Q
TESTL ;TESTS FOR SEVERAL LOTS
 S U="^" D VAC
 ;S XX=1 F  S XX=$O(^TMP($J,XX)) Q:+XX=0  D
 F I=106,107,113,115,117 S BPCVIEN=I  D
 . ;S BPCVIEN=$P($G(^TMP($J,XX)),U,3) W !,^TMP($J,XX)
 . W !,BPCVIEN
 . D LOT
 . W !,^BITMP($J),I
 Q
VACNAMS(BGUARRAY) ;EP CALL FROM REMOTE PROC: MDAO
 ;
VAC ;
 S BPCGUI=1,X="" K ^TMP($J)
 S BGUARRAY="^TMP("_$J_")"
 I $P($G(^BISITE(DUZ(2),0)),U,15)\1'=7 S ^TMP($J,1)=-1,^TMP($J,2)="IMMUNIZATION VERSION INCORRECT!" D KILL Q
 D VACNAMS^BIRPC2(.X)
 S BPCCTR=1
 S X="" F  S X=$O(^BITMP($J,"DILIST",1,X)) Q:+X=0  D
 . S BPCCTR=BPCCTR+1
 . S ^TMP($J,BPCCTR)=^BITMP($J,"DILIST",1,X)
 . S ^TMP($J,BPCCTR)=^TMP($J,BPCCTR)_U_$G(^BITMP($J,"DILIST","ID",X,.02))
 . S ^TMP($J,BPCCTR)=^TMP($J,BPCCTR)_U_^BITMP($J,"DILIST",2,X)
 I BPCCTR=1 S ^TMP($J,1)=-1,^TMP($J,2)="No Vaccine list is available" D KILL Q
 S ^TMP($J,1)=BPCCTR
 D KILL
 Q
LOTNUMS(BGUARRAY,BPCVIEN) ;EP CALL FROM REMOTE PROC: MDAO
LOT ;
 S BPCGUI=1,X="" K ^TMP($J)
 S BGUARRAY="^TMP("_$J_")"
 I $P($G(^BISITE(DUZ(2),0)),U,15)\1'=7 S ^TMP($J,1)=-1,^TMP($J,2)="IMMUNIZATION VERSION INCORRECT!" D KILL Q
 I $G(BPCVIEN)="" S ^TMP($J,1)=-1,^TMP($J,2)="VACCINE IEN NOT SENT!" D KILL Q
 D LOTNUMS^BIRPC2(X,BPCVIEN)
 Q
 S BPCCTR=1
 S X="" F  S X=$O(^BITMP($J,"DILIST",1,X)) Q:+X=0  D
 . S BPCCTR=BPCCTR+1
 . S ^TMP($J,BPCCTR)=^BITMP($J,"DILIST",1,X)
 . S ^TMP($J,BPCCTR)=^TMP($J,BPCCTR)_U_$G(^BITMP($J,"DILIST","ID",X,.02))
 . S ^TMP($J,BPCCTR)=^TMP($J,BPCCTR)_U_^BITMP($J,"DILIST",2,X)
 I BPCCTR=1 S ^TMP($J,1)=-1,^TMP($J,2)="No Vaccine list is available" D KILL Q
 S ^TMP($J,1)=BPCCTR
 D KILL
 Q
USELOT(BGUARRAY,BPCLIEN)  ;EP CALL FROM REMOTE PROC: BPC IMM LOT REQUIRED
 ;
ENL ;
 S BPCGUI=1,XWBWRAP=1,X="" K ^TMP($J)
 S BGUARRAY="^TMP("_$J_")"
 S BPCLIEN=107,DUZ=1 ;TESTING
 I $P($G(^BISITE(DUZ(2),0)),U,15)\1'=7 S ^TMP($J,1)=-1,^TMP($J,2)="IMMUNIZATION VERSION INCORRECT!" D KILL Q
 I $G(BPCLIEN)="" S ^TMP($J,1)=-1,^TMP($J,2)="VACCINE IEN NOT SENT!" D KILL Q
 S BPCCTR=1
 S X1="",X1=$O(^AUTTIML("C",BPCLIEN,X1)) Q:X1=""  D
 . S BPCCTR=BPCCTR+1
 . S ^TMP($J,BPCCTR)=X1
 I BPCCTR=1 S ^TMP($J,1)="1",^TMP($J,2)=0 Q
 I BPCCTR=2 S ^TMP($J,1)="1",^TMP($J,2)=1
 D KILL
 Q
 ;
HIDOSE(BGUARRAY,BPCPIEN,BPCVIEN)  ;EP CALL FROM REMOTE PROC: BPC IMM HIDOSE
 ;
ENDOSE ;
 S BPCGUI=1,XWBWRAP=1,X="" K ^TMP($J)
 S BGUARRAY="^TMP("_$J_")"
 S BPCPIEN=25241,BPCVIEN=133,DUZ=1 ;TESTING
 I $G(BPCPIEN)="" S ^TMP($J,1)=-1,^TMP($J,2)="PATIENT IEN NOT SENT!" D KILL Q
 I $G(BPCVIEN)="" S ^TMP($J,1)=-1,^TMP($J,2)="VACCINE IEN NOT SENT!" D KILL Q
 S (X,X1)="" D IMMHX^BIRPC(.X,25241)
 S X1=$$HIDOSE^BIUTL11(25241,133,.X)
 S ^TMP($J,1)="1",^TMP($J,2)=""
 S:+X1 ^TMP($J,2)=+X1
 D KILL
 Q
 ;
KILL ;
 K BPCCTR,BPCGUI,BPCLIEN,BPCPIEN,BPCVIEN,X,X1,X2,X3,X4,X5,X6,X7,X8,XX
 Q