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

BPC7OGMC.m

Go to the documentation of this file.
BPC7OGMC ; IHS/OIT/MJL - Interim report rpc memo chem 5/20/97 19:03 ;
 ;;1.5;BPC;;MAY 26, 2005
 ;;
 ;;5.2;LAB SERVICE;**187**;Sep 27, 1994
 ;
 ; sets lab data into ^TMP("BPC7OG",$J,"TP"
 ; ^TMP("BPC7OG",$J,"G")=dfn^pnm^lrdfn^age^sex^lrcw
 ; ^TMP("BPC7OG",$J,"TMP",test subscript in data)=zero node of test
 ; ^TMP("BPC7OG",$J,"TP",collect date/time)=zero node from data
 ; ^TMP("BPC7OG",$J,"TP",collect date/time,printorder)=test#^name^printname^^printcode^dataname^result^flag
 ; ^TMP("BPC7OG",$J,"TP",collect date/time,printorder,#)=interpretation
 ; ^TMP("BPC7OG",$J,"TP",collect date/time,"C",#)=comment
 ;
CH(LRDFN,IDT,ALL,OUTCNT,FORMAT,DONE) ; EP from LR7OGM
 N CDT,CHSUB,CMNT,INTP,LABSUB,PNODE,PORDER,SPEC,TCNT,TESTNUM,TESTSUB,ZERO
 S ZERO=^LR(LRDFN,"CH",IDT,0)
 I '$P(ZERO,U,3) Q
 S CDT=+ZERO,LABSUB="CH",TCNT=0,SPEC=$P(ZERO,U,5)
 S CHSUB=1 F  S CHSUB=$O(^LR(LRDFN,"CH",IDT,CHSUB)) Q:CHSUB=""  I ALL!$D(^TMP("BPC7OG",$J,"TMP",CHSUB)) D  Q
 .I FORMAT D
 ..S ^TMP("BPC7OGX",$J,"OUTPUT",OUTCNT)="^CH^"_(9999999-IDT)
 ..S OUTCNT=OUTCNT+1
 ..S DONE=1
 .K ^TMP("BPC7OG",$J,"TP")
 .I ALL S TESTSUB=1 F  S TESTSUB=$O(^LR(LRDFN,"CH",IDT,TESTSUB)) Q:TESTSUB<1  S TESTNUM=$O(^LAB(60,"C","CH;"_TESTSUB_";1",0)) D CHSETUP
 .E  S TESTSUB=1 F  S TESTSUB=$O(^TMP("BPC7OG",$J,"TMP",TESTSUB)) Q:TESTSUB<1  S TESTNUM=+^(TESTSUB) D CHSETUP
 .I TCNT D
 ..S ^TMP("BPC7OG",$J,"TP",CDT)=ZERO
 ..S CMNT=0 F  S CMNT=+$O(^LR(LRDFN,LABSUB,IDT,1,CMNT)) Q:CMNT<1  S ^TMP("BPC7OG",$J,"TP",CDT,"C",CMNT)=^(CMNT,0) S TCNT=TCNT+1
 .I FORMAT D GRID^BPC7OGMG(.OUTCNT)
 .I 'FORMAT D PRINT^BPC7OGMP(.OUTCNT)
 .K ^TMP("BPC7OG",$J,"TP")
 Q
 ;
CHSETUP ; within scope of CH
 I 'TESTNUM Q
 Q:'$D(^LAB(60,TESTNUM,.1))  S PNODE=^(.1)
 Q:'$D(^LR(LRDFN,LABSUB,IDT,TESTSUB))  Q:'$L($P(^(TESTSUB),U))
 S PORDER=$P(PNODE,U,6),PORDER=$S(PORDER:PORDER,1:TESTSUB/1000000)
 F  Q:'$D(^TMP("BPC7OG",$J,"TP",CDT,PORDER))  Q:TESTNUM=+^(PORDER)  S PORDER=PORDER+1
 I $D(^TMP("BPC7OG",$J,"TP",CDT,PORDER)) Q
 S ^TMP("BPC7OG",$J,"TP",CDT,PORDER)=TESTNUM_U_$P(^LAB(60,TESTNUM,0),U)_U_$P(PNODE,U)_U_$P(PNODE,U,2)_U_$P(PNODE,U,3)_U_$P(^(0),U,5)_U_$P(^LR(LRDFN,LABSUB,IDT,TESTSUB),U)_U_$P(^(TESTSUB),U,2)
 S TCNT=TCNT+1
 I $D(^LAB(60,TESTNUM,1,SPEC,1,0)) D
 .S INTP=0 F  S INTP=+$O(^LAB(60,TESTNUM,1,SPEC,1,INTP)) Q:INTP<1  S ^TMP("BPC7OG",$J,"TP",CDT,PORDER,INTP)=^(INTP,0) S TCNT=TCNT+1
 Q