source: FOIAVistA/trunk/r/GEN_MED_OTHER-GMV/GMVDS1.m@ 1765

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

initial load of FOIAVistA 6/30/08 version

File size: 4.0 KB
Line 
1GMVDS1 ;HOIFO/YH,FT-CURRENT VITALS BY PATIENT OR LOCATION ;10/25/02 10:20
2 ;;5.0;GEN. MED. REC. - VITALS;;Oct 31, 2002
3 ;
4 ; This routine uses the following IAs:
5 ; #10039 - FILE 42 references (supported)
6 ; #10040 - FILE 44 references (supported)
7 ; #10061 - ^VADPT calls (supported)
8 ; #10090 - FILE 4 references (supported)
9 ; #10103 - ^XLFDT calls (supported)
10 ; #10104 - ^XLFSTR calls (supported)
11 ;
12EN1(RESULT,GMVDATA) ; [RPC entry point]
13 ; GMV LATEST VITALS FOR PATIENT & GMV LATEST VITALS BY LOCATION
14 ; DFN - patient internal entry number
15 ; GMVDEV - device name
16 ; GMVIEN - device internal entry number
17 ; GMVPDT - date/time to print the report
18 ; GMVWARD - ward internal entry number
19 ; GMVHLOC - hospital location internal entry number
20 ;
21 N DFN,GMVDEV,GMVIEN,GMVPDT,GMVWARD,GMVHLOC
22 S DFN=+$P(GMVDATA,U,1),GMVDEV=$P(GMVDATA,U,5),GMVIEN=+$P(GMVDATA,U,6),GMVPDT=$P(GMVDATA,U,7),GMVWARD=$P(GMVDATA,U,8),GMVHLOC=$P(GMVDATA,U,9)
23 S ZTIO=GMVDEV ;device
24 S ZTDTH=$S($G(GMVPDT)>0:GMVPDT,1:$$NOW^XLFDT()) ;date/time to print
25 S ZTRTN="EN2^GMVDS1"
26 S (ZTSAVE("DFN"),ZTSAVE("GMVWARD"),ZTSAVE("GMVHLOC"))=""
27 I DFN>0 S ZTDESC="Latest Vitals Display for a Patient"
28 I GMVWARD>0 S ZTDESC="Latest Vitals by Location"
29 D ^%ZTLOAD
30 S RESULT=$S($G(ZTSK)>0:"Report sent to device. Task #: "_ZTSK,1:"Unable to task the report.")
31 K ZTSK,ZTIO,ZTDTH,ZTSAVE,ZTDESC,ZTRTN
32 Q
33EN2 ; Start the report output
34 S:$D(ZTQUEUED) ZTREQ="@"
35 S GMVEDB=$S(DFN>0:"P",1:"A") ;P is one patient, A is whole ward
36 S GMVWARD(1)=$S(GMVWARD>0:$P($G(^DIC(42,GMVWARD,0)),U,1),1:"") ;ward name
37 K ^TMP($J)
38 I $G(GMVEDB)="P" D
39 .D DEM^VADPT,INP^VADPT
40 .S GMRRMBD=$S(VAIN(5)'="":VAIN(5),1:" BLANK") ;roombed
41 .S GMVNAME=$S(VADM(1)'="":VADM(1),1:" BLANK") ;patient name
42 .S GMVWARD=$P(VAIN(4),"^") ;ward ien
43 .S GMVWARD(1)=$P(VAIN(4),"^",2) ;ward name
44 .D KVAR^VADPT K VA ;kill VADPT variables
45 .S ^TMP($J,GMRRMBD,GMVNAME,DFN)=""
46 E D WARD
47AE ;
48 S (GMROUT,GMVPAGE)=0
49 S GMVDASH=$$REPEAT^XLFSTR("-",80) ;line of dashes
50 D NOW^%DTC
51 S Y=% X ^DD("DD") S GMRPDT=$P(Y,"@")_" ("_$P($P(Y,"@",2),":",1,2)_")"
52 S GMRSTR="T;P;R;BP;WT;HT;CVP;CG;PO2;PN"
53 S GLOC=1 ;<-might be dead code
54 U IO
55 D HDR
56 I $O(^TMP($J,""))="" W !,"THERE IS NO DATA FOR THIS REPORT" D Q1 Q
57 S GMRRMBD=""
58 F S GMRRMBD=$O(^TMP($J,GMRRMBD)) Q:GMRRMBD=""!GMROUT S GMVNAME="" F S GMVNAME=$O(^TMP($J,GMRRMBD,GMVNAME)) Q:GMVNAME=""!GMROUT F DFN=0:0 S DFN=$O(^TMP($J,GMRRMBD,GMVNAME,DFN)) Q:DFN'>0 D PRT Q:GMROUT
59Q1 ; Kill variables and quit
60 K ^TMP($J),DFN,GMRADM,GMRDA,GMVDASH,GMVEDB,GMVNAME,GMRNM,GMROUT,GMRPDT,GMVPAGE,GMRRMBD,GMRPR,GMRVDT,GMRVTDA,GMVWARD,GMRX,GMRSITE,GMRSP,GMRVX,GMVHLOC,POP,GMRDT,%,%T,GDT
61 K GSTRIN,GMRSTR,GMROUT,GMRVOERR,GMRVSTOP,GMRVSTRT,GLOC,GDATA
62 D KVAR^VADPT
63 D Q^GMVDS0
64 D ^%ZISC
65 Q
66HDR ; Report Header
67 W:$Y>0 @IOF
68 S GMVPAGE=GMVPAGE+1
69 I GMVEDB="A" W !,GMRPDT,?20,"VITALS REPORT FOR UNIT: "_GMVWARD(1) W:GMVHLOC>0 " - "_$$GET1^DIQ(4,+$$GET1^DIQ(44,+GMVHLOC,3,"I"),.01,"I")
70 I GMVEDB="P" W !,GMRPDT,?28,"LATEST VITALS REPORT"
71 W ?72,"PAGE ",GMVPAGE
72 W !,GMVDASH,!
73 Q
74PRT ; Body of report
75 D:IOSL<($Y+6)!($E(IOST)'="P") HDR Q:GMROUT
76 D DEM^VADPT K GMRDT
77 W !,$S(GMRRMBD'=" BLANK":$E(GMRRMBD,1,10),1:""),?12,$E(GMVNAME,1,20),?34,$P(VADM(2),U,2),!
78 D EN1^GMVDS0,Q2
79 Q
80Q2 ; Kill variables
81 K GMRLIN,GMRJ,GBP,GMR,GMRL,GMRDT,GMRDAT,GMRDATS,GMRI,GMRX,GMRY,GMRVX,GSITE,GQUAL
82 Q
83WARD ; Build TMP global for patients on ward
84 ; set ^TMP($J,roombed,patient name,DFN)=""
85 ; GMVWARD(1) is the NAME of FILE 42 entry
86 ; GMVRMBD(n) is an array of room numbers on the ward (e.g, GMVRMBD(200))
87 ; GMVEDB is a code for the type of sort
88 ; A = all patients on a ward
89 ; S = selected roombeds on a ward
90 ; P = an individual patient
91 K ^TMP($J)
92 S DFN=0
93 F S DFN=$O(^DPT("CN",GMVWARD(1),DFN)) Q:DFN="" D
94 .D DEM^VADPT,INP^VADPT
95 .S GMVRMBD=$S(VAIN(5)'="":VAIN(5),1:" BLANK") ;roombed
96 .S GMVNAME=$S(VADM(1)'="":VADM(1),1:" BLANK") ;patient name
97 .D KVAR^VADPT K VA
98 .S:$S("Aa"[GMVEDB:1,$D(GMVROOM($P(GMVRMBD,"-"))):1,1:0) ^TMP($J,GMVRMBD,GMVNAME,DFN)=""
99 .Q
100 Q
Note: See TracBrowser for help on using the repository browser.