LRMITSPS ;VA/SLC/STAFF - MICRO TREND PROCESS SETUP ;JUL 06, 2010 3:14 PM
;;5.2;LAB SERVICE;**257,1027**;NOV 01, 1997
; from LRMITSPO
;
S LRMERGEV=$S(LRMERGE="S":LRSPECN,LRMERGE="C":LRCOLN,1:0)
; setup data for each report type
;MULTIDIVISIONAL PATCH LR*5.2*257 02/01
F LRTYPE="O;LRORGN;LRORGNM","S;LRSPECN;LRSPECNM","L;LRLOCN;LRLOCNM","D;LRDOCN;LRDOCNM","P;LRPATN;LRPATNM","C;LRCOLN;LRCOLNM","DIV;LRDIV;LRDIVNM" I $D(LRM($P(LRTYPE,";"))) D
.S LRRTYPE=$P(LRTYPE,";"),LRGPN=@$P(LRTYPE,";",2),LRGPNM=@$P(LRTYPE,";",3)
.; count patients for report type
.I $D(LRM(LRRTYPE,"A")) S ^TMP($J,"PAT",LRRTYPE,LRPATN)=""
.I $D(LRM(LRRTYPE,"S",LRGPN)) S ^TMP($J,"PAT",LRRTYPE,LRPATN)=""
.; setup isolate data
.S LRN1=$G(^TMP($J,LRRTYPE,LRGPNM,LRGPN,LRORGNM,LRORGN))
.I 'LRN1 D
..S (LRN1,LRSEQN)=LRSEQN+1
..S ^TMP($J,LRRTYPE,LRGPNM,LRGPN,LRORGNM,LRORGN)=LRN1
.S LRN2=$G(^TMP($J,LRN1,"P",LRPATNM,LRPATN,LRSPECNM,LRSPECN))
.I 'LRN2 D
..S (LRN2,LRSEQN)=LRSEQN+1
..S ^TMP($J,LRN1,"P",LRPATNM,LRPATN,LRSPECNM,LRSPECN)=LRN2
.S (LRN3,LRSEQN)=LRSEQN+1
.S ^(LRGPN)=$G(^TMP($J,LRRTYPE,LRGPNM,LRGPN))+1
.S ^TMP($J,LRN2,LRCDATE,LRSUBN)=LRN3_U_LRACC_U_LRPLOS_U_LRCOLN
.S ^TMP($J,"M",LRN1,LRPATN_";"_LRORGN_";"_LRMERGEV,-LRN3)=LRN2_U_LRCDATE_U_LRSUBN
.; setup bacteria antibiotic data
.S LRDN=0 F S LRDN=$O(LRANTIM(LRDN)) Q:LRDN<2 D
..S LRANTINM=$P($G(^TMP($J,"A",LRDN)),U,2) Q:'$L(LRANTINM)
..S ^TMP($J,LRN3,"A",LRANTINM)=LRANTIM(LRDN)
.; setup mycobatcteria antibiotic data
.S LRDN=0 F S LRDN=$O(LRTB(LRDN)) Q:LRDN<2 D
..S LRANTINM=$P($G(^TMP($J,"T",LRDN)),U) Q:'$L(LRANTINM)
..S ^TMP($J,LRN3,"T",LRANTINM)=LRTB(LRDN)
Q
LRMITSPS ;VA/SLC/STAFF - MICRO TREND PROCESS SETUP ;JUL 06, 2010 3:14 PM
+1 ;;5.2;LAB SERVICE;**257,1027**;NOV 01, 1997
+2 ; from LRMITSPO
+3 ;
+4 SET LRMERGEV=$SELECT(LRMERGE="S":LRSPECN,LRMERGE="C":LRCOLN,1:0)
+5 ; setup data for each report type
+6 ;MULTIDIVISIONAL PATCH LR*5.2*257 02/01
+7 FOR LRTYPE="O;LRORGN;LRORGNM","S;LRSPECN;LRSPECNM","L;LRLOCN;LRLOCNM","D;LRDOCN;LRDOCNM","P;LRPATN;LRPATNM","C;LRCOLN;LRCOLNM","DIV;LRDIV;LRDIVNM"
IF $DATA(LRM($PIECE(LRTYPE,";")))
Begin DoDot:1
+8 SET LRRTYPE=$PIECE(LRTYPE,";")
SET LRGPN=@$PIECE(LRTYPE,";",2)
SET LRGPNM=@$PIECE(LRTYPE,";",3)
+9 ; count patients for report type
+10 IF $DATA(LRM(LRRTYPE,"A"))
SET ^TMP($JOB,"PAT",LRRTYPE,LRPATN)=""
+11 IF $DATA(LRM(LRRTYPE,"S",LRGPN))
SET ^TMP($JOB,"PAT",LRRTYPE,LRPATN)=""
+12 ; setup isolate data
+13 SET LRN1=$GET(^TMP($JOB,LRRTYPE,LRGPNM,LRGPN,LRORGNM,LRORGN))
+14 IF 'LRN1
Begin DoDot:2
+15 SET (LRN1,LRSEQN)=LRSEQN+1
+16 SET ^TMP($JOB,LRRTYPE,LRGPNM,LRGPN,LRORGNM,LRORGN)=LRN1
End DoDot:2
+17 SET LRN2=$GET(^TMP($JOB,LRN1,"P",LRPATNM,LRPATN,LRSPECNM,LRSPECN))
+18 IF 'LRN2
Begin DoDot:2
+19 SET (LRN2,LRSEQN)=LRSEQN+1
+20 SET ^TMP($JOB,LRN1,"P",LRPATNM,LRPATN,LRSPECNM,LRSPECN)=LRN2
End DoDot:2
+21 SET (LRN3,LRSEQN)=LRSEQN+1
+22 SET ^(LRGPN)=$GET(^TMP($JOB,LRRTYPE,LRGPNM,LRGPN))+1
+23 SET ^TMP($JOB,LRN2,LRCDATE,LRSUBN)=LRN3_U_LRACC_U_LRPLOS_U_LRCOLN
+24 SET ^TMP($JOB,"M",LRN1,LRPATN_";"_LRORGN_";"_LRMERGEV,-LRN3)=LRN2_U_LRCDATE_U_LRSUBN
+25 ; setup bacteria antibiotic data
+26 SET LRDN=0
FOR
SET LRDN=$ORDER(LRANTIM(LRDN))
IF LRDN<2
QUIT
Begin DoDot:2
+27 SET LRANTINM=$PIECE($GET(^TMP($JOB,"A",LRDN)),U,2)
IF '$LENGTH(LRANTINM)
QUIT
+28 SET ^TMP($JOB,LRN3,"A",LRANTINM)=LRANTIM(LRDN)
End DoDot:2
+29 ; setup mycobatcteria antibiotic data
+30 SET LRDN=0
FOR
SET LRDN=$ORDER(LRTB(LRDN))
IF LRDN<2
QUIT
Begin DoDot:2
+31 SET LRANTINM=$PIECE($GET(^TMP($JOB,"T",LRDN)),U)
IF '$LENGTH(LRANTINM)
QUIT
+32 SET ^TMP($JOB,LRN3,"T",LRANTINM)=LRTB(LRDN)
End DoDot:2
End DoDot:1
+33 QUIT