VistA-WorldVistAEHR/r/LAB_SERVICE-LR-LS/LRCAPMA2.m

100 lines
4.2 KiB
Mathematica

LRCAPMA2 ;SLC/AM/DALISC/FHS/J0 - WKLD REPORT BY MAJOR SECTION; 2/6/91
;;5.2;LAB SERVICE;;Sep 27, 1994
EN ;
TOP ;
N LRCCNT,LRICNT,LROCNT,LRNCNT,LRACNT,LRCST,LRIST,LROST,LRNST,LRAST
S LRHDR="WORKLOAD STATISTICS BY MAJOR SECTION"
S LRHDR2="REPORT DATE RANGE: "_LRDT1_" - "_LRDT2
D PRTINIT^LRCAPU
S (LRCGT,LRIGT,LROGT,LRNGT,LRAGT)=0
S LRGTREC=$G(^TMP("LR-WL",$J,0))
I $L(LRGTREC) D
. S LRCGT=+$P(LRGTREC,U),LRIGT=+$P(LRGTREC,U,2),LROGT=+$P(LRGTREC,U,3)
. S LRNGT=+$P(LRGTREC,U,4),LRAGT=LRCGT+LRIGT+LROGT+LRNGT
I $E(IOST,1,2)="C-" W @IOF
D:'LRSUMM DET
D:'LREND SUM^LRCAPMA3
D:'LREND PRNTMAN^LRCAPMR1
D:'LREND COMM^LRCAPMR2
Q
DET ;Detailed section
F LRLDIV="AP","CP" D Q:LREND
. S LRHDR3=$S(LRLDIV="AP":"ANATOMIC PATHOLOGY",1:"CLINICAL PATHOLOGY")
. S LRIN=0
. F S LRIN=$O(^TMP("LR-WL",$J,"DIV",LRLDIV,LRIN)) Q:('LRIN)!(LREND) D
. . S LRINN=$S($L($G(^DIC(4,LRIN,0))):$P(^(0),U),1:LRIN)
. . S (LRICGT,LRIIGT,LRIOGT,LRINGT,LRIAGT)=0
. . S LRGTREC=$G(^TMP("LR-WL",$J,"DIV",LRLDIV,LRIN,0))
. . I $L(LRGTREC) D
. . . S LRICGT=+$P(LRGTREC,U),LRIIGT=+$P(LRGTREC,U,2)
. . . S LRIOGT=+$P(LRGTREC,U,3),LRINGT=+$P(LRGTREC,U,4)
. . . S LRIAGT=LRICGT+LRIIGT+LRIOGT+LRINGT
. . D PRTDET
. . D:('LREND)&(LRIAGT) INSTSUM
Q
PRTDET ;Print details
D HDR^LRCAPU
W !,?(80-$L(LRINN)\2),LRINN,!
S LRMAA=0
F S LRMAA=$O(^TMP("LR-WL",$J,"DIV",LRLDIV,LRIN,LRMAA)) Q:(LRMAA="")!($G(LREND)) D
. S LRLSSA=""
. F S LRLSSA=$O(^TMP("LR-WL",$J,"DIV",LRLDIV,LRIN,LRMAA,LRLSSA)) Q:(LRLSSA="")!($G(LREND)) D LSS
Q:LREND
I $Y>(IOSL-5) D NPG^LRCAPU Q:LREND W !,?(80-$L(LRINN)\2),LRINN,!!
I 'LRIAGT D
. W !!!,"NO DATA FOR THIS INSTITUTION AND DATE RANGE",!
E D
. W !!!,"GRAND TOTAL",?43,$J(LRICGT,5),?50,$J(LRIIGT,5)
. W ?57,$J(LRIOGT,5),?65,$J(LRINGT,5),?73,$J(LRIAGT,7),!
D:($E(IOST,1,2)="C-")&('LREND) PAUSE^LRCAPU W @IOF
Q
INSTSUM ;
S LRLAB="!!,?(80-7\2),""SUMMARY"",!,?(80-$L(LRINN)\2),LRINN,!!,""MAJOR SECTION"",?15,""LAB SUBSECTION"",?43,"" CTRL"",?50,""INPAT"",?56,""OUTPAT"",?64,""OTHERS"",?73,"" TOTAL"",!"
D HDR^LRCAPU W @LRLAB
S LRMAA=""
F S LRMAA=$O(^TMP("LR-WL",$J,"DIV",LRLDIV,LRIN,LRMAA)) Q:(LRMAA="")!(LREND) D
. S LRLSSA=""
. F S LRLSSA=$O(^TMP("LR-WL",$J,"DIV",LRLDIV,LRIN,LRMAA,LRLSSA)) Q:(LRLSSA="")!(LREND) D PSUM
I $Y>(IOSL-4) D NPG^LRCAPU Q:LREND W @LRLAB
W !!,"GRAND TOTAL",?43,$J(LRICGT,5),?50,$J(LRIIGT,5),?57,$J(LRIOGT,5)
W ?65,$J(LRINGT,5),?73,$J(LRIAGT,7),!
D:($E(IOST,1,2)="C-")&('LREND) PAUSE^LRCAPU W @IOF
Q
PSUM ;
Q:LREND
Q:'$D(^TMP("LR-WL",$J,"DIV",LRLDIV,LRIN,LRMAA,LRLSSA,0))#2 S LRX=^(0)
I $Y>(IOSL-3) D NPG^LRCAPU Q:LREND W @LRLAB
S LRCCNT=+$P(LRX,U),LRICNT=+$P(LRX,U,2),LROCNT=+$P(LRX,U,3)
S LRNCNT=+$P(LRX,U,4),LRACNT=LRCCNT+LRICNT+LROCNT+LRNCNT
W !,$E(LRMAN(LRMAA),1,14),?15,$E(LRLSSN(LRLSSA),1,14),?31,"NUMBER :"
W ?43,$J(LRCCNT,5),?50,$J(LRICNT,5),?57,$J(LROCNT,5)
W ?65,$J(LRNCNT,5),?73,$J(LRACNT,7)
W !,?31,"PERCENT :"
W ?43,$J($S(LRIAGT:LRCCNT/LRIAGT,1:0)*100,5,1),?50,$J($S(LRIAGT:LRICNT/LRIAGT,1:0)*100,5,1)
W ?57,$J($S(LRIAGT:LROCNT/LRIAGT,1:0)*100,5,1),?65,$J($S(LRIAGT:LRNCNT/LRIAGT,1:0)*100,5,1)
W ?73,$J($S(LRIAGT:LRACNT/LRIAGT,1:0)*100,7,1)
W !
Q
LSS ;
S LRLAB="!!,""MAJOR SECTION: "",LRMAN(LRMAA),!,""LAB SUBSECTION: "",LRLSSN(LRLSSA),!!,""CODE"",?11,""PROCEDURE"",?43,""CNTRL"",?50,""INPAT"",?56,""OUTPAT"",?64,""OTHERS"",?73,"" TOTAL"",!"
I $Y>(IOSL-7) D NPG^LRCAPU Q:LREND W !,?(80-$L(LRINN)\2),LRINN,!
W @LRLAB
S (LRCST,LRIST,LROST,LRNST,LRAST,LRCC)=0
F S LRCC=$O(^TMP("LR-WL",$J,"DIV",LRLDIV,LRIN,LRMAA,LRLSSA,LRCC)) Q:(LRCC="")!(LREND) D PCC
Q:LREND
S LRX=$G(^TMP("LR-WL",$J,"DIV",LRLDIV,LRIN,LRMAA,LRLSSA,0))
S LRCST=+$P(LRX,U),LRIST=+$P(LRX,U,2),LROST=+$P(LRX,U,3)
S LRNST=+$P(LRX,U,4),LRAST=LRCST+LRIST+LROST+LRNST
I $Y+4>IOSL D NPG^LRCAPU Q:LREND W !,?(80-$L(LRINN)\2),LRINN,!,@LRLAB
W !,?11,"SUB TOTAL",?43,$J(LRCST,5),?50,$J(LRIST,5)
W ?57,$J(LROST,5),?65,$J(LRNST,5),?73,$J(LRAST,7),!
Q
PCC ;
S LRX=$G(^TMP("LR-WL",$J,"DIV",LRLDIV,LRIN,LRMAA,LRLSSA,LRCC))
I $Y+3>IOSL D NPG^LRCAPU Q:LREND W !,?(80-$L(LRINN)\2),LRINN,!,@LRLAB
S LRCCNT=+$P(LRX,U),LRICNT=+$P(LRX,U,2),LROCNT=+$P(LRX,U,3)
S LRNCNT=+$P(LRX,U,4),LRACNT=LRCCNT+LRICNT+LROCNT+LRNCNT
W $P(LRX,U,5),?11,$E(LRCC,1,30),?43,$J(LRCCNT,5),?50,$J(LRICNT,5)
W ?57,$J(LROCNT,5),?65,$J(LRNCNT,5),?73,$J(LRACNT,7),!
Q