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

LRPXCHKA.m

Go to the documentation of this file.
LRPXCHKA ;SLC/STAFF - Lab PXRMINDX Index Validation AP ;3/17/04  15:07
 ;;5.2;LAB SERVICE;**295**;Sep 27, 1994
 ;
AP(DFN,LRDFN) ; from LRPXCHK
 N DATE,LRIDT,SUB,ZERO
 F SUB="CY","EM","SP" D
 . S LRIDT=0
 . F  S LRIDT=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT)) Q:LRIDT<1  D
 .. S ZERO=$G(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,0))
 .. S DATE=$$LRIDT^LRPXAPIU(LRIDT) I 'DATE Q
 .. I '$P(ZERO,U,3) Q
 .. I '$P(ZERO,U,11) Q
 .. D CYEMSP(LRDFN,DFN,LRIDT,DATE,SUB) ; cyto, electron micro, surg path
 I $D(^TMP("LRPXCHK",$J,"LR",LRDFN,"AU")) D AUTOPSY(DFN,LRDFN)
 Q
 ;
AUTOPSY(DFN,LRDFN) ;
 N DATE,ETIOL,I,II,III,ICD,ICDX,ITEM,NODE,ORGAN,SNOMED,SPEC,SUB,SUBS
 I '($P(^TMP("LRPXCHK",$J,"LR",LRDFN,"AU"),U,3)&($P(^("AU"),U,15))) Q
 S DATE=$$DOD^LRPXAPIU(DFN)  I 'DATE Q
 S SPEC=0
 F  S SPEC=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,33,SPEC)) Q:SPEC<1  D
 . I '$L($P($G(^TMP("LRPXCHK",$J,"LR",LRDFN,33,SPEC,0)),U)) Q
 . S ITEM="A;S;1."_$$UP^XLFSTR($P(^TMP("LRPXCHK",$J,"LR",LRDFN,33,SPEC,0),U))
 . S NODE=LRDFN_";33;"_SPEC_";0"
 . D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
 S ICD=0
 F  S ICD=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,80,ICD)) Q:ICD<1  D
 . S ICDX=+$G(^TMP("LRPXCHK",$J,"LR",LRDFN,80,ICD,0))
 . I 'ICDX Q
 . S ITEM="A;I;"_ICDX
 . S NODE=LRDFN_";80;"_ICD_";0"
 . D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
 S I=0
 F  S I=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,"AY",I)) Q:I<1  D
 . S ORGAN=+$G(^TMP("LRPXCHK",$J,"LR",LRDFN,"AY",I,0))
 . I 'ORGAN Q
 . S ITEM="A;O;"_ORGAN
 . S NODE=LRDFN_";AY;"_I_";0"
 . D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
 . F SUBS="1D","2M","3F","4P" D
 .. S SUB=+SUBS
 .. S II=0
 .. F  S II=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,"AY",I,SUB,II)) Q:II<1  D
 ... S SNOMED=+$G(^TMP("LRPXCHK",$J,"LR",LRDFN,"AY",I,SUB,II,0))
 ... I 'SNOMED Q
 ... S ITEM="A;"_$E(SUBS,2)_";"_SNOMED
 ... S NODE=LRDFN_";AY;"_I_";"_SUB_";"_II_";0"
 ... D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
 ... I SUB'=2 Q
 ... S III=0
 ... F  S III=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,"AY",I,SUB,II,1,III)) Q:III<1  D
 .... S ETIOL=+$G(^TMP("LRPXCHK",$J,"LR",LRDFN,"AY",I,SUB,II,1,III,0))
 .... I 'ETIOL Q
 .... S ITEM="A;E;"_ETIOL
 .... S NODE=LRDFN_";AY;"_I_";"_SUB_";"_II_";1;"_III_";0"
 .... D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
 Q
 ;
CYEMSP(LRDFN,DFN,LRIDT,DATE,SUB) ;
 N ACC,I,ICD,ICDX,ITEM,NODE,ORGAN,PREP,SPEC,TEST,TESTS K TESTS
 I '$D(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,0)) Q
 S SPEC=0
 F  S SPEC=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,.1,SPEC)) Q:SPEC<1  D
 . I '$L($P($G(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,.1,SPEC,0)),U)) Q
 . S ITEM="A;S;1."_$$UP^XLFSTR($P(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,.1,SPEC,0),U))
 . S NODE=LRDFN_";"_SUB_";"_LRIDT_";.1;"_SPEC_";0"
 . D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
 . S PREP=0
 . F  S PREP=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,.1,SPEC,1,PREP)) Q:PREP<1  D
 .. S TEST=0
 .. F  S TEST=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,.1,SPEC,1,PREP,1,TEST)) Q:TEST<1  D
 ... S TEST=+$G(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,.1,SPEC,1,PREP,1,TEST,0))
 ... I 'TEST Q
 ... S ITEM="A;T;"_TEST
 ... S NODE=LRDFN_";"_SUB_";"_LRIDT_";.1;"_SPEC_";1;"_PREP_";1;"_TEST_";0"
 ... D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
 ; S ACC=$P(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,0),U,6) ; do not use tests on acc
 ; I $L(ACC) D
 ; . S NODE=LRDFN_";"_SUB_";"_LRIDT_";0"
 ; . D ACCY^LRPXAPI(.TESTS,ACC,DATE)
 ; . I $O(TESTS(0)) D
 ; .. S TEST=0
 ; .. F  S TEST=+$O(TESTS(TEST)) Q:TEST<1  D
 ; ... S ITEM="A;T;"_TEST
 ; ... D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
 S ICD=0
 F  S ICD=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,3,ICD)) Q:ICD<1  D
 . S ICDX=+$G(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,3,ICD,0))
 . I 'ICDX Q
 . S ITEM="A;I;"_ICDX
 . S NODE=LRDFN_";"_SUB_";"_LRIDT_";3;"_ICD_";0"
 . D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
 S I=0
 F  S I=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,2,I)) Q:I<1  D
 . S ORGAN=+$G(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,2,I,0))
 . I 'ORGAN Q
 . S ITEM="A;O;"_ORGAN
 . S NODE=LRDFN_";"_SUB_";"_LRIDT_";2;"_I_";0"
 . D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
 . D SNOMED(LRDFN,LRIDT,SUB,I)
 Q
 ;
SNOMED(LRDFN,LRIDT,APSUB,I) ;
 N ETIOL,II,III,ITEM,NODE,SNOMED,SUB,SUBS
 F SUBS="1D","2M","3F","4P" D
 . S SUB=+SUBS
 . S II=0
 . F  S II=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,APSUB,LRIDT,2,I,SUB,II)) Q:II<1  D
 .. S SNOMED=+$G(^TMP("LRPXCHK",$J,"LR",LRDFN,APSUB,LRIDT,2,I,SUB,II,0))
 .. I 'SNOMED Q
 .. S ITEM="A;"_$E(SUBS,2)_";"_SNOMED
 .. S NODE=LRDFN_";"_APSUB_";"_LRIDT_";2;"_I_";"_SUB_";"_II_";0"
 .. D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
 .. I SUB'=2 Q
 .. S III=0
 .. F  S III=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,APSUB,LRIDT,2,I,SUB,II,1,III)) Q:III<1  D
 ... S ETIOL=+$G(^TMP("LRPXCHK",$J,"LR",LRDFN,APSUB,LRIDT,2,I,SUB,II,1,III,0))
 ... I 'ETIOL Q
 ... S ITEM="A;E;"_ETIOL
 ... S NODE=LRDFN_";"_APSUB_";"_LRIDT_";2;"_I_";"_SUB_";"_II_";1;"_III_";0"
 ... D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
 Q
 ;