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

BHSHS1.m

Go to the documentation of this file.
BHSHS1 ;IHS/CIA/MGH - Health Summary for pt history components ;30-Nov-2015 10:25;DU
 ;;1.0;HEALTH SUMMARY COMPONENTS;**1,2,3,9,10,11,12**;March 17, 2006;Build 3
 ;===================================================================
 ;VA health summary components for history components
 ;includes family hx, personal hx, and surgical hx
 ;Taken from APCHS6
 ; IHS/TUCSON/LAB - PART 6 OF APCHS -- SUMMARY PRODUCTION COMPONENTS ;
 ;;2.0;IHS RPMS/PCC Health Summary;**11**;JUN 24, 1997
 ;Patch 1 changes made up to IHS patch 14
 ;Patch 2 chages made up to IHS patch 16
 ;Patch 3 changes made up to bjpc version 2
 ;Patch 12 used new API for taxonomies
FMH ; ******************** FAMILY HISTORY * 9000014 *******
 ; <SETUP>
 N BHSPAT,BHSQ
 S BHSPAT=DFN
 Q:'$D(^AUPNFH("AC",BHSPAT))
 D CKP^GMTSUP Q:$D(GMTSQIT)
 ; <DISPLAY>
 S BHSDFN="" F BHSQ=0:0 S BHSDFN=$O(^AUPNFH("AC",BHSPAT,BHSDFN)) Q:BHSDFN=""  D FHDSP
 ; <CLEANUP>
FMHX K BHSDFN,BHSN,BHSICD,BHSDAT,BHSNRQ,BHSICL,X,R,S,N,A
 Q
FHDSP S BHSN=^AUPNFH(BHSDFN,0)
 S BHSICD=$P(BHSN,U,1) D GETICDDX^BHSUTL
 S X=$P(BHSN,U,3) D REGDT4^GMTSU S BHSDAT=X
 S BHSNRQ=$P(BHSN,U,4)
 D GETNARR^BHSUTL
 D CKP^GMTSUP Q:$D(GMTSQIT)  W BHSDAT_" " ;S BHSICL=10 D PRTICD^BHSUTL
 S (X,R,S,N,A)=""
 S R=$$VAL^XBDIQ1(9000014,BHSDFN,.07)
 S N=$$VAL^XBDIQ1(9000014,BHSDFN,.04)_" ("_$$VAL^XBDIQ1(9000014,BHSDFN,.01)_")"
 S A=$P(^AUPNFH(BHSDFN,0),U,5)
 S S=$$VAL^XBDIQ1(9000014,BHSDFN,.06)
 S X=X_$S(R]"":R_"; ",1:"")
 S X=X_$S(N]"":N_"; ",1:"")
 S X=X_$S(A]"":A_"; ",1:"")
 S X=X_$S(S]"":S_"; ",1:"")
 W ?10,X,!
 Q
 ;
PMH ; ******************** PERSONAL HISTORY * 9000013 *******
 ; <SETUP>
 N BHSPAT,BHSQ,BHSNTE,X
 S BHSPAT=DFN
 Q:'$D(^AUPNPH("AC",BHSPAT))
 D CKP^GMTSUP Q:$D(GMTSQIT)
 ; <DISPLAY>
 S BHSDFN="" F BHSQ=0:0 S BHSDFN=$O(^AUPNPH("AC",BHSPAT,BHSDFN)) Q:BHSDFN=""  D PHDSP
 ; <CLEANUP>
PMHX K BHSDFN,BHSN,BHSICD,BHSICL,BHSNRQ,BHSDAT,BHSDTH
 Q
PHDSP S BHSN=^AUPNPH(BHSDFN,0)
 S BHSICD=$P(BHSN,U,1) D GETICDDX^BHSUTL
 S X=$P(BHSN,U,3) D REGDT4^GMTSU S BHSDAT=X
 S BHSDTH=$P(BHSN,U,5) I BHSDTH]"" S X=BHSDTH D REGDT4^GMTSU S BHSDTH=X
 S BHSNRQ=$P(BHSN,U,4)
 D GETNARR^BHSUTL
 K BHSDTE S:BHSDTH]"" BHSNTE="(onset: "_BHSDTH_")"
 D CKP^GMTSUP Q:$D(GMTSQIT)  W BHSDAT_" " S BHSICL=10 D PRTICD^BHSUTL
 Q
 ;
HOS ; ************* HISTORY OF SURGERY * 9000010.08 (V PROCEDURE)& CPT *******
 ; <SETUP>
 N BHSPAT,BHSNTE,BHSQ,BHSDFN,BHSICD,BHSN,BHSCNT,BHSNRQ,BHSIVD,BHSDS,BHHOSA,BHSNRQ1
 N BHT,BHCPT,BHSIEN,BHCPTI,BHSCSVD,BHSCPT2,I,MATCH,SCODE,Z,CODE
 S BHSPAT=DFN,BHSCNT=0
 ;Q:'$D(^AUPNVPRC("AC",BHSPAT))
 D CKP^GMTSUP Q:$D(GMTSQIT)
 S BHSCNT=0
 ; <DISPLAY>
 S BHSIVD=0 F  S BHSIVD=$O(^AUPNVPRC("AA",BHSPAT,BHSIVD)) Q:'BHSIVD  D
 .S BHSDFN=0 F   S BHSDFN=$O(^AUPNVPRC("AA",BHSPAT,BHSIVD,BHSDFN)) Q:'BHSDFN  D        ;D HOSDSP Q:$D(GMTSQIT)
 ..S BHSICD=$P(^AUPNVPRC(BHSDFN,0),U)
 ..S BHSN=^AUPNVPRC(BHSDFN,0)
 ..D HOSCHK Q:BHSICD=""
 ..S BHSCNT=BHSCNT+1
 ..S BHSCSVD=+^AUPNVSIT($P(BHSN,U,3),0)\1
 ..D GETICDOP^BHSUTL
 ..S Y=$P(BHSN,U,3),X=+^AUPNVSIT(Y,0)\1 D REGDT4^GMTSU S BHSDAT=X
 ..S BHSNRQ=$P(BHSN,U,4)
 ..I BHSNRQ D GETNARR^BHSUTL
 ..I BHSNRQ="" D
 ...;Patch 9 for ICD-10
 ...S BHSNRQ=$P($$ICDOP^ICDEX($P(BHSN,U,1),+^AUPNVSIT($P(BHSN,U,3),0)\1,"","I"),U,5)  ;cmi/anch/maw 8/28/2007 code set
 ..S BHSNRQ1=$P($$ICDOP^ICDEX($P(BHSN,U,1),BHSDAT,"","I"),U,2)
 ..S BHSDS="DATE?" D
 ...S X=$P(BHSN,U,6) I X]"" D REGDT4^GMTSU S BHSDS=X Q
 ...S X=(9999999-BHSIVD) D REGDT4^GMTSU S BHSDS=X
 ..D GETOPRV
 ..S BHHOSA(BHSIVD,"PRC",BHSDFN)=BHSDS_U_BHSNRQ_U_BHSOP_U_BHSNRQ1
 ;now go through v cpt
 S BHT=$O(^ATXAX("B","APCH HS MAJOR PROCEDURE CPTS",0))
 S BHCPTI=0 F  S BHCPTI=$O(^AUPNVCPT("AA",BHSPAT,BHCPTI)) Q:BHCPTI'=+BHCPTI  D
 .;IHS/MSC/MGH Patch 11 new check
 .S CODE=$P($G(^ICPT(BHCPTI,0)),U)
 .I '$$ICD^ATXAPI(CODE,BHT,1) Q  ;not a cpt wanted on this compone
 .S BHSIVD=0 F  S BHSIVD=$O(^AUPNVCPT("AA",BHSPAT,BHCPTI,BHSIVD)) Q:BHSIVD=""  D
 ..S BHSIEN=0 F  S BHSIEN=$O(^AUPNVCPT("AA",BHSPAT,BHCPTI,BHSIVD,BHSIEN)) Q:BHSIEN'=+BHSIEN  D
 ...S X=(9999999-BHSIVD) D REGDT4^GMTSU S BHSDS=X
 ...S BHSN=^AUPNVCPT(BHSIEN,0)
 ...S BHSICD=$P(BHSN,U,1)
 ...D GETCPT^BHSUTL
 ...S BHSNRQ=$P(BHSN,U,4)
 ...I BHSNRQ D GETNARR^BHSUTL
 ...N BHSVDT
 ...S BHSVDT=$P(+^AUPNVSIT($P(BHSN,U,3),0),".")
 ...I BHSNRQ="" S BHSNRQ=$P($$CPT^ICPTCOD($P(BHSN,U,1),BHSVDT),U,3)
 ...S BHHOSA(BHSIVD,"CPT",BHSIEN)=BHSDS_U_BHSNRQ_U_$S($P($G(^AUPNVCPT(BHSIEN,12)),U,4):$$VAL^XBDIQ1(9000010.18,BHSIEN,1204),1:$$VAL^XBDIQ1(9000010.18,BHSIEN,1202))_U_BHSICD  ;
 ...S BHHOSC(BHSIVD,"CPT",$P(^ICPT($P(BHSN,U,1),0),U,1))=""
 ;now get all tran codes hcpcs
 S BHSIEN=0 F  S BHSIEN=$O(^AUPNVTC("AC",BHSPAT,BHSIEN)) Q:BHSIEN=""  D
 .Q:'$D(^AUPNVTC(BHSIEN))
 .S V=$P(^AUPNVTC(BHSIEN,0),U,3)
 .Q:'V
 .Q:'$D(^AUPNVSIT(V,0))
 .S V=$P($P(^AUPNVSIT(V,0),U),".")
 .S X=V  D REGDT4^GMTSU  S BHSDS=X
 .S BHSIVD=9999999-V
 .S BHCPT=$$VAL^XBDIQ1(9000010.33,BHSIEN,.07)
 .S BHCPTI=$P(^AUPNVTC(BHSIEN,0),U,7)
 .Q:'BHCPTI
 .S CODE=$P($G(^ICPT(BHCPTI,0)),U)
 .I '$$ICD^ATXAPI(CODE,BHT,1) Q  ;not a cpt wanted on this compone
 .Q:$D(BHHOSC(BHSIVD,"CPT",BHCPT))
 .;S BHSNRQ=$P(^ICPT(BHCPTI,0),U,2)
 .S BHSNRQ=$P($$CPT^ICPTCOD(BHCPTI,V),U,3)
 .S BHSICD=BHCPTI
 .D GETCPT^BHSUTL
 .S BHHOSA(BHSIVD,"CPT",BHSIEN)=BHSDS_U_BHSNRQ_U_$S($P($G(^AUPNVTC(BHSIEN,12)),U,4):$$VAL^XBDIQ1(9000010.33,BHSIEN,1204),1:$$VAL^XBDIQ1(9000010.33,BHSIEN,1202))_U_BHSICD
 ;now display the procedures/cpt codes
 W ?1,"TIME",?12,"USER",?30,"CODE AND TEXT",!
 S BHSIVD=0 F  S BHSIVD=$O(BHHOSA(BHSIVD)) Q:BHSIVD=""!($D(GMTSQIT))  D
 .D CKP^GMTSUP Q:$D(GMTSQIT)
 .  S BHIEN=0 F  S BHIEN=$O(BHHOSA(BHSIVD,"PRC",BHIEN)) Q:BHIEN'=+BHIEN!($D(GMTSQIT))  D
 .. S BHSOP=$P(BHHOSA(BHSIVD,"PRC",BHIEN),U,3)
 .. S BHSNRQ=$P(BHHOSA(BHSIVD,"PRC",BHIEN),U,2)
 .. S BHSDS=$P(BHHOSA(BHSIVD,"PRC",BHIEN),U,1)
 .. S BHSICD=$P(BHHOSA(BHSIVD,"PRC",BHIEN),U,4)
 .. W BHSDS,?12,$E(BHSOP,1,15) S BHSNTE="" S BHSICL=26 D PRTICD^BHSUTL
 .  S BHIEN=0 F  S BHIEN=$O(BHHOSA(BHSIVD,"CPT",BHIEN)) Q:BHIEN'=+BHIEN!($D(GMTSQIT))  D
 .. S BHSOP=$P(BHHOSA(BHSIVD,"CPT",BHIEN),U,3)     ;the user
 .. S BHSNRQ=$P(BHHOSA(BHSIVD,"CPT",BHIEN),U,2)    ;the narrative
 .. S BHSDS=$P(BHHOSA(BHSIVD,"CPT",BHIEN),U,1)     ;the date
 .. S BHSICD=$P(BHHOSA(BHSIVD,"CPT",BHIEN),U,4)    ;the code and text
 .. W BHSDS,?12,$E(BHSOP,1,15) S BHSNTE="" S BHSICL=26 D PRTICD^BHSUTL
 I 'BHSCNT D CKP^GMTSUP Q:$D(GMTSQIT)  W "Minor procedures are on file but have not been displayed.",!
 ; now display refusals for icd procedures
 S BHSFN=80.1,BHST="PROCEDURE"
 S BHSS="S %=0,BHSICD=$P(^AUPNPREF(BHSI,0),U,6) Q:'BHSICD  D HOSCHK^BHSHS1 I BHSICD S %=1"
 D DISPREF^BHSRAD
 S BHSFN=81,BHST="CPT"
 ;IHS/MSC/MGH  Patch 10
 S BHSS="S %=0,BHCPT=$P(^AUPNPREF(BHSI,0),U,6) Q:'BHCPT  I $$ICD^ATXAPI(BHCPT,$O(^ATXAX(""B"",""APCH HS MAJOR PROCEDURE CPTS"",0)),1) S %=1"
 D DISPREF^BHSRAD
 ; <CLEANUP>
HOSX K BHSDFN,BHSICD,BHSNRQ,BHSDAT,BHSDS,BHSICL,BHSIVD,BHSCOD,BHSCNT,BHSOPN,BHSOP,Y,BHIEN,BHHOSC,BHSS,BHST,BHSFN,V
 Q
HOSDSP S BHSN=^AUPNVPRC(BHSDFN,0)
 S BHSICD=$P(BHSN,U,1)
 D HOSCHK Q:BHSICD=""
 S BHSCNT=BHSCNT+1
 S BHSCSVD=+^AUPNVSIT($P(BHSN,U,3),0)\1
 D GETICDOP^BHSUTL
 S Y=$P(BHSN,U,3),X=+^AUPNVSIT(Y,0)\1 D REGDT4^GMTSU S BHSDAT=X
 S BHSNRQ=$P(BHSN,U,4)
 ;Fixed patch 1001
 I BHSNRQ D GETNARR^BHSUTL
 ;I BHSNRQ="" S BHSNRQ=$P(^ICD0($P(BHSN,U,1),0),U,4)
 ;Patch 9 for ICD-10
 I $$AICD^BHSUTL D
 .I BHSNRQ="" S BHSNRQ=$P($$ICDOP^ICDEX($P(BHSN,U,1),BHSDAT,"","I"),U,5)  ;cmi/anch/maw 8/28/2007 code set versioning
 .E  S BHSNRQ1=BHSNRQ   ;P11
 .S BHSNRQ=$P($$ICDOP^ICDEX($P(BHSN,U,1),BHSDAT,"","I"),U,2)_" "_BHSNRQ1
 E  I BHSNRQ="" S BHSNRQ=$P($$ICDOP^ICDCODE($P(BHSN,U,1),BHSDAT),U,5)  ;cmi/anch/maw 8/28/2007 code set versioning
 ;end patch
 S BHSDS="DATE?",X=$P(BHSN,U,6) I Y]"" D REGDT4^GMTSU S BHSDS=X
 D GETOPRV
 D CKP^GMTSUP Q:$D(GMTSQIT)
 W BHSDS W ?12,BHSOP S BHSNTE="" S BHSICL=26 D PRTICD^BHSUTL
 K BHSOP
 Q
HOSCHK ;
 ;S BHSCOD=+^ICD0(BHSICD,0)
 ;Patch 9 for ICD-10
 I $$AICD^BHSUTL S BHSCOD=$P($$ICDOP^ICDEX(BHSICD,"","","I"),U,1)
 E  S BHSCOD=$P($$ICDOP^ICDCODE(BHSICD),U,1)
 I $$ICD^ATXAPI(BHSCOD,$O(^ATXAX("B","APCH MINOR SURGICAL PROCS",0)),0) S BHSICD=""
 ;I BHSCOD\1>85 S BHSICD="" Q
 ;I BHSCOD=69.7 S BHSICD="" Q
 ;I BHSCOD\1=23 S BHSICD="" Q
 ;I BHSCOD\1=24 S BHSICD="" Q
 ;I $E(BHSCOD,1,4)="38.9" S BHSICD="" Q
 ;I BHSCOD=73.09 S BHSICD="" Q
 Q
GETOPRV ;get Operating Provider
 NEW BHSOPN
 S BHSOP=""
 S BHSOPN=$P(BHSN,U,11)
 Q:'+BHSOPN
 S BHSOP=$E($P($G(^VA(200,BHSOPN,0)),U,1),1,15)    ;provider name
 Q