source: WorldVistAEHR/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIUWRIIS.m@ 1608

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

initial load of WorldVistAEHR

File size: 6.4 KB
RevLine 
[613]1TIUWRIIS ;SLC/AJB,AGP - War Related Illness and Injury Study Center ; 08/18/03
2 ;;1.0;TEXT INTEGRATION UTILITIES;**159**;Jun 20, 1997
3 ;
4 Q
5ADDRESS(DFN) ;
6 N TIUCNT,TIUI,TIUY,VAPA S TIUI=0
7 N TIUCITY,TIUST,TIUZIP
8 D ADD^VADPT
9 S TIUY=$NA(^TMP("TIUWRIISC",$J))
10 F TIUCNT=1:1:3 D
11 . Q:VAPA(TIUCNT)=""
12 . S TIUI=TIUI+1
13 . S @TIUY@(TIUI,0)=VAPA(TIUCNT) I TIUCNT>1 S @TIUY@(TIUI,0)=" "_@TIUY@(TIUI,0)
14 S TIUCITY=" "_VAPA(4)
15 S TIUST=$$GET1^DIQ(5,+VAPA(5),1)
16 S TIUZIP=VAPA(6)
17 S @TIUY@(4,0)=TIUCITY_", "_TIUST_" "_TIUZIP
18 Q "~@"_$NA(@TIUY)
19LAB2(DFN,TIUTEST,COUNT,TPERIOD,TIUEDT,TIULDT) ; Get Lab Results
20 N CNT,DRANGE,INDATE,LABIEN,NUM,OUTPUT,REGDATE,SEQ,SEQ1,SUB,STRING
21 N TIULOUT,TIUY,TIUTST,TIUX,TMP1,TMP2
22 K ^TMP($J,"TIUWRIIS","LABOUT"),^TMP("LRRR",$J)
23 I $G(TPERIOD)="",$G(TIUEDT)="",$G(TIULDT)="" Q "<Invalid Date or Time Period Entered>"
24 I ($G(TPERIOD)?1"T-"1N.N) D
25 . S TIULDT=$$NOW^XLFDT D DT^DILF("P",TPERIOD,.DRANGE) S TIUEDT=$G(DRANGE)
26 I $G(COUNT)="" S COUNT=1
27 I $G(TIUTEST)="" Q "LAB NAME NOT FOUND"
28 S LABIEN=+$O(^LAB(60,"B",TIUTEST,0))
29 I '+$G(LABIEN) Q "INVALID LAB TEST NAME"
30 D RR^LR7OR1(DFN,"",$G(TIUEDT),$G(TIULDT),"",LABIEN,"",$G(COUNT),"",0)
31 I '$D(^TMP("LRRR",$J)) Q "No Lab Information Found for "_TIUTEST
32 S TIULOUT="^TMP($J,""TIUWRIIS"",""LABOUT"")",CNT=1,@TIULOUT@(CNT,0)="Lab Information for "_TIUTEST
33 S STRING=$$LJ^XLFSTR("Collection Date/Time",25),STRING=STRING_$$LJ^XLFSTR("Specimen",10)
34 S STRING=STRING_$$LJ^XLFSTR("Test",8),STRING=STRING_$$LJ^XLFSTR("Result",12)
35 S STRING=STRING_$$LJ^XLFSTR("Range",10),CNT=CNT+1,@TIULOUT@(CNT,0)=STRING
36 S SUB="" F S SUB=$O(^TMP("LRRR",$J,DFN,SUB)) Q:SUB="" D
37 . S INDATE="" F S INDATE=$O(^TMP("LRRR",$J,DFN,SUB,INDATE)) Q:+INDATE'>0 D
38 . . S SEQ="" F S SEQ=$O(^TMP("LRRR",$J,DFN,SUB,INDATE,SEQ)) Q:SEQ="" D
39 . . . I SEQ'="N" D
40 . . . . S CNT=CNT+1
41 . . . . S REGDATE=$$FMTE^XLFDT(9999999-INDATE)
42 . . . . S NODE=$G(^TMP("LRRR",$J,DFN,SUB,INDATE,SEQ))
43 . . . . S STRING=$$LJ^XLFSTR(REGDATE,25)
44 . . . . S STRING=STRING_$$LJ^XLFSTR($$GET1^DIQ(61,$P($G(NODE),U,19)_",",.01),10)
45 . . . . S STRING=STRING_$$LJ^XLFSTR($P($G(NODE),U,15),8)
46 . . . . S STRING=STRING_$$LJ^XLFSTR($P($G(NODE),U,2)_" "_$P($G(NODE),U,3)_$P($G(NODE),U,4),12)
47 . . . . S STRING=STRING_$$LJ^XLFSTR($P($G(NODE),U,5),10)
48 . . . . S @TIULOUT@(CNT,0)=STRING
49 . . . I SEQ="N" S SEQ1="" F S SEQ1=$O(^TMP("LRRR",$J,DFN,SUB,INDATE,SEQ,SEQ1)) Q:+SEQ1'>0 D
50 . . . . S NODE=$G(^TMP("LRRR",$J,DFN,SUB,INDATE,SEQ,SEQ1))
51 . . . . I $G(NODE)["[" D
52 . . . . . S NAME=$P($G(NODE),"[",2),NAME=$P($G(NAME),"]",1)
53 . . . . . S NAME=$$GET1^DIQ(200,$G(NAME)_",",.01)
54 . . . . . S TMP1=$P($G(NODE),"["),TMP2=$P($G(NODE),"]",2)
55 . . . . . S NODE=TMP1_" "_NAME_" "_TMP2
56 . . . . S CNT=CNT+1,@TIULOUT@(CNT,0)="Comment: "_NODE
57 K ^TMP("LRRR",$J)
58LABQ Q "~@"_$NA(@TIULOUT)
59PNOK(DFN) ;
60 N CNT,PNOK,VAOA
61 K ^TMP($J,"TIUWRIIS","PNOK")
62 D OAD^VADPT
63 S CNT=1
64 S PNOK="^TMP($J,""TIUWRIIS"",""PNOK"")"
65 I $D(VAOA) D
66 . S @PNOK@(CNT,0)="Primary Next of Kin Information"
67 . S CNT=CNT+1
68 . S @PNOK@(CNT,0)=$S($G(VAOA(9))'="":$G(VAOA(9)),1:"No Next of Kin Enter")
69 . S CNT=CNT+1
70 . S @PNOK@(CNT,0)=$S($G(VAOA(10))'="":"Relationship to Patient: "_VAOA(10),1:"Relationship Unknown")
71 . S CNT=CNT+1
72 . I $G(VAOA(1))=""&($G(VAOA(2))="")&($G(VAOA(3))="") S @PNOK@(CNT,0)="No Address Information Enter"
73 . E D
74 . . S @PNOK@(CNT,0)=$G(VAOA(1))
75 . . I $G(VAOA(2))'="" S @PNOK@(CNT,0)=@PNOK@(CNT,0)_" "_VAOA(2)
76 . . I $G(VAOA(3))'="" S CNT=CNT+1 S @PNOK@(CNT,0)=VAOA(3)
77 . S CNT=CNT+1
78 . I $G(VAOA(4))'="" S @PNOK@(CNT,0)=$G(VAOA(4))_", "_$P($G(VAOA(5)),U,2)_" "_$G(VAOA(6))
79 . I $G(VAOA(8))'="" S CNT=CNT+1 S @PNOK@(CNT,0)="Home Phone Number: "_VAOA(8)
80 E Q "No Next Kin Information Found"
81 Q "~@"_$NA(@PNOK)
82 ;
83SNOK(DFN) ;
84 N CNT,VAOA
85 K ^TMP($J,"TIUWRIIS","SNOK")
86 S VAOA("A")=3
87 D OAD^VADPT
88 S CNT=1
89 S PNOK="^TMP($J,""TIUWRIIS"",""SNOK"")"
90 I $D(VAOA) D
91 . S @PNOK@(CNT,0)="Secondary Next of Kin Information"
92 . S CNT=CNT+1
93 . S @PNOK@(CNT,0)=$S($G(VAOA(9))'="":$G(VAOA(9)),1:"No Next of Kin Enter")
94 . S CNT=CNT+1
95 . S @PNOK@(CNT,0)=$S($G(VAOA(10))'="":"Relationship to Patient: "_VAOA(10),1:"Relationship Unknown")
96 . S CNT=CNT+1
97 . I $G(VAOA(1))=""&($G(VAOA(2))="")&($G(VAOA(3))="") S @PNOK@(CNT,0)="No Address Information Enter"
98 . E D
99 . . S @PNOK@(CNT,0)=$G(VAOA(1))
100 . . I $G(VAOA(2))'="" S @PNOK@(CNT,0)=@PNOK@(CNT,0)_" "_VAOA(2)
101 . . I $G(VAOA(3))'="" S CNT=CNT+1 S @PNOK@(CNT,0)=VAOA(3)
102 . S CNT=CNT+1
103 . I $G(VAOA(4))'="" S @PNOK@(CNT,0)=$G(VAOA(4))_", "_$P($G(VAOA(5)),U,2)_" "_$G(VAOA(6))
104 . I $G(VAOA(8))'="" S CNT=CNT+1 S @PNOK@(CNT,0)="Home Phone Number: "_VAOA(8)
105 E Q "No Next Kin Information Found"
106 Q "~@"_$NA(@PNOK)
107 ;
108VITALS(DFN,TEST,COUNT,TPERIOD) ; Return vitals for last 24 hours.
109 N %,CNT,DATE,END,GMRVSTR,IEN,INVDATE,NODE,START,TIUVITAL,VITAL,VITALS
110 K ^TMP($J,"TIUWRIIS","VITALS")
111 K ^UTILITY($J,"GMRVD")
112 I ($G(TPERIOD)?1"T-"1N.N) D
113 . D NOW^%DTC S END=%
114 . D DT^DILF("P",TPERIOD,.DRANGE)
115 . S START=$G(DRANGE)_"."_$P(END,".",2)
116 E I $G(TPERIOD)'="" Q "INVALID DATE TIME PERIOD ENTER"
117 S CNT=1
118 S DATE=0
119 S TIUVITAL="^TMP($J,""TIUWRIIS"",""VITALS"")"
120 S GMRVSTR=$G(TEST)
121 S GMRVSTR(0)=START_U_END_U_COUNT_U_"1"
122 D EN1^GMRVUT0
123 I '$D(^UTILITY($J,"GMRVD")) S @TIUVITAL@(CNT,0)="No Vitals Were Found" Q "~@"_$NA(@TIUVITAL)
124 S INVDATE="" F S INVDATE=$O(^UTILITY($J,"GMRVD",INVDATE)) Q:+INVDATE=0 D
125 . S VITAL="" F S VITAL=$O(^UTILITY($J,"GMRVD",INVDATE,VITAL)) Q:VITAL="" D
126 . .S IEN="" F S IEN=$O(^UTILITY($J,"GMRVD",INVDATE,VITAL,IEN)) Q:+IEN=0 D
127 . . . S NODE=^UTILITY($J,"GMRVD",INVDATE,VITAL,IEN)
128 . . . I DATE'=INVDATE D Q
129 . . . . S @TIUVITAL@(CNT,0)="Vitals Enter at: "_$$FMTE^XLFDT(9999999-INVDATE)
130 . . . . S CNT=CNT+1
131 . . . . S DATE=INVDATE
132 . . . . S @TIUVITAL@(CNT,0)=VITAL_": "_$P($G(NODE),U,8)
133 . . . . S CNT=CNT+1
134 . . . I DATE=INVDATE D
135 . . . . S @TIUVITAL@(CNT,0)=VITAL_": "_$P($G(NODE),U,8)
136 . . . . S CNT=CNT+1
137 K ^UTILITY($J,"GMRVD")
138 Q "~@"_$NA(@TIUVITAL)
139PROB(DFN) ; Get total active problem list for a patient
140 N CNT,CNT1,ROOT,NODE,STRING,TIUPOUT
141 K ^TMP($J,"TIUWRIIS","PROB")
142 S TIUPOUT="^TMP($J,""TIUWRIIS"",""PROB"")"
143 S CNT1=1
144 D LIST^GMPLUTL2(.ROOT,+DFN,"A")
145 I '$D(ROOT) Q "No Active Problem Found"
146 S @TIUPOUT@(CNT1,0)=$$LJ^XLFSTR("Code",10)_$$LJ^XLFSTR("Description",63) S CNT1=CNT1+1
147 S CNT=0 F S CNT=$O(ROOT(CNT)) Q:'CNT D
148 . S NODE=$G(ROOT(CNT)) Q:$P($G(NODE),U,10)["$"!($P($G(NODE),U,3)="")
149 . S STRING=$$LJ^XLFSTR($P($G(NODE),U,4),10)_$P($G(NODE),U,3)
150 . S @TIUPOUT@(CNT1,0)=STRING
151 . S CNT1=CNT1+1
152 Q "~@"_$NA(@TIUPOUT)
Note: See TracBrowser for help on using the repository browser.