Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: DGPT70DI

DGPT70DI.m

Go to the documentation of this file.
DGPT70DI ;ALB/MTC/ADL,HIOFO/FT - Diagnosis edits for 700's - E codes, V codes, gender and ICD9 Diag. ;2/20/15 12:20pm
 ;;5.3;Registration;**510,850,884,1057**;Aug 13, 1993;Build 17
 ;;ADL;Update for CSV Project;;Mar. 24, 2003
 ;
 ; ICDEX APIs - #5747
 ; ICDXCODE APIs - #5699
 ;
EN ;called from DGPT702
 I DGPTFMT=2 F DGPTL3=1:1:9 S DGPTDIA=$P((@("DGPTGD"_DGPTL3))," ",1) S DGPTERC=0 D DIAG I DGPTERC D ERR G:DGPTEDFL EXIT
 I DGPTFMT=3 F DGPTL3=2:1:25 S DGPTDIA=$P((@("DGPTGD"_DGPTL3))," ",1),DGPTPOA=@("DGPTPOA"_DGPTL3),DGPTERC=0 D  I DGPTERC D ERR G:DGPTEDFL EXIT
 . Q:(DGPTDIA="")!(DGPTPOA="")
 . I DGPTDIA="",DGPTPOA'=" " S DGPTERC=$S(DGPTL3<10:719+DGPTL3,1:787+DGPTL3) ;POA without a DX. using invalid dx error code
 . Q:DGPTDIA=""
 . I "1YNUW "'[DGPTPOA S DGPTREC=$S(DGPTL3<10:719+DGPTL3,1:787+DGPTL3) D ERR  ; DG*5.3*1057
 . S DGPTERC=0 D DIAG
 Q
 ;
DIAG ;
 N SYS,EFFDATE,IMPDATE,DGPTDAT,SYS
 D EFFDATE^DGPTIC10($G(PTF))
 S SYS=$$SYS^ICDEX("DIAG",EFFDATE)
 Q:DGPTDIA=""
 I SYS=1 I $E(DGPTDIA,1)="E" S DGPTERC=0 D DIAGE Q
 I SYS=1 I $E(DGPTDIA,1)="V" S DGPTERC=0 D DIAGV Q
 S DGPTERC=$S(DGPTL3<10:719+DGPTL3,1:787+DGPTL3)
 F DGPTL4=1:1:$L(DGPTDIA) S DGPTDIA1=$E(DGPTDIA,1,DGPTL4)_"."_$E(DGPTDIA,DGPTL4+1,$L(DGPTDIA))_" " I +$$CODEN^ICDEX(DGPTDIA1,80)>0 S DGPTERC=0 D GEN Q
 Q
ERR ;
 D WRTERR^DGPTAE(DGPTERC,NODE,SEQ)
 Q
EXIT ;
 K DGPTDIA,DGPTDIA1,DGPTDIA2,DGPTL3,DGPTL4,DGPTPOA
 Q
 ;note: E and V codes were eliminated in ICD-10 and incorporated into the main code set.
DIAGE ; Supplementary Classification of Factors Influencing Health Status
 ; and Contact with Health Services.
 N EFFDATE,IMPDATE,DGPTDAT,SYS
 D EFFDATE^DGPTIC10($G(PTF))
 Q:$E(DGPTDIA)'="E"
 S SYS=$$SYS^ICDEX("DIAG",EFFDATE)
 S:SYS=30 DGPTDIA1=$E(DGPTDIA,1,3)_"."_$E(DGPTDIA,4,$L(DGPTDIA))_" " ;will it ever be 30 (i.e, ICD10)?
 S:SYS=1 DGPTDIA1=$E(DGPTDIA,1,4)_"."_$E(DGPTDIA,5,$L(DGPTDIA))_" "
 I +$$CODEN^ICDEX(DGPTDIA1,80)<1 S DGPTERC=$S(DGPTL3<10:719+DGPTL3,1:787+DGPTL3) Q
 S DGPTDIA2=+$$CODEN^ICDEX(DGPTDIA1,80) I DGPTDIA2<1 S DGPTERC=$S(DGPTL3<10:719+DGPTL3,1:787+DGPTL3) Q
 S DGPTTMP=$$ICDDATA^ICDXCODE("DIAG",DGPTDIA2,EFFDATE)
 I DGPTTMP=-1!('$P(DGPTTMP,U,10)) S DGPTERC=$S(DGPTL3<10:719+DGPTL3,1:787+DGPTL3) Q
 I ($P(DGPTTMP,U,10)=0)&($E(DGPTDDS,1,7)>$P(DGPTTMP,U,12)) S DGPTERC=$S(DGPTL3<10:719+DGPTL3,1:787+DGPTL3) Q
 I ($P(DGPTTMP,U,11)]"")&(DGPTGEN'=$P(DGPTTMP,U,11)) S DGPTERC=$S(DGPTL3<10:719+DGPTL3,1:787+DGPTL3) Q
 S @("DGPTGD"_DGPTL3)=$P(DGPTDIA1," ",1)
 S DGPTDIAR(DGPTDDS)=$S($D(DGPTDIAR(DGPTDDS)):DGPTDIAR(DGPTDDS)_U_DGPTDIA2,1:DGPTDIA2)
 Q
DIAGV ; Supplementary Classification of External Causes of Inquiry and Poisoning
 N EFFDATE,IMPDATE,DGPTDAT
 D EFFDATE^DGPTIC10($G(PTF))
 Q:$E(DGPTDIA)'="V"
 S DGPTDIA1=$E(DGPTDIA,1,3)_"."_$E(DGPTDIA,4,$L(DGPTDIA))_" "
 I +$$CODEN^ICDEX(DGPTDIA1,80)<1 S DGPTERC=$S(DGPTL3<10:719+DGPTL3,1:787+DGPTL3) Q
 S DGPTDIA2=+$$CODEN^ICDEX(DGPTDIA1,80) I DGPTDIA2<1 S DGPTERC=$S(DGPTL3<10:719+DGPTL3,1:787+DGPTL3) Q
 S DGPTTMP=$$ICDDATA^ICDXCODE("DIAG",DGPTDIA2,EFFDATE)  ;use date of disp. if defined, else today
 I DGPTTMP=-1!('$P(DGPTTMP,U,10)) S DGPTERC=$S(DGPTL3<10:719+DGPTL3,1:787+DGPTL3) Q
 I ($P(DGPTTMP,U,10)=0)&($E(DGPTDDS,1,7)>$P(DGPTTMP,U,12)) S DGPTERC=$S(DGPTL3<10:719+DGPTL3,1:787+DGPTL3) Q
 I ($P(DGPTTMP,U,11)]"")&(DGPTGEN'=$P(DGPTTMP,U,11)) S DGPTERC=$S(DGPTL3<10:719+DGPTL3,1:787+DGPTL3) Q
 S @("DGPTGD"_DGPTL3)=$P(DGPTDIA1," ",1)
 S DGPTDIAR(DGPTDDS)=$S($D(DGPTDIAR(DGPTDDS)):DGPTDIAR(DGPTDDS)_U_DGPTDIA2,1:DGPTDIA2)
 Q
GEN ;gender - 884 no longer flags a gender error
 N EFFDATE,IMPDATE,DGPTDAT
 D EFFDATE^DGPTIC10($G(PTF))
 S DGPTDIA2=+$$CODEN^ICDEX(DGPTDIA1,80) I DGPTDIA2<1 S DGPTERC=$S(DGPTL3<10:719+DGPTL3,1:787+DGPTL3) Q
 S DGPTTMP=$$ICDDATA^ICDXCODE("DIAG",DGPTDIA2,EFFDATE)  ;use date of disp. if defined, else today
 I DGPTTMP=-1!('$P(DGPTTMP,U,10)) S DGPTERC=$S(DGPTL3<10:719+DGPTL3,1:787+DGPTL3) Q
 ;I $P(DGPTTMP,U,11)]""&(DGPTGEN'=$P(DGPTTMP,U,11)) S DGPTERC=751 Q
 S @("DGPTGD"_DGPTL3)=$P(DGPTDIA1," ",1)
ARRAY ;this array is used to build the error display in the List Manager interface
 S DGPTDIAR(DGPTDDS)=$S($D(DGPTDIAR(DGPTDDS)):DGPTDIAR(DGPTDDS)_U_DGPTDIA2,1:DGPTDIA2)
 Q