VENPCCAM ; IHS/OIT/GIS - NEW CHECK IN MODULE ;
;;2.6;PCC+;;NOV 12, 2007
;
; ASK ABOUT CC AND MEASUREMENTS
;
MSR(VIEN,DEPTIEN) ; EP-GET MEASUREMENT VALUES AND STORE THEM IN V FILES FOR USE IN THIS ENCOUNTER
I '$D(^AUPNVSIT(+$G(VIEN),0)) Q
N DFN,DOB,BP,HT,WT,CC,HC,TMP,PU,RS,X,MMN,DIRX,DIRA,DIRB,DIRQ,DIRL
N VAL,Z,X,Y,IVAL,HCFLAG,PFLAG,CCFLAG,PULFLAG,DATA,MSR
S DFN=$P($G(^AUPNVSIT(VIEN,0)),U,5) I '$D(^DPT(+DFN,0)) Q
S DOB=$P(^DPT(DFN,0),U,3) I 'DOB Q
S HCFLAG=0 I ((DT-DOB)\10000)<2 S HCFLAG=1 ; HEAD CIRC FLAG
S PFLAG=0 I DT-DOB>90000 S PFLAG=1 ; PAIN FLAG
S CCFLAG='$P($G(^VEN(7.95,+$G(DEPTIEN),4)),U) ; CHIEF COMPLAINT FLAG
S PULFLAG=$P($G(^VEN(7.95,+$G(DEPTIEN),4)),U,2) ; PULMONARY DATA FLAG
W !!,"Record check-in data now."
W !,"'^'=Back up/edit '^^'=Stop '?'=Get help '@'=Erase an existing entry",!
CC ; EP - CHIEF COMPLAINT
I 'CCFLAG G HT
K X,Y,Z,VAL,IVAL
S DIRX="FO^1:240",DIRA="Chief complaint(s)",DIRB=$E($$CCTXT(VIEN),1,240)
S DIRQ="Example: 'URI, Fever'"
I $D(MSR(0)) S DIRB=MSR(0)
S VAL=$$DIR(DIRX,DIRA,DIRB,DIRQ) K DIRX,DIRA,DIRB,DIRQ
I VAL="" K MSR(0) G HT
I VAL=U W " ??" G CC
I VAL?2."^" G MFILE
S MSR(0)=VAL
HT ; EP - HEIGHT IN IN OR CM
S DIRX="FO^1:10",DIRA="Height",DIRB=""
S DIRQ="EXAMPLES: 5-11, 5 11, 67"""", 67 INCHES, 135 CM, 99C, 60I"
I $D(MSR("HT")) S DIRB=MSR("HT")
S (IVAL,VAL)=$$DIR(DIRX,DIRA,DIRB,DIRQ) K DIRX,DIRA,DIRB,DIRQ
I VAL="" K MSR("HT") G WT
I VAL=U,'CCFLAG W " ??" G HT
I VAL=U G CC
I VAL?2."^" G MFILE
I VAL'>0 W " ??" G HT
I VAL?1N1P1.2N,VAL'=+VAL S IVAL=(+VAL*12)+(+$E(VAL,3,99))
E I VAL?1.3N1.E S Z="" D I Z="" W " <- Please specifiy inches or cm" G HT
. S Z=$P(VAL,+VAL,2)
. I Z'["""",Z'["c",Z'["C",Z'["i",Z'["I" S Z="" Q
. I Z'["C",Z'["c" S Z="IN",IVAL=+VAL Q
. S Z="CM",IVAL=(+VAL)/2.54
. Q
I IVAL["." S IVAL=(IVAL\1)_"."_(+$E($P(IVAL,".",2)))
S X=IVAL D HT^AUPNVMSR
I '$D(X) W " <- Invalid height. Try again..." G HT
S MSR("HT")=VAL,MSR("HT",0)=IVAL
WT ; EP - WEIGHT IN LBS OR KGS
K X,Y,Z,VAL,IVAL
S DIRX="FO^1:10",DIRA="Weight",DIRB=""
S DIRQ="Lbs. assumed unless metric weight specified. EXAMPLES: 75 LBS, 2144 GM, 71 KG, 65.2K"
I $D(MSR("WT")) S DIRB=MSR("WT")
S (VAL,IVAL)=$$DIR(DIRX,DIRA,DIRB,DIRQ) K DIRX,DIRA,DIRB,DIRQ
I VAL="" K MSR("WT") G HC
I VAL=U G HT
I VAL?2."^" G MFILE
I +VAL<1 W " ??" G WT
I VAL'=+VAL D I Z="" W " <- Unknown units or invalid entry" G WT
. S Z=$P(VAL,+VAL,2)
. I Z["L"!(Z["l") S IVAL=+VAL,Z="LBS" Q
. I Z["K"!(Z["k") S IVAL=VAL/.45959237,Z="KG" Q
. I Z["G"!(Z["g") S IVAL=VAL/459.59237,Z="GM" Q
. S Z=""
. Q
I IVAL["." S IVAL=(IVAL\1)_"."_(+$E($P(IVAL,".",2)))
S X=IVAL D WT^AUPNVMSR
I '$D(X) W " <- Invalid weight. Try again..." G WT
S MSR("WT")=VAL,MSR("WT",0)=IVAL
HC ; EP - HEAD CIRC IN INCHES AND CM
I 'HCFLAG G BP
K X,Y,Z,VAL,IVAL
S DIRX="FO^1:10",DIRA="Head Circumference",DIRB=""
S DIRQ="You must specify units. EXAMPLES: 17"""", 17 INCHES, 48 CM, 45C, 16I"
I $D(MSR("HC")) S DIRB=MSR("HC")
S (VAL,IVAL)=$$DIR(DIRX,DIRA,DIRB,DIRQ) K DIRX,DIRA,DIRB,DIRQ
I VAL="" K MSR("HC") G BP
I VAL=U G WT
I VAL?2."^" G MFILE
I VAL'>0 W " ??" G HC
S Z=$P(VAL,+VAL,2)
I Z'["""",Z'["c",Z'["C",Z'["i",Z'["I" W " <- Please specifiy inches or cm" G HC
S IVAL=+VAL
I Z["C"!(Z["c") S IVAL=IVAL/2.54
I IVAL["." S IVAL=(IVAL\1)_"."_(+$E($P(IVAL,".",2)))
S X=IVAL D HC^AUPNVMSR
I '$D(X) W " <- Invalid HEAD CIRCUMFERENCE. Try again..." G HC
S MSR("HC")=VAL,MSR("HC",0)=IVAL
BP ; EP - BLOOD PRESSURE
K X,Y,Z,VAL,IVAL
S DIRX="FO^1:7",DIRA="B/P",DIRB=""
S DIRQ="Example: 120/88"
I $D(MSR("BP")) S DIRB=MSR("BP")
S VAL=$$DIR(DIRX,DIRA,DIRB,DIRQ) K DIRX,DIRA,DIRB,DIRQ
I VAL="" K MSR("BP") G TMP
I VAL=U,'HCFLAG G WT
I VAL=U G HC
I VAL?2."^" G MFILE
S X=VAL D BP^AUPNVMSR
I '$D(X) W " <- Invalid B/P. Try again..." G BP
S MSR("BP")=VAL,MSR("BP",0)=VAL
TMP ; EP - TEMPERATURE IN F OR C
K X,Y,Z,VAL,IVAL
S DIRX="FO^1:8",DIRA="Temperature",DIRB=""
S DIRQ="Fahrenheit assumed unless metric temp specified. EXAMPLES: 98.6, 102.0 F, 39.5C"
I $D(MSR("TMP")) S DIRB=MSR("TMP")
S (IVAL,VAL)=$$DIR(DIRX,DIRA,DIRB,DIRQ) K DIRX,DIRA,DIRB,DIRQ
I VAL="" K MSR("TMP") G PU
I VAL=U G BP
I VAL?2."^" G MFILE
I +VAL<30 W " ??" G TMP
I VAL'=+VAL D I Z="" W " <- Unknown units or invalid entry" G TMP
. S Z=$P(VAL,+VAL,2)
. I Z["F"!(Z["f") S IVAL=+VAL,Z="F" Q
. I Z["C"!(Z["c") S IVAL=(+VAL)*9/5+32,Z="C" Q
. S Z=""
I IVAL["." S IVAL=(IVAL\1)_"."_(+$E($P(IVAL,".",2)))
S X=IVAL D TMP^AUPNVMSR
I '$D(X) W " <- Invalid temperature. Try again..." G TMP
S MSR("TMP")=VAL,MSR("TMP",0)=IVAL
PU ; EP - PULSE
K X,Y,Z,VAL,IVAL
S DIRX="FO^1:3",DIRA="Pulse",DIRB=""
S DIRQ="Example: 64"
I $D(MSR("PU")) S DIRB=MSR("PU")
S VAL=$$DIR(DIRX,DIRA,DIRB,DIRQ) K DIRX,DIRA,DIRB,DIRQ
I VAL="" K MSR("PU") G RS
I VAL=U G TMP
I VAL?2."^" G MFILE
S X=VAL D PU^AUPNVMSR
I '$D(X) W " <- Invalid pulse. Try again..." G PU
S MSR("PU")=VAL,MSR("PU",0)=VAL
RS ; EP - RESPIRATIONS
K X,Y,Z,VAL,IVAL
S DIRX="FO^1:3",DIRA="Respirations",DIRB=""
S DIRQ="Example: 18"
I $D(MSR("RS")) S DIRB=MSR("RS")
S VAL=$$DIR(DIRX,DIRA,DIRB,DIRQ) K DIRX,DIRA,DIRB,DIRQ
I VAL="" K MSR("RS") G PA
I VAL=U G PU
I VAL?2."^" G MFILE
S X=VAL D RS^AUPNVMSR
I '$D(X) W " <- Invalid respiration rate. Try again..." G RS
S MSR("RS")=VAL,MSR("RS",0)=VAL
PA ; EP - PAIN
I 'PFLAG G O2
K X,Y,Z,VAL,IVAL
S DIRX="FO^1:2",DIRA="Pain",DIRB=""
S DIRQ="Select a PAIN SCALE number between 0 and 10"
I $D(MSR("PA")) S DIRB=MSR("PA")
S VAL=$$DIR(DIRX,DIRA,DIRB,DIRQ) K DIRX,DIRA,DIRB,DIRQ
I VAL="" K MSR("PA") G O2
I VAL=U G RS
I VAL?2."^" G MFILE
S X=VAL D PA^AUPNVMSR
I '$D(X) W " <- Invalid PAIN SCALE value. Try again..." G PA
S MSR("PA")=VAL,MSR("PA",0)=VAL
O2 ; EP - O2 SATURATION
I 'PULFLAG G MFILE
K X,Y,Z,VAL,IVAL
S DIRX="FO^1:3",DIRA="O2 Saturation",DIRB=""
S DIRQ="Select a value between 1 and 100"
I $D(MSR("O2")) S DIRB=MSR("O2")
S VAL=$$DIR(DIRX,DIRA,DIRB,DIRQ) K DIRX,DIRA,DIRB,DIRQ
I VAL="" K MSR("O2") G PF
I VAL=U,'PFLAG G RS
I VAL=U G PA
I VAL?2."^" G MFILE
I (+VAL)'>0 W " ??" G O2
S X=+VAL D O2^AUPNVMSR
I '$D(X) W " <- Invalid O2 Sat value. Try again..." G O2
S MSR("O2")=VAL,MSR("O2",0)=VAL
PF ; EP - PEAK FLOW
K X,Y,Z,VAL,IVAL
S DIRX="FO^1:3",DIRA="Peak flow",DIRB=""
S DIRQ="Select a value between 100 and 500"
I $D(MSR("PF")) S DIRB=MSR("PF")
S VAL=$$DIR(DIRX,DIRA,DIRB,DIRQ) K DIRX,DIRA,DIRB,DIRQ
I VAL="" K MSR("PF") G MFILE
I VAL=U G O2
I VAL?2."^" G MFILE
I +VAL'>0 W " ??" G PF
S X=VAL D PF^AUPNVMSR
I '$D(X) W " <- Invalid Peak flow value. Try again..." G PF
S MSR("PF")=VAL,MSR("PF",0)=VAL
MFILE ; EP - FILE RESULTS
I $O(MSR(""))="" Q ; NOTHING HAS BEEN ENTERED
S DIRX="SO^S:SUBMIT;E:EDIT;C:CANCEL"
S DIRB="SUBMIT",DIRA="Your choice",DIRQ=""
S VAL=$$DIR(DIRX,DIRA,DIRB,DIRQ) K DIRX,DIRA,DIRB,DIRQ
I $E(VAL)?1A S VAL=$$UP^XLFSTR($E(VAL))
I VAL="E" G CC ; EDIT THE RESULTS FROM THE TOP
I VAL="C" W !,"Request cancelled! No data submitted..." S NCCANCEL=1 Q
I VAL'="S" Q
FILE ; EP - PROCESS THE CHECKIN DATA ; PATCHED BY GIS/OIT 2/1/06 ; PCC + VERSION 2.5, PATCH 4
I 'VIEN Q
N DIC,DIE,DA,DR,X,Y
I $L($G(MSR(0))) D NFILE(VIEN,MSR(0)) ; FILE THE CHIEF COMPLAINT
S MMN="A",DLAYGO=9000010.01,DIC(0)="L",DIC="^AUPNVMSR(",DIE=DIC
S DR=".02////"_DFN_";.03////"_VIEN_";.04////^ S X=VAL"
F S MMN=$O(MSR(MMN)) Q:MMN="" D ; LOOP THROUGH RESULTS AND FILE THEM IN V MEASUREMENTS
. S VAL=$G(MSR(MMN,0)) I '$L(VAL) Q
. S X=""""_MMN_""""
. D ^DIC I Y=-1 Q
. S DA=+Y
. L +^AUPNVMSR(DA):0 I $T D ^DIE L -^AUPNVMSR(DA)
. Q
D ^XBFMK
Q
;
DIR(DIRX,DIRA,DIRB,DIRQ) ; EP-QUERY GENERATOR
N X,Y,VAL,DIR
I '$L($G(DIRX)) Q ""
S DIR(0)=DIRX,DIR("A")=DIRA,DIR("?")=DIRQ
I $L($G(DIRB)) S DIR("B")=DIRB
D ^DIR
S VAL=X
I VAL="@" S VAL="" W " <- Deleted"
D ^XBFMK K DIROUT
Q VAL
;
CCTXT(VIEN) ; EP - RETURN THE CC TEXT IN A SINGLE STRING
; PATCHED BY GIS/OIT 7/21/06 ; PCC + VERSION 2.5, PATCH 5
N NIEN,TXT,TTIEN,DFN,A,B,DA,LINE,LAST
S TTIEN=$O(^AUTTNTYP("B","CHIEF COMPLAINT",0)) I 'TTIEN Q ""
S DA=0,NIEN=0
F S DA=$O(^AUPNVNT("AD",+$G(VIEN),DA)) Q:'DA I +$G(^AUPNVNT(DA,0))=TTIEN S NIEN=DA
I 'NIEN Q ""
S TXT="",LINE=0,LAST=""
F S LINE=$O(^AUPNVNT(NIEN,11,LINE)) Q:'LINE D
. S (A,B)=$G(^AUPNVNT(NIEN,11,LINE,0))
. I '$L(A) Q
. I $L(LAST),$E(A,$L(A))'=" ",$E(LAST)'=" " S A=" "_A
. S TXT=TXT_A
. S LAST=B
. Q
Q TXT
;
NFILE(VIEN,TXT) ; EP - POPULTES THE V NARRATIVE TEXT FILE WITH A CC
; PATCHED BY GIS/OIT 7/21/06 ; PCC + VERSION 2.5, PATCH 5
N X,Y,Z,%,ARR,CNT,DA,DR,DIE,DIC,DLAYGO,TTIEN,CREF,LINE,A,B,NIEN,DFN
I $L($G(TXT)),$D(^AUPNVSIT($G(VIEN),0))
E Q
S DFN=$P($G(^AUPNVSIT(VIEN,0)),U,5) I 'DFN Q
S TTIEN=$O(^AUTTNTYP("B","CHIEF COMPLAINT",0)) I 'TTIEN Q
S DA=0,NIEN=0
F S DA=$O(^AUPNVNT("AD",+$G(VIEN),DA)) Q:'DA I +$G(^AUPNVNT(DA,0))=TTIEN S NIEN=DA
I 'NIEN D I 'NIEN Q
. S (DIC,DIE,DLAYGO)=9000010.34,DIC(0)="L",X="""`"_TTIEN_""""
. D ^DIC I Y=-1 Q
. S (NIEN,DA)=+Y
. S DR=".02////"_DFN_";.03////"_VIEN
. L +^AUPNVNT(DA):1 I D ^DIE L -^AUPNVNT(DA)
. Q
S CREF=$NA(^AUPNVNT(NIEN,11))
K @CREF ; CLEAN OUT THE EXISITING ENTRY
S (X,Y)=TXT,CNT=0
F D I '$L(X) Q ; MAKE THE LINE ARRAY
. S A=$E(X,1,75)
. S %=$L(A," ")
. I %=1!($L(A)<75) S CNT=CNT+1,LINE(CNT)=A,X="" Q
. S B=$P(A," ",1,(%-1)),X=$P(X," ",%,999)
. S CNT=CNT+1,LINE(CNT)=B
. Q
I 'CNT Q
S @CREF@(0)="^^"_CNT_U_CNT_U_DT_U ; FILE THE DATA
F X=1:1:CNT S @CREF@(X,0)=LINE(X)
Q
;
VENPCCAM ; IHS/OIT/GIS - NEW CHECK IN MODULE ;
+1 ;;2.6;PCC+;;NOV 12, 2007
+2 ;
+3 ; ASK ABOUT CC AND MEASUREMENTS
+4 ;
MSR(VIEN,DEPTIEN) ; EP-GET MEASUREMENT VALUES AND STORE THEM IN V FILES FOR USE IN THIS ENCOUNTER
+1 IF '$DATA(^AUPNVSIT(+$GET(VIEN),0))
QUIT
+2 NEW DFN,DOB,BP,HT,WT,CC,HC,TMP,PU,RS,X,MMN,DIRX,DIRA,DIRB,DIRQ,DIRL
+3 NEW VAL,Z,X,Y,IVAL,HCFLAG,PFLAG,CCFLAG,PULFLAG,DATA,MSR
+4 SET DFN=$PIECE($GET(^AUPNVSIT(VIEN,0)),U,5)
IF '$DATA(^DPT(+DFN,0))
QUIT
+5 SET DOB=$PIECE(^DPT(DFN,0),U,3)
IF 'DOB
QUIT
+6 ; HEAD CIRC FLAG
SET HCFLAG=0
IF ((DT-DOB)\10000)<2
SET HCFLAG=1
+7 ; PAIN FLAG
SET PFLAG=0
IF DT-DOB>90000
SET PFLAG=1
+8 ; CHIEF COMPLAINT FLAG
SET CCFLAG='$PIECE($GET(^VEN(7.95,+$GET(DEPTIEN),4)),U)
+9 ; PULMONARY DATA FLAG
SET PULFLAG=$PIECE($GET(^VEN(7.95,+$GET(DEPTIEN),4)),U,2)
+10 WRITE !!,"Record check-in data now."
+11 WRITE !,"'^'=Back up/edit '^^'=Stop '?'=Get help '@'=Erase an existing entry",!
CC ; EP - CHIEF COMPLAINT
+1 IF 'CCFLAG
GOTO HT
+2 KILL X,Y,Z,VAL,IVAL
+3 SET DIRX="FO^1:240"
SET DIRA="Chief complaint(s)"
SET DIRB=$EXTRACT($$CCTXT(VIEN),1,240)
+4 SET DIRQ="Example: 'URI, Fever'"
+5 IF $DATA(MSR(0))
SET DIRB=MSR(0)
+6 SET VAL=$$DIR(DIRX,DIRA,DIRB,DIRQ)
KILL DIRX,DIRA,DIRB,DIRQ
+7 IF VAL=""
KILL MSR(0)
GOTO HT
+8 IF VAL=U
WRITE " ??"
GOTO CC
+9 IF VAL?2."^"
GOTO MFILE
+10 SET MSR(0)=VAL
HT ; EP - HEIGHT IN IN OR CM
+1 SET DIRX="FO^1:10"
SET DIRA="Height"
SET DIRB=""
+2 SET DIRQ="EXAMPLES: 5-11, 5 11, 67"""", 67 INCHES, 135 CM, 99C, 60I"
+3 IF $DATA(MSR("HT"))
SET DIRB=MSR("HT")
+4 SET (IVAL,VAL)=$$DIR(DIRX,DIRA,DIRB,DIRQ)
KILL DIRX,DIRA,DIRB,DIRQ
+5 IF VAL=""
KILL MSR("HT")
GOTO WT
+6 IF VAL=U
IF 'CCFLAG
WRITE " ??"
GOTO HT
+7 IF VAL=U
GOTO CC
+8 IF VAL?2."^"
GOTO MFILE
+9 IF VAL'>0
WRITE " ??"
GOTO HT
+10 IF VAL?1N1P1.2N
IF VAL'=+VAL
SET IVAL=(+VAL*12)+(+$EXTRACT(VAL,3,99))
+11 IF '$TEST
IF VAL?1.3N1.E
SET Z=""
Begin DoDot:1
+12 SET Z=$PIECE(VAL,+VAL,2)
+13 IF Z'[""""
IF Z'["c"
IF Z'["C"
IF Z'["i"
IF Z'["I"
SET Z=""
QUIT
+14 IF Z'["C"
IF Z'["c"
SET Z="IN"
SET IVAL=+VAL
QUIT
+15 SET Z="CM"
SET IVAL=(+VAL)/2.54
+16 QUIT
End DoDot:1
IF Z=""
WRITE " <- Please specifiy inches or cm"
GOTO HT
+17 IF IVAL["."
SET IVAL=(IVAL\1)_"."_(+$EXTRACT($PIECE(IVAL,".",2)))
+18 SET X=IVAL
DO HT^AUPNVMSR
+19 IF '$DATA(X)
WRITE " <- Invalid height. Try again..."
GOTO HT
+20 SET MSR("HT")=VAL
SET MSR("HT",0)=IVAL
WT ; EP - WEIGHT IN LBS OR KGS
+1 KILL X,Y,Z,VAL,IVAL
+2 SET DIRX="FO^1:10"
SET DIRA="Weight"
SET DIRB=""
+3 SET DIRQ="Lbs. assumed unless metric weight specified. EXAMPLES: 75 LBS, 2144 GM, 71 KG, 65.2K"
+4 IF $DATA(MSR("WT"))
SET DIRB=MSR("WT")
+5 SET (VAL,IVAL)=$$DIR(DIRX,DIRA,DIRB,DIRQ)
KILL DIRX,DIRA,DIRB,DIRQ
+6 IF VAL=""
KILL MSR("WT")
GOTO HC
+7 IF VAL=U
GOTO HT
+8 IF VAL?2."^"
GOTO MFILE
+9 IF +VAL<1
WRITE " ??"
GOTO WT
+10 IF VAL'=+VAL
Begin DoDot:1
+11 SET Z=$PIECE(VAL,+VAL,2)
+12 IF Z["L"!(Z["l")
SET IVAL=+VAL
SET Z="LBS"
QUIT
+13 IF Z["K"!(Z["k")
SET IVAL=VAL/.45959237
SET Z="KG"
QUIT
+14 IF Z["G"!(Z["g")
SET IVAL=VAL/459.59237
SET Z="GM"
QUIT
+15 SET Z=""
+16 QUIT
End DoDot:1
IF Z=""
WRITE " <- Unknown units or invalid entry"
GOTO WT
+17 IF IVAL["."
SET IVAL=(IVAL\1)_"."_(+$EXTRACT($PIECE(IVAL,".",2)))
+18 SET X=IVAL
DO WT^AUPNVMSR
+19 IF '$DATA(X)
WRITE " <- Invalid weight. Try again..."
GOTO WT
+20 SET MSR("WT")=VAL
SET MSR("WT",0)=IVAL
HC ; EP - HEAD CIRC IN INCHES AND CM
+1 IF 'HCFLAG
GOTO BP
+2 KILL X,Y,Z,VAL,IVAL
+3 SET DIRX="FO^1:10"
SET DIRA="Head Circumference"
SET DIRB=""
+4 SET DIRQ="You must specify units. EXAMPLES: 17"""", 17 INCHES, 48 CM, 45C, 16I"
+5 IF $DATA(MSR("HC"))
SET DIRB=MSR("HC")
+6 SET (VAL,IVAL)=$$DIR(DIRX,DIRA,DIRB,DIRQ)
KILL DIRX,DIRA,DIRB,DIRQ
+7 IF VAL=""
KILL MSR("HC")
GOTO BP
+8 IF VAL=U
GOTO WT
+9 IF VAL?2."^"
GOTO MFILE
+10 IF VAL'>0
WRITE " ??"
GOTO HC
+11 SET Z=$PIECE(VAL,+VAL,2)
+12 IF Z'[""""
IF Z'["c"
IF Z'["C"
IF Z'["i"
IF Z'["I"
WRITE " <- Please specifiy inches or cm"
GOTO HC
+13 SET IVAL=+VAL
+14 IF Z["C"!(Z["c")
SET IVAL=IVAL/2.54
+15 IF IVAL["."
SET IVAL=(IVAL\1)_"."_(+$EXTRACT($PIECE(IVAL,".",2)))
+16 SET X=IVAL
DO HC^AUPNVMSR
+17 IF '$DATA(X)
WRITE " <- Invalid HEAD CIRCUMFERENCE. Try again..."
GOTO HC
+18 SET MSR("HC")=VAL
SET MSR("HC",0)=IVAL
BP ; EP - BLOOD PRESSURE
+1 KILL X,Y,Z,VAL,IVAL
+2 SET DIRX="FO^1:7"
SET DIRA="B/P"
SET DIRB=""
+3 SET DIRQ="Example: 120/88"
+4 IF $DATA(MSR("BP"))
SET DIRB=MSR("BP")
+5 SET VAL=$$DIR(DIRX,DIRA,DIRB,DIRQ)
KILL DIRX,DIRA,DIRB,DIRQ
+6 IF VAL=""
KILL MSR("BP")
GOTO TMP
+7 IF VAL=U
IF 'HCFLAG
GOTO WT
+8 IF VAL=U
GOTO HC
+9 IF VAL?2."^"
GOTO MFILE
+10 SET X=VAL
DO BP^AUPNVMSR
+11 IF '$DATA(X)
WRITE " <- Invalid B/P. Try again..."
GOTO BP
+12 SET MSR("BP")=VAL
SET MSR("BP",0)=VAL
TMP ; EP - TEMPERATURE IN F OR C
+1 KILL X,Y,Z,VAL,IVAL
+2 SET DIRX="FO^1:8"
SET DIRA="Temperature"
SET DIRB=""
+3 SET DIRQ="Fahrenheit assumed unless metric temp specified. EXAMPLES: 98.6, 102.0 F, 39.5C"
+4 IF $DATA(MSR("TMP"))
SET DIRB=MSR("TMP")
+5 SET (IVAL,VAL)=$$DIR(DIRX,DIRA,DIRB,DIRQ)
KILL DIRX,DIRA,DIRB,DIRQ
+6 IF VAL=""
KILL MSR("TMP")
GOTO PU
+7 IF VAL=U
GOTO BP
+8 IF VAL?2."^"
GOTO MFILE
+9 IF +VAL<30
WRITE " ??"
GOTO TMP
+10 IF VAL'=+VAL
Begin DoDot:1
+11 SET Z=$PIECE(VAL,+VAL,2)
+12 IF Z["F"!(Z["f")
SET IVAL=+VAL
SET Z="F"
QUIT
+13 IF Z["C"!(Z["c")
SET IVAL=(+VAL)*9/5+32
SET Z="C"
QUIT
+14 SET Z=""
End DoDot:1
IF Z=""
WRITE " <- Unknown units or invalid entry"
GOTO TMP
+15 IF IVAL["."
SET IVAL=(IVAL\1)_"."_(+$EXTRACT($PIECE(IVAL,".",2)))
+16 SET X=IVAL
DO TMP^AUPNVMSR
+17 IF '$DATA(X)
WRITE " <- Invalid temperature. Try again..."
GOTO TMP
+18 SET MSR("TMP")=VAL
SET MSR("TMP",0)=IVAL
PU ; EP - PULSE
+1 KILL X,Y,Z,VAL,IVAL
+2 SET DIRX="FO^1:3"
SET DIRA="Pulse"
SET DIRB=""
+3 SET DIRQ="Example: 64"
+4 IF $DATA(MSR("PU"))
SET DIRB=MSR("PU")
+5 SET VAL=$$DIR(DIRX,DIRA,DIRB,DIRQ)
KILL DIRX,DIRA,DIRB,DIRQ
+6 IF VAL=""
KILL MSR("PU")
GOTO RS
+7 IF VAL=U
GOTO TMP
+8 IF VAL?2."^"
GOTO MFILE
+9 SET X=VAL
DO PU^AUPNVMSR
+10 IF '$DATA(X)
WRITE " <- Invalid pulse. Try again..."
GOTO PU
+11 SET MSR("PU")=VAL
SET MSR("PU",0)=VAL
RS ; EP - RESPIRATIONS
+1 KILL X,Y,Z,VAL,IVAL
+2 SET DIRX="FO^1:3"
SET DIRA="Respirations"
SET DIRB=""
+3 SET DIRQ="Example: 18"
+4 IF $DATA(MSR("RS"))
SET DIRB=MSR("RS")
+5 SET VAL=$$DIR(DIRX,DIRA,DIRB,DIRQ)
KILL DIRX,DIRA,DIRB,DIRQ
+6 IF VAL=""
KILL MSR("RS")
GOTO PA
+7 IF VAL=U
GOTO PU
+8 IF VAL?2."^"
GOTO MFILE
+9 SET X=VAL
DO RS^AUPNVMSR
+10 IF '$DATA(X)
WRITE " <- Invalid respiration rate. Try again..."
GOTO RS
+11 SET MSR("RS")=VAL
SET MSR("RS",0)=VAL
PA ; EP - PAIN
+1 IF 'PFLAG
GOTO O2
+2 KILL X,Y,Z,VAL,IVAL
+3 SET DIRX="FO^1:2"
SET DIRA="Pain"
SET DIRB=""
+4 SET DIRQ="Select a PAIN SCALE number between 0 and 10"
+5 IF $DATA(MSR("PA"))
SET DIRB=MSR("PA")
+6 SET VAL=$$DIR(DIRX,DIRA,DIRB,DIRQ)
KILL DIRX,DIRA,DIRB,DIRQ
+7 IF VAL=""
KILL MSR("PA")
GOTO O2
+8 IF VAL=U
GOTO RS
+9 IF VAL?2."^"
GOTO MFILE
+10 SET X=VAL
DO PA^AUPNVMSR
+11 IF '$DATA(X)
WRITE " <- Invalid PAIN SCALE value. Try again..."
GOTO PA
+12 SET MSR("PA")=VAL
SET MSR("PA",0)=VAL
O2 ; EP - O2 SATURATION
+1 IF 'PULFLAG
GOTO MFILE
+2 KILL X,Y,Z,VAL,IVAL
+3 SET DIRX="FO^1:3"
SET DIRA="O2 Saturation"
SET DIRB=""
+4 SET DIRQ="Select a value between 1 and 100"
+5 IF $DATA(MSR("O2"))
SET DIRB=MSR("O2")
+6 SET VAL=$$DIR(DIRX,DIRA,DIRB,DIRQ)
KILL DIRX,DIRA,DIRB,DIRQ
+7 IF VAL=""
KILL MSR("O2")
GOTO PF
+8 IF VAL=U
IF 'PFLAG
GOTO RS
+9 IF VAL=U
GOTO PA
+10 IF VAL?2."^"
GOTO MFILE
+11 IF (+VAL)'>0
WRITE " ??"
GOTO O2
+12 SET X=+VAL
DO O2^AUPNVMSR
+13 IF '$DATA(X)
WRITE " <- Invalid O2 Sat value. Try again..."
GOTO O2
+14 SET MSR("O2")=VAL
SET MSR("O2",0)=VAL
PF ; EP - PEAK FLOW
+1 KILL X,Y,Z,VAL,IVAL
+2 SET DIRX="FO^1:3"
SET DIRA="Peak flow"
SET DIRB=""
+3 SET DIRQ="Select a value between 100 and 500"
+4 IF $DATA(MSR("PF"))
SET DIRB=MSR("PF")
+5 SET VAL=$$DIR(DIRX,DIRA,DIRB,DIRQ)
KILL DIRX,DIRA,DIRB,DIRQ
+6 IF VAL=""
KILL MSR("PF")
GOTO MFILE
+7 IF VAL=U
GOTO O2
+8 IF VAL?2."^"
GOTO MFILE
+9 IF +VAL'>0
WRITE " ??"
GOTO PF
+10 SET X=VAL
DO PF^AUPNVMSR
+11 IF '$DATA(X)
WRITE " <- Invalid Peak flow value. Try again..."
GOTO PF
+12 SET MSR("PF")=VAL
SET MSR("PF",0)=VAL
MFILE ; EP - FILE RESULTS
+1 ; NOTHING HAS BEEN ENTERED
IF $ORDER(MSR(""))=""
QUIT
+2 SET DIRX="SO^S:SUBMIT;E:EDIT;C:CANCEL"
+3 SET DIRB="SUBMIT"
SET DIRA="Your choice"
SET DIRQ=""
+4 SET VAL=$$DIR(DIRX,DIRA,DIRB,DIRQ)
KILL DIRX,DIRA,DIRB,DIRQ
+5 IF $EXTRACT(VAL)?1A
SET VAL=$$UP^XLFSTR($EXTRACT(VAL))
+6 ; EDIT THE RESULTS FROM THE TOP
IF VAL="E"
GOTO CC
+7 IF VAL="C"
WRITE !,"Request cancelled! No data submitted..."
SET NCCANCEL=1
QUIT
+8 IF VAL'="S"
QUIT
FILE ; EP - PROCESS THE CHECKIN DATA ; PATCHED BY GIS/OIT 2/1/06 ; PCC + VERSION 2.5, PATCH 4
+1 IF 'VIEN
QUIT
+2 NEW DIC,DIE,DA,DR,X,Y
+3 ; FILE THE CHIEF COMPLAINT
IF $LENGTH($GET(MSR(0)))
DO NFILE(VIEN,MSR(0))
+4 SET MMN="A"
SET DLAYGO=9000010.01
SET DIC(0)="L"
SET DIC="^AUPNVMSR("
SET DIE=DIC
+5 SET DR=".02////"_DFN_";.03////"_VIEN_";.04////^ S X=VAL"
+6 ; LOOP THROUGH RESULTS AND FILE THEM IN V MEASUREMENTS
FOR
SET MMN=$ORDER(MSR(MMN))
IF MMN=""
QUIT
Begin DoDot:1
+7 SET VAL=$GET(MSR(MMN,0))
IF '$LENGTH(VAL)
QUIT
+8 SET X=""""_MMN_""""
+9 DO ^DIC
IF Y=-1
QUIT
+10 SET DA=+Y
+11 LOCK +^AUPNVMSR(DA):0
IF $TEST
DO ^DIE
LOCK -^AUPNVMSR(DA)
+12 QUIT
End DoDot:1
+13 DO ^XBFMK
+14 QUIT
+15 ;
DIR(DIRX,DIRA,DIRB,DIRQ) ; EP-QUERY GENERATOR
+1 NEW X,Y,VAL,DIR
+2 IF '$LENGTH($GET(DIRX))
QUIT ""
+3 SET DIR(0)=DIRX
SET DIR("A")=DIRA
SET DIR("?")=DIRQ
+4 IF $LENGTH($GET(DIRB))
SET DIR("B")=DIRB
+5 DO ^DIR
+6 SET VAL=X
+7 IF VAL="@"
SET VAL=""
WRITE " <- Deleted"
+8 DO ^XBFMK
KILL DIROUT
+9 QUIT VAL
+10 ;
CCTXT(VIEN) ; EP - RETURN THE CC TEXT IN A SINGLE STRING
+1 ; PATCHED BY GIS/OIT 7/21/06 ; PCC + VERSION 2.5, PATCH 5
+2 NEW NIEN,TXT,TTIEN,DFN,A,B,DA,LINE,LAST
+3 SET TTIEN=$ORDER(^AUTTNTYP("B","CHIEF COMPLAINT",0))
IF 'TTIEN
QUIT ""
+4 SET DA=0
SET NIEN=0
+5 FOR
SET DA=$ORDER(^AUPNVNT("AD",+$GET(VIEN),DA))
IF 'DA
QUIT
IF +$GET(^AUPNVNT(DA,0))=TTIEN
SET NIEN=DA
+6 IF 'NIEN
QUIT ""
+7 SET TXT=""
SET LINE=0
SET LAST=""
+8 FOR
SET LINE=$ORDER(^AUPNVNT(NIEN,11,LINE))
IF 'LINE
QUIT
Begin DoDot:1
+9 SET (A,B)=$GET(^AUPNVNT(NIEN,11,LINE,0))
+10 IF '$LENGTH(A)
QUIT
+11 IF $LENGTH(LAST)
IF $EXTRACT(A,$LENGTH(A))'=" "
IF $EXTRACT(LAST)'=" "
SET A=" "_A
+12 SET TXT=TXT_A
+13 SET LAST=B
+14 QUIT
End DoDot:1
+15 QUIT TXT
+16 ;
NFILE(VIEN,TXT) ; EP - POPULTES THE V NARRATIVE TEXT FILE WITH A CC
+1 ; PATCHED BY GIS/OIT 7/21/06 ; PCC + VERSION 2.5, PATCH 5
+2 NEW X,Y,Z,%,ARR,CNT,DA,DR,DIE,DIC,DLAYGO,TTIEN,CREF,LINE,A,B,NIEN,DFN
+3 IF $LENGTH($GET(TXT))
IF $DATA(^AUPNVSIT($GET(VIEN),0))
+4 IF '$TEST
QUIT
+5 SET DFN=$PIECE($GET(^AUPNVSIT(VIEN,0)),U,5)
IF 'DFN
QUIT
+6 SET TTIEN=$ORDER(^AUTTNTYP("B","CHIEF COMPLAINT",0))
IF 'TTIEN
QUIT
+7 SET DA=0
SET NIEN=0
+8 FOR
SET DA=$ORDER(^AUPNVNT("AD",+$GET(VIEN),DA))
IF 'DA
QUIT
IF +$GET(^AUPNVNT(DA,0))=TTIEN
SET NIEN=DA
+9 IF 'NIEN
Begin DoDot:1
+10 SET (DIC,DIE,DLAYGO)=9000010.34
SET DIC(0)="L"
SET X="""`"_TTIEN_""""
+11 DO ^DIC
IF Y=-1
QUIT
+12 SET (NIEN,DA)=+Y
+13 SET DR=".02////"_DFN_";.03////"_VIEN
+14 LOCK +^AUPNVNT(DA):1
IF $TEST
DO ^DIE
LOCK -^AUPNVNT(DA)
+15 QUIT
End DoDot:1
IF 'NIEN
QUIT
+16 SET CREF=$NAME(^AUPNVNT(NIEN,11))
+17 ; CLEAN OUT THE EXISITING ENTRY
KILL @CREF
+18 SET (X,Y)=TXT
SET CNT=0
+19 ; MAKE THE LINE ARRAY
FOR
Begin DoDot:1
+20 SET A=$EXTRACT(X,1,75)
+21 SET %=$LENGTH(A," ")
+22 IF %=1!($LENGTH(A)<75)
SET CNT=CNT+1
SET LINE(CNT)=A
SET X=""
QUIT
+23 SET B=$PIECE(A," ",1,(%-1))
SET X=$PIECE(X," ",%,999)
+24 SET CNT=CNT+1
SET LINE(CNT)=B
+25 QUIT
End DoDot:1
IF '$LENGTH(X)
QUIT
+26 IF 'CNT
QUIT
+27 ; FILE THE DATA
SET @CREF@(0)="^^"_CNT_U_CNT_U_DT_U
+28 FOR X=1:1:CNT
SET @CREF@(X,0)=LINE(X)
+29 QUIT
+30 ;