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

BHSHOS.m

Go to the documentation of this file.
BHSHOS ;IHS/CIA/MGH - Health Summary for hospitalization encounters ;17-Mar-2006 10:36;MGH
 ;;1.0;HEALTH SUMMARY COMPONENTS;;March 17, 2006
 ;===================================================================
 ;Taken from APCHS2C
 ; IHS/TUCSON/LAB - PART 2C OF APCHS -- SUMMARY PRODUCTION COMPONENTS ;
 ;;2.0;IHS RPMS/PCC Health Summary;;JUN 24, 1997
 ;VA verision of IHS health summary component for hospitalization encounters
INPT ; ********** HOSPITALIZATION ENCOUNTERS * 9000010/900010.07 **********
 ; <SETUP>
 N BHSPAT,BHSQ,BHSNTE
 S BHSPAT=DFN
 Q:'$D(^AUPNVSIT("AAH",BHSPAT))
 D CKP^GMTSUP Q:$D(GMTSQIT)
 ; <DISPLAY>
 S BHSPVD=0
 S BHSIVD="" F BHSQ=0:0 S BHSIVD=$O(^AUPNVSIT("AAH",BHSPAT,BHSIVD)) Q:BHSIVD=""!(BHSIVD>GMTSDLM)  D
 .D ONEDATE Q:$D(GMTSQIT)  S:BHSDAT'=BHSPVD GMTSNDM=GMTSNDM-1,BHSPVD=BHSDAT Q:GMTSNDM=0
 ; <CLEANUP>
INPTX K BHSIVD,BHSDTU,BHSDAT,BHSVDF,BHSFAC,BHSFO,BHSMTX,BHSMOD,BHSPVD,BHSHDN,BHSDDC,BHSCDN,BHSICD,BHSICL,BHSN,BHSNRQ,BHSPDN,BHSVTP
 K BHSNFL,BHSNSH,BHSNAB,BHSVSC,BHSITE,Y,X
 Q
ONEDATE S X=-BHSIVD\1+9999999 D REGDT4^GMTSU S BHSDAT=X S BHSDTU=(BHSDAT=BHSPVD)
 S BHSVDF="" F BHSQ=0:0 S BHSVDF=$O(^AUPNVSIT("AAH",BHSPAT,BHSIVD,BHSVDF)) Q:BHSVDF=""  S BHSN=^AUPNVSIT(BHSVDF,0) D GETSITEV^BHSUTL D:"H"[BHSVSC HOSP Q:$D(GMTSQIT)
 Q
 ;
HOSP ;
 Q:$P(BHSN,U,9)=0!($P(BHSN,U,11)=1)
 S BHSVTP=$P(BHSN,U,3)
 S BHSDTU=1
 S BHSFAC=BHSNSH
 S BHSDDC="?"
 I BHSVTP'="C" S BHSHDN=$O(^AUPNVINP("AD",BHSVDF,0)) I BHSHDN S X=+^AUPNVINP(BHSHDN,0) D REGDT4^GMTSU S BHSDDC=X
 I BHSVTP="C" S BHSCDN=$O(^AUPNVCHS("AD",BHSVDF,0)) I BHSCDN S X=$P(^AUPNVCHS(BHSCDN,0),U,7) D REGDT4^GMTSU S BHSDDC=X
 D CKP^GMTSUP Q:$D(GMTSQIT)  D IHDR
 S BHSPDN="" F BHSQ=0:0 S BHSPDN=$O(^AUPNVPOV("AD",BHSVDF,BHSPDN)) Q:'BHSPDN  S BHSN=^AUPNVPOV(BHSPDN,0) D DSPPOV
 W:$X ?33,"<no visit data>",!
 Q
 ;
DSPPOV S BHSICD=$P(BHSN,U,1) D GETICDDX^BHSUTL
 S BHSNRQ=$P(BHSN,U,4)
 D GETNARR^BHSUTL
 S BHSMOD=$P(BHSN,U,6)
 I BHSMOD]"" S BHSMTX=$P(^DD(9000010.07,.06,0),U,3),BHSMTX=$P($P(BHSMTX,BHSMOD_":",2),";",1),BHSMTX=$P(BHSMTX,",",1),BHSICD=BHSMTX_" "_BHSICD
 S:$D(^AUPNVCHS("AD",BHSVDF)) BHSNTE="*** CHS ***"
 D CKP^GMTSUP Q:$D(GMTSQIT)  D:GMTSNPG IHDR S BHSICL=33 S:0 BHSICD=BHSVSC_":"_BHSICD D PRTICD^BHSUTL
 Q
 ;
IHDR W BHSDAT,"-",BHSDDC,?18,BHSFAC
 Q