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

RASETU.m

Go to the documentation of this file.
  1. RASETU ;HISC/DAD-Determine Order Status for an Exam Set ;11 Apr 2018 12:07 PM
  1. ;;5.0;Radiology/Nuclear Medicine;**15,124**;Mar 16, 1998;Build 4
  1. ;
  1. ;Routine reads through all cases generated from a single order
  1. ;to gather information about the case statuses needed to determine
  1. ;what status the order should be updated to
  1. ;Input: RADFN=Patient ien <-> RAOIFN=order IEN
  1. ;Output: RASTATUS array with status info about exam set passed back
  1. ; format: min status_"^"_max status_"^"_$S(All_Statuses=0:1,1:0)
  1. EN1(RAOIFN,RADFN) ;
  1. Q:'($D(^RADPT("AO",RAOIFN,RADFN))\10) "^^"
  1. ; save current RACNI so we'd know which exam to skip
  1. ; in the loop below if Exam Deletion is being processed, because
  1. ; 1. the exam node hasn't been killed off yet,
  1. ; 2. the exam node may have a non-cancelled exam status,
  1. ; which would throw off the loop calculation below
  1. ;
  1. ; if called from the RA CANCEL option skip the exam
  1. ; we intend to cancel b/c at this time it does not
  1. ; have a exam status value of cancelled. The exam
  1. ; will be updated to a cancelled exam status just
  1. ; before the option has completed (patch 124)
  1. ;
  1. ;
  1. N RACNISAV S RACNISAV=$G(RACNI)
  1. ;
  1. N RACNI,RADTI,RAORDER,RAPROC,RASTATUS
  1. S RAORDER=$G(^RAO(75.1,RAOIFN,0))
  1. I RAORDER="" Q "^^"
  1. S RAPROC=+$P(RAORDER,U,2) ; Procedure IEN
  1. S RASTATUS("ORD")=$P(RAORDER,U,5) ; Initial status
  1. S RASTATUS("MAX")=-1 ; Largest status found
  1. S RASTATUS("MIN")=10 ; Smallest non-zero status found
  1. S RASTATUS("NUL")=1 ; $S(All_Statuses=0:1,1:0)
  1. ;
  1. S RADTI=0
  1. F S RADTI=$O(^RADPT("AO",RAOIFN,RADFN,RADTI)) Q:RADTI'>0 D
  1. . S RACNI=0
  1. . F S RACNI=$O(^RADPT("AO",RAOIFN,RADFN,RADTI,RACNI)) Q:RACNI'>0 D
  1. .. I $D(RADELFLG),RACNISAV=RACNI Q ;skip if Exam Deletion
  1. .. ;the variable RACAN124 is set in the ENTRY ACTION field of the [RA
  1. .. ;CANCEL] record in the OPTION file (killed in EXIT ACTION field)
  1. .. I $D(RACAN124),RACNISAV=RACNI Q ;p124
  1. .. S RASTATUS=+$P($G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0)),U,3)
  1. .. S RASTATUS(0)=$P($G(^RA(72,RASTATUS,0)),U,3) Q:RASTATUS(0)=""
  1. .. I RASTATUS(0)>RASTATUS("MAX") S RASTATUS("MAX")=RASTATUS(0)
  1. .. I (RASTATUS(0)),(RASTATUS(0)<RASTATUS("MIN")) D
  1. ... S RASTATUS("MIN")=RASTATUS(0)
  1. ... Q
  1. .. I RASTATUS(0)>0 S RASTATUS("NUL")=0
  1. .. Q
  1. . Q
  1. Q RASTATUS("MIN")_"^"_RASTATUS("MAX")_"^"_RASTATUS("NUL")
  1. ;
  1. PARNT(RAOIFN,RADFN) ; Based on the patient and the order number, determine
  1. ; if the exams are part of an exam set.
  1. ; Input: 'RAOIFN' -> Order # 'RADFN' -> Patient ien
  1. ; Output: $S(Exam Set:1,1:0)
  1. ;
  1. Q:'($D(^RADPT("AO",RAOIFN,RADFN))\10) 0
  1. N RADTI,RARXM
  1. S RADTI=+$O(^RADPT("AO",RAOIFN,RADFN,0)) Q:'RADTI 0
  1. S RARXM(0)=$G(^RADPT(RADFN,"DT",RADTI,0))
  1. Q +$P(RARXM(0),"^",5)