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

APCHS8A.m

Go to the documentation of this file.
APCHS8A ; IHS/CMI/LAB - PART 8A OF APCHS -- SUMMARY PRODUCTION COMPONENTS ; 
 ;;2.0;IHS PCC SUITE;**4**;MAY 14, 2009
 ;
EYERX ; *************** EYE GLASS PRESCRIPTIONS * 9000010.04 *******
 ; <SETUP>
 Q:'$D(^AUPNVEYE("AA",APCHSPAT))
 X APCHSCKP Q:$D(APCHSQIT)  X:'APCHSNPG APCHSBRK
 S APCHSDT=$O(^AUPNVEYE("AA",APCHSPAT,0))
 S APCHSN=$O(^AUPNVEYE("AA",APCHSPAT,APCHSDT,0))
 S APCHSP=^AUPNVEYE(APCHSN,0),APCHSVDF=$P(APCHSP,U,3) D GETSITEV^APCHSUTL
 S Y=-APCHSDT\1+9999999 X APCHSCVD S APCHSDAT=Y
BLD ; <BUILD>
 S APCHSEN=$G(^AUPNVEYE(APCHSN,19))
 S APCHST="Reading only^^^^^^^^^^^^Pupil near^Pupil  far"
 S APCHSJ="1^^^^^^^^^2^2^4^2^2"
 S APCHSL="" F APCHSI=1,13 D ADDTOL
 S APCHSL1=$E(APCHSL,3,255)
 S APCHSL="" F APCHSI=14 D ADDTOL
 S APCHSL2=$E(APCHSL,3,255)
 S APCHST=""
 S APCHSL="R" F APCHSI=2,3,4,15,8 D BLDL
DSPLY ;<DISPLAY>
 X APCHSCKP Q:$D(APCHSQIT)  W APCHSDAT,?10,APCHSNSH,!
 X APCHSCKP Q:$D(APCHSQIT)  W:APCHSNPG APCHSDAT,?10,APCHSNSH,!
 W "  Sphere    Cyl   Axis  Prism  Add",!
 X APCHSCKP Q:$D(APCHSQIT)  D:APCHSNPG NPG W APCHSL,?44,APCHSL1,!
 S APCHSL="L" F APCHSI=5,6,7,16,9 D BLDL
 X APCHSCKP Q:$D(APCHSQIT)  D:APCHSNPG NPG W APCHSL,?61,APCHSL2,!
EYEMEAS ;display eye care measurements
 K APCHSMT
 S APCHSM=$O(^AUTTMSR("C","07",0)),APCHSP=1 I APCHSM D GATHER
 S APCHSM=$O(^AUTTMSR("C","08",0)),APCHSP=2 I APCHSM D GATHER
 S APCHSM=$O(^AUTTMSR("C","11",0)),APCHSP=3 I APCHSM D GATHER
 D DISPEM
 ; <CLEANUP>
EYERXX K APCHSDAT,APCHSDT,APCHSEN,APCHSF,APCHSI,APCHSJ,APCHSL,APCHSL1,APCHSL2,APCHSN,APCHST,APCHSVDF,Y,APCHSM,APCHSVNM,APCHSMT,APCHSM,APCHSJ,APCHSX
 Q
GATHER ;gather up last 5 of measurement in array by inverse date
 S (C,D,N)=0 F  S D=$O(^AUPNVMSR("AA",APCHSPAT,APCHSM,D)) Q:D'=+D  S N=0 F  S N=$O(^AUPNVMSR("AA",APCHSPAT,APCHSM,D,N)) Q:N'=+N!(C>3)  D
 .Q:$P($G(^AUPNVMSR(N,2)),U,1)
 .S C=C+1,$P(APCHSMT(D),U,APCHSP)=$$VAL^XBDIQ1(9000010.01,N,.04)
 Q
DISPEM ;display eye measurements
 X APCHSCKP Q:$D(APCHSQIT)
 W !?29,"Eye Care Measurements"
 X APCHSCKP Q:$D(APCHSQIT)
 W !?15,"VU",?34,"VC",?48,"TONOMETRY"
 S APCHSX=0 F  S APCHSX=$O(APCHSMT(APCHSX)) Q:APCHSX=""!($D(APCHSQIT))  X APCHSCKP Q:$D(APCHSQIT)  W !,$$FMTE^XLFDT((9999999-APCHSX),"2D") S APCHSJ="10;29;48" F APCHST=1:1:3 W ?$P(APCHSJ,";",APCHST),$P(APCHSMT(APCHSX),U,APCHST)
 Q
ADDTOL S APCHSF=$P(APCHSEN,U,APCHSI) S:APCHSF="" APCHSF="-" S APCHSF=$J(APCHSF,$P(APCHSJ,U,APCHSI))
 S:APCHSF]"" APCHSL=APCHSL_"  "_$P(APCHST,U,APCHSI)_": "_APCHSF
 Q
BLDL S APCHSF=$J($P(APCHSEN,U,APCHSI),7)
 S APCHSL=APCHSL_APCHSF
 Q
NPG W APCHSDAT,?10,APCHSNSH,!
 W "  Sphere    Cyl   Axis  Prism  Add",!
 Q
 ;
 ;
EKG ; ***** EKG SUMMARY * 9000010.21 (V DIAGNOSTIC PROCEDURE RESULT) *****
 ;<setup>
 ;Q:'$D(^AUPNVDXP("AC",APCHSPAT))
 I '$D(^AUPNVDXP("AC",APCHSPAT)),'$D(^AUPNPREF("AA",APCHSPAT,9999999.68,691.500002)) Q
 X APCHSCKP Q:$D(APCHSQIT)  X:'APCHSNPG APCHSBRK
 S APCHSCNT=0
 S APCHSDAT=0 F APCHSQ=0:0 S APCHSDAT=$O(^AUPNVDXP("AA",APCHSPAT,APCHSDAT)) Q:'APCHSDAT  D  Q:$D(APCHSQIT)
 . S APCHSIVD=0 F APCHQ=0:0 S APCHSIVD=$O(^AUPNVDXP("AA",APCHSPAT,APCHSDAT,APCHSIVD)) Q:APCHSIVD=""!(APCHSIVD>APCHSDLM)  D  Q:$D(APCHSQIT)
 .. S APCHSDFN=0 F APCHQ=0:0 S APCHSDFN=$O(^AUPNVDXP("AA",APCHSPAT,APCHSDAT,APCHSIVD,APCHSDFN)) Q:'APCHSDFN  D EKGDSP Q:$D(APCHSQIT)
 .. Q
 . Q
 ;NOW DISPLAY EKG REFUSALS
 Q:'$D(^AUPNPREF("AA",APCHSPAT,9999999.68,691.500002))
 X APCHSCKP Q:$D(APCHSQIT)
 ;W ! ;,"Refusal of EKG: "
 S APCHSD=0 F  S APCHSD=$O(^AUPNPREF("AA",APCHSPAT,9999999.68,691.500002,APCHSD)) Q:APCHSD=""!(APCHSD>APCHSDLM)!($D(APCHSQIT))  D
 .S APCHSI=0 F  S APCHSI=$O(^AUPNPREF("AA",APCHSPAT,9999999.68,691.500002,APCHSD,APCHSI)) Q:APCHSI=""!($D(APCHSQIT))  D
 ..X APCHSCKP Q:$D(APCHSQIT)
 ..W !,$$DATE^APCHSMU(9999999-APCHSD),?12,"(",$$VAL^XBDIQ1(9000022,APCHSI,.07),")","   ",$$VAL^XBDIQ1(9000022,APCHSI,.04)
 ..Q
 .Q
 Q
 ;
EKGX ; exit EKG
 ;<CLEANUP>
 K APCHSDP,APCHSDFN,APCHSNRQ,APCHSDAT,APCHSDS,APCHSN,APCHSIVD,APCHSVL,APCHSCNT,Y
 Q
 ;
EKGDSP ;display EKG(S)
 ; <DISPLAY>
 S APCHSN=^AUPNVDXP(APCHSDFN,0)
 S APCHSDP=$P(APCHSN,U,1)
 D GETEKG Q:APCHSDP=""
 S APCHSCNT=APCHSCNT+1
 S APCHSDS="DATE?"
 S Y=$P(APCHSN,U,3),Y=+^AUPNVSIT(Y,0)\1 X APCHSCVD S APCHSDS=Y
 S APCHSVL=$P($P(APCHSN,U,4),":")
 S APCHSVL=$S(APCHSVL="N":"NORMAL",APCHSVL="A":"ABNORMAL",APCHSVL="B":"BORDERLINE",1:"<none recorded>") ;IHS/CMI/LAB  added borderline
 X APCHSCKP Q:$D(APCHSQIT)
 W APCHSDS W ?12,APCHSDP,?30,"RESULT: ",APCHSVL,!
 Q
GETEKG ;get EKG
 S APCHSDP=$P(^AUTTDXPR(APCHSDP,0),U)
 Q