source: WorldVistAEHR/trunk/r/SPINAL_CORD_DYSFUNCTION-SPN/SPNLRJI.m@ 767

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

initial load of WorldVistAEHR

File size: 4.3 KB
Line 
1SPNLRJI ;ISC-SF/GB-SCD IP/OP REPORT (PRINT IP) ;6/23/95 11:57
2 ;;2.0;Spinal Cord Dysfunction;;01/02/1997
3INPAT(TITLE,PAGELEN,HIUSERS,ABORT) ;
4 ; PAGELEN Number of lines per page
5 ; TITLE Array of header lines (titles)
6 S TITLE(3)=$$CENTER^SPNLRU("Inpatient Activity")
7 D PIP1 Q:ABORT
8 D PIP2 Q:ABORT
9 I HIUSERS D
10 . D PIP3 Q:ABORT
11 . D PIP4
12 Q
13PIP1 ;
14 ; ADM Number of admissions (stays)
15 N ADM,OUT,LINE,STARTLIN,COL,NPATS,DAYS
16 S TITLE(5)=""
17 S NPATS=+$G(^TMP("SPN",$J,"IP","PAT"))
18 S ADM=+$G(^TMP("SPN",$J,"IP","ADM"))
19 S DAYS=+$G(^TMP("SPN",$J,"IP","DAYS"))
20 S TITLE(6)=$$CENTER^SPNLRU("Totals: "_$FN(NPATS,",")_" patient"_$S(NPATS=1:"",1:"s")_" for "_$FN(ADM,",")_" stay"_$S(ADM=1:"",1:"s")_" and "_$FN(DAYS,",")_" day"_$S(DAYS=1:"",1:"s")_" inpatient care")
21 S ADM=+$O(^TMP("SPN",$J,"IP","ADM","PAT",""))
22 F D Q:ADM=""!(ABORT)
23 . D HEADER^SPNLRU(.TITLE,.ABORT) Q:ABORT
24 . K OUT,TITLE(5),TITLE(6)
25 . S STARTLIN=$Y
26 . S OUT(STARTLIN+1)=""
27 . F COL=1:1:3 D Q:ADM=""
28 . . S OUT(STARTLIN)=$G(OUT(STARTLIN))_" Patients Stays "
29 . . F LINE=STARTLIN+2:1:PAGELEN D Q:ADM=""
30 . . . S OUT(LINE)=$G(OUT(LINE))_$J($FN($G(^TMP("SPN",$J,"IP","ADM","PAT",ADM)),","),11)_$J($FN(ADM,","),9)_" "
31 . . . S ADM=$O(^TMP("SPN",$J,"IP","ADM","PAT",ADM))
32 . S LINE=""
33 . F S LINE=$O(OUT(LINE)) Q:LINE="" D
34 . . W !,OUT(LINE)
35 Q
36PIP2 ;
37 ; BS Bed Section Array
38 ; BSNAME Bed Section Name
39 ; BSNR Bed Section Number
40 ; DAYS Number of days spent in a bed section
41 ; NPATS Number of patients
42 ; STAYS Number of stays in a bed section
43 N STAYS,BSNAME,NPATS,DAYS,BS,BSNR
44 S TITLE(5)=""
45 S TITLE(6)=$$CENTER^SPNLRU("Median Length of Stay (MLOS): "_$FN($$MEDIAN^SPNLRU($G(^TMP("SPN",$J,"IP","ADM")),"^TMP(""SPN"","_$J_",""IP"",""ADM"",""DAYS"","),",",1)_" days")
46 ; TITLE(5)=" 1 2 3 4 5 6 7 8"
47 S TITLE(7)=""
48 S TITLE(8)="Specialty Patients Stays Days MLOS"
49 D HEADER^SPNLRU(.TITLE,.ABORT) Q:ABORT
50 S BSNR="" ; set up to print bed sections in name order
51 F S BSNR=$O(^TMP("SPN",$J,"IP","BS",BSNR)) Q:BSNR="" D
52 . S BS(^TMP("SPN",$J,"IP","BS",BSNR,"NAME"))=BSNR
53 S BSNAME=""
54 F S BSNAME=$O(BS(BSNAME)) Q:BSNAME="" D Q:ABORT
55 . I $Y>PAGELEN D HEADER^SPNLRU(.TITLE,.ABORT) Q:ABORT
56 . S BSNR=BS(BSNAME)
57 . S NPATS=^TMP("SPN",$J,"IP","BS",BSNR)
58 . S STAYS=^TMP("SPN",$J,"IP","BS",BSNR,"STAYS")
59 . S DAYS=^TMP("SPN",$J,"IP","BS",BSNR,"DAYS")
60 . W !,BSNAME,?35,$J($FN(NPATS,","),9),?50,$J($FN(STAYS,","),7),?60,$J($FN(DAYS,","),8),?70,$J($$MEDIAN^SPNLRU(STAYS,"^TMP(""SPN"","_$J_",""IP"",""BS"","""_BSNR_""",""DAYS"","),9,1)
61 K TITLE(5),TITLE(6),TITLE(7),TITLE(8)
62 Q
63PIP3 ;
64 ; ADM Number of admissions (stays)
65 ; DAYS Number of days for these admissions
66 ; I High User Counter
67 ; PID Patient ID (Coded SSN)
68 ; PNAME Patient Name
69 ; PSSN Patient SSN
70 N ADM,I,DAYS,PID,PNAME,PSSN
71 S TITLE(5)=""
72 S TITLE(6)=$$CENTER^SPNLRU("Highest Number of Stays")
73 S TITLE(7)=""
74 S TITLE(8)="Patient Name SSN Stays Days"
75 D HEADER^SPNLRU(.TITLE,.ABORT) Q:ABORT
76 S ADM=""
77 F I=1:1:HIUSERS S ADM=$O(^TMP("SPN",$J,"IP","HI","H1",ADM)) Q:ADM="" D Q:ABORT
78 . S DAYS=""
79 . F S DAYS=$O(^TMP("SPN",$J,"IP","HI","H1",ADM,DAYS)) Q:DAYS="" D Q:ABORT
80 . . S PID=""
81 . . F S PID=$O(^TMP("SPN",$J,"IP","HI","H1",ADM,DAYS,PID)) Q:PID="" D Q:ABORT
82 . . . I $Y>PAGELEN D HEADER^SPNLRU(.TITLE,.ABORT) Q:ABORT
83 . . . D GETNAME^SPNLRU(PID,.PNAME,.PSSN)
84 . . . W !,PNAME,?32,PSSN,?45,$J($FN(-ADM,","),10),?60,$J($FN(-DAYS,","),11)
85 K TITLE(5),TITLE(6),TITLE(7),TITLE(8)
86 Q
87PIP4 ;
88 N ADM,I,DAYS,PID,PNAME,PSSN
89 S TITLE(5)=""
90 S TITLE(6)=$$CENTER^SPNLRU("Highest Number of Days")
91 S TITLE(7)=""
92 S TITLE(8)="Patient Name SSN Days Stays"
93 D HEADER^SPNLRU(.TITLE,.ABORT) Q:ABORT
94 S DAYS=""
95 F I=1:1:HIUSERS S DAYS=$O(^TMP("SPN",$J,"IP","HI","H2",DAYS)) Q:DAYS="" D Q:ABORT
96 . S ADM=""
97 . F S ADM=$O(^TMP("SPN",$J,"IP","HI","H2",DAYS,ADM)) Q:ADM="" D Q:ABORT
98 . . S PID=""
99 . . F S PID=$O(^TMP("SPN",$J,"IP","HI","H2",DAYS,ADM,PID)) Q:PID="" D Q:ABORT
100 . . . I $Y>PAGELEN D HEADER^SPNLRU(.TITLE,.ABORT) Q:ABORT
101 . . . D GETNAME^SPNLRU(PID,.PNAME,.PSSN)
102 . . . W !,PNAME,?32,PSSN,?45,$J($FN(-DAYS,","),11),?60,$J($FN(-ADM,","),10)
103 K TITLE(5),TITLE(6),TITLE(7),TITLE(8)
104 Q
Note: See TracBrowser for help on using the repository browser.