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

BHSEXAM1.m

Go to the documentation of this file.
BHSEXAM1 ; IHS/MSC/MGH - Exams selected component;29-Oct-2012 11:24;DU
 ;;1.0;HEALTH SUMMARY COMPONENTS;**7**;March 17, 2006;Build 12
 ; SLC/SBW,KER - PCE Examination Comp ; 08/27/2002
 ;
 ;
 ; External References
 ;   DBIA  3063  EXAM^PXRHS05
 ;   DBIA 10011  ^DIWP
 ;
 ;For selected procedures see if you have a match
EXAM ;EP Get the selected exam list
 N GMTSI,GMTSF,GMTSC,EXAM,EXAMSEL
 Q:'$D(GMTSEG(GMTSEGN,9999999.15))
 S GMTSI=0 F GMTSI=0:0 S GMTSI=$O(GMTSEG(GMTSEGN,9999999.15,GMTSI)) Q:'+GMTSI  D
 .S EXAM=$G(GMTSEG(GMTSEGN,9999999.15,GMTSI))
 .S EXAMSEL(EXAM)=""
 D SEL(.EXAMSEL)
 Q
SEL(ITEMS) ;
 N BHSPAT,V,Y,CNT,BHSEXAM,BHSIVD,BHIEN,EDATE,A,B,C,BHEXAM,BHSA,%
 S BHSPAT=DFN
 I '$D(^AUPNVXAM("AA",BHSPAT)) Q  ;no exams for this patient
 ; <DISPLAY>
 K BHCPTA
 S CNT=0
 I $D(ITEMS)>0 D
 .S BHSEXAM=0 F  S BHSEXAM=$O(ITEMS(BHSEXAM)) Q:BHSEXAM=""  D
 ..Q:BHSEXAM=""
 ..S CNT=0
 ..S BHSIVD="" F  S BHSIVD=$O(^AUPNVXAM("AA",BHSPAT,BHSEXAM,BHSIVD)) Q:BHSIVD=""!(BHSIVD>GMTSDLM)  D
 ...S BHIEN=0 F  S BHIEN=$O(^AUPNVXAM("AA",BHSPAT,BHSEXAM,BHSIVD,BHIEN)) Q:BHIEN'=+BHIEN!(CNT+1>GMTSNDM)  D
 ....S BHEXAM=$$VAL^XBDIQ1(9000010.13,BHIEN,.01)
 ....S EDATE=$$VAL^XBDIQ1(9000010.13,BHIEN,1201)
 ....S EDATE=$P(EDATE,"@",1)
 ....I EDATE="" S EDATE=$$VALI^XBDIQ1(9000010,$P(^AUPNVXAM(BHIEN,0),U,3),.01)
 ....S B=$$VAL^XBDIQ1(9000010.13,BHIEN,.04)
 ....S C=$$VAL^XBDIQ1(9000010.13,BHIEN,1204)
 ....S BHSA(BHEXAM,BHSIVD,BHIEN)=BHEXAM_U_EDATE_U_B_U_C
 ....S CNT=CNT+1
 D CKP^GMTSUP Q:$D(GMTSQIT)
 W "Exam",?32,"Date",?45,"Result",?65,"Provider",!
 S BHSEXAM=0 F  S BHSEXAM=$O(BHSA(BHSEXAM)) Q:BHSEXAM=""!($D(GMTSQIT))  D
 .D CKP^GMTSUP Q:$D(GMTSQIT)  I GMTSNPG W ?28,"CODE",?34,"CPT NARRATIVE",?72,"UNITS",!
 .;W $$DATE^BHSMU((9999999-BHSIVD))
 .S BHSIVD="" F  S BHSIVD=$O(BHSA(BHSEXAM,BHSIVD)) Q:BHSIVD=""!($D(GMTSQIT))  D
 ..S BHIEN=0 F  S BHIEN=$O(BHSA(BHSEXAM,BHSIVD,BHIEN)) Q:BHIEN'=+BHIEN!($D(GMTSQIT))  D
 ...D CKP^GMTSUP Q:$D(GMTSQIT)  I GMTSNPG W "Exam",?32,"Date",?45,"Result",?65,"Provider",!
 ...S %=$G(BHSA(BHSEXAM,BHSIVD,BHIEN))
 ...W $P(%,U,1),?32,$P(%,U,2),?45,$P(%,U,3),?65,$P(%,U,4)
 ...W !
 ;
 Q
HDR ; Header
 W ?5,"Exam",?32,"Result",?47,"Date",?55,"Facility",!!
 Q