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

PXUTLSTP.m

Go to the documentation of this file.
  1. PXUTLSTP ;ISL/dee,ESW - Utility routine used by PCE to add/edit/delete stop code visits ; 10/11/2017
  1. ;;1.0;PCE PATIENT CARE ENCOUNTER;**1,96,166,197,211**;Aug 12, 1996;Build 454
  1. Q
  1. ;
  1. STOPCODE(PXUTSOR,PXUTSTOP,PXUTVST,PXUTSVST) ;Makes or edits visit to create the secondary visit for the credit stops
  1. ; Parameters
  1. ; PXUTSOR IEN of the Data source
  1. ; PXUTSTOP Pointer to Stop Code OR "@" if delete the secondary visit
  1. ; PXUTVST Main visit
  1. ; PXUTSVST Secondary visit
  1. ; if there is not one then create one
  1. ; if there is one then this is an edit or delete
  1. ;
  1. ; Returns the pointer to the secondary visit
  1. ; or 0 if the secondary visit was deleted
  1. ; or -1 if the secondary visit could not be deleted
  1. ; or null if visit tracking did not create the visit
  1. ;
  1. ;
  1. D EVENT^PXKMAIN
  1. N PXUAFTER,PXUTNODE,PXUTRET,PXKERROR,PXUTEXIT
  1. K ^TMP("PXK",$J)
  1. S PXUTEXIT=0
  1. ;
  1. I $G(PXUTSVST)>0 D Q:PXUTEXIT -1
  1. . I PXUTSTOP="@" D
  1. ..;--ENTERED TO TRY TO KILL STOP CODES
  1. DELETE ..;If stop code has to be killed on credit stop code visit then
  1. ..; the whole visit has to be killed with and pointing to it
  1. ..; outpatient encounter.
  1. .. F PXUTNODE=0,21,150,800,811,812 D
  1. ... S (^TMP("PXK",$J,"VST",1,PXUTNODE,"AFTER"),^TMP("PXK",$J,"VST",1,PXUTNODE,"BEFORE"))=$G(^AUPNVSIT(PXUTSVST,PXUTNODE))
  1. .. S $P(^TMP("PXK",$J,"VST",1,0,"AFTER"),"^",8)="@"
  1. .. S ^TMP("PXK",$J,"VST",1,"IEN")=PXUTSVST
  1. ..; Verify if this is really credit stop visit with only 1 dependent
  1. ..; entry that is outpatient encounter.
  1. .. I $$DEC^VSITKIL(PXUTVST)>2 Q ; do not kill the secondary, visit will stay PX/197
  1. .. ;I $$DEC^VSITKIL(PXUTSVST,0)<2,$P($G(^AUPNVSIT(PXUTSVST,150)),U,3)="C" D ;PX/96;commented PX/197
  1. .. I '$D(^SCE("AVSIT",PXUTVST)) Q ; do not kill
  1. .. S ^TMP("PXK",$J,"VST",1,0,"AFTER")="@"
  1. ..; Find Outpatient Encounter to take care of
  1. .. N SDOEP
  1. .. D LISTVST^SDOERPC(.SDOEP,PXUTVST)
  1. .. S SDOEP=$P(SDOEP,")")_","_""""""_")"
  1. .. S SDOEP=$O(@SDOEP) D CHLD^SDCODEL(SDOEP,0)
  1. . E D
  1. EDIT .. F PXUTNODE=0,21,150,800,811,812 D
  1. ... S (^TMP("PXK",$J,"VST",1,PXUTNODE,"AFTER"),^TMP("PXK",$J,"VST",1,PXUTNODE,"BEFORE"))=$G(^AUPNVSIT(PXUTSVST,PXUTNODE))
  1. .. S $P(^TMP("PXK",$J,"VST",1,0,"AFTER"),"^",8)=PXUTSTOP
  1. .. S ^TMP("PXK",$J,"VST",1,"IEN")=PXUTSVST
  1. ;
  1. E I $G(PXUTVST)>0 D
  1. CREATE . F PXUTNODE=150,800,811 D
  1. .. S ^TMP("PXK",$J,"VST",1,PXUTNODE,"AFTER")=""
  1. .. S ^TMP("PXK",$J,"VST",1,PXUTNODE,"BEFORE")=""
  1. . S ^TMP("PXK",$J,"VST",1,21,"AFTER")=$G(^AUPNVSIT(PXUTVST,21))
  1. . S ^TMP("PXK",$J,"VST",1,21,"BEFORE")=""
  1. . S ^TMP("PXK",$J,"VST",1,150,"AFTER")="^^S"
  1. . S ^TMP("PXK",$J,"VST",1,150,"BEFORE")=""
  1. . S ^TMP("PXK",$J,"VST",1,812,"AFTER")="^^"_PXUTSOR
  1. . S ^TMP("PXK",$J,"VST",1,812,"BEFORE")=""
  1. . S PXUAFTER=$G(^AUPNVSIT(PXUTVST,0))
  1. . S ^TMP("PXK",$J,"VST",1,0,"AFTER")=$P(PXUAFTER,"^",1)_"^^^^"_$P(PXUAFTER,"^",5,6)_"^^"_PXUTSTOP_"^^^^"_PXUTVST_"^^^^^^^^^"_$P(PXUAFTER,"^",21,22)
  1. . S ^TMP("PXK",$J,"VST",1,0,"BEFORE")=""
  1. . S ^TMP("PXK",$J,"VST",1,"IEN")=""
  1. E Q -1
  1. ;
  1. S ^TMP("PXK",$J,"SOR")=PXUTSOR
  1. D EN1^PXKMAIN
  1. S PXUTRET=^TMP("PXK",$J,"VST",1,"IEN")
  1. D EVENT^PXKMAIN
  1. K ^TMP("PXK",$J)
  1. I PXUTRET>0,$G(PXUTSVST)>0,PXUTSTOP="@" D
  1. . N PXUTKILL
  1. . S PXUTKILL=$$KILL^VSITKIL(PXUTSVST)
  1. . S:'PXUTKILL PXUTRET=0 ; visit was killed
  1. D MODIFIED^VSIT(PXUTVST)
  1. Q PXUTRET
  1. ;
  1. ;
  1. ;
  1. ;
  1. DEAD(VSIT) ;---*** ADDED IN ALBANY BY VAUGHN
  1. ;--TO KILL LEFT OVER CREDIT STOP ENTRY THAT IS NOT DELETED
  1. ;-added next line to quit
  1. Q:$G(VSIT)<1
  1. N DEAD,CHILD
  1. S CHILD=0 F S CHILD=$O(^AUPNVSIT("AD",VSIT,CHILD)) Q:CHILD="" D
  1. .I $P($G(^AUPNVSIT(CHILD,0)),"^",8)="",$P($G(^AUPNVSIT(CHILD,0)),"^",9)<1,$P($G(^AUPNVSIT(CHILD,150)),"^",3)="C" S DEAD=$$KILL^VSITKIL(CHILD)
  1. ;-----END OF ADDED CODE VAUGHN----
  1. ;