source: WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRCAPAM5.m@ 619

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

initial load of WorldVistAEHR

File size: 4.5 KB
RevLine 
[613]1LRCAPAM5 ;DALISC/FHS - RCS 14-4 REPORT PART 1
2 ;;5.2;LAB SERVICE;;Sep 27, 1994
3EN ;
4INST ;
5 K LRDA,LRRPTM S LRDA(1)=$$INSN^LRU I 'LRDA(1) W !!?10,"I am sorry, there is no primary institution defined in ^XMB(1,1,""XUS"") ",!," Aborted " G EXIT
6DIV ;
7 K DIC
8 S DIC("A")="Select Division: "
9 S DIC("B")=$P($G(^DIC(4,+DUZ(2),0)),U)
10 S DIC=4,DIC(0)="AQENMZ"
11 D ^DIC G:Y<1 EXIT S LRDA=Y
12MONTHS ;
13 K DA,DIC
14 S DA(1)=LRDA(1),DA=+LRDA,DIC(0)="AQEN"
15 S DIC="^LRO(67.9,"_DA(1)_",1,"_DA_",1,"
16 S DIC("A")="Select Month: "
17 F D ^DIC Q:Y<1 S LRRPTM(Y)=""
18 I '$O(LRRPTM(0)) W !!?5,"Nothing Selected " G EXIT
19DATTYP ;
20 K DIR
21 S DIR(0)="S^1:All workload;2:LMIP reportable workload;3:Non-LMIP workload"
22 S DIR("A")="Enter the number for the workload data to report"
23 S DIR("B")=1
24 S DIR("?")=" reportable for LMIP."
25 S DIR("?",1)="1 - will include all workload data in the file, period."
26 S DIR("?",2)=" "
27 S DIR("?",3)="2 - will include only workload which is associated with a"
28 S DIR("?",4)=" WKLD code that is marked as reportable for LMIP uses."
29 S DIR("?",5)=" "
30 S DIR("?",6)="3 - will include any workload which is not marked as"
31 D ^DIR G:($D(DTOUT))!($D(DUOUT)) EXIT
32 S LRDTYP=Y,LRHD0=$S(LRDTYP=1:"ALL WORKLOAD DATA FOR: ",LRDTYP=2:"LMIP WORKLOAD DATA FOR: ",1:"Non-LMIP WORKLOAD DATA FOR: ")
33REPTYP ;
34 K DIR S DIR(0)="S^1:CDR report"
35 S:LRDTYP=2 DIR(0)=DIR(0)_";2:LMIP report;3:CDR and LMIP reports"
36 S DIR("A")="Enter the number for the report(s) you want printed"
37 S DIR("B")=1
38 D ^DIR G:($D(DTOUT))!($D(DUOUT)) EXIT S LRRTYP=Y
39DETSUM ;
40 I (LRRTYP=1)!(LRRTYP=3) D G:$G(LREND) EXIT
41 .W !!,"CDR format selection: "
42 .K DIR,X,Y S DIR(0)="S^1:Detailed report;2:Summary report"
43 .D ^DIR
44 .I ($D(DTOUT))!($D(DUOUT)) S LREND=1 Q
45 .S LRRPT=+X
46DEVICE ;
47 S %ZIS="Q" D ^%ZIS G:POP EXIT I $D(IO("Q")) G ZTLOAD
48 D WAIT^DICD
49QUE ;
50 U IO K ^TMP($J,"RCS14-4"),^TMP($J,"LMIP")
51 S (LRERR,LRMT)="" S:$D(ZTQUEUED) ZTREQ="@"
52 F S LRMT=$O(LRRPTM(LRMT)) Q:LRMT="" S (LRCAP,LRTSTOT)=0 D
53 .D INITSUM^LRCAPAM7
54 .S:'$D(^TMP($J,"RCS14-4",$P(LRMT,U,2),0)) ^(0)=0 S LRTOT1=^(0)
55 .F S LRCAP=$O(^LRO(67.9,+LRDA(1),1,+LRDA,1,+LRMT,1,LRCAP)) Q:LRCAP<1 I $D(^(LRCAP,0))#2 S LRTREAT=0 D S ^TMP($J,"RCS14-4",$P(LRMT,U,2),0)=LRTOT1
56 ..S LRN=$G(^LRO(67.9,+LRDA(1),1,+LRDA,1,+LRMT,1,LRCAP,0)),LRN2=+$G(^(2))
57 ..I '$O(^LRO(67.9,+LRDA(1),1,+LRDA,1,+LRMT,1,LRCAP,1,0)) S LRCAPIFN=+$O(^LAM("C",$P(LRN,U)_" ",0)) D:LRCAPIFN BMPSUM^LRCAPAM7 Q
58 ..S LRCC=$P(LRN,U) S LRCCN=$E($$WKLDNAME^LRCAPU(LRCC),1,40)
59 ..S:LRCCN["*ERR" LRERR=LRERR+1
60 ..Q:((LRDTYP=2)&('LRN2))!((LR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,1:2000)
81 S LRTRN="[ "_LRCDR_" ] "_$S($L($P(NODE,U)):$P(NODE,U),LRCDR=2100:"BLOOD BANK",1:"AMBULATORY CARE")
82 S LRSV=$S($L($P(NODE,U,3)):$P(NODE,U,3),1:LRTRN)
83 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)
84 I $L(LRSV)<4 S LRSB=$S(LRSV="SCI":"SPINAL CORD INJURY",LRSV="D":"DOMICILIARY",LRSV="B":"BLIND REHAB",1:"RESPITE CARE")
85 S LRBS=$S($L($P(NODE,U,5)):$P(NODE,U,5),1:LRTRN)
86 S:'$D(^TMP($J,"RCS14-4",$P(LRMT,U,2),3))#2 ^(3)=0 S ^(3)=(^(3)+$P(LRN1,U,2))
87 S:'$D(^TMP($J,"RCS14-4",$P(LRMT,U,2),3,LRSV)) ^(LRSV)=0 S ^(LRSV)=(^(LRSV)+$P(LRN1,U,2))
88 S:'$D(^TMP($J,"RCS14-4",$P(LRMT,U,2),5))#2 ^(5)=0 S ^(5)=(^(5)+$P(LRN1,U,2))
89 S:'$D(^TMP($J,"RCS14-4",$P(LRMT,U,2),5,LRBS)) ^(LRBS)=0 S ^(LRBS)=(^(LRBS)+$P(LRN1,U,2))
90 Q
91ZTLOAD ;
92 S ZTIO=ION,ZTRTN="QUE^LRCAPAM5",ZTDESC="LR RCS/CDR REPORT"
93 S ZTSAVE("LR*")="",ZTSAVE("LRDA*")=""
94 D ^%ZTLOAD K ZTSK G EXIT
Note: See TracBrowser for help on using the repository browser.