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

PXCEVFI5.m

Go to the documentation of this file.
  1. PXCEVFI5 ;ISL/dee - Check to see if the encounter is a standalone and if it needs to be deleted ;3/17/04 12:24pm
  1. ;;1.0;PCE PATIENT CARE ENCOUNTER;**14,99,124,199**;Aug 12, 1996;Build 51
  1. ;
  1. Q
  1. CHECK ;Check to see if this is a standalone and if it is make sure it has
  1. ; a procedure or stop code. If it does not have either then allow the
  1. ; user to continue editing it or to delete the encounter.
  1. ;Also check that if there are diagnoses for the encounter that one of
  1. ; them is primary.
  1. ;
  1. ;Quit if no visit ien
  1. I '$D(^AUPNVSIT(PXCEVIEN)) S PXCEEXIT=1 Q
  1. N PXCEVST0,PXCEPDX,PXCEAPPT
  1. S PXCEVST0=^AUPNVSIT(PXCEVIEN,0)
  1. ;Quit if Historical visit
  1. I $P(PXCEVST0,"^",7)="E" S PXCEEXIT=1 Q
  1. ;Get primary Dx if one
  1. I '$D(^AUPNVPOV("AD",PXCEVIEN)) S PXCEPDX=-1 ;no Dx so do not need a primary one
  1. E S PXCEPDX=$$PRIMVPOV^PXUTL1(PXCEVIEN)
  1. ;Get if there is an appointment
  1. S PXCEAPPT=$$VSTAPPT^PXUTL1(PXCEPAT,+PXCEVST0,$P(PXCEVST0,"^",22),PXCEVIEN)
  1. ;Quit if there is an appointment and primary Dx
  1. I PXCEPDX,PXCEAPPT S PXCEEXIT=1 Q
  1. ;Quit if there are procedures or stop codes and a primary Dx
  1. ;DROP PROCEDURE CHECK
  1. S PXCEEXIT=1 Q
  1. ;
  1. I PXCEPDX,$D(^AUPNVCPT("AD",PXCEVIEN))!($D(^AUPNVSIT("AD",PXCEVIEN))) S PXCEEXIT=1 Q
  1. N DIR,X,Y,PXCECNT
  1. S DIR("B")="NO"
  1. S DIR(0)="Y"
  1. S PXCECNT=1
  1. I 'PXCEPDX D
  1. . S DIR("A",PXCECNT)="None of the diagnoses for this encounter are Primary."
  1. . S PXCECNT=PXCECNT+1
  1. I 'PXCEAPPT,'$D(^AUPNVCPT("AD",PXCEVIEN)),'$D(^AUPNVSIT("AD",PXCEVIEN)) D
  1. . I $G(PXQUIT) D Q
  1. .. N DIR
  1. .. S DIR(0)="FOA"
  1. .. S DIR("A",1)="This encounter does not have a procedure, it will be DELETED."
  1. .. S DIR("A")="Press any key to continue: "
  1. .. D ^DIR
  1. .. I $$DELVFILE^PXAPI("ALL",PXCEVIEN)
  1. . S DIR("A",PXCECNT)="This encounter must have a procedure."
  1. . S PXCECNT=PXCECNT+1
  1. . S DIR("A",PXCECNT)="It will be deleted if a procedure is not added."
  1. . S PXCECNT=PXCECNT+1
  1. . S DIR("A")="Delete this encounter"
  1. . D ^DIR
  1. . I Y=1 D
  1. .. I $$DELVFILE^PXAPI("ALL",PXCEVIEN)
  1. .. S PXCEEXIT=1
  1. . E S PXCEEXIT=0
  1. E D
  1. . S DIR("A")="Quit anyway"
  1. . D ^DIR
  1. . I Y=0 S PXCEEXIT=0
  1. . E S PXCEEXIT=1
  1. Q
  1. ;