source: WorldVistAEHR/trunk/r/HEALTH_SUMMARY-GMTS/GMTSMCZZ.m@ 619

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

initial load of WorldVistAEHR

File size: 4.1 KB
Line 
1GMTSMCZZ ;SLC/SBW - Medicine 2.2 HS Component ;18/APRIL/95
2 ;;2.7;Health Summary;;Oct 20, 1995
3GMTSMCPS ;WISC/DCB - Medicine 2.2 Health Summary Component ;5/10/94
4 ;;2.7;Health Summary;;Oct 20, 1995
5BEG ;One Line summary only
6 D START(0,"B") Q
7BRIEF ;Brief Summary
8 D START(1,"B") Q
9ABN ;Print Brief summary for only abnomaral or Null
10 D START(2,"B") Q
11FULL ;Full Sunnary
12 D START(1,"F") Q
13CAP ;Capture
14 D START(1,"C") Q
15ADBF ;Print Full Summary for only abnotmal or null
16 D START(2,"F") Q
17START(BRIEF,MCTYPE) ;Get the record and display the record
18 N TV,VV,SP
19 K ^TMP("MCAR",$J)
20 S RMAR=$S($D(IOM):IOM,1:IOM)
21 S TV=(.25*RMAR+.5)\1
22 S VV=(.70*RMAR+.5)\1
23 S SP=(RMAR-(TV+VV))-1
24 D KVAR^VADPT
25 I '$D(^MCAR(690,"AC",DFN)) D EXIT Q
26 D SEARCH
27 I '$D(^TMP("MCAR",$J)) D EXIT Q
28 F MCL=1:1 Q:$D(GMTSQIT) Q:'$D(^TMP("MCAR",$J,MCL)) D GETREC(MCL,RMAR,TV,VV,SP)
29 D EXIT
30 Q
31SEARCH ;SEARCH FOR SELECTED PATIENT
32 I $D(GMTSNDM),(GMTSNDM>0) S MAX=GMTSNDM
33 E S MAX=50
34 D HSUM^GMTSMCMA(DFN,GMTSEND,GMTSBEG,MAX,"",MCTYPE)
35 Q
36GETREC(MCL,RMAR,TV,VV,SP) ;Return record
37 N MCDATE,MCPROC,MCSUM,MCPSUM,LOOP,LINE,BLINE
38 S (LOOP,BLINE)="",$P(BLINE,"-",80)="-"
39 S MCDATE=$$RETURN("DATE/TIME",MCL)
40 S MCPROC=$$RETURN("PROCEDURE",MCL)
41 S MCSUM=$$RETURN("SUMMARY",MCL)
42 S MCPSUM=$$RETURN("PROCEDURE SUMMARY",MCL)
43 D CKP^GMTSUP Q:$D(GMTSQIT) W !,MCDATE,?(TV+SP),MCPROC
44 D CKP^GMTSUP Q:$D(GMTSQIT) W !,BLINE
45 D:MCSUM'="" PRINT(MCSUM,VV,"Summary:",TV,SP)
46 D:MCPSUM'="" PRINT(MCPSUM,VV,"Procedure Summary:",TV,SP)
47 D CKP^GMTSUP Q:$D(GMTSQIT) W !
48 Q:+$G(BRIEF)=0
49 I BRIEF=2,("N"[$E(MCSUM,1)),(MCSUM'="") Q
50 F S LOOP=+$O(^TMP("MCAR",$J,MCL,LOOP)) Q:LOOP=0!$D(GMTSQIT) D REPORT(LOOP,MCL,RMAR,BLINE,TV,VV,SP)
51 Q
52 I MLEN>RMAR D CKP^GMTSUP Q:$D(GMTSQIT) W !
53REPORT(LOOP,MCL,RMAR,BLINE,TV,VV,SP) ;Report on procedure
54 N LINE,TEMP,HOLD,TITLE,VALUE,UNITS,MLEN,RANGE
55 N TARRAY,VARRY,LARRAY,TMAX,VMAX,MAX,LOOP2
56 S LINE=^TMP("MCAR",$J,MCL,LOOP,1)
57 S TEMP=$P(LINE,U,1),TITLE=$P(TEMP,";",1)_":"
58 S VALUE=$P(LINE,U,3,255),UNITS=$P(LINE,U,2)
59 Q:(VALUE="")&(MCTYPE'="C")
60 I $P(TEMP,";",2)="W" D WORD(MCL,LOOP,TITLE,RMAR,TV,VV,SP) Q
61 S VALUE=VALUE_$S(UNITS="":"",1:" "_UNITS)
62 D PRINT(VALUE,VV,TITLE,TV,SP)
63 D CKP^GMTSUP Q:$D(GMTSQIT) W !
64 Q
65WARP(VALUE,LENGTH,TEMP,MAX) ;WARP A FIELD
66 N DIWL,DIWR,DIWF,X,LOOP3,TEMP1 S LOOP3=""
67 K ^UTILITY($J,"W")
68 S DIWL=0,DIWR=LENGTH,X=VALUE D ^DIWP
69 F MAX=1:1 S LOOP3=+$O(^UTILITY($J,"W",DIWL,LOOP3)) Q:LOOP3=0 D
70 .S TEMP1=^UTILITY($J,"W",DIWL,LOOP3,0)
71 .S:$E(TEMP1,$L(TEMP1))=" " TEMP1=$E(TEMP1,1,$L(TEMP1)-1)
72 .S TEMP(LOOP3)=TEMP1
73 S MAX=MAX-1
74 Q
75WORD(MCL,LOOP,TITLE,RMAR,TV,VV,SP) ;Display word processing
76 N SLOOP,X,DIWR,DIWL,DIWF,TARRAY,TMAX,LOOP3,SPAC
77 D WARP(TITLE,TV,.TARRAY,.TMAX) K ^UTILITY($J,"W") S DIWR=VV,DIWL=0
78 F SLOOP=0:0 S SLOOP=+$O(^TMP("MCAR",$J,MCL,LOOP,SLOOP)) Q:SLOOP=0 D
79 .S X=$P(^TMP("MCAR",$J,MCL,LOOP,SLOOP),U,3) D ^DIWP
80 S SLOOP=0
81 F LOOP3=1:1 S SLOOP=+$O(^UTILITY($J,"W",DIWL,SLOOP)) Q:(SLOOP=0)!($D(GMTSQIT)) D
82 .D CKP^GMTSUP Q:$D(GMTSQIT)
83 .W !,$J($G(TARRAY(LOOP3)),TV),?(TV+SP),^UTILITY($J,"W",DIWL,SLOOP,0)
84 D CKP^GMTSUP Q:$D(GMTSQIT) W !
85 Q
86CONVERT(TITLE) ;Convert a word to upper/lower case TEMP = Temp
87 N UPPER,LOWER,TEMP,LOOP,HOLD,HOLD2
88 S UPPER="ABCDEFGHIJKLMNOPQRSTUVWXYZ",LOWER="abcdefghijklmnopqrstuvwxyz"
89 F LOOP=1:1:255 S HOLD=$P(TITLE," ",LOOP) Q:HOLD="" D
90 .S:$D(TEMP) TEMP=TEMP_" "
91 .S HOLD2=$E(HOLD,2,$L(HOLD))
92 .S TEMP=$G(TEMP)_$E(HOLD,1)_$TR(HOLD2,UPPER,LOWER)
93 Q TEMP
94PRINT(VALUE,VV,TITLE,TV,SP) ;Print a field and its value
95 N VMAX,TMAX,TARRAY,VARRAY,SPAC,LOOP2
96 S TITLE=$$CONVERT(TITLE)
97 D WARP(VALUE,VV,.VARRAY,.VMAX)
98 D WARP(TITLE,TV,.TARRAY,.TMAX)
99 S MAX=$S(VMAX<TMAX:TMAX,VMAX>TMAX:VMAX,1:TMAX)
100 S SPAC=TMAX-VMAX S:SPAC<0 SPAC=0
101 F LOOP2=1:1:TMAX D CKP^GMTSUP Q:$D(GMTSQIT) D
102 .W !,$J($G(TARRAY(LOOP2)),TV),?(TV+SP),$G(VARRAY(LOOP2-SPAC))
103 Q:$D(GMTSQIT)
104 Q
105RETURN(TYPE,LINE) ;Return key elements
106 N MCHOLD,HOLD
107 S MCHOLD=+$O(^TMP("MCAR",$J,LINE,"B",TYPE,""))
108 S HOLD=$P($G(^TMP("MCAR",$J,LINE,MCHOLD,1)),U,3)
109 K ^TMP("MCAR",$J,LINE,"B",TYPE,LINE)
110 K ^TMP("MCAR",$J,LINE,MCHOLD,1)
111 Q HOLD
112EXIT ;
113 K PR,OT,DA,MCARPPS,MCI,MCJ,R,MCL,S1,S2,S4,S5,S6,LL,LL1,MAX,VA
114 K ^TMP("MCAR",$J),K,N,MCARDT,MCARNM,MCARPROC,M,RMAR
115 Q
Note: See TracBrowser for help on using the repository browser.