ORDV05 ; slc/jdl - OE/RR Report Extracts ;10/8/03 11:18
;;3.0;ORDER ENTRY/RESULTS REPORTING;**109,208**;Dec 17, 1997
;
MI(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Microbiology
;External references to ^DPT(DFN,"LR"),^LR(LRDFN, extract:GET^ORDV05E
;
I $L($T(GCPR^OMGCOAS1)) D ; Call if FHIE station 200
. N BEG,END,MAX
. Q:'$G(ORALPHA) Q:'$G(OROMEGA)
. S MAX=$S(+$G(ORMAX)>0:ORMAX,1:999)
. S BEG=9999999-ORALPHA,END=9999999-OROMEGA
. D GCPR^OMGCOAS1(DFN,"MI",BEG,END,MAX)
;
N MAX,GMTS1,GMTS2,ORSITE,SITE,GO,N1,S1,OREC,CNT
Q:'$L(OREXT)
S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
Q:'$L($T(@GO))
S GMTSNDM=$S(+$G(ORMAX)>0:ORMAX,1:999),GMTS2=ORALPHA,GMTS1=OROMEGA
S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
K ^TMP("ORDATA",$J)
I '$L($T(GCPR^OMGCOAS1)) D
. K ^TMP("ORM",$J),^TMP("OR7OGX",$J),^TMP("OR7OG",$J)
. D @GO
S N1=0,CNT=0
F S N1=$O(^TMP("ORM",$J,N1)) Q:'N1 S S1="" F S S1=$O(^TMP("ORM",$J,N1,S1)) Q:S1="" S OREC=^(S1) D
. S CNT=CNT+1,SITE=$S($L($G(^TMP("ORM",$J,N1,S1,"facility"))):^("facility"),1:ORSITE)
. S ^TMP("ORDATA",$J,CNT,"WP",1)="1^"_SITE ;Station ID
. S ^TMP("ORDATA",$J,CNT,"WP",2)="2^"_$P(OREC,U) ;Collect dt
. S ^TMP("ORDATA",$J,CNT,"WP",3)="3^"_$P(OREC,U,5) ;Test name
. S ^TMP("ORDATA",$J,CNT,"WP",4)="4^"_$P(OREC,U,3) ;Collection sample
. S ^TMP("ORDATA",$J,CNT,"WP",5)="5^"_$P(OREC,U,4) ;Specimen
. S ^TMP("ORDATA",$J,CNT,"WP",6)="6^"_$P(OREC,U,2) ;Accession
. D SPMRG^ORDVU($NA(^TMP("ORM",$J,N1,S1,"REPORT")),$NA(^TMP("ORDATA",$J,CNT,"WP",7)),7) ;report
. I $O(^TMP("ORM",$J,N1,S1,"REPORT",0)) S ^TMP("ORDATA",$J,CNT,"WP",8)="8^[+]" ;flag for detail
K ^TMP("ORM",$J),^TMP("OR7OGX",$J),^TMP("OR7OG",$J)
S ROOT=$NA(^TMP("ORDATA",$J))
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORDV05 1762 printed Dec 13, 2024@02:30:11 Page 2
ORDV05 ; slc/jdl - OE/RR Report Extracts ;10/8/03 11:18
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**109,208**;Dec 17, 1997
+2 ;
MI(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Microbiology
+1 ;External references to ^DPT(DFN,"LR"),^LR(LRDFN, extract:GET^ORDV05E
+2 ;
+3 ; Call if FHIE station 200
IF $LENGTH($TEXT(GCPR^OMGCOAS1))
Begin DoDot:1
+4 NEW BEG,END,MAX
+5 if '$GET(ORALPHA)
QUIT
if '$GET(OROMEGA)
QUIT
+6 SET MAX=$SELECT(+$GET(ORMAX)>0:ORMAX,1:999)
+7 SET BEG=9999999-ORALPHA
SET END=9999999-OROMEGA
+8 DO GCPR^OMGCOAS1(DFN,"MI",BEG,END,MAX)
End DoDot:1
+9 ;
+10 NEW MAX,GMTS1,GMTS2,ORSITE,SITE,GO,N1,S1,OREC,CNT
+11 if '$LENGTH(OREXT)
QUIT
+12 SET GO=$PIECE(OREXT,";")_"^"_$PIECE(OREXT,";",2)
+13 if '$LENGTH($TEXT(@GO))
QUIT
+14 SET GMTSNDM=$SELECT(+$GET(ORMAX)>0:ORMAX,1:999)
SET GMTS2=ORALPHA
SET GMTS1=OROMEGA
+15 SET ORSITE=$$SITE^VASITE
SET ORSITE=$PIECE(ORSITE,"^",2)_";"_$PIECE(ORSITE,"^",3)
+16 KILL ^TMP("ORDATA",$JOB)
+17 IF '$LENGTH($TEXT(GCPR^OMGCOAS1))
Begin DoDot:1
+18 KILL ^TMP("ORM",$JOB),^TMP("OR7OGX",$JOB),^TMP("OR7OG",$JOB)
+19 DO @GO
End DoDot:1
+20 SET N1=0
SET CNT=0
+21 FOR
SET N1=$ORDER(^TMP("ORM",$JOB,N1))
if 'N1
QUIT
SET S1=""
FOR
SET S1=$ORDER(^TMP("ORM",$JOB,N1,S1))
if S1=""
QUIT
SET OREC=^(S1)
Begin DoDot:1
+22 SET CNT=CNT+1
SET SITE=$SELECT($LENGTH($GET(^TMP("ORM",$JOB,N1,S1,"facility"))):^("facility"),1:ORSITE)
+23 ;Station ID
SET ^TMP("ORDATA",$JOB,CNT,"WP",1)="1^"_SITE
+24 ;Collect dt
SET ^TMP("ORDATA",$JOB,CNT,"WP",2)="2^"_$PIECE(OREC,U)
+25 ;Test name
SET ^TMP("ORDATA",$JOB,CNT,"WP",3)="3^"_$PIECE(OREC,U,5)
+26 ;Collection sample
SET ^TMP("ORDATA",$JOB,CNT,"WP",4)="4^"_$PIECE(OREC,U,3)
+27 ;Specimen
SET ^TMP("ORDATA",$JOB,CNT,"WP",5)="5^"_$PIECE(OREC,U,4)
+28 ;Accession
SET ^TMP("ORDATA",$JOB,CNT,"WP",6)="6^"_$PIECE(OREC,U,2)
+29 ;report
DO SPMRG^ORDVU($NAME(^TMP("ORM",$JOB,N1,S1,"REPORT")),$NAME(^TMP("ORDATA",$JOB,CNT,"WP",7)),7)
+30 ;flag for detail
IF $ORDER(^TMP("ORM",$JOB,N1,S1,"REPORT",0))
SET ^TMP("ORDATA",$JOB,CNT,"WP",8)="8^[+]"
End DoDot:1
+31 KILL ^TMP("ORM",$JOB),^TMP("OR7OGX",$JOB),^TMP("OR7OG",$JOB)
+32 SET ROOT=$NAME(^TMP("ORDATA",$JOB))
+33 QUIT