source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCCVEAE.m@ 1582

Last change on this file since 1582 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.3 KB
Line 
1SCCVEAE ;ALB/RMO,TMP - Add/Edit Conversion; [ 03/31/95 3:11 PM ]
2 ;;5.3;Scheduling;**211**;Aug 13, 1993
3 ;
4EN(SCCVEVT,SCSTDT,SCENDT,SCLOG,SCREQ,SCSTOPF) ;Entry point to loop through all add/edits for a specified date range
5 ; Input -- SCCVEVT Conversion event
6 ; SCSTST Start date
7 ; SCENDT End date
8 ; SCLOG Scheduling conversion log IEN
9 ; SCREQ Scheduling conversion request IEN
10 ; Output -- SCSTOPF Conversion stop flag
11 N SCDTM
12 F SCDTM=SCSTDT:0 S SCDTM=$O(^SDV(SCDTM)) Q:'SCDTM!($P(SCDTM,".")>SCENDT)!($G(SCSTOPF)) D STOPS(SCCVEVT,SCDTM,SCLOG,SCREQ,.SCSTOPF)
13ENQ Q
14 ;
15STOPS(SCCVEVT,SCDTM,SCLOG,SCREQ,SCSTOPF) ;Loop through stop codes for a specific date/time
16 ; Input -- SCCVEVT Conversion event
17 ; SCDTM Visit date/time
18 ; SCLOG Scheduling conversion log IEN
19 ; SCREQ Scheduling conversion request IEN
20 ; Output -- SCSTOPF Conversion stop flag
21 N SCDA,SCQUIT,SC0,SCE,SCE0,X
22 IF SCCVEVT D ZERO(SCDTM)
23 S SCDA=0
24 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
25 .I $P(SC0,U,8) D Q:SCQUIT ; Is 'parent encounter' invalid?
26 .. S SCE=+$P($G(^SCE(+$P(SC0,U,8),0)),U,6)
27 .. Q:'SCE ;Encounter IS a parent, so it's OK to process
28 .. ;Check parents of children for validity
29 .. S SCE0=$G(^SCE(SCE,0))
30 .. ;
31 .. ;'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
32 .. 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
33 .. 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
34 .. IF $P(SCE0,U,5),'$P($G(^SCE(SCE,"CNV")),U,4) S SCQUIT=1 Q ; -- visit already exists / not historial visit
35 .. I SCCVEVT,'$P(SCE0,U,5) S SCQUIT=1 ;Parent has no visit, don't convert children
36 .. ;
37 . D EN^SCCVEAE1(SCCVEVT,SCDTM,SCDA,0,SCLOG)
38 . I $G(SCLOG) D STOP^SCCVLOG(SCLOG,SCREQ,.SCSTOPF)
39 . I '$G(SCLOG) S SCTOT("OK")=1
40STOPQ Q
41 ;
42ZERO(SCDTM) ; -- fix zeroth if missing
43 IF '$D(^SDV(SCDTM,"CS",0)),$O(^SDV(SCDTM,"CS",0)) S ^SDV(SCDTM,"CS",0)="^409.51P^^"
44 Q
45 ;
Note: See TracBrowser for help on using the repository browser.