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

LRARCAM5.m

Go to the documentation of this file.
LRARCAM5 ;DALISC/CKA - ARCHIVED RCS 14-4 REPORT PART 1
 ;;5.2;LAB SERVICE;**59**;August 31,1995
 ;same as LRCAPAM5 except for archived wkld file reference
EN ;
DEVICE ;
 S %ZIS="Q" D ^%ZIS G:POP EXIT I $D(IO("Q")) G ZTLOAD
 D WAIT^DICD
QUE ;
 U IO K ^TMP($J,"RCS14-4"),^TMP($J,"LMIP")
 S (LRERR,LRMT)="" S:$D(ZTQUEUED) ZTREQ="@"
 F  S LRMT=$O(LRRPTM(LRMT)) Q:LRMT=""  S LRTSTOT=0,LRCAP=""  D
 .D INITSUM^LRARCAM7
 .S:'$D(^TMP($J,"RCS14-4",$P(LRMT,U,2),0)) ^(0)=0 S LRTOT1=^(0)
 .F  S LRCAP=$O(^LAR(67.99999,+LRDA(1),1,+LRDA,1,+LRMT,1,"B",LRCAP)) Q:LRCAP=""  D
 ..S LRCAPN=$O(^LAR(67.99999,+LRDA(1),1,+LRDA,1,+LRMT,1,"B",LRCAP,0))
 ..I $D(^LAR(67.99999,+LRDA(1),1,+LRDA,1,+LRMT,1,LRCAPN,0))#2 S LRTREAT=0 D  S ^TMP($J,"RCS14-4",$P(LRMT,U,2),0)=LRTOT1
 ...S LRN=$G(^LAR(67.99999,+LRDA(1),1,+LRDA,1,+LRMT,1,LRCAPN,0)),LRN2=+$G(^(2))
 ...I '$O(^LAR(67.99999,+LRDA(1),1,+LRDA,1,+LRMT,1,LRCAPN,1,0)) S LRCAPIFN=+$O(^LAM("C",$P(LRN,U)_" ",0)) D:LRCAPIFN BMPSUM^LRARCAM7 Q
 ..S LRCC=$P(LRN,U) S LRCCN=$E($$WKLDNAME^LRARCU(LRCC),1,40)
 ..S:LRCCN["*ERR" LRERR=LRERR+1
 ..Q:((LRDTYP=2)&('LRN2))!((LRDTYP=3)&(LRN2))
 ..D BMPSUM^LRARCAM7
 ..S:'$D(^TMP($J,"RCS14-4",$P(LRMT,U,2),1,LRCCN,0))#2 ^(0)=$P(LRN,U,1,8)_U_$P(LRN,U,12) F I=2,3,4 S N=$P(LRN,U,I) I N S $P(LRTOT1,U,I)=($P(LRTOT1,U,I)+N)
 ..S LRTREAT="" F  S LRTREAT=$O(^LAR(67.99999,+LRDA(1),1,+LRDA,1,+LRMT,1,LRCAPN,1,"B",LRTREAT)) Q:LRTREAT=""  D
 ...S LRTREATN=$O(^LAR(67.99999,+LRDA(1),1,+LRDA,1,+LRMT,1,LRCAPN,1,"B",LRTREAT,0)),LRN1=^LAR(67.99999,+LRDA(1),1,+LRDA,1,+LRMT,1,LRCAPN,1,LRTREATN,0) D T1
 D ^LRARCAM6
EXIT ;
 D ^%ZISC
 D KILLALL^LRARCU
 K ^TMP($J,"RCS14-4"),^TMP($J,"LMIP"),LRERR
 Q
T1 ;
 D LKUP S:'$D(^TMP($J,"RCS14-4",$P(LRMT,U,2),1,LRCCN,LRTRN)) ^(LRTRN)=0 S ^(LRTRN)=(^(LRTRN)+$P(LRN1,U,2))
 S:'$D(^TMP($J,"RCS14-4",$P(LRMT,U,2),LRTRN)) ^(LRTRN)=0 S ^(LRTRN)=(^(LRTRN)+$P(LRN1,U,2))
 S LRTSTOT=LRTSTOT+$P(LRN1,U,2)
 Q
LKUP ;
 S NODE=$G(^DIC(42.4,+LRN1,0)),LRCDR=$S($P(NODE,U,6):$P(NODE,U,6),$P(LRN1,U)="XY ":2100,1:2000)
 S LRTRN="[ "_LRCDR_" ] "_$S($L($P(NODE,U)):$P(NODE,U),LRCDR=2100:"BLOOD BANK",1:"AMBULATORY CARE")
 S LRSV=$S($L($P(NODE,U,3)):$P(NODE,U,3),1:LRTRN)
 I $L(LRSV)<4 S LRSV=$S(LRSV="M":"MEDICINE",LRSV="S":"SURGERY",LRSV="P":"PSYCHIATRY",LRSV="NH":"NHCU",LRSV="NE":"NEUROLOGY",LRSV="I":"INTERMEDIATE MED",LRSV="R":"REHAB MEDICINE",1:LRSV)
 I $L(LRSV)<4 S LRSB=$S(LRSV="SCI":"SPINAL CORD INJURY",LRSV="D":"DOMICILIARY",LRSV="B":"BLIND REHAB",1:"RESPITE CARE")
 S LRBS=$S($L($P(NODE,U,5)):$P(NODE,U,5),1:LRTRN)
 S:'$D(^TMP($J,"RCS14-4",$P(LRMT,U,2),3))#2 ^(3)=0 S ^(3)=(^(3)+$P(LRN1,U,2))
 S:'$D(^TMP($J,"RCS14-4",$P(LRMT,U,2),3,LRSV)) ^(LRSV)=0 S ^(LRSV)=(^(LRSV)+$P(LRN1,U,2))
 S:'$D(^TMP($J,"RCS14-4",$P(LRMT,U,2),5))#2 ^(5)=0 S ^(5)=(^(5)+$P(LRN1,U,2))
 S:'$D(^TMP($J,"RCS14-4",$P(LRMT,U,2),5,LRBS)) ^(LRBS)=0 S ^(LRBS)=(^(LRBS)+$P(LRN1,U,2))
 Q
ZTLOAD ;
 S ZTIO=ION,ZTRTN="QUE^LRARCAM5",ZTDESC="ARCHIVED LR RCS/CDR REPORT"
 S ZTSAVE("LR*")="",ZTSAVE("LRDA*")=""
 D ^%ZTLOAD K ZTSK G EXIT