source: FOIAVistA/trunk/r/LAB_SERVICE-LR-LS/LREPI2A.m@ 1801

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

initial load of FOIAVistA 6/30/08 version

File size: 4.6 KB
Line 
1LREPI2A ;DALOI/CKA-EMERGING PATHOGENS HL7 BUILD ;5/14/03
2 ;;5.2;LAB SERVICE;**281**;Sep 27, 1994
3 ;
4START ;START
5 S LRPROT=0 F S LRPROT=$O(^TMP($J,LRPROT)) Q:+LRPROT'>0 D
6 .D INIT^HLFNC2(LRPROT,.HL)
7 .S LRMSGNM=1,LRMSGSZ=0,LRCS=$E(HL("ECH"))
8 .S LRMSGDF=$S(+$P($G(^LAB(69.4,LRPROT,0)),U,3)>0:+$P($G(^LAB(69.4,LRPROT,0)),U,3),1:30000)
9 .D EN,MOVE
10 .F LRTND="ETI","TST","HEP" D:$D(^TMP($J,LRTND)) TOTAL
11 .D EN,MOVE,SEND
12 .D ALERT
13 K LRDUZ,LRMSGDF,%,%X
14 Q
15SEND ;BUILD MESSAGE BUT DON'T SEND
16 D HEAD
17 I LRREP=2 D SPSHT^LREPIRS3 S ^XTMP("LREPILOCALSPSHT"_LRLRDT,"DONE")=1
18 I LRREP=1 D REPORT^LREPIRS1 S ^XTMP("LREPILOCALREP"_LRLRDT,"DONE")=1
19 K ^TMP("HLS",$J)
20 K LRLC,LRHDGLC,HLFS,LRSEG,LRSPSHT,MSG,LRPID,LROBR,LRX
21 Q
22ALERT ;Send a Alert if desired.
23 K XQA,XQAMSG,XQAOPT,XQAROU,XQAID,XQADATA,XQAFLAG
24 S X="NOW",%DT="SRT" D ^%DT,DD^%DT
25 S XQAMSG="The local report/spreadsheet finished generating at "_Y
26 S XQA(LRDUZ)=""
27 Q:'$D(XQA)
28 D SETUP^XQALERT
29 Q
30EN ;ENTRY TO BUILD A MESSAGE
31 S (LRCNT,LRPID)=1,DFN=0
32 F S DFN=$O(^TMP($J,LRPROT,DFN)) Q:+DFN'>0 D
33 .D PID^LREPI3
34 .S LRPV1=1,LRENDT=0,LRPFG="",LREFG=0,LRPVVV=0
35 .F S LRENDT=$O(^TMP($J,LRPROT,DFN,LRENDT)) S LRPFG="" Q:+LRENDT'>0!(LREFG) D
36 ..D PV1
37 ..I $D(^TMP("LREPISRCH",$J,DFN)),LRPROT=LRPROTX D RXNT^LREPIPH
38 ..S LRPATH=0,LRNTE=1,LRPVVV=1
39 ..F S LRPATH=$O(^TMP($J,LRPROT,DFN,LRENDT,LRPATH)) Q:+LRPATH'>0!(LREFG) D
40 ...D:LRPFG'=LRPATH NTE^LREPI3
41 ...S LRPFG=LRPATH,LROBR=1,LRINVD=0
42 ...F S LRINVD=$O(^TMP($J,LRPROT,DFN,LRENDT,LRPATH,LRINVD)) Q:+LRINVD'>0!(LREFG) D
43 ....S LRND=""
44 ....F S LRND=$O(^TMP($J,LRPROT,DFN,LRENDT,LRPATH,LRINVD,LRND)) Q:LRND=""!(LREFG) D
45 .....S LRDFN=$$LRDFN^LR7OR1(DFN) Q:'LRDFN
46 .....S LREFG=+$P($G(^LAB(69.5,LRPATH,0)),U,6)
47 .....S:LRND'="PTF" LROBR=$$EN^LREPI1(LRDFN,LRND,LRINVD,LROBR)+1
48 .....D:LRND="PTF" DG1^LREPI3
49 .....D MOVE
50 Q
51TOTAL ;Report the total counts -> "ETI" or "TST" or "HEP"
52 ; \/
53 S LRITN=0 F S LRITN=$O(^TMP($J,LRTND,LRITN)) Q:+LRITN'>0 D
54 .S (LRNLT,LRTNM)=""
55 .I LRTND="TST" D
56 ..I '$D(^TMP($J,"TPROT",LRITN,LRPROT)) QUIT
57 ..S LRTNM=$P($G(^LAB(60,LRITN,0)),U,1)
58 ..S LRNL=$G(^LAB(60,LRITN,64)) Q:+LRNL'>0
59 ..Q:'$D(^LAM(LRNL,0))
60 ..S LRNLT=$P(^LAM(LRNL,0),U,2)
61 .I LRTND="ETI" D
62 ..I '$D(^TMP($J,"EPROT",LRITN)) QUIT
63 ..S LRTNM=$P($G(^LAB(61.2,LRITN,0)),U,1)
64 ..S LRNL=$G(^LAB(61.2,LRITN,64)) Q:+LRNL'>0
65 ..Q:'$D(^LAM(LRNL,0))
66 ..S LRNLT=$P(^LAM(LRNL,0),U,2)
67 .I LRTND="STOT" D
68 ..I '$D(^TMP($J,"SPROT",LRITN,LRPROT)) QUIT
69 ..S LRTNM=""
70 ..S LRNL=LRITN
71 ..S LRNLT=""
72 .I LRTND="HEP" D
73 ..I '$D(^TMP($J,"HEP",LRITN)) QUIT
74 ..S LRNLT=""
75 ..I LRITN=1 S LRTNM="1-Declined Assessment for Hepatitis C"
76 ..I LRITN=2 S LRTNM="2-No Risk Factors for Hepatitis C"
77 ..I LRITN=3 S LRTNM="3-Previously Assessed for Hepatitis C"
78 ..I LRITN=4 S LRTNM="4-Risk Factors for Hepatitis C"
79 ..I LRITN=5 S LRTNM="5-Positive Test for Hepatitis C antibody"
80 ..I LRITN=6 S LRTNM="6-Negative Test for Hepatitis C antibody"
81 ..I LRITN=7 S LRTNM="7- Hepatitis C diagnosis (ICD-9 based)"
82 .K LRDATA
83 .I '$G(LRTNM) D NAME
84 .S LRDATA="NTE"_HLFS_HLFS_"T"_LRCS_LRNLT_LRCS_LRTNM_LRCS_+^TMP($J,LRTND,LRITN)
85 .S LRCNT=LRCNT+1
86 .S ^TMP("HLS",$J,LRCNT)=$$UP^XLFSTR(LRDATA)
87 .K LRDATA
88 .S (LRPCNT,LRPTOT)=0
89 .F S LRPCNT=$O(^TMP($J,LRTND,LRITN,LRPCNT)) Q:+LRPCNT'>0 S LRPTOT=LRPTOT+1
90 .Q:LRPTOT'>0
91 .I '$G(LRTNM) D NAME
92 .S LRDATA="NTE"_HLFS_HLFS_"T"_LRCS_LRNLT_LRCS_"PATIENTS WITH "_LRTNM_LRCS_LRPTOT ;+^TMP($J,LRPCNT,LRITN)
93 .S LRCNT=LRCNT+1
94 .S ^TMP("HLS",$J,LRCNT)=$$UP^XLFSTR(LRDATA)
95 Q
96NAME ;
97 Q:LRTND'="TST"
98 S LRTNM=$P($G(^LAB(60,LRITN,0)),U,1)
99 S LRNL=$G(^LAB(60,LRITN,64)) Q:+LRNL'>0
100 Q:'$D(^LAM(LRNL,0))
101 S LRNLT=$P(^LAM(LRNL,0),U,2)
102 ;
103 QUIT
104HEAD ;ENTER A NTE FOR REPORT HEADER
105 K LRDATA
106 S LRDATA="NTE"_HLFS_HLFS_$S(LRRTYPE:"R",1:"")_LRCS
107 I $G(LR31799Z)=1 S LRDATA=LRDATA_"*** H E P A T I T I S C MARCH 17 1999 ***"
108 S LRDATA=LRDATA_"REPORTING DATE FROM "_$$HLDATE^HLFNC(LRRPS)
109 S LRDATA=LRDATA_" TO "_$$HLDATE^HLFNC(LRRPE)
110 S LRDATA=LRDATA
111 I LRPROTX=LRPROT S LRDATA=LRDATA_LRCS_LRCS_"V3"
112 I '$O(^TMP("HLS",$J,1)) S LRDATA=LRDATA_LRCS_"N"
113 S ^TMP("HLS",$J,1)=$$UP^XLFSTR(LRDATA)
114 K LRDATA
115 Q
116MOVE S LRMOVE=0
117 F S LRMOVE=$O(^TMP("HL7",$J,LRMOVE)) Q:+LRMOVE'>0 D
118 .S LRCNT=LRCNT+1
119 .S ^TMP("HLS",$J,LRCNT)=^TMP("HL7",$J,LRMOVE)
120 K ^TMP("HL7",$J),LRMOVE
121 Q
122 ;
123PV1 ;
124 ;I $O(^TMP($J,LRPROT,DFN,LRENDT,""))!('$D(^TMP("LREPISRCH",$J,DFN)))!($P(LRNDTDA,"^",3))="UPDT" D PV1^LREPI3 S LRPVVV=1
125 I LRPV1>1,$O(^TMP($J,LRPROT,DFN,LRENDT,LRPATH))="",$P($G(^TMP($J,LRPROT,DFN,LRENDT)),"^",3)'="UPDT" Q
126 I $P($G(^TMP($J,LRPROT,DFN,LRENDT)),"^",3)="UPDT" D PV1^LREPI3 S LRPVVV=1 Q
127 I $O(^TMP($J,LRPROT,DFN,LRENDT,""))]"" D PV1^LREPI3 S LRPVVV=1 Q
128 I '$D(^TMP("LREPISRCH",$J,DFN)) D PV1^LREPI3 S LRPVVV=1 Q
129 Q
Note: See TracBrowser for help on using the repository browser.