DGPTAE03 ;ALB/MTC,HIOFO/FT - 501 Edit Checks Cont ;10/29/2014 3:42pm
;;5.3;Registration;**8,52,164,850,884**;Aug 13, 1993;Build 31
;
; ICDEX APIs - #5747
;
501 ;--Check elapsed days between movements vs leave and pass days
;
S (X2,X3,DGPTL3)=0 F DGPTL4=0:0 S DGPTL3=$O(^TMP("AEDIT",$J,"N501",DGPTL3)) Q:DGPTL3="" D
. S X3=$$FMDT^DGPT101($E(^TMP("AEDIT",$J,"N501",DGPTL3),31,36))_"."_$E(^TMP("AEDIT",$J,"N501",DGPTL3),37,40) I (X3<DGPTMDTS)&(X3>X2) S X2=X3
I X2=0 S X2=DGPTDTS
D ^%DTC I X>0,(X-DGPTMLD-DGPTMPD<0) S DGPTERC=543
K X,X1,X2,X3,DGPTL3,DGPTL4
Q
;
535 ;--Check elapsed days between movements vs leave and pass days
;
S (X2,X3,DGPTL3)=0 F DGPTL4=0:0 S DGPTL3=$O(^TMP("AEDIT",$J,"N535",DGPTL3)) Q:DGPTL3="" D
. S X3=$$FMDT^DGPT101($E(^TMP("AEDIT",$J,"N535",DGPTL3),31,36))_"."_$E(^TMP("AEDIT",$J,"N535",DGPTL3),37,40) I (X3<DGPTTDTS)&(X3>X2) S X2=X3
I X2=0 S X2=DGPTDTS
D ^%DTC I X>0,(X-DGPTTLD-DGPTTPD<0) S DGPTERC=543
K X,X1,X2,X3,DGPTL3,DGPTL4
Q
;
SP ; Spinal injury and related diagnosis edits
D EDIT I DGPTERC Q
D DIA
Q
EDIT ;
N FLAG,I
I "1234X "'[DGPTMSI S DGPTERC=509 Q
I DGPTSTTY="^"!(DGPTSTTY="") Q
I "1234X"[DGPTMSI S DGPTERC=509,FLAG=1 F I=10,11,30,40,42 S I=U_I_U I DGPTSTTY[I S DGPTERC=0,FLAG=0 Q
Q
DIA ; - Diagnosis check for Spinal Cord Injury
Q:(DGPTSTTY'["^10^")!(DGPTSTTY'["^11^")
N SYS,EFFDATE,IMPDATE,DGPTDAT
D EFFDATE^DGPTIC10($G(PTF))
S SYS=$$SYS^ICDEX("DIAG",EFFDATE)
I SYS=1 D
. I DGPTMSI="X"&((DGPTMD1?1"3440"1N)!(DGPTMD1=3441)!(DGPTMD2?1"3440"1N)!(DGPTMD2=3441)!(DGPTMD3?1"3440"1N)!(DGPTMD3=3441)!(DGPTMD4?1"3440"1N)!(DGPTMD4=3441)!(DGPTMD5?1"3440"1N)!(DGPTMD5=3441)) S DGPTERC=554 Q
. I "13"[DGPTMSI&((DGPTMD1'=3441)&(DGPTMD2'=3441)&(DGPTMD3'=3441)&(DGPTMD4'=3441)&(DGPTMD5'=3441)) S DGPTERC=554 Q
. I "24"[DGPTMSI&((DGPTMD1'?1"3440"1N)&(DGPTMD2'?1"3440"1N)&(DGPTMD3'?1"3440"1N)&(DGPTMD4'?1"3440"1N)&(DGPTMD5'?1"3440"1N)) S DGPTERC=554 Q
I SYS=30 D ;icd10
. N DGLOOP,DGPTDXCODE,DGPTFLAG
. S DGPTFLAG=0
. F DGLOOP=1:1:25 S DGPTDXCODE=@("DGPTMD"_DGLOOP) D Q:DGPTFLAG
.. I (DGPTDXCODE?1"G822"1N)!(DGPTDXCODE?1"G825"1N) S DGPTFLAG=1
. I DGPTMSI="X"&(DGPTFLAG=1) S DGPTERC=554 Q
. I "13"[DGPTMSI&(DGPTFLAG=1) S DGPTERC=554 Q
. I "24"[DGPTMSI&(DGPTFLAG=1) S DGPTERC=554 Q
. Q
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGPTAE03 2308 printed Oct 16, 2024@18:52:06 Page 2
DGPTAE03 ;ALB/MTC,HIOFO/FT - 501 Edit Checks Cont ;10/29/2014 3:42pm
+1 ;;5.3;Registration;**8,52,164,850,884**;Aug 13, 1993;Build 31
+2 ;
+3 ; ICDEX APIs - #5747
+4 ;
501 ;--Check elapsed days between movements vs leave and pass days
+1 ;
+2 SET (X2,X3,DGPTL3)=0
FOR DGPTL4=0:0
SET DGPTL3=$ORDER(^TMP("AEDIT",$JOB,"N501",DGPTL3))
if DGPTL3=""
QUIT
Begin DoDot:1
+3 SET X3=$$FMDT^DGPT101($EXTRACT(^TMP("AEDIT",$JOB,"N501",DGPTL3),31,36))_"."_$EXTRACT(^TMP("AEDIT",$JOB,"N501",DGPTL3),37,40)
IF (X3<DGPTMDTS)&(X3>X2)
SET X2=X3
End DoDot:1
+4 IF X2=0
SET X2=DGPTDTS
+5 DO ^%DTC
IF X>0
IF (X-DGPTMLD-DGPTMPD<0)
SET DGPTERC=543
+6 KILL X,X1,X2,X3,DGPTL3,DGPTL4
+7 QUIT
+8 ;
535 ;--Check elapsed days between movements vs leave and pass days
+1 ;
+2 SET (X2,X3,DGPTL3)=0
FOR DGPTL4=0:0
SET DGPTL3=$ORDER(^TMP("AEDIT",$JOB,"N535",DGPTL3))
if DGPTL3=""
QUIT
Begin DoDot:1
+3 SET X3=$$FMDT^DGPT101($EXTRACT(^TMP("AEDIT",$JOB,"N535",DGPTL3),31,36))_"."_$EXTRACT(^TMP("AEDIT",$JOB,"N535",DGPTL3),37,40)
IF (X3<DGPTTDTS)&(X3>X2)
SET X2=X3
End DoDot:1
+4 IF X2=0
SET X2=DGPTDTS
+5 DO ^%DTC
IF X>0
IF (X-DGPTTLD-DGPTTPD<0)
SET DGPTERC=543
+6 KILL X,X1,X2,X3,DGPTL3,DGPTL4
+7 QUIT
+8 ;
SP ; Spinal injury and related diagnosis edits
+1 DO EDIT
IF DGPTERC
QUIT
+2 DO DIA
+3 QUIT
EDIT ;
+1 NEW FLAG,I
+2 IF "1234X "'[DGPTMSI
SET DGPTERC=509
QUIT
+3 IF DGPTSTTY="^"!(DGPTSTTY="")
QUIT
+4 IF "1234X"[DGPTMSI
SET DGPTERC=509
SET FLAG=1
FOR I=10,11,30,40,42
SET I=U_I_U
IF DGPTSTTY[I
SET DGPTERC=0
SET FLAG=0
QUIT
+5 QUIT
DIA ; - Diagnosis check for Spinal Cord Injury
+1 if (DGPTSTTY'["^10^")!(DGPTSTTY'["^11^")
QUIT
+2 NEW SYS,EFFDATE,IMPDATE,DGPTDAT
+3 DO EFFDATE^DGPTIC10($GET(PTF))
+4 SET SYS=$$SYS^ICDEX("DIAG",EFFDATE)
+5 IF SYS=1
Begin DoDot:1
+6 IF DGPTMSI="X"&((DGPTMD1?1"3440"1N)!(DGPTMD1=3441)!(DGPTMD2?1"3440"1N)!(DGPTMD2=3441)!(DGPTMD3?1"3440"1N)!(DGPTMD3=3441)!(DGPTMD4?1"3440"1N)!(DGPTMD4=3441)!(DGPTMD5?1"3440"1N)!(DGPTMD5=3441))
SET DGPTERC=554
QUIT
+7 IF "13"[DGPTMSI&((DGPTMD1'=3441)&(DGPTMD2'=3441)&(DGPTMD3'=3441)&(DGPTMD4'=3441)&(DGPTMD5'=3441))
SET DGPTERC=554
QUIT
+8 IF "24"[DGPTMSI&((DGPTMD1'?1"3440"1N)&(DGPTMD2'?1"3440"1N)&(DGPTMD3'?1"3440"1N)&(DGPTMD4'?1"3440"1N)&(DGPTMD5'?1"3440"1N))
SET DGPTERC=554
QUIT
End DoDot:1
+9 ;icd10
IF SYS=30
Begin DoDot:1
+10 NEW DGLOOP,DGPTDXCODE,DGPTFLAG
+11 SET DGPTFLAG=0
+12 FOR DGLOOP=1:1:25
SET DGPTDXCODE=@("DGPTMD"_DGLOOP)
Begin DoDot:2
+13 IF (DGPTDXCODE?1"G822"1N)!(DGPTDXCODE?1"G825"1N)
SET DGPTFLAG=1
End DoDot:2
if DGPTFLAG
QUIT
+14 IF DGPTMSI="X"&(DGPTFLAG=1)
SET DGPTERC=554
QUIT
+15 IF "13"[DGPTMSI&(DGPTFLAG=1)
SET DGPTERC=554
QUIT
+16 IF "24"[DGPTMSI&(DGPTFLAG=1)
SET DGPTERC=554
QUIT
+17 QUIT
End DoDot:1
+18 QUIT