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

BHSCPT1.m

Go to the documentation of this file.
BHSCPT1 ;IHS/MSC/MGH - Health Summary for V CPT file ;31-Dec-2015 13:12;DU
 ;;1.0;HEALTH SUMMARY COMPONENTS;**7,9,13**;March 17, 2006;Build 6
 ;===================================================================
 ; IHS/TUCSON/LAB - PART 6 OF APCHS -- SUMMARY PRODUCTION COMPONENTS ;  [ 05/04/04  2:46 PM ]
 ;Patch 7 added component for CPT selection codes
CPT ;EP - display cpt codes for select items, date limits are applicable
 ;For selected procedures see if you have a match
 N GMTSI,GMTSF,GMTSC,CPT,CPTSEL
 Q:'$D(GMTSEG(GMTSEGN,81))
 S GMTSI=0 F GMTSI=0:0 S GMTSI=$O(GMTSEG(GMTSEGN,81,GMTSI)) Q:'+GMTSI  D
 .S CPT=$G(GMTSEG(GMTSEGN,81,GMTSI))
 .S CPTSEL(CPT)=""
 D SEL(.CPTSEL)
 Q
SEL(ITEMS) ;
 N BHSPAT,V,Y,OLDCPT,CNT,BHCPTI,BHSIVD,BHCPT,BHCPTA,BHIEN,BHSIVD,BHSNAR
 S BHSPAT=DFN
 I '$D(^AUPNVCPT("AA",BHSPAT)) Q  ;no cpt codes for this patient
 ; <DISPLAY>
 K BHCPTA
 I $D(ITEMS)>0 D
 .S CODE=0 F  S CODE=$O(ITEMS(CODE)) Q:CODE=""  D
 ..S LKUP=$P($G(^ICPT(CODE,0)),U,1)
 ..S BHCPTI=$O(^ICPT("BA",$G(LKUP)_" ",0))
 ..Q:BHCPTI=""
 ..S CNT=0
 ..S BHSIVD="" F  S BHSIVD=$O(^AUPNVCPT("AA",BHSPAT,BHCPTI,BHSIVD)) Q:BHSIVD=""!(BHSIVD>GMTSDLM)  D
 ...S BHIEN=0 F  S BHIEN=$O(^AUPNVCPT("AA",BHSPAT,BHCPTI,BHSIVD,BHIEN)) Q:BHIEN'=+BHIEN!(CNT+1>GMTSNDM)  D
 ....S BHCPT=$$VAL^XBDIQ1(9000010.18,BHIEN,.01)
 ....;IHS/MSC/MGH Patch 13
 ....S BHSNAR=$$VAL^XBDIQ1(9000010.18,BHIEN,.04)
 ....I BHSNAR="" S BHCPTA(BHCPT,BHSIVD,BHIEN)=$P($$CPT^ICPTCOD(BHCPTI,(9999999-BHSIVD)),U,3)_U_$$VAL^XBDIQ1(9000010.18,BHIEN,.16)_U_$$VALI^XBDIQ1(9000010,$P(^AUPNVCPT(BHIEN,0),U,3),.06)
 ....E  S BHCPTA(BHCPT,BHSIVD,BHIEN)=BHSNAR_U_$$VAL^XBDIQ1(9000010.18,BHIEN,.16)_U_$$VALI^XBDIQ1(9000010,$P(^AUPNVCPT(BHIEN,0),U,3),.06)
 ....S Y=$$VALI^XBDIQ1(9000010,$P(^AUPNVCPT(BHIEN,0),U,3),.08) S $P(BHCPTA(BHCPT,BHSIVD,BHIEN),U,4)=Y
 ....S CNT=CNT+1
 D CKP^GMTSUP Q:$D(GMTSQIT)
 W "DATE",?10,"LOC",?30,"CODE",?36,"CPT NARRATIVE",?72,"UNITS",!
 S OLDCPT=""
 S BHCPT=0 F  S BHCPT=$O(BHCPTA(BHCPT)) Q:BHCPT=""!($D(GMTSQIT))  D
 .D CKP^GMTSUP Q:$D(GMTSQIT)  I GMTSNPG W "DATE",?10,"LOC",?30,"CODE",?36,"CPT NARRATIVE",?72,"UNITS",!
 .I BHCPT'=OLDCPT W ! S OLDCPT=BHCPT
 .S BHSIVD="" F  S BHSIVD=$O(BHCPTA(BHCPT,BHSIVD)) Q:BHSIVD=""!($D(GMTSQIT))  D
 ..W $$DATE^BHSMU((9999999-BHSIVD))
 ..S BHIEN=0 F  S BHIEN=$O(BHCPTA(BHCPT,BHSIVD,BHIEN)) Q:BHIEN'=+BHIEN!($D(GMTSQIT))  D
 ...D CKP^GMTSUP Q:$D(GMTSQIT)  I GMTSNPG W "DATE",?10,"LOC",?30,"CODE",?36,"CPT NARRATIVE",?72,"UNITS",!
 ...S %=$P(BHCPTA(BHCPT,BHSIVD,BHIEN),U,3)
 ...I % W ?10,$P($G(^AUTTLOC(%,0)),U,2)
 ...S %=$P(BHCPTA(BHCPT,BHSIVD,BHIEN),U,4)
 ...I % W ?22,$P($G(^DIC(40.7,%,9999999)),U)
 ...W ?30,BHCPT,?37,$E($P(BHCPTA(BHCPT,BHSIVD,BHIEN),U,1),1,36)
 ...W ?73,$P(BHCPTA(BHCPT,BHSIVD,BHIEN),U,2)
 ...W !
 ; <CLEANUP>
 ;now display CPT refusals
 ;S BHST="CPT",BHSFN=81 D DISPREF^BHSRAD
 ;K BHST,BHSFN
CPTALLX K BHSIVD,BHSDAT,BHCPT,BHIEN,BHCPTA,BHCPTI,%,CODE,CPTSEL
 Q