VistA-FOIAVistA/r/NURSING_SERVICE-NUR/NURAGEN2.m

53 lines
4.2 KiB
Mathematica

NURAGEN2 ;HIRMFO/JH/MD-GENERIC REPORT GENERATOR FOR ADMIN. part 2 ;MAR 95
;;4.0;NURSING SERVICE;;Apr 25, 1997
;This is a continuation of routine NURAGEN1.
;
F1 S NURSORT=$G(^TMP($J,"L",NURFAC,NURPROG,NPC2,NPC3,NPC4)),NURSX=0 I NURSORT F S NURSX=$O(^TMP($J,"L1",NURSORT,NPC5,NPC6,NURSX)) Q:NURSX'>0 S ^TMP("NURA",$J,NURFAC,NURPROG,NPC6,NURSX,NURSORT)=""
Q
F2 S NURSORT=$G(^TMP($J,"L",NURFAC,NURPROG,NPC2,NPC3,NPC4)),NURSX=0 I NURSORT F S NURSX=$O(^TMP($J,"L1",NURSORT,NPC5,NPC6,NPC7,NURSX)) Q:NURSX'>0 S ^TMP("NURA",$J,NURFAC,NURPROG,NPC7,NURSX,NURSORT)=""
Q
F3 S NURSORT=$G(^TMP($J,"L",NURFAC,NURPROG,NPC2,NPC3,NPC4)),NURSX=0 I NURSORT F S NURSX=$O(^TMP($J,"L1",NURSORT,NPC5,NPC6,NURSX)) Q:NURSX'>0 S ^TMP("NURA",$J,NURFAC,NURPROG,NPC6,NPC4,NURSX)=""
Q
F4 S NURSORT=$G(^TMP($J,"L",NURFAC,NURPROG,NPC2,NPC3,NPC4)),NURSX=0 I NURSORT F S NURSX=$O(^TMP($J,"L1",NURSORT,NPC5,NPC6,NPC7,NURSX)) Q:NURSX'>0 S ^TMP("NURA",$J,NURFAC,NURPROG,NPC7,NPC5,NURSX)=""
Q
F5 S NURSORT=$G(^TMP($J,"L",NURFAC,NURPROG,NPC2,NPC3,NPC4)),NURSX=0 I NURSORT F S NURSX=$O(^TMP($J,"L1",NURSORT,NPC5,NPC6,NPC7,NURSX)) Q:NURSX'>0 S ^TMP("NURA",$J,NURFAC,NURPROG,NPC7,NURSX,NURSORT)=""
Q
F6 S NURSORT=$G(^TMP($J,"L",NURFAC,NURPROG,NPC2,NPC3,NPC4)),NURSX=0 I NURSORT F S NURSX=$O(^TMP($J,"L1",NURSORT,NPC5,NPC6,NPC7,NPC8,NURSX)) Q:NURSX'>0 S ^TMP("NURA",$J,NURFAC,NURPROG,NPC8,NURSX,NURSORT)=""
Q
F7 S NURSORT=$G(^TMP($J,"L",NURFAC,NURPROG,NPC2,NPC3,NPC4)),NURSX=0 I NURSORT F S NURSX=$O(^TMP($J,"L1",NURSORT,NPC5,NURSX)) Q:NURSX'>0 S ^TMP("NURA",$J,NURFAC,NURPROG,NPC5,NURSX,NURSORT)=""
Q
F8 S NURSORT=$G(^TMP($J,"L",NURFAC,NURPROG,NPC2,NPC3,NPC4)),NURSX=0 I NURSORT F S NURSX=$O(^TMP($J,"L1",NURSORT,NPC5,NPC6,NURSX)) Q:NURSX'>0 S ^TMP("NURA",$J,NURFAC,NURPROG,NPC6,NURSX,NURSORT)=""
Q
F9 S NURSORT=$G(^TMP($J,"L",NURFAC,NURPROG,NPC2,NPC3,NPC4)),NURSX=0 I NURSORT F S NURSX=$O(^TMP($J,"L1",NURSORT,NPC5,NURSX)) Q:NURSX'>0 S ^TMP("NURA",$J,NURFAC,NURPROG,NPC5,NPC3,NURSX)=""
Q
F10 S NURSORT=$G(^TMP($J,"L",NURFAC,NURPROG,NPC2,NPC3,NPC4)),NURSX=0 I NURSORT F S NURSX=$O(^TMP($J,"L1",NURSORT,NPC5,NPC6,NURSX)) Q:NURSX'>0 S ^TMP("NURA",$J,NURFAC,NURPROG,NPC6,NPC4,NURSX)=""
Q
F11 S NURSORT=$G(^TMP($J,"L",NURFAC,NURPROG,NPC2,NPC3,NPC4)),NURSX=0 I NURSORT F S NURSX=$O(^TMP($J,"L1",NURSORT,NPC5,NPC6,NPC7,NURSX)) Q:NURSX'>0 S ^TMP("NURA",$J,NURFAC,NURPROG,NPC7,NURSX,NURSORT)=""
Q
NURA ;SET ^TMP("NURA",$J) FOR PERSON AND ASSIGNMENT COUNT
K ^TMP("NURA",$J) S (NURSORT,NURSORT(1))=0
F S NURSORT=$O(^TMP($J,"L1",NURSORT)) Q:NURSORT'>0 S N="" F S N=$O(^TMP($J,"L1",NURSORT,N)) Q:N="" S N(1)="" F S N(1)=$O(^TMP($J,"L1",NURSORT,N,N(1))) Q:N(1)="" S N(2)="" F S N(2)=$O(^TMP($J,"L1",NURSORT,N,N(1),N(2))) Q:N(2)="" D
.I NURSORT(2)>2 S N(3)="" F S N(3)=$O(^TMP($J,"L1",NURSORT,N,N(1),N(2),N(3))) Q:N(3)="" D
..I NURSORT(2)=3 D GLOB
..S N(4)="" F S N(4)=$O(^TMP($J,"L1",NURSORT,N,N(1),N(2),N(3),N(4))) Q:N(4)="" D
...I NURSORT(2)=4 D GLOB
...E S N(5)="" F S N(5)=$O(^TMP($J,"L1",NURSORT,N,N(1),N(2),N(3),N(4),N(5))) Q:N(5)="" D GLOB
.I NURSORT(2)=2 D GLOB
K N Q
GLOB ;S ^TMP("NURA",$J) FOR ASSIGNMENT AND PERSON COUNTS
I NURROU=7!(NURROU=18) S ^TMP("NURA",$J,@NURSORT(3),N(3)_"-"_N(4))="" Q
I NURROU=8 S ^TMP("NURA",$J,@NURSORT(3),N(4)_"-"_N(5))="" Q
I NURROU=17 S ^TMP("NURA",$J,@NURSORT(3),N(2)_"-"_N(3))="" Q
S NURSORT(1)=NURSORT(1)+1,^TMP("NURA",$J," BLANK"," BLANK",@NURSORT(3),NURSORT(1),NURSORT)=""
Q
GENDER ;TOTAL COUNTS FOR GENDER REPORTS
K ^TMP("NURA",$J) S NURFAC="" F S NURFAC=$O(^TMP($J,"L",NURFAC)) Q:NURFAC="" S NURPROG="" F S NURPROG=$O(^TMP($J,"L",NURFAC,NURPROG)) Q:NURPROG="" S NL="" F S NL=$O(^TMP($J,"L",NURFAC,NURPROG,NL)) Q:NL="" D
. S NL(1)="" F S NL(1)=$O(^TMP($J,"L",NURFAC,NURPROG,NL,NL(1))) Q:NL(1)="" S NL(2)="" F S NL(2)=$O(^TMP($J,"L",NURFAC,NURPROG,NL,NL(1),NL(2))) Q:NL(2)="" S NURSORT=^TMP($J,"L",NURFAC,NURPROG,NL,NL(1),NL(2)) D:NURSORT L1
Q
L1 S NL1="" F S NL1=$O(^TMP($J,"L1",NURSORT,NL1)) Q:NL1="" S NL1(1)="" F S NL1(1)=$O(^TMP($J,"L1",NURSORT,NL1,NL1(1))) Q:NL1(1)="" S NL1(2)="" F S NL1(2)=$O(^TMP($J,"L1",NURSORT,NL1,NL1(1),NL1(2))) Q:NL1(2)="" D
.I NURSORT(2)=3 S NL1(3)="" F S NL1(3)=$O(^TMP($J,"L1",NURSORT,NL1,NL1(1),NL1(2),NL1(3))) Q:NL1(3)="" D GLOB1
.E D GLOB1
Q
GLOB1 S NURSORT(1)=NURSORT(1)+1,^TMP("NURA",$J,@NURSORT(3),@NURSORT(4),NURSORT(1))=""
Q