Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BHSEYEKG

BHSEYEKG.m

Go to the documentation of this file.
BHSEYEKG ;IHS/CIA/MGH - Health Summary eye and EKG components ;05-Oct-2012 09:30;DU
 ;;1.0;HEALTH SUMMARY COMPONENTS;**7**;March 17, 2006;Build 12
 ;===================================================================
 ;VA version of IHS health summary components for eye glasses and EKGs
EYERX ; *************** EYE GLASS PRESCRIPTIONS * 9000010.04 *******
 ; <SETUP>
 N BHSPAT,BHSP,BHSNSH,X
 S BHSPAT=DFN
 D EYEMEAS
 Q:'$D(^AUPNVEYE("AA",BHSPAT))
 D CKP^GMTSUP Q:$D(GMTSQIT)
 S BHSDT=$O(^AUPNVEYE("AA",BHSPAT,0)) Q:BHSDT=""  D
 .W !!?29,"Current Eyeglass Prescription"
 .S BHSN="" F  S BHSN=$O(^AUPNVEYE("AA",BHSPAT,BHSDT,BHSN)) Q:BHSN=""  D
 ..S BHSP=^AUPNVEYE(BHSN,0),BHSVDF=$P(BHSP,U,3) D GETSITEV^BHSUTL
 ..S X=-BHSDT\1+9999999 D REGDT4^GMTSU S BHSDAT=X
 ..D BLD
 D EYERXX
 Q
BLD ; <BUILD>
 S BHSEN=$G(^AUPNVEYE(BHSN,19))
 S BHST="Reading only^^^^^^^^^^^^Pupil near^Pupil  far^^^^^Pupil L^Pupil R"
 S BHSJ="1^^^^^^^^^2^2^4^2^2^^^^2^2"
 S BHSL="" F BHSI=1,13 D ADDTOL
 S BHSL1=$E(BHSL,3,255)
 S BHSL="" F BHSI=14,19,20 D ADDTOL
 S BHSL2=$E(BHSL,3,255)
 S BHST=""
 S BHSL="R" F BHSI=2,3,4,15,17,8 D BLDL
DSPLY ;<DISPLAY>
 D CKP^GMTSUP Q:$D(GMTSQIT)  W !,BHSDAT,?12,BHSNSH,!
 D CKP^GMTSUP Q:$D(GMTSQIT)  W:GMTSNPG !,BHSDAT,?10,BHSNSH,!
 W "  Sphere     Cyl    Axis  Prism H   Prism V   Add",!
 D CKP^GMTSUP Q:$D(GMTSQIT)  D:GMTSNPG NPG W !,BHSL,!
 S BHSL="L" F BHSI=5,6,7,16,18,9 D BLDL
 D CKP^GMTSUP Q:$D(GMTSQIT)  D:GMTSNPG NPG W BHSL,!
 S BHSL1=BHSL1_" "_BHSL2
 D CKP^GMTSUP Q:$D(GMTSQIT)  D:GMTSNPG NPG W !,BHSL1,!!
 Q
EYEMEAS ;display eye care measurements
 K BHSMT
 S BHSM=$O(^AUTTMSR("C","07",0)),BHSP=1 I BHSM D GATHER
 S BHSM=$O(^AUTTMSR("C","08",0)),BHSP=2 I BHSM D GATHER
 S BHSM=$O(^AUTTMSR("C","11",0)),BHSP=3 I BHSM D GATHER
 D DISPEM
 Q
 ; <CLEANUP>
EYERXX K BHSDAT,BHSDT,BHSEN,BHSF,BHSI,BHSJ,BHSL,BHSL1,BHSL2,BHSN,BHST,BHSVDF,Y,BHSM,BHSVNM,BHSMT,BHSM,BHSJ,BHSX
 Q
GATHER ;gather up last 5 of measurement in array by inverse date
 N C,D,N
 S (C,D,N)=0 F  S D=$O(^AUPNVMSR("AA",BHSPAT,BHSM,D)) Q:D'=+D  S N=0 F  S N=$O(^AUPNVMSR("AA",BHSPAT,BHSM,D,N)) Q:N'=+N!(C>3)  S C=C+1,$P(BHSMT(D),U,BHSP)=$$VAL^XBDIQ1(9000010.01,N,.04)
 Q
DISPEM ;display eye measurements
 D CKP^GMTSUP Q:$D(GMTSQIT)
 W !?29,"Eye Care Measurements"
 D CKP^GMTSUP Q:$D(GMTSQIT)
 W !?15,"VU",?34,"VC",?48,"TONOMETRY"
 S BHSX=0 F  S BHSX=$O(BHSMT(BHSX)) Q:BHSX=""!($D(GMTSQIT))  D CKP^GMTSUP Q:$D(GMTSQIT)  W !,$$FMTE^XLFDT((9999999-BHSX),"2D") S BHSJ="10;29;48" F BHST=1:1:3 W ?$P(BHSJ,";",BHST),$P(BHSMT(BHSX),U,BHST)
 Q
ADDTOL S BHSF=$P(BHSEN,U,BHSI) S:BHSF="" BHSF="-" S BHSF=$J(BHSF,$P(BHSJ,U,BHSI))
 S:BHSF]"" BHSL=BHSL_"  "_$P(BHST,U,BHSI)_": "_BHSF
 Q
BLDL S BHSF=$J($P(BHSEN,U,BHSI),8)
 S BHSL=BHSL_BHSF
 Q
NPG W BHSDAT,?10,BHSNSH,!
 W "  Sphere     Cyl    Axis  Prism H   Prism V   Add",!
 Q
 ;
 ;
EKG ; ***** EKG SUMMARY * 9000010.21 (V DIAGNOSTIC PROCEDURE RESULT) *****
 ;<setup>
 N BHSPAT,APCHQ,BHSQ
 S BHSPAT=DFN
 Q:'$D(^AUPNVDXP("AC",BHSPAT))
 D CKP^GMTSUP Q:$D(GMTSQIT)
 S BHSCNT=0
 S BHSDAT=0 F BHSQ=0:0 S BHSDAT=$O(^AUPNVDXP("AA",BHSPAT,BHSDAT)) Q:'BHSDAT  D  Q:$D(GMTSQIT)
 . S BHSIVD=0 F APCHQ=0:0 S BHSIVD=$O(^AUPNVDXP("AA",BHSPAT,BHSDAT,BHSIVD)) Q:BHSIVD=""!(BHSIVD>GMTSDLM)  D  Q:$D(GMTSQIT)
 .. S BHSDFN=0 F APCHQ=0:0 S BHSDFN=$O(^AUPNVDXP("AA",BHSPAT,BHSDAT,BHSIVD,BHSDFN)) Q:'BHSDFN  D EKGDSP Q:$D(GMTSQIT)
 .. Q
 . Q
 ;
EKGX ; exit EKG
 ;<CLEANUP>
 K BHSDP,BHSDFN,BHSNRQ,BHSDAT,BHSDS,BHSN,BHSIVD,BHSVL,BHSCNT,Y
 Q
 ;
EKGDSP ;display EKG(S)
 ; <DISPLAY>
 S BHSN=^AUPNVDXP(BHSDFN,0)
 S BHSDP=$P(BHSN,U,1)
 D GETEKG Q:BHSDP=""
 S BHSCNT=BHSCNT+1
 S BHSDS="DATE?"
 S Y=$P(BHSN,U,3),X=+^AUPNVSIT(Y,0)\1 D REGDT4^GMTSU S BHSDS=X
 S BHSVL=$P($P(BHSN,U,4),":")
 S BHSVL=$S(BHSVL="N":"NORMAL",BHSVL="A":"ABNORMAL",BHSVL="B":"BORDERLINE",1:"<none recorded>") ;IHS/CMI/LAB  added borderline
 D CKP^GMTSUP Q:$D(GMTSQIT)
 W BHSDS W ?12,BHSDP,?30,"RESULT: ",BHSVL,!
 Q
GETEKG ;get EKG
 S BHSDP=$P(^AUTTDXPR(BHSDP,0),U)
 Q