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