source: WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRMITSPC.m@ 1389

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

initial load of WorldVistAEHR

File size: 2.2 KB
Line 
1LRMITSPC ;SLC/STAFF - MICRO TREND PROCESS COUNT ;10/17/92 23:16
2 ;;5.2;LAB SERVICE;;Sep 27, 1994
3 ; from LRMITSPE
4 ; returns counts of isolates and susceptibilities in ^TMP($J,n1,"C"
5 ;
6 S LRTYPE="" F S LRTYPE=$O(^TMP($J,"PAT",LRTYPE)) Q:LRTYPE="" D
7 .S (LRCNT,LRPATN)=0 F S LRPATN=$O(^TMP($J,"PAT",LRTYPE,LRPATN)) Q:LRPATN<1 S LRCNT=LRCNT+1
8 .S ^TMP($J,LRTYPE)=LRCNT
9 S LRN1=0 F S LRN1=$O(^TMP($J,"M",LRN1)) Q:LRN1<1 D Q:LREND
10 .I LRN1#10=0,$$S^%ZTLOAD S (LREND,ZTSTOP)=1 Q
11 .S (LROCNTC,LROCNTM,LROCNTN)=0
12 .S LRMCAT="" F S LRMCAT=$O(^TMP($J,"M",LRN1,LRMCAT)) Q:LRMCAT="" D
13 ..K ^TMP($J,"MP")
14 ..S LRCNT=0,LRNN3="" F S LRNN3=$O(^TMP($J,"M",LRN1,LRMCAT,LRNN3)) Q:LRNN3="" S LRX=^(LRNN3),LRN3=-LRNN3 D
15 ...S LRN2=+LRX,LRCDATE=$P(LRX,U,2),LRSUBN=$P(LRX,U,3),LRCNT=LRCNT+1
16 ...; setup non tested data
17 ...I '$D(^TMP($J,LRN3)) S $P(^TMP($J,LRN2,LRCDATE,LRSUBN),U,5)="N",LROCNTN=LROCNTN+1 Q
18 ...I '$D(^TMP($J,"MP")) D SETUP Q
19 ...I LRMERGE="N" D SETUP Q
20 ...D CHECK
21 .S ^TMP($J,LRN1,"C")=LROCNTC_U_LROCNTM_U_LROCNTN
22 K ^TMP($J,"MP"),^("PAT"),LRANTIN,LRANTINM,LRANTIV,LRCDATE,LRCNT,LRMARRAY,LRMCAT,LRMCNT,LRMDONE,LRN1,LRN2,LRN3,LRNN3,LROCNTC,LROCNTM,LROCNTN,LROK,LRPATN,LRSUBN,LRTYPE,LRX
23 Q
24CHECK ; check data for merges
25 S (LRMDONE,LRMCNT)=0 F S LRMCNT=$O(^TMP($J,"MP",LRMCNT)) Q:LRMCNT<1 D Q:LRMDONE
26 .K LRMARRAY S LROK=1,LRANTINM="" F S LRANTINM=$O(^TMP($J,LRN3,"A",LRANTINM)) Q:LRANTINM="" S LRANTIV=$P(^(LRANTINM),U) D Q:'LROK
27 ..I '$D(^TMP($J,"MP",LRMCNT,LRANTINM)) S LRMARRAY(LRANTINM)=LRANTIV Q
28 ..I LRANTIV'=^TMP($J,"MP",LRMCNT,LRANTINM) S LROK=0 Q
29 .I LROK S LRMDONE=1 D Q
30 ..S LRANTINM=0 F S LRANTINM=$O(LRMARRAY(LRANTINM)) Q:LRANTINM<1 D ABCOUNT(LRN1,LRMCNT,LRANTINM,LRMARRAY(LRANTINM))
31 ; setup merged data
32 I LRMDONE S $P(^TMP($J,LRN2,LRCDATE,LRSUBN),U,5)="M",LROCNTM=LROCNTM+1 Q
33 I 'LRMDONE D SETUP
34 Q
35SETUP ; setup tested data
36 S $P(^TMP($J,LRN2,LRCDATE,LRSUBN),U,5)="T",LROCNTC=LROCNTC+1
37 S LRANTINM="" F S LRANTINM=$O(^TMP($J,LRN3,"A",LRANTINM)) Q:LRANTINM="" S LRANTIV=$P(^(LRANTINM),U) D
38 .D ABCOUNT(LRN1,LRCNT,LRANTINM,LRANTIV)
39 Q
40ABCOUNT(N1,CNT,ABREV,AVALUE) ; count data, setup merge pattern
41 N LRX
42 S LRX=$G(^TMP($J,N1,"C",ABREV)),^(ABREV)=($P(LRX,U)+1)_U_($P(LRX,U,2)+$S(AVALUE["S":1,1:0))
43 S ^TMP($J,"MP",CNT,ABREV)=AVALUE
44 Q
Note: See TracBrowser for help on using the repository browser.