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

LR7OGMC.m

Go to the documentation of this file.
  1. LR7OGMC ;VA/DALOI/STAFF- Interim report rpc memo chem ; 03-Jul-2014 07:41 ; MKK
  1. ;;5.2;LAB SERVICE;**1027,1028,1031,1033**;NOV 01, 1997;Build 146
  1. ;
  1. ;;VA LR Patche(s): 187,230,312,286,356,372,395
  1. ;
  1. ; sets lab data into ^TMP("LR7OG",$J,"TP"
  1. ; ^TMP("LR7OG",$J,"G")=dfn^pnm^lrdfn^age^sex^lrcw
  1. ; ^TMP("LR7OG",$J,"TMP",LR Subscript)=ifn of test from 60
  1. ; ^TMP("LR7OG",$J,"T",ifn 60)=^LAB(60,IFN,0)
  1. ; ^TMP("LR7OG",$J,"TP",collect date/time)=zero node from data
  1. ; ^TMP("LR7OG",$J,"TP",collect date/time,printorder)=test#^name^printname^^printcode^dataname^result^flag^units^range^performing site
  1. ; ^TMP("LR7OG",$J,"TP",collect date/time,printorder,#)=interpretation
  1. ; ^TMP("LR7OG",$J,"TP",collect date/time,"C",#)=comment
  1. ; ALL = 1 when coming from INTERIMG^LR7OGM (Most Recent)
  1. CH(LRDFN,IDT,ALL,OUTCNT,FORMAT,DONE,SKIP) ; from LR7OGM
  1. N CDT,CHSUB,CMNT,INTP,LABSUB,PNODE,PORDER,SPEC,TCNT,TESTNUM,TESTSUB,ZERO,ACC,NUM,AREA,ACDT,LRAAT,LRAD,UID,GOTNP
  1. S GOTNP=0,ZERO=$G(^LR(LRDFN,"CH",IDT,0)),UID=$P($G(^("ORU")),"^")
  1. I UID'="" S UID=$$CHECKUID^LRWU4(UID)
  1. S AREA=$P(UID,"^",2),ACDT=$P(UID,"^",3),NUM=$P(UID,"^",4),CDT=+ZERO,LABSUB="CH",TCNT=0,SPEC=$P(ZERO,U,5)
  1. D GETNP ;Check for NP comments
  1. I FORMAT,GOTNP S SKIP=1 Q
  1. I GOTNP,'$P(ZERO,"^",3) D Q
  1. . D ACC:UID
  1. . I $O(^TMP("LR7OG",$J,"TP",CDT,0)) K:FORMAT ^TMP("LR7OG",$J,"TP",CDT) D CHKNP Q
  1. D ACC:UID,VER
  1. I '$O(^TMP("LR7OG",$J,"TP",CDT,0)) S SKIP=1 Q
  1. I '$O(^LR(LRDFN,"CH",IDT,1)) D CHKNP
  1. I FORMAT D
  1. . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)="0^CH^"_(9999999-IDT)
  1. . S OUTCNT=OUTCNT+1,DONE=1
  1. I FORMAT,'GOTNP D GRID^LR7OGMG(.OUTCNT)
  1. ; I 'FORMAT D PRINT^LR7OGMP(.OUTCNT)
  1. I 'FORMAT D PRINT^BLR7OGMP(.OUTCNT) ; IHS/MSC/MKK - LR*5.2*1031 - Restore LR*5.2*1028 Modification
  1. K ^TMP("LR7OG",$J,"TP")
  1. Q
  1. ACC ;Check Accession
  1. N ANODE,X0,LRODT,LRSN,LROD0,LROD1,X,STATUS,LROS
  1. K ^TMP("LR7OG",$J,"ACC")
  1. I '$D(^LRO(68,+AREA,1,+ACDT,1,+NUM)) Q
  1. S X0=$G(^LRO(68,+AREA,1,+ACDT,1,+NUM,0)),LRODT=$P(X0,"^",4),LRSN=$P(X0,"^",5),LROD0=$G(^LRO(69,+LRODT,1,LRSN,0)),LROD1=$G(^(1))
  1. S TESTNUM=0 F S TESTNUM=$O(^LRO(68,+AREA,1,+ACDT,1,+NUM,4,TESTNUM)) Q:'TESTNUM S ANODE=^(TESTNUM,0) D
  1. . I $P(ANODE,"^",6)'="*Not Performed" Q:$P(ANODE,"^",5) ;complete date
  1. . I FORMAT,$P(ANODE,"^",6)="*Not Performed" Q ;Don't show NP'd results on Most Recent Report
  1. . I 'ALL,'$D(^TMP("LR7OG",$J,"T",TESTNUM)),'$D(TESTS(TESTNUM)) Q ;Selected test not in accession
  1. . I TESTNUM'=$P(ANODE,"^",9),$P($G(^LRO(68,+AREA,1,+ACDT,1,+NUM,4,+$P(ANODE,"^",9),0)),"^",5) Q ;complete date on parent
  1. . S ^TMP("LR7OG",$J,"ACC",TESTNUM)=ANODE
  1. I '$O(^TMP("LR7OG",$J,"ACC",0)) Q
  1. S TESTNUM=0 F S TESTNUM=$O(^TMP("LR7OG",$J,"ACC",TESTNUM)) Q:'TESTNUM S ANODE=^(TESTNUM) D
  1. . Q:'$D(^LAB(60,TESTNUM,.1)) S PNODE=^(.1) I '("BO"[$P($G(^(0)),U,3)) Q
  1. . S PORDER=$P(PNODE,U,6),PORDER=$S(PORDER:PORDER,1:1/1000000)
  1. . F Q:'$D(^TMP("LR7OG",$J,"TP",CDT,PORDER)) Q:TESTNUM=+^(PORDER) S PORDER=PORDER+1
  1. . I $D(^TMP("LR7OG",$J,"TP",CDT,PORDER)) Q
  1. . S LROS="Collected - Specimen In Lab"
  1. . I $L(LROD1) S X=$P(LROD1,U,4),LROS=$S(X="C":"Collected - Specimen In Lab",X="U":"Uncollected, cancelled",1:"On Collection List")
  1. . S STATUS=$S($P(ANODE,"^",6)="*Not Performed":"Test Not Performed",1:LROS)
  1. . S ^TMP("LR7OG",$J,"TP",CDT,PORDER)=TESTNUM_U_$P(^LAB(60,TESTNUM,0),U)_U_$P(PNODE,U)_U_$P(PNODE,U,2)_U_"X"_U_$P(^(0),U,5)_U_STATUS
  1. . S TCNT=TCNT+1
  1. K ^TMP("LR7OG",$J,"ACC")
  1. I TCNT S ^TMP("LR7OG",$J,"TP",CDT)=ZERO
  1. Q
  1. VER ;Check Verified Results
  1. Q:'$P(ZERO,U,3)
  1. 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
  1. I 'ALL S TESTSUB=1 F S TESTSUB=$O(^TMP("LR7OG",$J,"TMP",TESTSUB)) Q:TESTSUB<1 S TESTNUM=+^(TESTSUB) D CHSETUP
  1. I TCNT D
  1. . S ^TMP("LR7OG",$J,"TP",CDT)=ZERO,CMNT=0
  1. . F S CMNT=+$O(^LR(LRDFN,LABSUB,IDT,1,CMNT)) Q:CMNT<1 S ^TMP("LR7OG",$J,"TP",CDT,"C",CMNT)=^(CMNT,0) S TCNT=TCNT+1
  1. Q
  1. CHSETUP ; within scope of CH
  1. N LRX
  1. I 'TESTNUM Q
  1. Q:'$D(^LAB(60,TESTNUM,.1)) S PNODE=^(.1) I '("BO"[$P($G(^(0)),U,3)) Q
  1. ;Q:'$D(^LR(LRDFN,LABSUB,IDT,TESTSUB)) Q:'$L($P(^(TESTSUB),U))
  1. Q:'$D(^LR(LRDFN,LABSUB,IDT,TESTSUB)) Q:'$L($P($G(^(TESTSUB)),U)) ; IHS/MSC/MKK - LR*5.2*1033
  1. S PORDER=$P(PNODE,U,6),PORDER=$S(PORDER:PORDER,1:TESTSUB/1000000)
  1. F Q:'$D(^TMP("LR7OG",$J,"TP",CDT,PORDER)) Q:TESTNUM=+^(PORDER) S PORDER=PORDER+1
  1. I $D(^TMP("LR7OG",$J,"TP",CDT,PORDER)) Q
  1. S LRX=$$TSTRES^LRRPU(LRDFN,LABSUB,IDT,TESTSUB,TESTNUM)
  1. S ^TMP("LR7OG",$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(LRX,U)_U_$P(LRX,U,2)_U_$P(LRX,U,5)_U_$$EN^LRLRRVF($P(LRX,U,3),$P(LRX,U,4))_U_$P(LRX,U,6)
  1. ; Save performing lab ien in list
  1. ; I $P(LRX,U,6) S ^TMP("LRPLS",$J,$P(LRX,U,6))=""
  1. I $P(LRX,U,6) S ^TMP("LRPLS",$J,$P(LRX,U,6))=$P($G(^LR(LRDFN,"CH",IDT,"RF")),"^",2,3) ; IHS/MSC/MKK - LR*5.2*1033
  1. S TCNT=TCNT+1
  1. I $D(^LAB(60,TESTNUM,1,SPEC,1,0)) D
  1. . S INTP=0
  1. . F S INTP=+$O(^LAB(60,TESTNUM,1,SPEC,1,INTP)) Q:INTP<1 D
  1. .. S ^TMP("LR7OG",$J,"TP",CDT,PORDER,INTP)=^(INTP,0)
  1. .. S TCNT=TCNT+1
  1. Q
  1. CMT ; Retrieve specimen comments
  1. S ^TMP("LR7OG",$J,"TP",CDT)=ZERO,CMNT=0
  1. F S CMNT=+$O(^LR(LRDFN,LABSUB,IDT,1,CMNT)) Q:CMNT<1 S ^TMP("LR7OG",$J,"TP",CDT,"C",CMNT)=^(CMNT,0) S TCNT=TCNT+1
  1. Q
  1. CHKNP ; Check for NP comments and no verified results.
  1. N LRCAN,X
  1. S LRCAN=0
  1. F S LRCAN=+$O(^LR(LRDFN,"CH",IDT,1,LRCAN)) Q:LRCAN<1 S X=^(LRCAN,0) Q:(($E(X)="*")&(X["Not Performed:"))
  1. ; Print if cancel comment and no unverified results.
  1. I LRCAN<1 Q
  1. D CMT
  1. ; I 'FORMAT D PRINT^LR7OGMP(.OUTCNT)
  1. I 'FORMAT D PRINT^BLR7OGMP(.OUTCNT) ; IHS/MSC/MKK - LR*5.2*1031
  1. K ^TMP("LR7OG",$J,"TP")
  1. Q
  1. GETNP ;Set NP flag (Not Performed)
  1. N LRCAN,X
  1. S LRCAN=0
  1. F S LRCAN=+$O(^LR(LRDFN,"CH",IDT,1,LRCAN)) Q:LRCAN<1 S X=^(LRCAN,0) Q:(($E(X)="*")&(X["Not Performed:"))
  1. Q:LRCAN<1
  1. I $G(FORMAT) Q:$O(^LR(LRDFN,"CH",IDT,1))
  1. S GOTNP=1
  1. Q