source: WorldVistAEHR/trunk/r/GEN_MED_REC_VITALS-GMRV/GMRVEE2.m@ 824

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

initial load of WorldVistAEHR

File size: 4.7 KB
Line 
1GMRVEE2 ;HIRMFO/YH-ENTERED IN ERROR EDIT (cont.) ;2/6/99
2 ;;4.0;Vitals/Measurements;**1,7,11**;Apr 25, 1997
3EN1 ; ENTER NEW DATE/TIME VITALS TAKEN
4 S %DT(0)="-NOW",%DT("A")="Enter new date/time vitals were taken: ",%DT="AETRS" D ^%DT K %DT S:X?1"^".E!(+Y'>0) GMROUT=1 Q:GMROUT S GMRCHC(1)=+Y
5 Q
6EN2 ; ENTER NEW READING
7 S GMRENTY=8,GLVL=8,GMRVIT=GMRX,(GMRVITY,GMRTY)=$S($D(^GMRD(120.51,GMRX,0)):$P(^(0),"^",2),1:""),GMRVIT(1)=$P(^(0),"^"),GMRAINP=$S($D(^(1)):^(1),1:""),GSAVE=GMRVITY,GMRO2(GMRVITY)=""
8 S GDT=GMRVIDT D EN1^GMRVADM G:GMROUT Q
9ERRAT W !!,"NEW "_$S($P(GMRVIT(1),"^")'="":$P(GMRVIT(1),"^"),1:"VALUE")_": " R X:DTIME S:'$T X="^^" W ! I "^^"[X!(X="") W !,$C(7),?3,"NO UPDATING HAS OCCURRED!!" S GMROUT=1 G Q
10 I X?1"?".E S GOPT=GMRTY_"^GMRVUT1" D @GOPT K GOPT G ERRAT
11 I GMRTY="T"!(GMRTY="P")!(GMRTY="R") S X=$$RDSITE(X),GMRSITE=$P(X,U,2),X=$P(X,U) S GMRSITE=$$UP^XLFSTR(GMRSITE) D TPSITE^GMRVUT1
12 I GMRTY="T"!(GMRTY="P")!(GMRTY="R") S:'$D(GMRSITE(GMRVITY)) GMROUT=1 S:GMROUT=0 GMRSITE=GMRSITE(GMRVITY) I GMROUT W !,"NO UPDATING HAS OCCURRED",!
13 I GMRTY="CG" D G:$G(X)="" ERRAT
14 . X GMRAINP I $G(X)="" W !,?3,$C(7),"INVALID ENTRY??" Q
15 . K GMRSITE(GMRVITY),GMRINF(GMRVITY) D LISTQ^GMRVQUAL,OTHERQ^GMRVQUAL
16 G:GMROUT Q
17 I GMRTY="PO2" X GMRAINP W:'$D(X) !,?3,$C(7),"INVALID ENTRY??" G:'$D(X) ERRAT S (GMRSITE(GMRVITY),GMRINF("GMRVITY"))="" D O2^GMRVUT3 G Q:GMROUT,Q1
18 I GMRTY="PN" X GMRAINP W:'$D(X) !,?3,$C(7),"INVALID ENTRY??" G:'$D(X) ERRAT S (GMRSITE(GMRVITY),GMRINF("GMRVITY"))="" G Q:GMROUT,Q1
19 I GMRTY="BP" X GMRAINP W:'$D(X) !,?3,$C(7),"INVALID ENTRY??" G:'$D(X) ERRAT D LISTQ^GMRVQUAL,OTHERQ^GMRVQUAL,CLEAR^GMRVQUAL G Q:GMROUT,Q1
20 I GMRTY="WT" S GMRSITE=$P(X,+X,2) G:GMRSITE=""!("LlLk"'[$E(GMRSITE)) ERRAT D WTYPE^GMRVUT1 S:'$D(GMRSITE(GMRVITY)) GMROUT=1 S:GMROUT=0 GMRSITE=GMRSITE(GMRVITY) I GMROUT W !,"NO UPDATING HAS OCCURRED",!
21 I GMRVITY="HT" S GMRSITE=$P(X,",",2),X=$P(X,",") S:GMRSITE="" GMRSITE="A" X GMRAINP W:'$D(X) !,?3,$C(7),"INVALID ENTRY??" G:'$D(X) ERRAT D TPSITE^GMRVUT1 G Q:GMROUT,Q1
22 G:GMROUT Q X GMRAINP I '$D(X) W !,?3,$C(7),"INVALID ENTRY??" G ERRAT
23Q1 G:GMROUT Q S GMRCHC(2)=X
24Q S GMRVITY=GSAVE K GSAVE D CLEAR^GMRVQUAL Q
25EN3 ; SELECT NEW PATIENT FOR VITALS
26 S DIC("A")="Select the NEW Patient's name: ",DIC(0)="AEQM",DIC="^DPT(" D ^DIC K DIC S:$D(DTOUT)!$D(DUOUT)!(+Y'>0) GMROUT=1 Q:GMROUT S GMRCHC(3)=+Y
27 Q
28DUPREC ;PRINT WARNING MESSAGE IF THE DATE/TIME CHANGE WILL CAUSE DUPLICATE RECORD
29 W ! S GVIT=0 F GII=0:0 S GVIT=$O(GMRARTY(GVIT)) Q:GVIT'>0 I $D(^GMR(120.5,"AA",DFN,GVIT,GDATE)) D CHKER
30 K GDA,GVIT,GII Q
31CHKER ;
32 S GDA=0 F GDA=0:0 S GDA=$O(^GMR(120.5,"AA",DFN,GVIT,GDATE,GDA)) Q:GDA'>0 I '$D(^GMR(120.5,GDA,2)) S GMROUT=1 W !,$P($S($D(^GMRD(120.51,GVIT,0)):^(0),1:0),"^")," already exists on ",Y," reading - ",$P(^GMR(120.5,GDA,0),"^",8)
33 Q
34DUPDT ;SET EXISTING OLD VITAL AS ERROR RECORD
35 S GMRDA=0 F GMRDA=0:0 S GMRDA=$O(^GMR(120.5,"AA",DFN,GMRY,GDATE,GMRDA)) Q:GMRDA'>0 I '$D(^GMR(120.5,GMRDA,2)) D ERREN^GMRVEE1 Q
36 Q
37PRTEED ; PRINT ERROR RECORD
38 S GMRDAT=^GMR(120.5,GMRDA,0)
39 S GMRTY=$S($D(^GMRD(120.51,GMRX,0)):^(0),1:""),GMRAINP=$S($D(^GMRD(120.51,$P(GMRDAT,"^",3),1))#2:^(1),1:""),GMRVX=$P(GMRTY,"^",2),GMRVX(0)=$P(GMRDAT,U,8),GMRVX(1)=0 D:GMRVX(0)>0 EN1^GMRVSAS0 S GMRVX(1)=$S(GMRVX(1)>0:" *",1:"")
40 S GMRZZ="",GMRZZ(1)="" I $P($G(^GMR(120.5,GMRDA,5,0)),"^",4)>0 K GMRVARY S GMRVARY="" D CHAR^GMRVCHAR(GMRDA,.GMRVARY,GMRX) S GMRZZ=$$WRITECH^GMRVCHAR(GMRDA,.GMRVARY,9) S:GMRZZ'="" GMRZZ(1)=" ("_GMRZZ_")"
41 I GMRVX="T",GMRVX(0)>0 S GMRVX(0)=GMRVX(0)_" F ("_$J(GMRVX(0)-32*5/9,0,1)_" C)"
42 I GMRVX="WT",GMRVX(0)>0 S GMRVX(0)=GMRVX(0)_" lb ("_$J(GMRVX(0)/2.2,0,2)_" kg)"
43 I GMRVX="HT",GMRVX(0)>0 S GMRVX(0)=$S(GMRVX(0)\12:GMRVX(0)\12_" ft ",1:"")_$S(GMRVX(0)#12:GMRVX(0)#12_" in",1:"")_" ("_$J(GMRVX(0)*2.54,0,2)_" cm)"
44 I GMRVX="CG",GMRVX(0)>0 S GMRVX(0)=GMRVX(0)_" in ("_$J(+GMRVX(0)/.3937,0,2)_" cm)"
45 I GMRVX="CVP",GMRVX(0)>0 S GMRVX(0)=GMRVX(0)_" cmH2O ("_$J(GMRVX(0)/1.36,0,1)_" mmHg)"
46 I GMRVX="PO2",GMRVX(0)>0 D
47 .N GMRVPO S GMRVPO=$P(GMRDAT,"^",10)
48 .S GMRVX(0)="Pulse oximetry "_GMRVX(0)_"%"_$S(GMRVPO'="":" with supplemental O2 "_$S(GMRVPO["l/min":$P(GMRVPO," l/min")_"L/min",1:"")_$S(GMRVPO["l/min":$P(GMRVPO," l/min",2),1:GMRVPO),1:"")
49 .Q
50 I GMRX=$O(GMRARTY(0)) S Y=$P(GMRDAT,"^") W ! D DT^DIQ
51 W !,?2,$S($P(GMRTY,"^",2)="PN":"PN (pain)",1:$P(GMRTY,"^",2)),": ",$S($P(GMRDAT,U,8)'="":GMRVX(0)_GMRVX(1),1:"")
52 I GMRTY="PN" D
53 . I GMRVX(0)=0 W " No pain" Q
54 . I GMRVX(0)=99 W " Unable to respond" Q
55 . I GMRVX(0)=10 W " Worst imaginable to respond" Q
56 W:GMRVX="PO2"&(GMRZZ'="") !,?8,"via " W " ",GMRZZ
57 Q
58RDSITE(X) ; THIS FUNCTION CONVERTS A VITAL DATA ENTRY IN X TO A SITE AND
59 ; A READING. IT RETURNS SITE^READING.
60 N Y,Z,I,READ,SITE
61 S Y=$TR(X,"0123456789.","99999999999")
62 S Z=$L(X)+1,I=0 F S I=$F(Y,"9",I) Q:I'>0 S Z=I
63 S READ=$E(X,1,Z-1),SITE=$E(X,Z,$L(X))
64 Q READ_"^"_SITE
Note: See TracBrowser for help on using the repository browser.