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

BHSRAD.m

Go to the documentation of this file.
BHSRAD ;IHS/CIA/MGH - Health Summary for V RAD file ;02-Aug-2013 16:17;DU
 ;;1.0;HEALTH SUMMARY COMPONENTS;**1,2,4,8**;March 17, 2006;Build 22
 ;===================================================================
 ;Taken from BHS3C
 ; IHS/TUCSON/LAB - PART 3C OF APCHS -- SUMMARY PRODUCTION COMPONENTS ;  [ 01/20/04  8:04 PM ]
 ;;2.0;IHS RPMS/PCC Health Summary;**11,12**;JUN 24, 1997
 ;IHS/CMI/LAB - patch 12 added new rad component
 ;IHS/MSC/MGH  Updated to IHS patch 15
 ;IHS/MSC/MGH Patch 2 update to patch 16
 ;IHS/MSC/MGH Patch 4 moved exams to its own routine
 ;IHS/MSC/MGH patch 8 Updated refusals for SNOMED
MRR ; ******************** MOST RECENT RADIOLOGY * 9000010.22 *******
 N BHSPAT,BHSICD,BHSICL,BHSQ,X
 S BHSPAT=DFN
 I '$D(^AUPNVRAD("AA",BHSPAT)) S BHST="RADIOLOGY EXAM",BHSFN=71 D DISPREF^BHSRAD Q
 D CKP^GMTSUP Q:$D(GMTSQIT)
 ; <SETUP>
 ; <PROCESS>
 D RBLD,RPRT
 ; <CLEANUP>
 ;now display RAD refusals (patch 2)
 S BHST="RADIOLOGY EXAM",BHSFN=71 D DISPREF^BHSRAD
 K BHST,BHSFN
MRRX K BHSRT,BHSRR,BHSRTX,BHSRRT,BHSMXL,BHSRL,BHSRW,BHSNMX,BHSDFN,BHSIVD,BHSRTD,BHSN,BHSDCD,BHSEDT,Y
 Q
 ; <BUILD>
RBLD K BHSRRT S BHSMXL=0
 S BHSRRT="" F BHSQ=0:0 S BHSRRT=$O(^AUPNVRAD("AA",BHSPAT,BHSRRT)) Q:BHSRRT=""  D RDATE
 Q
RDATE S BHSIVD=$O(^AUPNVRAD("AA",BHSPAT,BHSRRT,0)) S BHSDFN=$O(^(BHSIVD,0)) D:BHSIVD&(BHSIVD'>GMTSDLM) RSET
 Q
RSET S BHSN=^AUPNVRAD(BHSDFN,0),BHSRR=$G(^AUPNVRAD(BHSDFN,11))
 S BHSEDT=$P($G(^AUPNVRAD(BHSDFN,12)),U) ;NEW LINE!
 S X=$P(BHSN,U,5),X=$$EXTSET^XBFUNC(9000010.22,.05,X) S BHSDCD=X
 ;S BHSRRT(BHSRRT)=(-BHSIVD\1+9999999)_U_BHSRR S BHSRTX=$P(^RAMIS(71,BHSRRT,0),U,1) S:$L(BHSRTX)>BHSMXL BHSMXL=$L(BHSRTX) ;ORIG LINE
 S BHSRRT(BHSRRT)=(-BHSIVD\1+9999999)_U_BHSRR_U_BHSEDT_U_BHSDCD_U_$$VAL^XBDIQ1(9000010.22,BHSDFN,.06)
 S BHSRTX=$P(^RAMIS(71,BHSRRT,0),U,1) S:$L(BHSRTX)>BHSMXL BHSMXL=$L(BHSRTX)
 Q
 ; <PRINT>
RPRT S BHSRW=BHSMXL+1,BHSRL=10,BHSNMX=(IOM-1-BHSRW)\BHSRL
 S BHSRT="" F BHSQ=0:0 S BHSRT=$O(BHSRRT(BHSRT)) Q:BHSRT=""  D RPRT2
 Q
RPRT2 ;
 S X=$P(BHSRRT(BHSRT),U,1),BHSRR=$P(BHSRRT(BHSRT),U,2) D REGDT4^GMTSU S BHSRTD=X
 S BHSEDT=$P($G(BHSRRT(BHSRT)),U,3) I BHSEDT]"" S X=$P(BHSEDT,".") D REGDT4^GMTSU S BHSEDT=X
 ;S BHSRTX=$P(^RAMIS(71,BHSRT,0),U,1) D CKP^GMTSUP Q:$D(GMTSQIT)  W BHSRTX,?BHSRW,"(",BHSRTD,")  ",BHSRR,!
 S BHSRTX=$P(^RAMIS(71,BHSRT,0),U,1) D CKP^GMTSUP Q:$D(GMTSQIT)  W !,BHSRTX,?BHSRW,"(",$S(BHSEDT]"":BHSEDT,1:BHSRTD),")  "
 ;IHS/MSC/MGH Patch change
 I $P(BHSRRT(BHSRT),U,4)]"" W "RESULT:  " S BHSDCD=$P(BHSRRT(BHSRT),U,4) W $S(BHSDCD]"":BHSDCD,1:"<none recorded>"),!
 I $P(BHSRRT(BHSRT),U,5)]"" W ?3,"Diagnostic Code: ",$P(BHSRRT(BHSRT),U,5),!
 W ?3,"IMPRESSION:  " S BHSICL=16,BHSNRQ=BHSRR,BHSTXT="",BHSICD="" D PRTTXT^BHSUTL
 K BHSTXT,BHSNRQ
 Q
DISPREF ;EP added in patch 2
 D CKP^GMTSUP Q:$D(GMTSQIT)
 N %,SNO
 S BHSRC=0
 S BHSX="" F  S BHSX=$O(^AUPNPREF("AA",BHSPAT,BHSFN,BHSX)) Q:BHSX=""!($D(GMTSQIT))  D
 .S BHSD=0 F  S BHSD=$O(^AUPNPREF("AA",BHSPAT,BHSFN,BHSX,BHSD)) Q:BHSD=""!(BHSD>GMTSDLM)!($D(GMTSQIT))  D
 ..S BHSI=0 F  S BHSI=$O(^AUPNPREF("AA",BHSPAT,BHSFN,BHSX,BHSD,BHSI)) Q:BHSI=""!($D(GMTSQIT))  D
 ...I $D(BHSS) X BHSS Q:'%
 ...S BHSRC=BHSRC+1
 ...I BHSRC=1 I BHST]"" W !,BHST," Refusals "
 ...D CKP^GMTSUP Q:$D(GMTSQIT)
 ...S SNO=$$GET1^DIQ(9000022,BHSI,1.02)
 ...S SNO=$P($$DESC^BSTSAPI(SNO_"^^1"),U,2)
 ...I SNO="" S SNO=$$VAL^XBDIQ1(9000022,BHSI,.07)
 ...W !,$$VAL^XBDIQ1(9000022,BHSI,.04)," -- ",SNO,?60,"(",$$DATE^APCHSMU(9999999-BHSD),")"
 ...;W !,$$VAL^XBDIQ1(9000022,BHSI,.04)," -- ",$$VAL^XBDIQ1(9000022,BHSI,.07),?60,"(",$$DATE^APCHSMU(9999999-BHSD),")"
 ..Q
 .Q
 W !
 K BHST,BHSX,BHSD,BHSS,BHSFN,BHSI,BHSRC
 Q
RAD ; ******************* RAD TESTS - ALL * 9000010.12 *******
 ; <SETUP>
 S BHSPAT=DFN
 I '$D(^AUPNVRAD("AA",BHSPAT)) S BHST="RADIOLOGY EXAM",BHSFN=71 D DISPREF^BHSRAD Q
 K BHSRRT
 ; <DISPLAY>
 S BHST="" F BHSQ=0:0 S BHST=$O(^AUPNVRAD("AA",BHSPAT,BHST)) Q:BHST=""  S BHSTX=$P(^RAMIS(71,BHST,0),U,1),BHSTL=$L(BHSTX) D CKP^GMTSUP Q:$D(GMTSQIT)  D RADBLD
 ; <CLEANUP>
 S BHST="RADIOLOGY EXAM",BHSFN=71 D DISPREF^BHSRAD
 K BHST,BHSFN
RADX K BHST,BHSTX,BHSTL,BHSIVD,BHSDFN,BHSRDG,BHSVDF,BHSDAT,X,Y
 K BHSNFL,BHSNSH,BHSNAB,BHSVSC,BHSITE,BHS0
 Q
RADBLD S BHSIVD="" F BHSQ=0:0 S BHSIVD=$O(^AUPNVRAD("AA",BHSPAT,BHST,BHSIVD)) Q:BHSIVD=""!(BHSIVD>GMTSDLM)  D RADBLD1
 Q
RADBLD1 ;
 D CKP^GMTSUP Q:$D(GMTSQIT)  S X=-BHSIVD\1+9999999 D REGDT4^GMTSU S BHSDAT=X W !,BHSDAT
 S BHSDFN=0 F BHSQ=0:0 S BHSDFN=$O(^AUPNVRAD("AA",BHSPAT,BHST,BHSIVD,BHSDFN)) Q:'BHSDFN  D
 .Q:'$D(^AUPNVRAD(BHSDFN,0))
 .S BHSEDT=$P($G(^AUPNVRAD(BHSDFN,12)),U,1)
 .D RADDSP
 Q
RADDSP ;
 S BHS0=$P(^AUPNVRAD(BHSDFN,0),U,1)
 S BHSRTX=$P(^RAMIS(71,$P(BHS0,U),0),U,1) W ?11,BHSRTX I BHSEDT'=9999999-BHSIVD W "  ("_$$FMTE^XLFDT(BHSEDT,5)_")"
 ;IHS/MSC/MGH  IHS patch changes
 I $P(BHS0,U,5)]"" W !?11,"RESULT:  " S BHSDCD=$P(BHS0,U,4) W $S(BHSDCD]"":BHSDCD,1:"<none recorded>"),!
 I $P(BHS0,U,6)]"" W ?3,"Diagnostic Code: ",$$VAL^XBDIQ1(9000010.22,BHSDFN,.05),!
 I $G(^AUPNVRAD(BHSDFN,11))]"" W ?11,"IMPRESSION:  " S BHSICL=12,BHSNRQ=$G(^AUPNVRAD(BHSDFN,11)),BHSTXT="",BHSICD="" D PRTTXT^BHSUTL
 I $G(^AUPNVRAD(BHSDFN,11))="" W !
 K BHSTXT,BHSNRQ
 Q