source: WorldVistAEHR/trunk/r/HEALTH_SUMMARY-GMTS/GMTS1.m@ 837

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

initial load of WorldVistAEHR

File size: 4.8 KB
RevLine 
[613]1GMTS1 ; SLC/JER,KER - Health Summary Driver ; 01/06/2003
2 ;;2.7;Health Summary;**7,16,24,28,37,49,58**;Oct 20, 1995
3 ;
4 ; External References
5 ; DBIA 10076 ^XUSEC(
6 ; DBIA 10000 C^%DTC
7 ; DBIA 10000 NOW^%DTC
8 ;
9EN ; Entry Point to Generate a Summary
10 ;
11 ; Requires: DFN, GMTSTITL, GMTSEG()
12 ; GMTSEGI(), GMTSEGC, DUZ(2)
13 ;
14 ; $I & IO MUST BE VALID, CALLER MUST CLOSE OUTPUT DEVICE
15 ;
16START ; Health Summary
17 N GMSUPRES,GMTSICF,GMTSPXD1,GMTSPXD2,GMTSBEG,GMTSEND
18 S GMSUPRES=$P($G(^GMT(142,+$G(GMTSTYP),0)),U,5)
19 I $D(GMSUPRES),$D(GMTSOBJ),'$D(GMTSOBJ("SUPPRESS COMPONENTS")) S GMSUPRES="N"
20 S:$D(GMTSOBJ("SUPPRESS COMPONENTS")) GMSUPRES="Y"
21 U IO S GMTSLO=3,GMTSLPG=0
22 D DEM^GMTSU
23 W:$E(IOST)="C"&('$D(GMTSOBJ)) @IOF D OUTPUT
24 K GMTSCVD,GMTSCKP,GMTSNPG,GMTSPG,GMTSQIT,GMTSHDR,GMTSHD2,GMTSBRK,GMTSLCMP,GMTSDTC
25 K GMTSEGN,GMTSE,GMTSEGR,GMTSEQ,GMTSEGH,GMTSEGL,GMTSDLM,GMTSDLS,GMTSNDM,GMTSN,GMTSQ
26 Q
27 ;
28OUTPUT ; Loop through GMTSEG()
29 D NOW^%DTC S X=% D REGDTM4^GMTSU S GMTSDTM=X
30 I +$G(GMTSPX1)&+$G(GMTSPX2) D ; Allows date range for data
31 . S GMTS2=9999999-$P(GMTSPX2,"."),GMTS1=9999999-$P(GMTSPX1,".")-.24
32 . ; For GMTS1 want to get everything till Midnight
33 . S X=GMTSPX1 D REGDT4^GMTSU S GMTSPXD1=X
34 . S X=GMTSPX2 D REGDT4^GMTSU S GMTSPXD2=X
35 D HEADER^GMTSUP
36 K GMTSQIT S GMTSEGN=""
37 F S GMTSEGN=$O(GMTSEG(GMTSEGN)) Q:GMTSEGN="" D I $D(GMTSQIT),(GMTSQIT="") Q
38 . K GMTSQIT S GMTSEQ=$P(GMTSEG(GMTSEGN),U,1)
39 . S GMTSE=$P(GMTSEG(GMTSEGN),U,2) D SEGMNT D:GMTSEGN=GMTSEGC LASTPG
40 I $D(GMTSOBJ),+($O(GMTSEG(0)))=0 W !," No data available"
41 S GMTSHDR=$E(GMTSHDR,1,3)_" END "_$E(GMTSHDR,9,79)
42 S:$D(GMTSOBJ) GMTSHDR=$E(GMTSHDR,1,74)
43 S:$D(GMTSOBJE) GMTSHDR="",$P(GMTSHDR,"*",74)="*"
44 I '$D(GMTSOBJ)!($D(GMTSOBJ("CONFIDENTIAL"))) W:$E(IOST)'="C" !,GMTSHDR,!
45 I '$D(GMTSOBJ) H:$E(IOST)="C" 1
46 W:'+$G(GMPSAP)&('$D(GMTSOBJ))&('$D(GMTSOBJE)) @IOF
47 I $D(GMTSQIT) D EXIT
48 Q
49 ;
50LASTPG ; Allows User to branch to an earlier component (last page)
51 Q:$E(IOST)'="C"!(IOT="HFS")!$D(GMTSQIT)
52 I +$G(GMPSAP),IOSL>998,$G(GMPAT(+$O(GMPAT(0),-1)))'=DFN Q
53 ; No footer when IOSL > 998 and action profile is printed.
54 I IOSL>998,+$G(GMPSAP) Q
55 ; No footer when IOSL > 998 and this isn't the last patient.
56 I IOSL>998,$G(GMPAT(+$O(GMPAT(""),-1)))'=$G(DFN) Q
57 I '$D(GMTSOBJ) F I=$Y:1:$S((IOSL-GMTSLO)'>64:(IOSL-GMTSLO),1:(24-GMTSLO)) W !
58 I $D(GMTSQIT),(GMTSQIT>0) K GMTSQIT
59 S GMTSLPG=1 D CKP^GMTSUP
60 Q
61EXIT ; Clean up and quit
62 K ZTSK
63 Q
64SEGMNT ; Output a Component Type
65 N GMTSLOCK,GMTSDBL,GMOOTXT,GMPXICDF,GMPXHLOC,GMPXNARR,GMPXCMOD,GMPXCM,GMTSWRIT,GMSEL
66 I $D(GMTSQIT),(GMTSQIT]"") K GMTSQIT
67 S X=^GMT(142.1,GMTSE,0)
68 S GMTSEGH=$S($P(X,U,4)]"":$P(X,U,4)_" - ",1:"")_$S($P(GMTSEG(GMTSEGN),U,5)]"":$P(GMTSEG(GMTSEGN),U,5),$P(X,U,9)]"":$P(X,U,9),1:" "_$P(X,U,1)),GMTSEGR=$P(X,"^",2)
69 Q:GMTSEGR=""
70 S GMTSLOCK=$P(X,U,7),GMTSDBL=$P(X,U,6),GMOOTXT=$P(X,U,8),GMPXCM=$P(X,U,14)
71 S GMPXHLOC=$P(GMTSEG(GMTSEGN),U,6),GMPXNARR=$P(GMTSEG(GMTSEGN),U,8)
72 S GMPXCMOD=$P(GMTSEG(GMTSEGN),U,9) S:GMPXCM'="Y" GMPXCMOD="N"
73 S GMPXICDF=$P(GMTSEG(GMTSEGN),U,7)
74 S GMTSNDM=$P(GMTSEG(GMTSEGN),U,3),GMTSDLM=$P(GMTSEG(GMTSEGN),U,4) S:GMTSNDM="" GMTSNDM=-1
75 ; Allow for date range for data
76 S:+$G(GMTSPX1)&+$G(GMTSPX2) GMTSDLM=""
77 S GMTSDLS=""
78 I GMTSDLM?1N.N!(GMTSDLM?1N.N1"D") S GMTSDLS=+GMTSDLM_" day"
79 S:GMTSDLM?1N.N1"W" GMTSDLS=+GMTSDLM_" week",GMTSDLM=+GMTSDLM*7
80 S:GMTSDLM?1N.N1"M" GMTSDLS=+GMTSDLM_" month",GMTSDLM=+GMTSDLM*30.4
81 S:GMTSDLM?1N.N1"Y" GMTSDLS=+GMTSDLM_" year",GMTSDLM=+GMTSDLM*365.25
82 S GMTSDLM=+GMTSDLM
83 S:+GMTSDLS>1 GMTSDLS=GMTSDLS_"s"
84 S GMTSEGL="" I GMTSNDM>0!(GMTSDLM>0) S GMTSEGL=" (max "_$S(GMTSNDM>0:GMTSNDM_$S(GMTSNDM=1:" occurrence",1:" occurrences")_$S(GMTSDLM>0:" or ",1:""),1:"")_$S(GMTSDLM>0:GMTSDLS,1:"")_")"
85 K GMTSDLS,GMTSN
86 D NOW^%DTC S GMTSDTC=%,DT=$P(%,".") K %,%H,%I
87 ; Use date range unless variables empty
88 ; GMTS1=Most recent inverted date
89 ; GMTS2=To date in the past in an inverted date format
90 I +$G(GMTSPX1)'>0!(+$G(GMTSPX2)'>0) D
91 . I GMTSDLM'>0 S (GMTS2,GMTSDLM)=9999999,GMTS1=6666666
92 . E S X1=GMTSDTC,X2=-GMTSDLM D C^%DTC S GMTSDLM=9999999-X,GMTS2=GMTSDLM,GMTS1=9999999-(GMTSDTC+.0001) K X1,X2
93 ; Set GMTSBEG to be GMTS2 uninverted
94 S GMTSBEG=$S(GMTS2=9999999:1,1:9999999-GMTS2)
95 ; Set GMTSEND to be GMTS1 uninverted
96 S GMTSEND=$S(GMTS1=6666666:9999999,1:$P(9999999-GMTS1,".")_".235959")
97 ; GMTSWRIT is used to print component heading on 1st write
98 S GMTSWRIT=1
99 I GMTSDBL]"",("PT"[GMTSDBL) D Q
100 . D:GMTSDBL="T" TDISBLD^GMTS2
101 . D:GMTSDBL="P"&$D(GMTSPRM) PDISBLD^GMTS2
102 I GMTSLOCK]"",('$D(^XUSEC(GMTSLOCK,DUZ))) D NOMATCH^GMTS2 Q
103 S GMSEL=$P($G(^GMT(142.1,GMTSE,1,1,0)),U)
104 I GMSEL]"",$O(GMTSEG(GMTSEGN,GMSEL,0))'>0 D NOSELECT^GMTS2 Q
105 S GMTSNPG=0,GMTSWRIT=1
106 D @($P(GMTSEGR,";",1)_U_$P(GMTSEGR,";",2))
107 D NODATA^GMTS2 S GMTSWRIT=1
108 K GMTSDLM
109 Q
Note: See TracBrowser for help on using the repository browser.