PXMCEVNT ;SLC/PKR - Mapped codes linking and unlinking event routines. ;09/21/2020
;;1.0;PCE PATIENT CARE ENCOUNTER;**211**;Aug 12, 1996;Build 454
;
;==========================================
ADDEVENT(VFILENUM,VSCIEN) ;Setup for protocol event for adding a code.
N DATATYPE,GBL,GBLDATA,NODE,PXKCO,VISITIEN
S PXKCO("SOR")=+$O(^PX(839.7,"B","PCE CODE MAPPING",0))
S VISITIEN=$P(^AUPNVSC(VSCIEN,0),U,3)
D SVBS(VISITIEN,PXKCO("SOR"))
S NODE=""
F S NODE=$O(GBLDATA(NODE)) Q:NODE="" D
. S ^TMP("PXKCO",$J,VISITIEN,"SC",VSCIEN,NODE,"AFTER")=GBLDATA(NODE)
. S ^TMP("PXKCO",$J,VISITIEN,"SC",VSCIEN,NODE,"BEFORE")=""
D TSKEVENT^PXMCEVNT(.PXKCO)
Q
;
;==========================================
DELEVENT(VFILENUM,VSCIEN,ZNODE) ;Setup for protocol event for deleting a code.
;NEED PXKCO("SOR") FOR THE EVENT TO FIRE, GET IT BACK
N DATATYPE,GBL,GBLDATA,PXKCO,VISITIEN
S VISITIEN=$P(ZNODE,U,3)
S PXKCO("SOR")=+$O(^PX(839.7,"B","PCE CODE MAPPING",0))
D SVBS(VISITIEN,PXKCO("SOR"))
S ^TMP("PXKCO",$J,VISITIEN,"SC",VSCIEN,0,"AFTER")=""
S ^TMP("PXKCO",$J,VISITIEN,"SC",VSCIEN,0,"BEFORE")=ZNODE
D TSKEVENT^PXMCEVNT(.PXKCO)
Q
;
;==========================================
SVBS(VISITIEN,SORIEN) ;Set the Visit "BEFORE" and "SOR" nodes of
;^TMP("PXKCO",$J).
N SOR
S SOR=$G(^PX(839.7,SORIEN,0))
S ^TMP("PXKCO",$J,VISITIEN,"VST",VISITIEN,0,"BEFORE")=$G(^AUPNVSIT(VISITIEN,0))
S ^TMP("PXKCO",$J,VISITIEN,"VST",VISITIEN,21,"BEFORE")=$G(^AUPNVSIT(VISITIEN,21))
S ^TMP("PXKCO",$J,VISITIEN,"VST",VISITIEN,800,"BEFORE")=$G(^AUPNVSIT(VISITIEN,800))
S ^TMP("PXKCO",$J,VISITIEN,"VST",VISITIEN,811,"BEFORE")=$G(^AUPNVSIT(VISITIEN,811))
S ^TMP("PXKCO",$J,VISITIEN,"VST",VISITIEN,150,"BEFORE")=$G(^AUPNVSIT(VISITIEN,150))
S ^TMP("PXKCO",$J,VISITIEN,"SOR",SORIEN,0,"AFTER")=SOR
S ^TMP("PXKCO",$J,VISITIEN,"SOR",SORIEN,0,"BEFORE")=SOR
Q
;
;==========================================
TSKEVENT(PXKCO) ;Task the PCE event point.
N ZTREQ,ZTSAVE,ZTSK,ZTIO,ZTDTH,ZTRTN
S ZTREQ="@"
S ZTSAVE("PXKCO(")=""
S ZTSAVE("^TMP(""PXKCO"",$J,")=""
S ZTRTN="EVENT^PXKMAIN"
S ZTDESC="PXK VISIT DATA EVENT"
S ZTDTH=$$NOW^XLFDT
S ZTIO=""
D ^%ZTLOAD
K ^TMP("PXKCO",$J)
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXMCEVNT 2222 printed Oct 16, 2024@18:30:15 Page 2
PXMCEVNT ;SLC/PKR - Mapped codes linking and unlinking event routines. ;09/21/2020
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**211**;Aug 12, 1996;Build 454
+2 ;
+3 ;==========================================
ADDEVENT(VFILENUM,VSCIEN) ;Setup for protocol event for adding a code.
+1 NEW DATATYPE,GBL,GBLDATA,NODE,PXKCO,VISITIEN
+2 SET PXKCO("SOR")=+$ORDER(^PX(839.7,"B","PCE CODE MAPPING",0))
+3 SET VISITIEN=$PIECE(^AUPNVSC(VSCIEN,0),U,3)
+4 DO SVBS(VISITIEN,PXKCO("SOR"))
+5 SET NODE=""
+6 FOR
SET NODE=$ORDER(GBLDATA(NODE))
if NODE=""
QUIT
Begin DoDot:1
+7 SET ^TMP("PXKCO",$JOB,VISITIEN,"SC",VSCIEN,NODE,"AFTER")=GBLDATA(NODE)
+8 SET ^TMP("PXKCO",$JOB,VISITIEN,"SC",VSCIEN,NODE,"BEFORE")=""
End DoDot:1
+9 DO TSKEVENT^PXMCEVNT(.PXKCO)
+10 QUIT
+11 ;
+12 ;==========================================
DELEVENT(VFILENUM,VSCIEN,ZNODE) ;Setup for protocol event for deleting a code.
+1 ;NEED PXKCO("SOR") FOR THE EVENT TO FIRE, GET IT BACK
+2 NEW DATATYPE,GBL,GBLDATA,PXKCO,VISITIEN
+3 SET VISITIEN=$PIECE(ZNODE,U,3)
+4 SET PXKCO("SOR")=+$ORDER(^PX(839.7,"B","PCE CODE MAPPING",0))
+5 DO SVBS(VISITIEN,PXKCO("SOR"))
+6 SET ^TMP("PXKCO",$JOB,VISITIEN,"SC",VSCIEN,0,"AFTER")=""
+7 SET ^TMP("PXKCO",$JOB,VISITIEN,"SC",VSCIEN,0,"BEFORE")=ZNODE
+8 DO TSKEVENT^PXMCEVNT(.PXKCO)
+9 QUIT
+10 ;
+11 ;==========================================
SVBS(VISITIEN,SORIEN) ;Set the Visit "BEFORE" and "SOR" nodes of
+1 ;^TMP("PXKCO",$J).
+2 NEW SOR
+3 SET SOR=$GET(^PX(839.7,SORIEN,0))
+4 SET ^TMP("PXKCO",$JOB,VISITIEN,"VST",VISITIEN,0,"BEFORE")=$GET(^AUPNVSIT(VISITIEN,0))
+5 SET ^TMP("PXKCO",$JOB,VISITIEN,"VST",VISITIEN,21,"BEFORE")=$GET(^AUPNVSIT(VISITIEN,21))
+6 SET ^TMP("PXKCO",$JOB,VISITIEN,"VST",VISITIEN,800,"BEFORE")=$GET(^AUPNVSIT(VISITIEN,800))
+7 SET ^TMP("PXKCO",$JOB,VISITIEN,"VST",VISITIEN,811,"BEFORE")=$GET(^AUPNVSIT(VISITIEN,811))
+8 SET ^TMP("PXKCO",$JOB,VISITIEN,"VST",VISITIEN,150,"BEFORE")=$GET(^AUPNVSIT(VISITIEN,150))
+9 SET ^TMP("PXKCO",$JOB,VISITIEN,"SOR",SORIEN,0,"AFTER")=SOR
+10 SET ^TMP("PXKCO",$JOB,VISITIEN,"SOR",SORIEN,0,"BEFORE")=SOR
+11 QUIT
+12 ;
+13 ;==========================================
TSKEVENT(PXKCO) ;Task the PCE event point.
+1 NEW ZTREQ,ZTSAVE,ZTSK,ZTIO,ZTDTH,ZTRTN
+2 SET ZTREQ="@"
+3 SET ZTSAVE("PXKCO(")=""
+4 SET ZTSAVE("^TMP(""PXKCO"",$J,")=""
+5 SET ZTRTN="EVENT^PXKMAIN"
+6 SET ZTDESC="PXK VISIT DATA EVENT"
+7 SET ZTDTH=$$NOW^XLFDT
+8 SET ZTIO=""
+9 DO ^%ZTLOAD
+10 KILL ^TMP("PXKCO",$JOB)
+11 QUIT
+12 ;