PXCASK ;ISL/dee - Validates & Translates data from the PCE Device Interface into PCE's PXK format for Skin Test ;07/30/15 09:15
;;1.0;PCE PATIENT CARE ENCOUNTER;**27,124,199,210**;Aug 12, 1996;Build 21
Q
; Variables
; PXCASK Copy of a SKIN TEST node of the PXCA array
; PXCAPRV Pointer to the provider (200)
; PXCANUMB Count of the number if SKs
; PXCAINDX Count of the number of SKIN TEST for one provider
; PXCAFTER Temp used to build ^TMP(PXCAGLB,$J,"SK",PXCANUMB,0,"AFTER")
; PXCAPNAR Pointer to the provider narrative (9999999.27)
;
SK(PXCASK,PXCANUMB,PXCAPRV,PXCAERRS) ;
N PXCAFTER
S PXCAFTER=$P(PXCASK,"^",1)_"^"_PXCAPAT_"^"_PXCAVSIT_"^"
S PXCAFTER=PXCAFTER_$P(PXCASK,"^",3)_"^"
S PXCAFTER=PXCAFTER_$P(PXCASK,"^",2)_"^"
;PX*1*124
S PXCAFTER=PXCAFTER_$P(PXCASK,"^",4)
S ^TMP(PXCAGLB,$J,"SK",PXCANUMB,"IEN")=""
S ^TMP(PXCAGLB,$J,"SK",PXCANUMB,0,"BEFORE")=""
S ^TMP(PXCAGLB,$J,"SK",PXCANUMB,0,"AFTER")=PXCAFTER
S ^TMP(PXCAGLB,$J,"SK",PXCANUMB,12,"BEFORE")=""
S ^TMP(PXCAGLB,$J,"SK",PXCANUMB,12,"AFTER")=$P(PXCASK,"^",5)_"^^^"_$S(PXCAPRV>0:PXCAPRV,1:"")
S ^TMP(PXCAGLB,$J,"SK",PXCANUMB,80,"BEFORE")=""
S ^TMP(PXCAGLB,$J,"SK",PXCANUMB,80,"AFTER")=$P(PXCASK,"^",6)_"^"_$P(PXCASK,"^",7)_"^"_$P(PXCASK,"^",8)_"^"_$P(PXCASK,"^",9)_"^"_$P(PXCASK,"^",10)_"^"_$P(PXCASK,"^",11)_"^"_$P(PXCASK,"^",12)_"^"_$P(PXCASK,"^",13)
S ^TMP(PXCAGLB,$J,"SK",PXCANUMB,812,"BEFORE")=""
S ^TMP(PXCAGLB,$J,"SK",PXCANUMB,812,"AFTER")="^"_PXCAPKG_"^"_PXCASOR
Q
;
SKINTEST(PXCA,PXCABULD,PXCAERRS) ;Validation routine for SK
Q:'$D(PXCA("SKIN TEST"))
N ICDDATA,ICDPCE,PXCAINDX,PXCAITEM,PXCANUMB,PXCAPRV,PXCASK,PXDXDATE
S PXDXDATE=$S($D(PXCAVSIT)=1:$$CSDATE^PXDXUTL(PXCAVSIT),$D(PXCADT)=1:PXCADT,1:DT)
S PXCAPRV="",PXCANUMB=0
F S PXCAPRV=$O(PXCA("SKIN TEST",PXCAPRV)) Q:PXCAPRV']"" D
. I PXCAPRV>0 D
.. I '$$ACTIVPRV^PXAPI(PXCAPRV,PXCADT) S PXCA("ERROR","SKIN TEST",PXCAPRV,0,0)="Provider is not active or valid^"_PXCAPRV
.. E I PXCABULD!PXCAERRS D ANOTHPRV^PXCAPRV(PXCAPRV)
. S PXCAINDX=""
. F S PXCAINDX=$O(PXCA("SKIN TEST",PXCAPRV,PXCAINDX)) Q:PXCAINDX']"" D
.. S PXCASK=$G(PXCA("SKIN TEST",PXCAPRV,PXCAINDX))
.. S PXCANUMB=PXCANUMB+1
.. I PXCASK="" S PXCA("ERROR","SKIN TEST",PXCAPRV,PXCAINDX,0)="SKIN TEST data missing" Q
.. S PXCAITEM=+$P(PXCASK,"^",1)
.. I $G(^AUTTSK(PXCAITEM,0))="" S PXCA("ERROR","SKIN TEST",PXCAPRV,PXCAINDX,1)="SKIN TEST type not in file 9999999.28^"_PXCAITEM
.. S PXCAITEM=$P(PXCASK,"^",2)
.. I '((PXCAITEM=(PXCAITEM\1)&(PXCAITEM>-1)&(PXCAITEM<41))!(PXCAITEM="")) S PXCA("ERROR","SKIN TEST",PXCAPRV,PXCAINDX,2)="SKIN TEST reaction must be an integer form 0 to 40^"_PXCAITEM
.. S PXCAITEM=$P(PXCASK,"^",3)
.. I '(PXCAITEM=""!(PXCAITEM="P")!(PXCAITEM="N")!(PXCAITEM="D")!(PXCAITEM="O")) S PXCA("ERROR","SKIN TEST",PXCAPRV,PXCAINDX,3)="SKIN TEST results must be P|N|D|O^"_PXCAITEM
.. F ICDPCE=6:1:13 D
... S PXCAITEM=$P(PXCASK,"^",ICDPCE) I PXCAITEM]"" D
.... S ICDDATA=$$ICDDATA^ICDXCODE("DIAG",PXCAITEM,PXDXDATE,"I")
.... I $P(ICDDATA,"^",1)'>0 D
..... S PXCA("ERROR","SKIN TEST",PXCAPRV,PXCAINDX,ICDPCE)="SKIN TEST Diagnosis # "_(ICDPCE-5)_" not in file 80^"_PXCAITEM
.... E I $P(ICDDATA,"^",10)'=1 D
..... S PXCA("ERROR","SKIN TEST",PXCAPRV,PXCAINDX,ICDPCE)="SKIN TEST Diagnosis # "_(ICDPCE-5)_" not an ACTIVE ICD Code^"_PXCAITEM
.. I PXCABULD&'$D(PXCA("ERROR","SKIN TEST",PXCAPRV,PXCAINDX))!PXCAERRS D SK(PXCASK,.PXCANUMB,PXCAPRV,PXCAERRS)
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXCASK 3488 printed Sep 15, 2024@21:51:49 Page 2
PXCASK ;ISL/dee - Validates & Translates data from the PCE Device Interface into PCE's PXK format for Skin Test ;07/30/15 09:15
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**27,124,199,210**;Aug 12, 1996;Build 21
+2 QUIT
+3 ; Variables
+4 ; PXCASK Copy of a SKIN TEST node of the PXCA array
+5 ; PXCAPRV Pointer to the provider (200)
+6 ; PXCANUMB Count of the number if SKs
+7 ; PXCAINDX Count of the number of SKIN TEST for one provider
+8 ; PXCAFTER Temp used to build ^TMP(PXCAGLB,$J,"SK",PXCANUMB,0,"AFTER")
+9 ; PXCAPNAR Pointer to the provider narrative (9999999.27)
+10 ;
SK(PXCASK,PXCANUMB,PXCAPRV,PXCAERRS) ;
+1 NEW PXCAFTER
+2 SET PXCAFTER=$PIECE(PXCASK,"^",1)_"^"_PXCAPAT_"^"_PXCAVSIT_"^"
+3 SET PXCAFTER=PXCAFTER_$PIECE(PXCASK,"^",3)_"^"
+4 SET PXCAFTER=PXCAFTER_$PIECE(PXCASK,"^",2)_"^"
+5 ;PX*1*124
+6 SET PXCAFTER=PXCAFTER_$PIECE(PXCASK,"^",4)
+7 SET ^TMP(PXCAGLB,$JOB,"SK",PXCANUMB,"IEN")=""
+8 SET ^TMP(PXCAGLB,$JOB,"SK",PXCANUMB,0,"BEFORE")=""
+9 SET ^TMP(PXCAGLB,$JOB,"SK",PXCANUMB,0,"AFTER")=PXCAFTER
+10 SET ^TMP(PXCAGLB,$JOB,"SK",PXCANUMB,12,"BEFORE")=""
+11 SET ^TMP(PXCAGLB,$JOB,"SK",PXCANUMB,12,"AFTER")=$PIECE(PXCASK,"^",5)_"^^^"_$SELECT(PXCAPRV>0:PXCAPRV,1:"")
+12 SET ^TMP(PXCAGLB,$JOB,"SK",PXCANUMB,80,"BEFORE")=""
+13 SET ^TMP(PXCAGLB,$JOB,"SK",PXCANUMB,80,"AFTER")=$PIECE(PXCASK,"^",6)_"^"_$PIECE(PXCASK,"^",7)_"^"_$PIECE(PXCASK,"^",8)_"^"_$PIECE(PXCASK,"^",9)_"^"_$PIECE(PXCASK,"^",10)_"^"_$PIECE(PXCASK,"^",11)_"^"_$PIECE(PXCASK,"^",12)_"^"_$PIECE(PXCASK,"^",
13)
+14 SET ^TMP(PXCAGLB,$JOB,"SK",PXCANUMB,812,"BEFORE")=""
+15 SET ^TMP(PXCAGLB,$JOB,"SK",PXCANUMB,812,"AFTER")="^"_PXCAPKG_"^"_PXCASOR
+16 QUIT
+17 ;
SKINTEST(PXCA,PXCABULD,PXCAERRS) ;Validation routine for SK
+1 if '$DATA(PXCA("SKIN TEST"))
QUIT
+2 NEW ICDDATA,ICDPCE,PXCAINDX,PXCAITEM,PXCANUMB,PXCAPRV,PXCASK,PXDXDATE
+3 SET PXDXDATE=$SELECT($DATA(PXCAVSIT)=1:$$CSDATE^PXDXUTL(PXCAVSIT),$DATA(PXCADT)=1:PXCADT,1:DT)
+4 SET PXCAPRV=""
SET PXCANUMB=0
+5 FOR
SET PXCAPRV=$ORDER(PXCA("SKIN TEST",PXCAPRV))
if PXCAPRV']""
QUIT
Begin DoDot:1
+6 IF PXCAPRV>0
Begin DoDot:2
+7 IF '$$ACTIVPRV^PXAPI(PXCAPRV,PXCADT)
SET PXCA("ERROR","SKIN TEST",PXCAPRV,0,0)="Provider is not active or valid^"_PXCAPRV
+8 IF '$TEST
IF PXCABULD!PXCAERRS
DO ANOTHPRV^PXCAPRV(PXCAPRV)
End DoDot:2
+9 SET PXCAINDX=""
+10 FOR
SET PXCAINDX=$ORDER(PXCA("SKIN TEST",PXCAPRV,PXCAINDX))
if PXCAINDX']""
QUIT
Begin DoDot:2
+11 SET PXCASK=$GET(PXCA("SKIN TEST",PXCAPRV,PXCAINDX))
+12 SET PXCANUMB=PXCANUMB+1
+13 IF PXCASK=""
SET PXCA("ERROR","SKIN TEST",PXCAPRV,PXCAINDX,0)="SKIN TEST data missing"
QUIT
+14 SET PXCAITEM=+$PIECE(PXCASK,"^",1)
+15 IF $GET(^AUTTSK(PXCAITEM,0))=""
SET PXCA("ERROR","SKIN TEST",PXCAPRV,PXCAINDX,1)="SKIN TEST type not in file 9999999.28^"_PXCAITEM
+16 SET PXCAITEM=$PIECE(PXCASK,"^",2)
+17 IF '((PXCAITEM=(PXCAITEM\1)&(PXCAITEM>-1)&(PXCAITEM<41))!(PXCAITEM=""))
SET PXCA("ERROR","SKIN TEST",PXCAPRV,PXCAINDX,2)="SKIN TEST reaction must be an integer form 0 to 40^"_PXCAITEM
+18 SET PXCAITEM=$PIECE(PXCASK,"^",3)
+19 IF '(PXCAITEM=""!(PXCAITEM="P")!(PXCAITEM="N")!(PXCAITEM="D")!(PXCAITEM="O"))
SET PXCA("ERROR","SKIN TEST",PXCAPRV,PXCAINDX,3)="SKIN TEST results must be P|N|D|O^"_PXCAITEM
+20 FOR ICDPCE=6:1:13
Begin DoDot:3
+21 SET PXCAITEM=$PIECE(PXCASK,"^",ICDPCE)
IF PXCAITEM]""
Begin DoDot:4
+22 SET ICDDATA=$$ICDDATA^ICDXCODE("DIAG",PXCAITEM,PXDXDATE,"I")
+23 IF $PIECE(ICDDATA,"^",1)'>0
Begin DoDot:5
+24 SET PXCA("ERROR","SKIN TEST",PXCAPRV,PXCAINDX,ICDPCE)="SKIN TEST Diagnosis # "_(ICDPCE-5)_" not in file 80^"_PXCAITEM
End DoDot:5
+25 IF '$TEST
IF $PIECE(ICDDATA,"^",10)'=1
Begin DoDot:5
+26 SET PXCA("ERROR","SKIN TEST",PXCAPRV,PXCAINDX,ICDPCE)="SKIN TEST Diagnosis # "_(ICDPCE-5)_" not an ACTIVE ICD Code^"_PXCAITEM
End DoDot:5
End DoDot:4
End DoDot:3
+27 IF PXCABULD&'$DATA(PXCA("ERROR","SKIN TEST",PXCAPRV,PXCAINDX))!PXCAERRS
DO SK(PXCASK,.PXCANUMB,PXCAPRV,PXCAERRS)
End DoDot:2
End DoDot:1
+28 QUIT
+29 ;