[613] | 1 | SCCVEDI3 ;ALB/RMO,TMP - Disposition Conversion cont.; [ 04/05/95 8:12 AM ]
|
---|
| 2 | ;;5.3;Scheduling;**211**;Aug 13, 1993
|
---|
| 3 | ;
|
---|
| 4 | SET(SCCVEVT,SCLOG,DFN,SCOE,SCCV) ;Set variables
|
---|
| 5 | ; Input -- SCCVEVT Conversion event
|
---|
| 6 | ; SCLOG Scheduling conversion log IEN
|
---|
| 7 | ; DFN Patient IEN
|
---|
| 8 | ; Output -- SCOE Outpatient encounter IEN
|
---|
| 9 | ; SCCV Conversion array:
|
---|
| 10 | ; SCCV("EVT") Conversion event
|
---|
| 11 | ; ("LOG") Scheduling conversion log IEN
|
---|
| 12 | ; ("NEW") Outpatient encounter
|
---|
| 13 | ; created by conversion flag
|
---|
| 14 | ; 0 = no new encounter or visit
|
---|
| 15 | ; 1 = new encounter and visit
|
---|
| 16 | ; 2 = new visit only
|
---|
| 17 | ; ("OE",0) Outpatient encounter 0th node
|
---|
| 18 | ; ("DISP",0) Disposition log-in date/time 0th node
|
---|
| 19 | ; ("ERR") Code for specific error, if any
|
---|
| 20 | ; ("VST") Visit file IEN
|
---|
| 21 | N SCOE0
|
---|
| 22 | S SCCV("EVT")=SCCVEVT
|
---|
| 23 | S SCCV("LOG")=+SCLOG,SCCV("ORG")=3
|
---|
| 24 | S SCCV("DISP",0)=$G(^DPT(DFN,"DIS",9999999-SCDTM,0))
|
---|
| 25 | I $D(SCCVDIS) D ;Find default disp. clinic for division
|
---|
| 26 | . S SCCV("LOC")=+$G(SCCVDIS(+$P(SCCV("DISP",0),U,4)))
|
---|
| 27 | . I 'SCCV("LOC"),$G(SCCVDIS(0)) S SCCV("LOC")=SCCVDIS(0)
|
---|
| 28 | S SCOE=+$P(SCCV("DISP",0),U,18),SCOE0=$G(^SCE(SCOE,0))
|
---|
| 29 | ;
|
---|
| 30 | ; On re-convert, delete previously converted data
|
---|
| 31 | I SCCVEVT=2 D
|
---|
| 32 | . ; only delete for reconvert if we created the encounter or completed
|
---|
| 33 | . ; the conversion by adding the visit
|
---|
| 34 | . Q:'$$CCREATE^SCCVU(SCOE)
|
---|
| 35 | . ;
|
---|
| 36 | . D RECNVT^SCCVEAP3(SCOE,SCOE0,.SCCONS)
|
---|
| 37 | . S SCOE0=$G(^SCE(SCOE,0)) S:SCOE0="" SCOE=0
|
---|
| 38 | ;
|
---|
| 39 | S SCCV("NEW")=$S('SCOE:1,'$P(SCOE0,U,5):2,1:0)
|
---|
| 40 | ;
|
---|
| 41 | I 'SCCV("NEW") G SETQ ;Already has enctr and visit
|
---|
| 42 | ;
|
---|
| 43 | ; If estimating, increment total number of encounters that would be
|
---|
| 44 | ; created by the conversion
|
---|
| 45 | I 'SCCVEVT D INCRTOT^SCCVEGU1(.SCTOT,SCCV("NEW")+6,1) D EN^SCCVZZ("DIS-"_(SCCV("NEW")+6),SCOE,SCDTM)
|
---|
| 46 | ;
|
---|
| 47 | G:'SCCVEVT SETQ ;Estimate exits here
|
---|
| 48 | ;
|
---|
| 49 | I 'SCOE D ;Needs both encounter and visit
|
---|
| 50 | . N SCCVT
|
---|
| 51 | . D SETSCCVT^SCCVEAP2(.SCCVT,.SCCONS)
|
---|
| 52 | . S SCOE=$$GETDISP^SDVSIT2(DFN,SCDTM)
|
---|
| 53 | . S:SCOE SCTOT(1.02)=$G(SCTOT(1.02))+1
|
---|
| 54 | . ;Check if child add/edits were auto-added (no children should be auto-created)
|
---|
| 55 | . I SCOE,$O(^SCE("APAR",SCOE,0)) D
|
---|
| 56 | .. N SCOEC,SCOE00
|
---|
| 57 | .. S SCOEC=0 F S SCOEC=$O(^SCE("APAR",SCOE,SCOEC)) Q:'SCOEC S SCOE00=$G(^SCE(SCOEC,0)) I $P(SCOE00,U,8)=2 D
|
---|
| 58 | ... N SCCV
|
---|
| 59 | ... S SCCV("NEW")=1
|
---|
| 60 | ... D ENC^SCCVEDI1(SCOEC,.SCCV)
|
---|
| 61 | ;
|
---|
| 62 | S SCCV("OE")=SCOE
|
---|
| 63 | S SCCV("OE",0)=$G(^SCE(SCOE,0))
|
---|
| 64 | S SCCV("VST")=$P(SCCV("OE",0),U,5)
|
---|
| 65 | S SCCV("REF")=9999999-SCDTM
|
---|
| 66 | ;
|
---|
| 67 | I 'SCCV("VST"),SCCV("NEW")'=1 D
|
---|
| 68 | . S SCCV("VST")=$$VISIT^SCCVEAP2(SCDTM,.SCCV) ; create visit only
|
---|
| 69 | ;
|
---|
| 70 | I SCCVEVT,'$G(SCCV("VST")),'$P(SCCV("OE",0),U,4) S SCCV("ERR")=8
|
---|
| 71 | SETQ Q
|
---|
| 72 | ;
|
---|