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

BHSLAB.m

Go to the documentation of this file.
BHSLAB ;IHS/CIA/MGH - Health Summary for V lab file ;14-Aug-2009 12:55;MGH
 ;;1.0;HEALTH SUMMARY COMPONENTS;**2,3**;March 17, 2006
 ;===================================================================
 ;VA Health Summary for IHS V lab file
 ;Take from APCHS3
 ; IHS/TUCSON/LAB - PART 3 OF APCHS -- SUMMARY PRODUCTION COMPONENTS
 ;;2.0;IHS RPMS/PCC Health Summary;;JUN 24, 1997
 ;Patch 3 added result date
LAB ; ******************** LAB DATA * 9000010.09 *******
 N BHSPAT,BHSQ,X
 S BHSPAT=DFN,BHSELX=""
 I '$D(^AUPNVLAB("AE",BHSPAT)) D EKGLAB^BHSLAB1 S BHST="LAB",BHSFN=60 D DISPREF^BHSRAD G LABX
 D CKP^GMTSUP Q:$D(GMTSQIT)
 ; <SETUP>
 K ^TMP($J,"BHSLRT"),^("BHSLDT"),^("BHSLD2")
 ; <PROCESS>
 D LBLD,LPRT
 W ! D EKGLAB^BHSLAB1
 ; <CLEANUP>
 ;Patch 2, lab refusals
 S BHST="LAB",BHSFN=60 D DISPREF^BHSRAD
LABX K BHSLT,BHSLR,BHSLTX,BHSDFN,BHSNDT,BHSLRT,BHSLDT,BHST,BHSFN,BHSLD2,BHSNA,BHSIVD,BHSDTL,BHSI,BHSJ,BHSL,BHSLL,BHSDSN,BHSIDN,BHSNMX,BHSLW,BHSMXL,BHSLTO,BHSLTN,BHSELX,Y
 K ^TMP($J,"BHSLRT"),^("BHSLDT"),^("BHSLD2")
 Q
 ; <BUILD>
LBLD K BHSLRT,BHSLDT,BHSLD2
 S (BHSNDT,BHSMXL,BHSLTN)=0
 S BHSIVD="" F BHSQ=0:0 S BHSIVD=$O(^AUPNVLAB("AE",BHSPAT,BHSIVD)) Q:'BHSIVD!(BHSIVD>GMTSDLM)  D
 .D LDATE S:$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