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

BPC7OGMG.m

Go to the documentation of this file.
BPC7OGMG ; IHS/OIT/MJL - Interim report rpc memo grid 5/22/97 14:23 ;
 ;;1.5;BPC;;MAY 26, 2005
 ;;
 ;;5.2;LAB SERVICE;**187**;Sep 27, 1994
 ;
GRID(OUTCNT) ;EP from BPC7OGMC
 N ACC,AGE,CDT,CMNT,DATA,DOC,FLAG,IDT,INTP,LINE,LRCW,PORDER,PRNTCODE,RANGE,SEX,SPEC,SUB,TCNT,TESTNAME,TESTNUM
 N UNITS,VALUE,X,ZERO
 ; the variables AGE, SEX, LRCW, and X are used withing the lab's print codes and ref ranges
 S AGE=$P(^TMP("BPC7OG",$J,"G"),U,4),SEX=$P(^("G"),U,5),LRCW=$P(^("G"),U,6)
 S CDT=+$O(^TMP("BPC7OG",$J,"TP",0)) Q:'CDT
 S IDT=9999999-CDT
 S ZERO=$S($D(^TMP("BPC7OG",$J,"TP",CDT))#2:^(CDT),1:"")
 I '$P(ZERO,U,3) Q
 S SPEC=+$P(ZERO,U,5)
 S DOC=$$NAME^BPC7OGMP(+$P(ZERO,U,10))
 S ACC=$P(ZERO,U,6)
 S $P(^TMP("BPC7OGX",$J,"OUTPUT",1),U,4,6)=SPEC_U_$P($G(^LAB(61,SPEC,0)),U)_U_ACC_U_DOC
 S TCNT=0
 S PORDER=0 F  S PORDER=$O(^TMP("BPC7OG",$J,"TP",CDT,PORDER)) Q:PORDER'>0  S DATA=^(PORDER) D
 .I $P(DATA,U,7)="" Q
 .S TCNT=TCNT+1
 .S TESTNUM=+DATA,TESTNAME=$P(DATA,U,2),PRNTCODE=$P(DATA,U,5),SUB=$P(DATA,U,6),FLAG=$P(DATA,U,8),X=$P(DATA,U,7)
 .I PRNTCODE="" S VALUE=$J(X,8)
 .E  S @("VALUE="_PRNTCODE)
 .D URANGE^BPC7OGU(TESTNUM,SPEC,AGE,SEX,.UNITS,.RANGE)
 .I '$L(UNITS)!'$L(RANGE) D  Q
 ..S ^TMP("BPC7OGX",$J,"OUTPUT",OUTCNT)=TESTNUM_U_TESTNAME_U_VALUE_U_FLAG
 ..S OUTCNT=OUTCNT+1
 .S ^TMP("BPC7OGX",$J,"OUTPUT",OUTCNT)=TESTNUM_U_TESTNAME_U_VALUE_U_FLAG_U_UNITS_U_RANGE
 .S OUTCNT=OUTCNT+1
 S $P(^TMP("BPC7OGX",$J,"OUTPUT",1),U)=TCNT
 S PORDER=0 F  S PORDER=$O(^TMP("BPC7OG",$J,"TP",CDT,PORDER)) Q:PORDER'>0  S DATA=^(PORDER) D
 .I $O(^TMP("BPC7OG",$J,"TP",CDT,PORDER,0))>0 D
 ..S TESTNAME=$P(DATA,U,3)
 ..S INTP=0 F  S INTP=+$O(^TMP("BPC7OG",$J,"TP",CDT,PORDER,INTP)) Q:INTP<1  S LINE=TESTNAME_" Eval: "_^(INTP) D
 ...S ^TMP("BPC7OGX",$J,"OUTPUT",OUTCNT)=LINE
 ...S OUTCNT=OUTCNT+1
 I $D(^TMP("BPC7OG",$J,"TP",CDT,"C")) D
 .S ^TMP("BPC7OGX",$J,"OUTPUT",OUTCNT)="Comment: "
 .S OUTCNT=OUTCNT+1
 .S CMNT=0 F  S CMNT=+$O(^TMP("BPC7OG",$J,"TP",CDT,"C",CMNT)) Q:CMNT<1  S LINE=^(CMNT) D
 ..S ^TMP("BPC7OGX",$J,"OUTPUT",OUTCNT)="   "_LINE
 ..S OUTCNT=OUTCNT+1
 Q