source: FOIAVistA/trunk/r/LAB_SERVICE-LR-LS/LRPXCHKA.m@ 1154

Last change on this file since 1154 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 4.7 KB
Line 
1LRPXCHKA ;SLC/STAFF - Lab PXRMINDX Index Validation AP ;3/17/04 15:07
2 ;;5.2;LAB SERVICE;**295**;Sep 27, 1994
3 ;
4AP(DFN,LRDFN) ; from LRPXCHK
5 N DATE,LRIDT,SUB,ZERO
6 F SUB="CY","EM","SP" D
7 . S LRIDT=0
8 . F S LRIDT=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT)) Q:LRIDT<1 D
9 .. S ZERO=$G(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,0))
10 .. S DATE=$$LRIDT^LRPXAPIU(LRIDT) I 'DATE Q
11 .. I '$P(ZERO,U,3) Q
12 .. I '$P(ZERO,U,11) Q
13 .. D CYEMSP(LRDFN,DFN,LRIDT,DATE,SUB) ; cyto, electron micro, surg path
14 I $D(^TMP("LRPXCHK",$J,"LR",LRDFN,"AU")) D AUTOPSY(DFN,LRDFN)
15 Q
16 ;
17AUTOPSY(DFN,LRDFN) ;
18 N DATE,ETIOL,I,II,III,ICD,ICDX,ITEM,NODE,ORGAN,SNOMED,SPEC,SUB,SUBS
19 I '($P(^TMP("LRPXCHK",$J,"LR",LRDFN,"AU"),U,3)&($P(^("AU"),U,15))) Q
20 S DATE=$$DOD^LRPXAPIU(DFN) I 'DATE Q
21 S SPEC=0
22 F S SPEC=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,33,SPEC)) Q:SPEC<1 D
23 . I '$L($P($G(^TMP("LRPXCHK",$J,"LR",LRDFN,33,SPEC,0)),U)) Q
24 . S ITEM="A;S;1."_$$UP^XLFSTR($P(^TMP("LRPXCHK",$J,"LR",LRDFN,33,SPEC,0),U))
25 . S NODE=LRDFN_";33;"_SPEC_";0"
26 . D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
27 S ICD=0
28 F S ICD=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,80,ICD)) Q:ICD<1 D
29 . S ICDX=+$G(^TMP("LRPXCHK",$J,"LR",LRDFN,80,ICD,0))
30 . I 'ICDX Q
31 . S ITEM="A;I;"_ICDX
32 . S NODE=LRDFN_";80;"_ICD_";0"
33 . D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
34 S I=0
35 F S I=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,"AY",I)) Q:I<1 D
36 . S ORGAN=+$G(^TMP("LRPXCHK",$J,"LR",LRDFN,"AY",I,0))
37 . I 'ORGAN Q
38 . S ITEM="A;O;"_ORGAN
39 . S NODE=LRDFN_";AY;"_I_";0"
40 . D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
41 . F SUBS="1D","2M","3F","4P" D
42 .. S SUB=+SUBS
43 .. S II=0
44 .. F S II=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,"AY",I,SUB,II)) Q:II<1 D
45 ... S SNOMED=+$G(^TMP("LRPXCHK",$J,"LR",LRDFN,"AY",I,SUB,II,0))
46 ... I 'SNOMED Q
47 ... S ITEM="A;"_$E(SUBS,2)_";"_SNOMED
48 ... S NODE=LRDFN_";AY;"_I_";"_SUB_";"_II_";0"
49 ... D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
50 ... I SUB'=2 Q
51 ... S III=0
52 ... F S III=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,"AY",I,SUB,II,1,III)) Q:III<1 D
53 .... S ETIOL=+$G(^TMP("LRPXCHK",$J,"LR",LRDFN,"AY",I,SUB,II,1,III,0))
54 .... I 'ETIOL Q
55 .... S ITEM="A;E;"_ETIOL
56 .... S NODE=LRDFN_";AY;"_I_";"_SUB_";"_II_";1;"_III_";0"
57 .... D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
58 Q
59 ;
60CYEMSP(LRDFN,DFN,LRIDT,DATE,SUB) ;
61 N ACC,I,ICD,ICDX,ITEM,NODE,ORGAN,PREP,SPEC,TEST,TESTS K TESTS
62 I '$D(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,0)) Q
63 S SPEC=0
64 F S SPEC=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,.1,SPEC)) Q:SPEC<1 D
65 . I '$L($P($G(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,.1,SPEC,0)),U)) Q
66 . S ITEM="A;S;1."_$$UP^XLFSTR($P(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,.1,SPEC,0),U))
67 . S NODE=LRDFN_";"_SUB_";"_LRIDT_";.1;"_SPEC_";0"
68 . D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
69 . S PREP=0
70 . F S PREP=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,.1,SPEC,1,PREP)) Q:PREP<1 D
71 .. S TEST=0
72 .. F S TEST=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,.1,SPEC,1,PREP,1,TEST)) Q:TEST<1 D
73 ... S TEST=+$G(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,.1,SPEC,1,PREP,1,TEST,0))
74 ... I 'TEST Q
75 ... S ITEM="A;T;"_TEST
76 ... S NODE=LRDFN_";"_SUB_";"_LRIDT_";.1;"_SPEC_";1;"_PREP_";1;"_TEST_";0"
77 ... D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
78 ; S ACC=$P(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,0),U,6) ; do not use tests on acc
79 ; I $L(ACC) D
80 ; . S NODE=LRDFN_";"_SUB_";"_LRIDT_";0"
81 ; . D ACCY^LRPXAPI(.TESTS,ACC,DATE)
82 ; . I $O(TESTS(0)) D
83 ; .. S TEST=0
84 ; .. F S TEST=+$O(TESTS(TEST)) Q:TEST<1 D
85 ; ... S ITEM="A;T;"_TEST
86 ; ... D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
87 S ICD=0
88 F S ICD=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,3,ICD)) Q:ICD<1 D
89 . S ICDX=+$G(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,3,ICD,0))
90 . I 'ICDX Q
91 . S ITEM="A;I;"_ICDX
92 . S NODE=LRDFN_";"_SUB_";"_LRIDT_";3;"_ICD_";0"
93 . D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
94 S I=0
95 F S I=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,2,I)) Q:I<1 D
96 . S ORGAN=+$G(^TMP("LRPXCHK",$J,"LR",LRDFN,SUB,LRIDT,2,I,0))
97 . I 'ORGAN Q
98 . S ITEM="A;O;"_ORGAN
99 . S NODE=LRDFN_";"_SUB_";"_LRIDT_";2;"_I_";0"
100 . D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
101 . D SNOMED(LRDFN,LRIDT,SUB,I)
102 Q
103 ;
104SNOMED(LRDFN,LRIDT,APSUB,I) ;
105 N ETIOL,II,III,ITEM,NODE,SNOMED,SUB,SUBS
106 F SUBS="1D","2M","3F","4P" D
107 . S SUB=+SUBS
108 . S II=0
109 . F S II=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,APSUB,LRIDT,2,I,SUB,II)) Q:II<1 D
110 .. S SNOMED=+$G(^TMP("LRPXCHK",$J,"LR",LRDFN,APSUB,LRIDT,2,I,SUB,II,0))
111 .. I 'SNOMED Q
112 .. S ITEM="A;"_$E(SUBS,2)_";"_SNOMED
113 .. S NODE=LRDFN_";"_APSUB_";"_LRIDT_";2;"_I_";"_SUB_";"_II_";0"
114 .. D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
115 .. I SUB'=2 Q
116 .. S III=0
117 .. F S III=$O(^TMP("LRPXCHK",$J,"LR",LRDFN,APSUB,LRIDT,2,I,SUB,II,1,III)) Q:III<1 D
118 ... S ETIOL=+$G(^TMP("LRPXCHK",$J,"LR",LRDFN,APSUB,LRIDT,2,I,SUB,II,1,III,0))
119 ... I 'ETIOL Q
120 ... S ITEM="A;E;"_ETIOL
121 ... S NODE=LRDFN_";"_APSUB_";"_LRIDT_";2;"_I_";"_SUB_";"_II_";1;"_III_";0"
122 ... D TMPCHK^LRPXCHK(DFN,DATE,ITEM,NODE)
123 Q
124 ;
Note: See TracBrowser for help on using the repository browser.