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

SCCVEAE.m

Go to the documentation of this file.
  1. SCCVEAE ;ALB/RMO,TMP - Add/Edit Conversion; [ 03/31/95 3:11 PM ]
  1. ;;5.3;Scheduling;**211**;Aug 13, 1993
  1. ;
  1. EN(SCCVEVT,SCSTDT,SCENDT,SCLOG,SCREQ,SCSTOPF) ;Entry point to loop through all add/edits for a specified date range
  1. ; Input -- SCCVEVT Conversion event
  1. ; SCSTST Start date
  1. ; SCENDT End date
  1. ; SCLOG Scheduling conversion log IEN
  1. ; SCREQ Scheduling conversion request IEN
  1. ; Output -- SCSTOPF Conversion stop flag
  1. N SCDTM
  1. F SCDTM=SCSTDT:0 S SCDTM=$O(^SDV(SCDTM)) Q:'SCDTM!($P(SCDTM,".")>SCENDT)!($G(SCSTOPF)) D STOPS(SCCVEVT,SCDTM,SCLOG,SCREQ,.SCSTOPF)
  1. ENQ Q
  1. ;
  1. STOPS(SCCVEVT,SCDTM,SCLOG,SCREQ,SCSTOPF) ;Loop through stop codes for a specific date/time
  1. ; Input -- SCCVEVT Conversion event
  1. ; SCDTM Visit date/time
  1. ; SCLOG Scheduling conversion log IEN
  1. ; SCREQ Scheduling conversion request IEN
  1. ; Output -- SCSTOPF Conversion stop flag
  1. N SCDA,SCQUIT,SC0,SCE,SCE0,X
  1. IF SCCVEVT D ZERO(SCDTM)
  1. S SCDA=0
  1. F S SCDA=$O(^SDV(SCDTM,"CS",SCDA)) Q:'SCDA!($G(SCSTOPF)) I $D(^SDV(SCDTM,"CS",SCDA,0)) S SC0=^(0),SCQUIT=0 D
  1. .I $P(SC0,U,8) D Q:SCQUIT ; Is 'parent encounter' invalid?
  1. .. S SCE=+$P($G(^SCE(+$P(SC0,U,8),0)),U,6)
  1. .. Q:'SCE ;Encounter IS a parent, so it's OK to process
  1. .. ;Check parents of children for validity
  1. .. S SCE0=$G(^SCE(SCE,0))
  1. .. ;
  1. .. ;'Estimate' processes Add/Edit data separate from 'parent' to avoid counting them twice, so the following checks are necessary to be sure the parent was a valid appt
  1. .. I $P(SCE0,U,8)=1 S X=$G(^DPT(+$P(SCE0,U,2),"S",+SCE0,0)) IF $P(X,U,2)'="",$P(X,U,2)'="I" S SCQUIT=1 Q ;Don't convert or add to estimate counts if children of an invalid appt
  1. .. I $P(SCE0,U,8)=3 S X=$G(^DPT(+$P(SCE0,U,2),"DIS",9999999-SCE0,0)) IF $P(X,U,2)=2 S SCQUIT=1 Q ;Don't convert or add to estimate counts if children of an invalid disposition
  1. .. IF $P(SCE0,U,5),'$P($G(^SCE(SCE,"CNV")),U,4) S SCQUIT=1 Q ; -- visit already exists / not historial visit
  1. .. I SCCVEVT,'$P(SCE0,U,5) S SCQUIT=1 ;Parent has no visit, don't convert children
  1. .. ;
  1. . D EN^SCCVEAE1(SCCVEVT,SCDTM,SCDA,0,SCLOG)
  1. . I $G(SCLOG) D STOP^SCCVLOG(SCLOG,SCREQ,.SCSTOPF)
  1. . I '$G(SCLOG) S SCTOT("OK")=1
  1. STOPQ Q
  1. ;
  1. ZERO(SCDTM) ; -- fix zeroth if missing
  1. IF '$D(^SDV(SCDTM,"CS",0)),$O(^SDV(SCDTM,"CS",0)) S ^SDV(SCDTM,"CS",0)="^409.51P^^"
  1. Q
  1. ;