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

ECUTL0.m

Go to the documentation of this file.
  1. ECUTL0 ;ALB/ESD - Event Capture Eligibility and In/Outpat Utilities ;2/9/18 16:51
  1. ;;2.0;EVENT CAPTURE;**10,139**;8 May 96;Build 7
  1. ;
  1. ;
  1. CHKDSS(DSSU,INOUT) ; Determine if DSS Unit is sending data to PCE
  1. ;
  1. ; Input:
  1. ; DSSU - DSS Unit IEN
  1. ; INOUT - Inpatient or Outpatient
  1. ;
  1. ; Output:
  1. ; Function Value - 0 if DSS Unit not sending to PCE or input
  1. ; parameters not passed in
  1. ; 1 if DSS Unit sending to PCE
  1. ;
  1. N ECDSS,ECSEND
  1. ;
  1. ;- Drops out if invalid condition
  1. D
  1. . I '$G(DSSU),($G(INOUT)="") S ECDSS=0 Q
  1. .;
  1. .;- Get 'Send to PCE' field
  1. . S ECSEND=$P($G(^ECD(+DSSU,0)),"^",14)
  1. . I ECSEND="A" S ECDSS=1 ;139 Change logic to set to 1 if sending (asking SC related questions)
  1. . E S ECDSS=0 ;139 else we're not asking SC related questions
  1. Q ECDSS
  1. ;
  1. ;
  1. ELGLST() ; Display list of patient eligibilities and allow user to
  1. ; select eligibility, given ELIG^VADPT has been previously called.
  1. ;
  1. ; Input:
  1. ; None
  1. ; Output:
  1. ; Function value - IEN of eligibility from ELIGIBILITY CODE file
  1. ; (#8) or 0 if unsuccessful
  1. ;
  1. N ECALLEL,ECELIEN,ECELIG,ECPRIMEL
  1. S (ECELIEN,ECELIG)=0
  1. ;
  1. ;- If VAEL not previously called, exit with error condition
  1. I '$D(VAEL)!('$G(VAEL(1))) G ELGLSTQ
  1. ELIG S ECALLEL=""
  1. S ECPRIMEL=$P(VAEL(1),"^",2)
  1. W !!,"THIS PATIENT HAS OTHER ENTITLED ELIGIBILITIES:"
  1. ;
  1. ;- Display all of patient's eligibilities
  1. F ECELIEN=0:0 S ECELIEN=$O(VAEL(1,ECELIEN)) Q:'ECELIEN D
  1. . W !?5,$P(VAEL(1,ECELIEN),"^",2)
  1. . S ECALLEL=ECALLEL_"^"_$P(VAEL(1,ECELIEN),"^",2)
  1. ;
  1. ;- Use patient's primary elig as default
  1. CHOOSE W !!,"ENTER THE ELIGIBILITY FOR THIS APPOINTMENT: "_ECPRIMEL_"// "
  1. ;
  1. ;- If return, uparrow, or time out get prim elig w/o searching for match
  1. R X:DTIME G PRIMELG:"^"[X!('$T) S X=$$UPPER^VALM1(X) G ELIG:X["?",CHOOSE:ECALLEL'[("^"_X)
  1. S ECPRIMEL=X_$P($P(ECALLEL,"^"_X,2),"^")
  1. W $P($P(ECALLEL,"^"_X,2),"^")
  1. ;
  1. ;- If match found, exit with eligibility IEN from file #8
  1. F ECELIEN=0:0 S ECELIEN=$O(VAEL(1,ECELIEN)) Q:'ECELIEN I $P(VAEL(1,ECELIEN),"^",2)=ECPRIMEL S ECELIG=+ECELIEN G ELGLSTQ
  1. ;
  1. ;- If default or error cond exit with IEN of primary elig from file #8
  1. PRIMELG I ('$T)!(X["^") D ELIGERR^ECUTL0
  1. I ('$T)!(X["^")!($P(VAEL(1),"^",2)=ECPRIMEL) S ECELIG=+$P(VAEL(1),"^")
  1. ;
  1. ELGLSTQ Q ECELIG
  1. ;
  1. ;
  1. MULTELG(DFN) ; Determine if patient has multiple eligibilites (calls
  1. ; ELIG^VADPT).
  1. ;
  1. ; Input:
  1. ; DFN - IEN of Patient file (#2)
  1. ; Output:
  1. ; Function value - 0 if no additional eligibilities exist,
  1. ; otherwise a number greater than 0 if addt'l eligibilities exist
  1. ;
  1. D ELIG^VADPT
  1. Q +$O(VAEL(1,0))
  1. ;
  1. ;
  1. ASKIF(ELIGNM) ; Ask user whether to edit the eligibility during the edit
  1. ; of an existing EC Patient file (#721) record
  1. ;
  1. ; Input:
  1. ; ELIGNM - Eligibility Name
  1. ;
  1. ; Output:
  1. ; Function value - 1 if user wants to edit eligibility
  1. ; 0 if user does not want to edit eligibility
  1. ; -1 if uparrow or time out
  1. ;
  1. N DIR
  1. Q:$G(ELIGNM)="" 0
  1. ;- Display patient's current eligibility
  1. W !!,"The eligibility previously filed for this patient's procedure is:",!?5,ELIGNM,!!
  1. ;- Ask user
  1. S DIR(0)="YA"
  1. S DIR("A")="Do you wish to edit the patient's eligibility? "
  1. S DIR("B")="NO"
  1. D ^DIR
  1. Q $S($D(DIRUT):-1,'Y:0,1:Y)
  1. ;
  1. ;
  1. ELIGERR ; If user uparrows or times out while choosing eligibility, display
  1. ; primary eligibility msg to screen
  1. ;
  1. ; Input:
  1. ; None
  1. ;
  1. ; Output:
  1. ; Display primary eligibility message to screen
  1. ;
  1. W !!?5,"No eligibility entered. The primary eligibility of the patient"
  1. W !?5,"will be sent to PCE for workload reporting (if the patient's"
  1. W !?5,"procedure data is complete).",!
  1. Q
  1. ;
  1. ;
  1. INOUTPT(DFN,PROCDT) ; Determine inpatient/outpatient status
  1. ;
  1. ; Input:
  1. ; DFN - IEN of Patient file (#2)
  1. ; PROCDT - Procedure Date/Time
  1. ;
  1. ; Output:
  1. ; Function value - I if inpatient, O if outpatient, null if error
  1. ;
  1. N ECPTSTAT
  1. S ECPTSTAT=1
  1. I '$G(DFN)!('$G(PROCDT)) S ECPTSTAT=0
  1. ;
  1. ;- Call inpat/outpat function if both input variables are present
  1. I ECPTSTAT D
  1. . S ECPTSTAT=$$INP^SDAM2(DFN,PROCDT)
  1. . I $G(ECPTSTAT)="" S ECPTSTAT="O"
  1. ;
  1. ;- If either one of input variables are missing, return null (otherwise
  1. ; return "I" or "O")
  1. Q $S(ECPTSTAT=0:"",1:ECPTSTAT)
  1. ;
  1. ;
  1. DSPSTAT(ECSTAT) ; Display inpatient/outpatient status
  1. ;
  1. ; Input:
  1. ; ECSTAT - Inpatient/Outpatient status (I=inpatient, O=outpatient)
  1. ;
  1. ; Output:
  1. ; Display inpatient/outpatient status to screen
  1. ;
  1. N ECTXT
  1. S ECTXT="This patient is an "
  1. W !!,ECTXT_$S(ECSTAT="I":"Inpatient",1:"Outpatient"),!
  1. Q
  1. ;
  1. ;
  1. INOUTERR ; Display inpat/outpat status error msg to screen and set exit
  1. ; variable
  1. ;
  1. ; Input:
  1. ; None
  1. ;
  1. ; Output:
  1. ; Display error message to screen
  1. ;
  1. W !,"Patient record data or procedure date/time data is missing. No action taken."
  1. S ECOUT=1
  1. Q