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

PXKMASC.m

Go to the documentation of this file.
PXKMASC ;ISL/JVS - Build and Pass to auto-check-out ;7/25/96  08:53
 ;;1.0;PCE PATIENT CARE ENCOUNTER;**22,41,73**;Aug 12, 1996
 ; Builds and passes data to MAS for Auto-checkout
 ;Variable List
 ;
EN1 ;Build the Temp global for MAS AND THE WORLD.
 ;S PXKGN=$P($T(GLOBAL^@PXKRTN),";;",2)_"("_PXKPIEN_","
 ;^TMP("PXKCO",$J,<VISIT IEN>,"PRV",<PROVIDER ien>,0,"AFTER")=DATA
 ;  ""                 ""                     ""    ,"BEFORE")=DATA
 N PXKGG,PXKSUB,PXKMOD,PXKSEQ
 Q:PXKSOR=$O(^PX(839.7,"B","PIMS CHECK-OUT",0))
 S PXKGG=0
 S PXKSUB=""
 F  S PXKSUB=$O(PXKAFT(PXKSUB)) Q:PXKSUB=""  D
 . I PXKSUB'=1 D PXGO Q
 . S PXKSEQ=""
 . F  S PXKSEQ=$O(PXKAFT(PXKSUB,PXKSEQ)) Q:PXKSEQ=""  D
 .. S PXKMOD=PXKAFT(PXKSUB,PXKSEQ)
 .. D PXGO
 Q
PXGO ;
 S PXKGG=0
 S PXKGN=$P($T(GLOBAL^@PXKRTN),";;",2)_"("_PXKPIEN_","
 I PXKSUB'=1 D
 . I $D(^TMP("PXKCO",$J,PXKVST,PXKCAT,PXKPIEN,PXKSUB,"BEFORE")) S PXKGG=1
 . S PXKGN=PXKGN_PXKSUB_")"
 I PXKSUB=1 D
 . I PXKMOD]"",$D(^TMP("PXKCO",$J,PXKVST,PXKCAT,PXKPIEN,PXKSUB,"BEFORE",PXKMOD)) S PXKGG=1
 . S PXKGN=PXKGN_PXKSUB_","_PXKSEQ_","_0_")"
 D @$S(PXKGG=1:"DUP",1:"ORG")
 D DEL
 D PTR
 Q
 ;
DUP ;Overwrite if a duplicate just the After Node
 I PXKSUB'=1 D  Q
 . S ^TMP("PXKCO",$J,PXKVST,PXKCAT,PXKPIEN,PXKSUB,"AFTER")=$G(@PXKGN)
 I $G(@PXKGN)]"" D
 . S ^TMP("PXKCO",$J,PXKVST,PXKCAT,PXKPIEN,PXKSUB,"AFTER",$G(@PXKGN))=""
 Q
 ;
ORG ;If original copy both
 I PXKSUB'=1 D  Q
 . S ^TMP("PXKCO",$J,PXKVST,PXKCAT,PXKPIEN,PXKSUB,"AFTER")=$G(@PXKGN)
 . S ^TMP("PXKCO",$J,PXKVST,PXKCAT,PXKPIEN,PXKSUB,"BEFORE")=$G(PXKBEF(PXKSUB))
 I $G(@PXKGN)]"" D
 . S ^TMP("PXKCO",$J,PXKVST,PXKCAT,PXKPIEN,PXKSUB,"AFTER",$G(@PXKGN))=""
 I $G(PXKBEF(PXKSUB,PXKSEQ))]"" D
 . S ^TMP("PXKCO",$J,PXKVST,PXKCAT,PXKPIEN,PXKSUB,"BEFORE",PXKBEF(PXKSUB,PXKSEQ))=""
 Q
 ;
DEL ;DELETE IF BOTH ARE NULL
 I '$D(^TMP("PXKCO",$J,PXKVST,PXKCAT,PXKPIEN,0)) D
 .K ^TMP("PXKCO",$J,PXKVST,PXKCAT,PXKPIEN)
 I $G(^TMP("PXKCO",$J,PXKVST,PXKCAT,PXKPIEN,0,"AFTER"))']"" D
 .I $G(^TMP("PXKCO",$J,PXKVST,PXKCAT,PXKPIEN,0,"BEFORE"))']"" D
 ..K ^TMP("PXKCO",$J,PXKVST,PXKCAT,PXKPIEN)
 I $P($G(^TMP("PXKCO",$J,PXKVST,PXKCAT,PXKPIEN,0,"AFTER")),"^",1)="@" D
 .K ^TMP("PXKCO",$J,PXKVST,PXKCAT,PXKPIEN)
 Q
 ;
PTR ; Set the Provider Narriative equal to the pointer in the files etc.
 N PXJ,PXJJ,PXJJJ,PXKR
 I $D(PXKPTR) S PXJ="" F  S PXJ=$O(PXKPTR(PXJ)) Q:PXJ=""  D
 .S PXJJ=""  F  S PXJJ=$O(PXKPTR(PXJ,PXJJ)) Q:PXJJ=""  D
 ..S PXJJJ="" F  S PXJJJ=$O(PXKPTR(PXJ,PXJJ,PXJJJ)) Q:PXJJJ=""  D
 ...S PXKR=$P($T(GLOBAL^@PXKRTN),";;",2)_"("_PXJ_","_PXJJ_")"
 ...I $D(^TMP("PXKCO",$J,PXKVST,PXKCAT,PXJ,PXJJ,"AFTER")) D
 ....S $P(^TMP("PXKCO",$J,PXKVST,PXKCAT,PXJ,PXJJ,"AFTER"),"^",PXJJJ)=$P($G(@PXKR),"^",PXJJJ)
 Q
 ;
EVENT ; EVENT TO PRESENT THE DATA TO OTHER USERS
 Q:'$D(PXKCO("SOR"))
 I '$D(^TMP("PXKCO",$J)) Q
 S PXKVVST=+$O(^TMP("PXKCO",$J,0))
 S ^TMP("PXKCO",$J,PXKVVST,"VST",PXKVVST,0,"AFTER")=$G(^AUPNVSIT(PXKVVST,0))
 S ^TMP("PXKCO",$J,PXKVVST,"VST",PXKVVST,21,"AFTER")=$G(^AUPNVSIT(PXKVVST,21))
 S ^TMP("PXKCO",$J,PXKVVST,"VST",PXKVVST,800,"AFTER")=$G(^AUPNVSIT(PXKVVST,800))
 S ^TMP("PXKCO",$J,PXKVVST,"VST",PXKVVST,811,"AFTER")=$G(^AUPNVSIT(PXKVVST,811))
 S ^TMP("PXKCO",$J,PXKVVST,"VST",PXKVVST,150,"AFTER")=$G(^AUPNVSIT(PXKVVST,150))
 S ^TMP("PXKCO",$J,PXKVVST,"SOR",PXKCO("SOR"),0,"AFTER")=$G(^PX(839.7,PXKCO("SOR"),0))
 S ^TMP("PXKCO",$J,PXKVVST,"SOR",PXKCO("SOR"),0,"BEFORE")=$G(^PX(839.7,PXKCO("SOR"),0))
 S X=+$O(^ORD(101,"B","PXK VISIT DATA EVENT",0))_";ORD(101,"
 ;D ENCEVENT^PXKENC(PXKVVST) ;makes the ^TMP("PXKENC",$J, array
 D COEVENT^PXKENC(PXKVVST) ;finishes the ^TMP("PXKCO",$J array
 D EN^XQOR
 D FINAL^SCDXHLDR(PXKVVST,$G(PXKVST))
UPD ;UP DATE VISIT FILE
 ;--REMOVE CHECK OUT DATE TIME
 N VSIT
 I $D(PXKVVST),$D(^AUPNVSIT(PXKVVST)) S VSIT("IEN")=PXKVVST,VSIT("COD")="@" D UPD^VSIT
 K ^TMP("PXKCO",$J),PXKVVST,PXKCO,VSIT
 K ^TMP("PXKENC",$J)
 Q