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

BHSMEAP.m

Go to the documentation of this file.
BHSMEAP ;IHS/CIA/MGH - Health Summary for Measurement Panels ;09-Dec-2010 09:21;DU
 ;;1.0;HEALTH SUMMARY COMPONENTS;**1,2,4**;Mar 17, 2006;Build 13
 ;===================================================================
 ;Taken from APCHS2A
 ; IHS/TUCSON/LAB - PART 2A OF APCHS -- SUMMARY PRODUCTION COMPONENTS ;
 ;;2.0;IHS RPMS/PCC Health Summary;;JUN 24, 1997
 ;VA Health summary format of IHS health summary component for measurement panels
 ;Patch 4 skip vitals entered in error
MEASP ; ******************** MEASUREMENT PANELS * 9000010.01 *******
 ; <SETUP>
 N BHSPAT,BHSP,BHSQ,APCHSPAT,APCHSIDT
 S (BHSPAT,APCHSPAT)=DFN
 Q:'$D(^AUPNVMSR("AA",BHSPAT))
 D CKP^GMTSUP
 ; <BUILD>  BHSCTL-HLTH SUM TYPE
 Q:$O(GMTSEG(GMTSEGN,9001017,0))'>0
 F BHSPOR=0:0 S BHSPOR=$O(GMTSEG(GMTSEGN,9001017,BHSPOR)) Q:'BHSPOR!(BHSPOR?1A)  S BHSND2=GMTSNDM,BHSDMX=0 D PBLD
MEASPX K BHSPOR,BHSPDF,BHSCOR,BHSCT,BHSCT2,BHSCT3,BHSCLN,BHSMT,BHSML,BHSTSQ,BHSTVL,BHSVAL,APCHSIVD,BHST,BHSC,BHSND2,BHSDMX,BHSDFN,BHSEDAT,BHSDAT,BHSDM2,BHSPS1,BHSIDT,BHSNTS,Y,X
 Q
PBLD S BHSPDF=$G(GMTSEG(GMTSEGN,9001017,BHSPOR)) Q:BHSPDF=""
 K BHSTSQ,BHSTVL,BHSNTS
 S BHSNTS=0
 F BHSPS1=1,0 F BHSCOR=0:0 S BHSCOR=$O(^APCHSMPN(BHSPDF,1,BHSCOR)) Q:BHSCOR=""!(BHSCOR?1A)  D CBLD
 D POUT
 Q
CBLD S BHSP=^APCHSMPN(BHSPDF,1,BHSCOR,0) S BHSCT3=$G(^(1))
 S BHSCT=$P(BHSP,U,2),BHSCLN=$P(BHSP,U,3)
 S X=$P(BHSP,U,5) S:X]"" BHSNTS(X)=""
 S:BHSCT="" BHSCT=" " S BHSCT2=$S($D(^AUTTMSR(BHSCT,0)):$P(^(0),U,1),1:BHSCT)
 S:$P(BHSP,U,4)]"" BHSCT2=$P(BHSP,U,4)
 S:BHSCLN="" BHSCLN=10
 S BHSTSQ(BHSCOR,1)=BHSCT2,BHSTSQ(BHSCOR,2)=BHSCLN,BHSTSQ(BHSCOR,3)=BHSCT3
 I BHSPS1 S APCHSIVD="" F BHSQ=0:0 S APCHSIVD=$O(^AUPNVMSR("AA",BHSPAT,BHSCT,APCHSIVD)) Q:APCHSIVD=""!(APCHSIVD>GMTSDLM)  D CBLD2
 I 'BHSPS1 S APCHSIVD=$O(^AUPNVMSR("AA",BHSPAT,BHSCT,0)) I APCHSIVD,'$D(BHSTVL(APCHSIVD,BHSCOR)) D CBLD3
 Q
CBLD2 I '$D(BHSTVL(APCHSIVD)) S BHSND2=BHSND2-1 I BHSND2=-1 S BHSND2=0 Q:BHSDMX&(APCHSIVD'<BHSDMX)  K BHSTVL(BHSDMX) F BHSDM2=0:0 S BHSDM2=$O(BHSTVL(BHSDM2)) Q:'BHSDM2  S BHSDMX=BHSDM2
 S:APCHSIVD>BHSDMX BHSDMX=APCHSIVD
CBLD3 S BHSDFN="" F  S BHSDFN=$O(^AUPNVMSR("AA",BHSPAT,BHSCT,APCHSIVD,BHSDFN)) Q:BHSDFN=""  D
 . Q:$P($G(^AUPNVMSR(BHSDFN,2)),U,1)  ;entered in error
 . S BHSVAL=$P(^AUPNVMSR(BHSDFN,0),U,4),BHSEDAT=$P($G(^AUPNVMSR(BHSDFN,12)),U,1)
 .I BHSEDAT'="" S BHSEDAT=9999999-BHSEDAT
 .I BHSEDAT="" S BHSEDAT=APCHSIVD
 .S BHSTVL(BHSEDAT,BHSCOR)=BHSVAL_"^"_$P(^AUPNVMSR(BHSDFN,0),U,6)
 Q
 ; <DISPLAY>
POUT D CKP^GMTSUP Q:$D(GMTSQIT)  W !
 D CKP^GMTSUP Q:$D(GMTSQIT)  D PHDR
 S APCHSIVD="" F BHSQ=0:0 S APCHSIVD=$O(BHSTVL(APCHSIVD)) Q:APCHSIVD=""  D CKP^GMTSUP Q:$D(GMTSQIT)  D:GMTSNPG PHDR D PLINE
 I $O(BHSNTS(0))]"" W ! S X="" F  S X=$O(BHSNTS(X)) Q:X=""  W X,!
 Q
PHDR S BHST=16,BHSC=""
 F BHSQ=0:0 S BHSC=$O(BHSTSQ(BHSC)) Q:BHSC=""  S BHSMT=BHSTSQ(BHSC,1),BHSML=BHSTSQ(BHSC,2) W ?(BHST+1+(BHSML-$L(BHSMT)\2)),BHSMT S BHST=BHST+BHSML+2
 W !
 Q
PLINE S (BHSIDT,APCHSIDT)=APCHSIVD
 ;IHS/MSC/MGH changed to fix bug in date display
 ;S X=BHSIDT I BHSEDAT="" S X=-APCHSIVD\1+9999999
 S X=-APCHSIDT+9999999
 D REGDTM^GMTSU
 S BHSDAT=X
 W BHSDAT S BHST=18
 S BHSC="" F BHSQ=0:0 S BHSC=$O(BHSTSQ(BHSC)) Q:BHSC=""  D PVAL
 W !
 Q
PVAL ;
 K BHSVNM
 S BHSML=BHSTSQ(BHSC,2)
 S (BHSVAL,BHSVNM)="",BHSVAL=$P($G(BHSTVL(APCHSIVD,BHSC)),U) I $P($G(BHSTVL(APCHSIVD,BHSC)),U,2)]"" S BHSVNM=$P($G(BHSTVL(APCHSIVD,BHSC)),U,2)
 I BHSVAL]"" S X=BHSVAL X BHSTSQ(BHSC,3) S BHSVAL=$P(X,"^",1),X=$P(X,"^",2) S:X]"" BHSNTS(X)=""
 S:BHSVAL]"" BHSVAL=$S($P(BHSML,".",2)="":$J(BHSVAL,$P(BHSML,".",1)),1:$J(BHSVAL,$P(BHSML,".",1),$P(BHSML,".",2)))
 W ?BHST,BHSVAL S BHST=BHST+BHSML+2
 K BHSVNM
 Q