SCCVU ;ALB/RMO,TMP - Encounter Conversion Utilities; [ 08/02/95 10:15 AM ]
;;5.3;Scheduling;**211**;Aug 13, 1993
;
INACT(SCDT) ; -- Check if encounter is "inactive"
;An inactive encounter is "an encounter which occurred prior
;to the beginning of the last fiscal year"
; Input -- SCDT Date
; Output -- 1=Yes and 0=No
N X,X1,X2
S X1=($E(DT,1,3)-$S($E(DT,4,5)>9:1,1:2))_"1001",X2=-1 D C^%DTC
Q $S(SCDT>X:0,1:1)
;
CON(SCOE) ; -- Check if encounter has already been converted
; Input -- SCOE Outpatient encounter IEN
; Output -- 1=Yes and 0=No
N SCOE0,SCORG,Y
S SCOE0=$G(^SCE(+SCOE,0)),SCORG=+$P(SCOE0,U,8)
I SCORG=1 D ;appointment
. S Y=+$P($G(^DPT(+$P(SCOE0,U,2),"S",+SCOE0,0)),U,23)
I SCORG=2 D ;add/edit
. S Y=+$P($G(^SDV($$SDVIEN(+$P(SCOE0,U,2),+SCOE0),"CS",+$P(SCOE0,U,9),0)),U,9)
I SCORG=3 D ;disposition
. S Y=+$P($G(^DPT(+$P(SCOE0,U,2),"DIS",9999999-SCOE0,0)),U,19)
Q +$G(Y)
;
PAUSE ;
N DIR
W ! S DIR(0)="E",DIR("A")="Press Return to Continue" D ^DIR K DIR W !
Q
;
CCREATE(SCOE) ; Check if encounter or its visit was created by the conversion
; routines
; SCOE = ien of the encounter
; RETURNS:
; 0 if neither the encounter nor the visit were created by the
; conversion
; 1 if the encounter and visit were created by the conversion
; 2 if the visit only was created by the conversion
;
N SCCVNV,STAT
;
S STAT=0
; In encounter, if conversion completed flag is set, the visit had to
; have been created by the conversion routines
S SCCVNV=$G(^SCE(SCOE,"CNV"))
I +SCCVNV,$P(SCCVNV,U,4) S STAT=1 ; encounter created and completed
I 'SCCVNV,$P(SCCVNV,U,4) S STAT=2 ; encounter not created, but completed
Q STAT
;
OK(SCMODE) ; -- is it ok to allow conversion and re-conversion (for testing)
; input: SCMODE := 1 - interactive | 0 - silent
;
N SCOK
S SCOK=1 ; <<-- set this flag to 1 allow all functionality, 0 otherwise
IF SCMODE,SCOK=0 D
. W !!,"Conversion functionality is disabled." D PAUSE
Q +$G(SCOK)
;
SDVIEN(DFN,DATE) ; -- get sdv ien for patient/date-time
Q +$G(^SDV("ADT",+DFN,+$P(DATE,".")))
;
ENDDATE() ; -- conversion end date
N Y
S Y=$$FMDATE^SCDXUTL()
IF Y S Y=$$FMADD^XLFDT(Y,-1)
IF 'Y S Y=2960930
Q Y
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCCVU 2290 printed Nov 22, 2024@17:48:59 Page 2
SCCVU ;ALB/RMO,TMP - Encounter Conversion Utilities; [ 08/02/95 10:15 AM ]
+1 ;;5.3;Scheduling;**211**;Aug 13, 1993
+2 ;
INACT(SCDT) ; -- Check if encounter is "inactive"
+1 ;An inactive encounter is "an encounter which occurred prior
+2 ;to the beginning of the last fiscal year"
+3 ; Input -- SCDT Date
+4 ; Output -- 1=Yes and 0=No
+5 NEW X,X1,X2
+6 SET X1=($EXTRACT(DT,1,3)-$SELECT($EXTRACT(DT,4,5)>9:1,1:2))_"1001"
SET X2=-1
DO C^%DTC
+7 QUIT $SELECT(SCDT>X:0,1:1)
+8 ;
CON(SCOE) ; -- Check if encounter has already been converted
+1 ; Input -- SCOE Outpatient encounter IEN
+2 ; Output -- 1=Yes and 0=No
+3 NEW SCOE0,SCORG,Y
+4 SET SCOE0=$GET(^SCE(+SCOE,0))
SET SCORG=+$PIECE(SCOE0,U,8)
+5 ;appointment
IF SCORG=1
Begin DoDot:1
+6 SET Y=+$PIECE($GET(^DPT(+$PIECE(SCOE0,U,2),"S",+SCOE0,0)),U,23)
End DoDot:1
+7 ;add/edit
IF SCORG=2
Begin DoDot:1
+8 SET Y=+$PIECE($GET(^SDV($$SDVIEN(+$PIECE(SCOE0,U,2),+SCOE0),"CS",+$PIECE(SCOE0,U,9),0)),U,9)
End DoDot:1
+9 ;disposition
IF SCORG=3
Begin DoDot:1
+10 SET Y=+$PIECE($GET(^DPT(+$PIECE(SCOE0,U,2),"DIS",9999999-SCOE0,0)),U,19)
End DoDot:1
+11 QUIT +$GET(Y)
+12 ;
PAUSE ;
+1 NEW DIR
+2 WRITE !
SET DIR(0)="E"
SET DIR("A")="Press Return to Continue"
DO ^DIR
KILL DIR
WRITE !
+3 QUIT
+4 ;
CCREATE(SCOE) ; Check if encounter or its visit was created by the conversion
+1 ; routines
+2 ; SCOE = ien of the encounter
+3 ; RETURNS:
+4 ; 0 if neither the encounter nor the visit were created by the
+5 ; conversion
+6 ; 1 if the encounter and visit were created by the conversion
+7 ; 2 if the visit only was created by the conversion
+8 ;
+9 NEW SCCVNV,STAT
+10 ;
+11 SET STAT=0
+12 ; In encounter, if conversion completed flag is set, the visit had to
+13 ; have been created by the conversion routines
+14 SET SCCVNV=$GET(^SCE(SCOE,"CNV"))
+15 ; encounter created and completed
IF +SCCVNV
IF $PIECE(SCCVNV,U,4)
SET STAT=1
+16 ; encounter not created, but completed
IF 'SCCVNV
IF $PIECE(SCCVNV,U,4)
SET STAT=2
+17 QUIT STAT
+18 ;
OK(SCMODE) ; -- is it ok to allow conversion and re-conversion (for testing)
+1 ; input: SCMODE := 1 - interactive | 0 - silent
+2 ;
+3 NEW SCOK
+4 ; <<-- set this flag to 1 allow all functionality, 0 otherwise
SET SCOK=1
+5 IF SCMODE
IF SCOK=0
Begin DoDot:1
+6 WRITE !!,"Conversion functionality is disabled."
DO PAUSE
End DoDot:1
+7 QUIT +$GET(SCOK)
+8 ;
SDVIEN(DFN,DATE) ; -- get sdv ien for patient/date-time
+1 QUIT +$GET(^SDV("ADT",+DFN,+$PIECE(DATE,".")))
+2 ;
ENDDATE() ; -- conversion end date
+1 NEW Y
+2 SET Y=$$FMDATE^SCDXUTL()
+3 IF Y
SET Y=$$FMADD^XLFDT(Y,-1)
+4 IF 'Y
SET Y=2960930
+5 QUIT Y
+6 ;