PXCAVIMM ;ISL/dee - Validates & Translates data from the PCE Device Interface into PCE's PXK format for Immunizations ;3/14/97
;;1.0;PCE PATIENT CARE ENCOUNTER;**27**;Aug 12, 1996
Q
; Variables
; PXCAIMM Copy of a IMMUNIZATION node of the PXCA array
; PXCAPRV Pointer to the provider (200)
; PXCANUMB Count of the number if IMMs
; PXCAINDX Count of the number of IMMUNIZATION for one provider
; PXCAFTER Temp used to build ^TMP(PXCAGLB,$J,"IMM",PXCANUMB,0,"AFTER")
; PXCAPNAR Pointer to the provider narrative (9999999.27)
;
IMM(PXCAIMM,PXCANUMB,PXCAPRV,PXCAERRS) ;
N PXCAFTER
S PXCAFTER=$P(PXCAIMM,"^",1)_"^"_PXCAPAT_"^"_PXCAVSIT_"^"
S PXCAFTER=PXCAFTER_$P(PXCAIMM,"^",2,4)
S ^TMP(PXCAGLB,$J,"IMM",PXCANUMB,"IEN")=""
S ^TMP(PXCAGLB,$J,"IMM",PXCANUMB,0,"BEFORE")=""
S ^TMP(PXCAGLB,$J,"IMM",PXCANUMB,0,"AFTER")=PXCAFTER
S ^TMP(PXCAGLB,$J,"IMM",PXCANUMB,12,"BEFORE")=""
S ^TMP(PXCAGLB,$J,"IMM",PXCANUMB,12,"AFTER")=$P(PXCAIMM,"^",6)_"^^^"_$S(PXCAPRV>0:PXCAPRV,1:"")
S ^TMP(PXCAGLB,$J,"IMM",PXCANUMB,811,"BEFORE")=""
S ^TMP(PXCAGLB,$J,"IMM",PXCANUMB,811,"AFTER")=$P(PXCAIMM,"^",7)
S ^TMP(PXCAGLB,$J,"IMM",PXCANUMB,812,"BEFORE")=""
S ^TMP(PXCAGLB,$J,"IMM",PXCANUMB,812,"AFTER")="^"_PXCAPKG_"^"_PXCASOR
Q
;
IMMUN(PXCA,PXCABULD,PXCAERRS) ;Validation routine for IMM
Q:'$D(PXCA("IMMUNIZATION"))
N PXCAIMM,PXCAPRV,PXCANUMB,PXCAINDX
N PXCAITEM,PXCAITM2
S PXCAPRV=""
S PXCANUMB=0
F S PXCAPRV=$O(PXCA("IMMUNIZATION",PXCAPRV)) Q:PXCAPRV']"" D
. I PXCAPRV>0 D
.. I '$$ACTIVPRV^PXAPI(PXCAPRV,PXCADT) S PXCA("ERROR","IMMUNIZATION",PXCAPRV,0,0)="Provider is not active or valid^"_PXCAPRV
.. E I PXCABULD!PXCAERRS D ANOTHPRV^PXCAPRV(PXCAPRV)
. S PXCAINDX=0
. F S PXCAINDX=$O(PXCA("IMMUNIZATION",PXCAPRV,PXCAINDX)) Q:PXCAINDX']"" D
.. S PXCAIMM=$G(PXCA("IMMUNIZATION",PXCAPRV,PXCAINDX))
.. S PXCANUMB=PXCANUMB+1
.. I PXCAIMM="" S PXCA("ERROR","IMMUNIZATION",PXCAPRV,PXCAINDX,0)="IMMUNIZATION data missing" Q
.. S PXCAITEM=+$P(PXCAIMM,U,1)
.. I $G(^AUTTIMM(PXCAITEM,0))="" S PXCA("ERROR","IMMUNIZATION",PXCAPRV,PXCAINDX,1)="IMMUNIZATION type not in file 9999999.14^"_PXCAITEM
.. S PXCAITEM=$P(PXCAIMM,U,2)
.. I '(PXCAITEM=""!(PXCAITEM="P")!(PXCAITEM="C")!(PXCAITEM="B")!((PXCAITEM=(PXCAITEM\1))&(PXCAITEM>0)&(PXCAITEM<9))) S PXCA("ERROR","IMMUNIZATION",PXCAPRV,PXCAINDX,2)="IMMUNIZATION series must be P|C|B|1|2|3|4|5|6|7|8^"_PXCAITEM
.. S PXCAITEM=$P(PXCAIMM,U,4)
.. I '((PXCAITEM=(PXCAITEM\1)&(PXCAITEM>0)&(PXCAITEM<12))!(PXCAITEM="")) S PXCA("ERROR","IMMUNIZATION",PXCAPRV,PXCAINDX,4)="IMMUNIZATION reaction must be an integer form 1 to 11^"_PXCAITEM
.. S PXCAITEM=$P(PXCAIMM,U,5)
.. I '(PXCAITEM=1!(PXCAITEM=0)!(PXCAITEM="")) S PXCA("ERROR","IMMUNIZATION",PXCAPRV,PXCAINDX,5)="IMMUNIZATION contraindicated flag bad^"_PXCAITEM
.. S PXCAITEM=$P(PXCAIMM,U,6)
.. S PXCAITEM=$P(PXCAIMM,U,7)
.. I $L(PXCAITEM)>80 S PXCA("ERROR","IMMUNIZATION",PXCAPRV,PXCAINDX,6)="IMMUNIZATION remarks must be 1-80 Characters^"_PXCAITEM
.. I PXCABULD&'$D(PXCA("ERROR","IMMUNIZATION",PXCAPRV,PXCAINDX))!PXCAERRS D IMM(PXCAIMM,.PXCANUMB,PXCAPRV,PXCAERRS)
Q
;
PXCAVIMM ;ISL/dee - Validates & Translates data from the PCE Device Interface into PCE's PXK format for Immunizations ;3/14/97
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**27**;Aug 12, 1996
+2 QUIT
+3 ; Variables
+4 ; PXCAIMM Copy of a IMMUNIZATION node of the PXCA array
+5 ; PXCAPRV Pointer to the provider (200)
+6 ; PXCANUMB Count of the number if IMMs
+7 ; PXCAINDX Count of the number of IMMUNIZATION for one provider
+8 ; PXCAFTER Temp used to build ^TMP(PXCAGLB,$J,"IMM",PXCANUMB,0,"AFTER")
+9 ; PXCAPNAR Pointer to the provider narrative (9999999.27)
+10 ;
IMM(PXCAIMM,PXCANUMB,PXCAPRV,PXCAERRS) ;
+1 NEW PXCAFTER
+2 SET PXCAFTER=$PIECE(PXCAIMM,"^",1)_"^"_PXCAPAT_"^"_PXCAVSIT_"^"
+3 SET PXCAFTER=PXCAFTER_$PIECE(PXCAIMM,"^",2,4)
+4 SET ^TMP(PXCAGLB,$JOB,"IMM",PXCANUMB,"IEN")=""
+5 SET ^TMP(PXCAGLB,$JOB,"IMM",PXCANUMB,0,"BEFORE")=""
+6 SET ^TMP(PXCAGLB,$JOB,"IMM",PXCANUMB,0,"AFTER")=PXCAFTER
+7 SET ^TMP(PXCAGLB,$JOB,"IMM",PXCANUMB,12,"BEFORE")=""
+8 SET ^TMP(PXCAGLB,$JOB,"IMM",PXCANUMB,12,"AFTER")=$PIECE(PXCAIMM,"^",6)_"^^^"_$SELECT(PXCAPRV>0:PXCAPRV,1:"")
+9 SET ^TMP(PXCAGLB,$JOB,"IMM",PXCANUMB,811,"BEFORE")=""
+10 SET ^TMP(PXCAGLB,$JOB,"IMM",PXCANUMB,811,"AFTER")=$PIECE(PXCAIMM,"^",7)
+11 SET ^TMP(PXCAGLB,$JOB,"IMM",PXCANUMB,812,"BEFORE")=""
+12 SET ^TMP(PXCAGLB,$JOB,"IMM",PXCANUMB,812,"AFTER")="^"_PXCAPKG_"^"_PXCASOR
+13 QUIT
+14 ;
IMMUN(PXCA,PXCABULD,PXCAERRS) ;Validation routine for IMM
+1 IF '$DATA(PXCA("IMMUNIZATION"))
QUIT
+2 NEW PXCAIMM,PXCAPRV,PXCANUMB,PXCAINDX
+3 NEW PXCAITEM,PXCAITM2
+4 SET PXCAPRV=""
+5 SET PXCANUMB=0
+6 FOR
SET PXCAPRV=$ORDER(PXCA("IMMUNIZATION",PXCAPRV))
IF PXCAPRV']""
QUIT
Begin DoDot:1
+7 IF PXCAPRV>0
Begin DoDot:2
+8 IF '$$ACTIVPRV^PXAPI(PXCAPRV,PXCADT)
SET PXCA("ERROR","IMMUNIZATION",PXCAPRV,0,0)="Provider is not active or valid^"_PXCAPRV
+9 IF '$TEST
IF PXCABULD!PXCAERRS
DO ANOTHPRV^PXCAPRV(PXCAPRV)
End DoDot:2
+10 SET PXCAINDX=0
+11 FOR
SET PXCAINDX=$ORDER(PXCA("IMMUNIZATION",PXCAPRV,PXCAINDX))
IF PXCAINDX']""
QUIT
Begin DoDot:2
+12 SET PXCAIMM=$GET(PXCA("IMMUNIZATION",PXCAPRV,PXCAINDX))
+13 SET PXCANUMB=PXCANUMB+1
+14 IF PXCAIMM=""
SET PXCA("ERROR","IMMUNIZATION",PXCAPRV,PXCAINDX,0)="IMMUNIZATION data missing"
QUIT
+15 SET PXCAITEM=+$PIECE(PXCAIMM,U,1)
+16 IF $GET(^AUTTIMM(PXCAITEM,0))=""
SET PXCA("ERROR","IMMUNIZATION",PXCAPRV,PXCAINDX,1)="IMMUNIZATION type not in file 9999999.14^"_PXCAITEM
+17 SET PXCAITEM=$PIECE(PXCAIMM,U,2)
+18 IF '(PXCAITEM=""!(PXCAITEM="P")!(PXCAITEM="C")!(PXCAITEM="B")!((PXCAITEM=(PXCAITEM\1))&(PXCAITEM>0)&(PXCAITEM<9)))
SET PXCA("ERROR","IMMUNIZATION",PXCAPRV,PXCAINDX,2)="IMMUNIZATION series must be P|C|B|1|2|3|4|5|6|7|8^"_PXCAITEM
+19 SET PXCAITEM=$PIECE(PXCAIMM,U,4)
+20 IF '((PXCAITEM=(PXCAITEM\1)&(PXCAITEM>0)&(PXCAITEM<12))!(PXCAITEM=""))
SET PXCA("ERROR","IMMUNIZATION",PXCAPRV,PXCAINDX,4)="IMMUNIZATION reaction must be an integer form 1 to 11^"_PXCAITEM
+21 SET PXCAITEM=$PIECE(PXCAIMM,U,5)
+22 IF '(PXCAITEM=1!(PXCAITEM=0)!(PXCAITEM=""))
SET PXCA("ERROR","IMMUNIZATION",PXCAPRV,PXCAINDX,5)="IMMUNIZATION contraindicated flag bad^"_PXCAITEM
+23 SET PXCAITEM=$PIECE(PXCAIMM,U,6)
+24 SET PXCAITEM=$PIECE(PXCAIMM,U,7)
+25 IF $LENGTH(PXCAITEM)>80
SET PXCA("ERROR","IMMUNIZATION",PXCAPRV,PXCAINDX,6)="IMMUNIZATION remarks must be 1-80 Characters^"_PXCAITEM
+26 IF PXCABULD&'$DATA(PXCA("ERROR","IMMUNIZATION",PXCAPRV,PXCAINDX))!PXCAERRS
DO IMM(PXCAIMM,.PXCANUMB,PXCAPRV,PXCAERRS)
End DoDot:2
End DoDot:1
+27 QUIT
+28 ;