SDCO21 ;ALB/RMO - Classification Cont. - Check Out;30 MAR 1993 2:10 pm ; 3/12/04 4:33pm
;;5.3;Scheduling;**150,244,325,441**;Aug 13, 1993;Build 14
;
CL(DFN,SDDT,SDOE,SDCLY) ;Build Classification Array
; Input -- DFN Patient file IEN
; SDDT Date/Time
; SDOE Outpatient Encounter file IEN [Optional]
; Output -- SDCLY Classification Array
; Subscripted by Class. Type file (#409.41) IEN
N SDCTI
S SDCTI=0 F S SDCTI=$O(^SD(409.41,SDCTI)) Q:'SDCTI I $$SCR(SDCTI,DFN,SDDT,$G(SDOE)) S SDCLY(SDCTI)=""
CLQ Q
;
SCR(SDCTI,DFN,SDDT,SDOE) ;Outpatient Classification Type Screen
; Input -- SDCTI Outpatient Classification Type IEN
; DFN Patient file IEN
; SDDT Date/Time
; SDOE Outpatient Encounter file IEN [Optional]
; Output -- 1=Yes and 0=No
N Y
I $$ACT^SDCODD(SDCTI,SDDT) D
.I $D(^SD(409.41,SDCTI,1)) X ^(1) Q:'$T
.S Y=1
SCRQ Q +$G(Y)
;
CLOE(SDOE,SDCLOEY) ;Set-up Classification Array for Outpatient Encounter
; Input -- SDOE Outpatient Encounter file IEN
; Output -- SDCLOEY Classification Array Set for Outpatient Encounter
; Subscripted by Class Type file IEN
; Null or 409.42 IEN^Internal Value^1=n/a^1=unedt
N SDCLY,SDCN0,SDCNI,SDCTI,SDCTIS,SDCTS,SDOE0
S SDOE0=$G(^SCE(+SDOE,0))
D CL($P(SDOE0,"^",2),+SDOE0,SDOE,.SDCLY)
S SDCTI=0 F S SDCTI=$O(^SDD(409.42,"AO",SDOE,SDCTI)) Q:'SDCTI S SDCNI=+$O(^(SDCTI,0)) I $D(^SDD(409.42,SDCNI,0)) S SDCN0=^(0) D
.S SDCLY(SDCTI)=SDCNI_"^"_$P(SDCN0,"^",3)_"^"_$S('$D(SDCLY(SDCTI)):1,1:"")_"^"_$S($P(SDOE0,"^",10)=2:1,1:"")
S SDCTIS=$$SEQ
F SDCTS=1:1 S SDCTI=+$P(SDCTIS,",",SDCTS) Q:'SDCTI I $D(SDCLY(SDCTI)) S SDCLOEY(SDCTI)=SDCLY(SDCTI)
CLOEQ Q
;
SC(SDCTI,SDOE,SDSELY,SDCLOEY) ;Service Connected Classification Checks
N SDCHGF,SDCLOE,SDSEL
S SDSEL=$S(SDCTI=1:2,SDCTI=2:3,SDCTI=4:4,1:"") G SCQ:SDSEL=""
D CHK(SDOE,SDCTI,.SDCLOE)
I $D(SDCLOE) D G SCQ
.I SDCLOE,$P(SDCLOE,"^",3) S SDCHGF=1
.I SDCLOE="" S SDCHGF=1
.I $G(SDCHGF) S:$D(SDSELY) SDSELY(SDSEL)="" S SDCLOEY(SDCTI)=SDCLOE
I '$D(SDCLOE) D
.K SDCLOEY(SDCTI)
SCQ Q
;
CHK(SDOE,SDCTI,SDCLOE) ;Check One Classification for Outpatient Encounter
; Input -- SDOE Outpatient Encounter file IEN
; SDCTI Outpatient Classification Type IEN
; Output -- SDCLOE Null or 409.42 IEN^Internal Value^1=n/a^1=unedt
N DFN,SDCL,SDCNI,SDDT,SDOE0
S SDOE0=$G(^SCE(+SDOE,0))
S DFN=+$P(SDOE0,"^",2),SDDT=+SDOE0
I $$SCR(SDCTI,DFN,SDDT,SDOE) S SDCL=""
S SDCNI=+$O(^SDD(409.42,"AO",SDOE,SDCTI,0))
I $D(^SDD(409.42,SDCNI,0)) S SDCL=SDCNI_"^"_$P(^(0),"^",3)_"^"_$S('$D(SDCL):1,1:"")_"^"_$S($P(SDOE0,"^",10)=2:1,1:"")
I $D(SDCL) S SDCLOE=SDCL
CHKQ Q
;
SEQ() ;Classification Type Sequence by IEN
; Input -- None
; Output -- Classification Type Sequence by IEN
; Current Sequence is: SC, CV, AO, IR, EC, SHAD, MST, HNC
Q "3,7,1,2,4,8,5,6"
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDCO21 3010 printed Dec 13, 2024@02:49:20 Page 2
SDCO21 ;ALB/RMO - Classification Cont. - Check Out;30 MAR 1993 2:10 pm ; 3/12/04 4:33pm
+1 ;;5.3;Scheduling;**150,244,325,441**;Aug 13, 1993;Build 14
+2 ;
CL(DFN,SDDT,SDOE,SDCLY) ;Build Classification Array
+1 ; Input -- DFN Patient file IEN
+2 ; SDDT Date/Time
+3 ; SDOE Outpatient Encounter file IEN [Optional]
+4 ; Output -- SDCLY Classification Array
+5 ; Subscripted by Class. Type file (#409.41) IEN
+6 NEW SDCTI
+7 SET SDCTI=0
FOR
SET SDCTI=$ORDER(^SD(409.41,SDCTI))
if 'SDCTI
QUIT
IF $$SCR(SDCTI,DFN,SDDT,$GET(SDOE))
SET SDCLY(SDCTI)=""
CLQ QUIT
+1 ;
SCR(SDCTI,DFN,SDDT,SDOE) ;Outpatient Classification Type Screen
+1 ; Input -- SDCTI Outpatient Classification Type IEN
+2 ; DFN Patient file IEN
+3 ; SDDT Date/Time
+4 ; SDOE Outpatient Encounter file IEN [Optional]
+5 ; Output -- 1=Yes and 0=No
+6 NEW Y
+7 IF $$ACT^SDCODD(SDCTI,SDDT)
Begin DoDot:1
+8 IF $DATA(^SD(409.41,SDCTI,1))
XECUTE ^(1)
if '$TEST
QUIT
+9 SET Y=1
End DoDot:1
SCRQ QUIT +$GET(Y)
+1 ;
CLOE(SDOE,SDCLOEY) ;Set-up Classification Array for Outpatient Encounter
+1 ; Input -- SDOE Outpatient Encounter file IEN
+2 ; Output -- SDCLOEY Classification Array Set for Outpatient Encounter
+3 ; Subscripted by Class Type file IEN
+4 ; Null or 409.42 IEN^Internal Value^1=n/a^1=unedt
+5 NEW SDCLY,SDCN0,SDCNI,SDCTI,SDCTIS,SDCTS,SDOE0
+6 SET SDOE0=$GET(^SCE(+SDOE,0))
+7 DO CL($PIECE(SDOE0,"^",2),+SDOE0,SDOE,.SDCLY)
+8 SET SDCTI=0
FOR
SET SDCTI=$ORDER(^SDD(409.42,"AO",SDOE,SDCTI))
if 'SDCTI
QUIT
SET SDCNI=+$ORDER(^(SDCTI,0))
IF $DATA(^SDD(409.42,SDCNI,0))
SET SDCN0=^(0)
Begin DoDot:1
+9 SET SDCLY(SDCTI)=SDCNI_"^"_$PIECE(SDCN0,"^",3)_"^"_$SELECT('$DATA(SDCLY(SDCTI)):1,1:"")_"^"_$SELECT($PIECE(SDOE0,"^",10)=2:1,1:"")
End DoDot:1
+10 SET SDCTIS=$$SEQ
+11 FOR SDCTS=1:1
SET SDCTI=+$PIECE(SDCTIS,",",SDCTS)
if 'SDCTI
QUIT
IF $DATA(SDCLY(SDCTI))
SET SDCLOEY(SDCTI)=SDCLY(SDCTI)
CLOEQ QUIT
+1 ;
SC(SDCTI,SDOE,SDSELY,SDCLOEY) ;Service Connected Classification Checks
+1 NEW SDCHGF,SDCLOE,SDSEL
+2 SET SDSEL=$SELECT(SDCTI=1:2,SDCTI=2:3,SDCTI=4:4,1:"")
if SDSEL=""
GOTO SCQ
+3 DO CHK(SDOE,SDCTI,.SDCLOE)
+4 IF $DATA(SDCLOE)
Begin DoDot:1
+5 IF SDCLOE
IF $PIECE(SDCLOE,"^",3)
SET SDCHGF=1
+6 IF SDCLOE=""
SET SDCHGF=1
+7 IF $GET(SDCHGF)
if $DATA(SDSELY)
SET SDSELY(SDSEL)=""
SET SDCLOEY(SDCTI)=SDCLOE
End DoDot:1
GOTO SCQ
+8 IF '$DATA(SDCLOE)
Begin DoDot:1
+9 KILL SDCLOEY(SDCTI)
End DoDot:1
SCQ QUIT
+1 ;
CHK(SDOE,SDCTI,SDCLOE) ;Check One Classification for Outpatient Encounter
+1 ; Input -- SDOE Outpatient Encounter file IEN
+2 ; SDCTI Outpatient Classification Type IEN
+3 ; Output -- SDCLOE Null or 409.42 IEN^Internal Value^1=n/a^1=unedt
+4 NEW DFN,SDCL,SDCNI,SDDT,SDOE0
+5 SET SDOE0=$GET(^SCE(+SDOE,0))
+6 SET DFN=+$PIECE(SDOE0,"^",2)
SET SDDT=+SDOE0
+7 IF $$SCR(SDCTI,DFN,SDDT,SDOE)
SET SDCL=""
+8 SET SDCNI=+$ORDER(^SDD(409.42,"AO",SDOE,SDCTI,0))
+9 IF $DATA(^SDD(409.42,SDCNI,0))
SET SDCL=SDCNI_"^"_$PIECE(^(0),"^",3)_"^"_$SELECT('$DATA(SDCL):1,1:"")_"^"_$SELECT($PIECE(SDOE0,"^",10)=2:1,1:"")
+10 IF $DATA(SDCL)
SET SDCLOE=SDCL
CHKQ QUIT
+1 ;
SEQ() ;Classification Type Sequence by IEN
+1 ; Input -- None
+2 ; Output -- Classification Type Sequence by IEN
+3 ; Current Sequence is: SC, CV, AO, IR, EC, SHAD, MST, HNC
+4 QUIT "3,7,1,2,4,8,5,6"