source: PGC/trunk/p/GMRVED2.m@ 1010

Last change on this file since 1010 was 958, checked in by George Lilly, 14 years ago

Pediatric Growth Charts initial release

File size: 5.7 KB
Line 
1GMRVED2 ;HIOFO/RM,YH,FT-VITAL SIGNS EDIT SHORT FORM ;7/20/07 13:43
2 ;;5.0;GEN. MED. REC. - VITALS;**2**;Oct 31, 2002;Build 15
3 ;
4 ; This routine uses the following IAs:
5 ; #10035 - ^DPT( references (supported)
6 ; #10061 - ^VADPT calls (supported)
7 ; #10103 - ^XLFDT calls (supported)
8 ; #10104 - ^XLFSTR calls (supported)
9 ;
10EN1 ; SORT PATIENTS ON WARD
11 K ^TMP($J)
12WSA1 ; SET ^TMP($J, FOR SORT
13 D DEM^VADPT,INP^VADPT S GMRRMBD=$S(VAIN(5)'="":VAIN(5),1:" BLANK"),GMRNAM=$S(VADM(1)'="":VADM(1),1:" BLANK") D KVAR^VADPT K VA
14 S:$S("Aa"[GMREDB:1,$D(GMRROOM($P(GMRRMBD,"-"))):1,1:0) ^TMP($J,GMRRMBD,GMRNAM,DFN)=""
15 S DFN=$O(^DPT("CN",GMRWARD(1),DFN))
16 Q:DFN="" G WSA1
17EN2 ; BEGIN EDITING WARD VITALS
18 I $O(^TMP($J,0))="" S GMROUT=1 Q
19 W !,"Begin entering patient vitals." S GMRDT0=GMRVIDT
20 S GMRRMBD="" F GMRI=0:0 S GMRRMBD=$O(^TMP($J,GMRRMBD)) Q:GMRRMBD=""!GMROUT S GMRNAM="" F GMRI=0:0 S GMRNAM=$O(^TMP($J,GMRRMBD,GMRNAM)) Q:GMRNAM=""!GMROUT F DFN=0:0 S DFN=$O(^TMP($J,GMRRMBD,GMRNAM,DFN)) Q:DFN'>0 D V1 Q:GMROUT
21 W !,"Enter return to continue" R X:DTIME Q
22V1 ;
23 W !!,$S(GMRNAM'=" BLANK":GMRNAM,1:DFN),?$X+10,$S(GMRRMBD'=" BLANK":GMRRMBD,1:"")," OK? YES// " R GMRX:DTIME
24 I GMRX="^"!('$T) S GMROUT=1 Q
25 S GMRX=$$UP^XLFSTR(GMRX) I ((GMRX="")!($E(GMRX)="Y")) K GMRTO S GDT=GMRVIDT D EN1^GMRVADM G:GMROUT&'$D(GMRTO) V2 D EN2^GMRVED3 G:GMROUT&'$D(GMRTO) V2 Q
26 G:GMRX?1"N".E V2
27 W !,"ANSWER YES OR NO" G V1
28V2 ;
29 W !!,"Do you wish to stop looping through names? YES//" R GMRX:DTIME
30 S GMRX=$$UP^XLFSTR(GMRX) I (('$T)!(GMRX="")!($E(GMRX)="Y")!(GMRX="^")) S GMROUT=1 Q
31 I GMRX?1"N".E S GMROUT=0 Q
32 W !,"ANSWER YES OR NO" G V2
33EN4 ; ENTRY FROM GMRVED0 TO ADD THE PATIENT DATA TO THE 120.5 FILE
34 D NOW^%DTC S GMRDATE=%
35 F GMRX=2:1:$L(GMRSTR(0),";")-1 S GMRVITY=$P(GMRSTR(0),";",GMRX) D
36 . S GMRVIT=$S(GMRVITY="T":"TEMPERATURE",GMRVITY="P":"PULSE",GMRVITY="R":"RESPIRATION",GMRVITY="BP":"BLOOD PRESSURE",GMRVITY="HT":"HEIGHT",GMRVITY="CG":"CIRCUMFERENCE/GIRTH",1:"")
37 . S:GMRVIT="" GMRVIT=$S(GMRVITY="WT":"WEIGHT",GMRVITY="CVP":"CENTRAL VENOUS PRESSURE",GMRVITY="PO2":"PULSE OXIMETRY",GMRVITY="PN":"PAIN",1:"")
38 . D:$G(GMRDAT(GMRVITY))'=""&(GMRVIT'="") ADDNODE
39 Q
40ADDNODE ; add data to the 120.5 file
41 N GMVDTDUN,GMVFDA,GMVIEN
42 S GMVDTDUN=GMRVIDT
43 S GMRVIT(1)=$O(^GMRD(120.51,"B",GMRVIT,0))
44 S GMVDTDUN=$$CHKDT(GMRVIDT,GMRVIT(1))
45 S GMVFDA(120.5,"+1,",.01)=GMVDTDUN ;Date/Time
46 S GMVFDA(120.5,"+1,",.02)=DFN ;Patient
47 S GMVFDA(120.5,"+1,",.03)=GMRVIT(1) ;Vital Type
48 S GMVFDA(120.5,"+1,",.04)=GMRDATE ;Date Time entered
49 S GMVFDA(120.5,"+1,",.05)=GMRVHLOC ;Hospital
50 S GMVFDA(120.5,"+1,",.06)=DUZ ;Entered by (DUZ)
51 S GMVFDA(120.5,"+1,",1.2)=GMRDAT(GMRVITY) ;Rate
52 S GMVFDA(120.5,"+1,",1.4)=$G(GMRO2(GMRVITY)) ;Sup 02
53 S GMVIEN=""
54 D UPDATE^DIE("","GMVFDA","GMVIEN")
55 ;file any qualifiers
56 I $D(GMRSITE(GMRVITY))!$D(GMRINF(GMRVITY)) D
57 .I $G(GMRSITE(GMRVITY))'="" D
58 ..S GDATA=+$P(GMRSITE(GMRVITY),U,2)
59 ..Q:'GDATA
60 ..D ADDQUAL(GMVIEN(1)_"^"_GDATA)
61 ..Q
62 .I $D(GMRINF(GMRVITY)) D
63 ..S I=0
64 ..F S I=$O(GMRINF(GMRVITY,I)) Q:I'>0 D
65 ...S I(1)=""
66 ...F S I(1)=$O(GMRINF(GMRVITY,I,I(1))) Q:I(1)="" D
67 ....S GDATA=+$P(GMRINF(GMRVITY,I,I(1)),"^")
68 ....Q:'GDATA
69 ....D ADDQUAL(GMVIEN(1)_"^"_GDATA)
70 ....Q
71 ...Q
72 ..Q
73 .Q
74 S DA=+GMVIEN(1)
75 I GMREDB="P1" S GMRVIEN(GMRVITY)=DA_"^"_GMRDAT(GMRVITY)_"^"_$G(GMRSITE(GMRVITY))
76 S:GMRENTY>4 GLAST=GMRVIDT,GLAST(1)=$G(GLAST(1))+1
77 ; for VOE Pediatric Growth Charts
78 I "8920"[(+GMRVIT(1)) D EN^GMRVPGC(DFN) ; 8=Height 9=Weight 20=Circumference
79 Q
80XREF(DA) ; Set cross-references for FILE 120.5 entry
81 ; Execute SET logic only. Set's all cross-references for this entry.
82 ; DA is the record number
83 N DIC,DIK,X,Y
84 Q:'DA
85 S DIK="^GMR(120.5,"
86 D IX1^DIK
87 Q
88XREF1(DA) ; Set cross-references for FILE 120.5 entry
89 ; Execute SET logic only. Set's all cross-references for this entry.
90 ; DA is the record number
91 N DIC,DIK,GMRVDA,GMRVIEN,X,Y
92 Q:'DA
93 S GMRVIEN=0,GMRVDA=DA
94 F S GMRVIEN=$O(^GMR(120.5,GMRVDA,5,GMRVIEN)) Q:'GMRVIEN D
95 .S DA(1)=GMRVDA,DA=GMRVIEN
96 .S DIK="^GMR(120.5,DA(1),5,"
97 .D IX1^DIK
98 .Q
99 Q
100SETPRMT ; SET VITAL TYPE PATTERN MATCH
101 S G=$P(GMRSTR(0),";",GMRX)
102 S GMRHELP=GMRHELP_$S(G="P":"PPP",G="WT":"WWW.WW",G="R":"RR",G="CG":"NNN.NN",G="CVP":"NN",G="PO2":"NNN",G="HT":"HH",G="BP":"BBB/BBB/BBB (or BBB/BBB)",G="T":"TTT.T",G="PN":"NN",1:"")_$S(GMRX'=($L(GMRSTR(0),";")-1):"-",1:"")
103 S GMRHELP(1)=GMRHELP(1)_$S(GMRHELP(1)'="":",",1:"")_$P(GMRSTR(0),";",GMRX)_"^GMRVUT1"
104 S GMRPRMT=GMRPRMT_$S(G="T":"Temp",G="P":"Pulse",G="WT":"Wt.",G="R":"Resp",G="HT":"Ht.",G="BP":"BP",G="CG":"Circumference/Girth",G="CVP":"CVP",G="PO2":"PO2",G="PN":"Pain",1:"")_$S(GMRX'=($L(GMRSTR(0),";")-1):"-",1:"")
105 Q
106CHKDT(GMVDT,GMVSAV) ;Check if there is an entry for that date & time
107 N GMVA,GMVTY
108 S GMVA=0
109 F S GMVA=$O(^GMR(120.5,"B",GMVDT,GMVA)) Q:'GMVA D
110 .I DFN'=$P($G(^GMR(120.5,GMVA,0)),U,2) Q
111 .S GMVTY=$P($G(^GMR(120.5,GMVA,0)),"^",3)
112 .I GMVTY=GMVSAV D
113 ..S GMVDT=$$FMADD^XLFDT(GMVDT,"","","",1)
114 ..Q
115 .Q
116 Q GMVDT
117 ;
118ADDQUAL(GMRVDATA) ; Add qualifiers to FILE 120.5 entry
119 ; ADD QUALIFIER TO 120.505 SUBFILE
120 ; Input:
121 ; GMRVDATA=120.5 IEN^QUALIFIER (120.52) IEN
122 ;
123 N GMVCNT,GMVERR,GMVFDA,GMVOKAY,GMRVIEN,GMRVQUAL
124 S GMRVIEN=+$P(GMRVDATA,"^",1) ;File 120.5 ien
125 S GMRVQUAL=+$P(GMRVDATA,"^",2) ;File 120.52 ien
126 ; Does File 120.5 entry exist?
127 I '$D(^GMR(120.5,GMRVIEN,0)) Q
128 ; Is the qualifier already stored?
129 I $O(^GMR(120.5,GMRVIEN,5,"B",GMRVQUAL,0))>0 Q
130 ; Legitimate Qualifier?
131 I '$D(^GMRD(120.52,GMRVQUAL,0)) Q
132 S GMVCNT=0 ;counter for number of tries to lock an entry
133B2 ; Lock the entry
134 I GMVCNT>3 Q ;4 strikes and you're out
135 L +^GMR(120.5,GMRVIEN,0):1
136 S GMVCNT=GMVCNT+1
137 I '$T L -^GMR(120.5,GMRVIEN,0) G B2
138 ; Store the qualifier
139 S GMVFDA(120.505,"+1,"_GMRVIEN_",",.01)=GMRVQUAL
140 D UPDATE^DIE("","GMVFDA","GMVOKAY","GMVERR")
141 L -^GMR(120.5,GMRVIEN,0)
142 Q
Note: See TracBrowser for help on using the repository browser.