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

BRAPRAD.m

Go to the documentation of this file.
  1. BRAPRAD ;CIA/PLS,IHS/ITSC/CLS - Radiology Protocol Event API ; 28 Apr 2014 4:26 PM
  1. ;;5.0;Radiology/Nuclear Medicine;**1001,1003,1006**;Nov 01, 2010;Build 2
  1. ;
  1. HOOK ;
  1. ;S $ZE="RAD PCC TEST" D ^ZTER ;IHS/ITSC/CLS testing
  1. N SEG,LP,DL1,DL2,RAPCC,ACTION,ORDSTS
  1. ; Get SEND PCC AT EXAMINED field
  1. S RAPCC=+$G(^RA(79,+$G(RAMDIV),9999999))
  1. S LP=0
  1. S SEG=$$SEG("MSH",.LP)
  1. Q:'LP
  1. S DL1=$E(SEG,4),DL2=$E(SEG,5)
  1. Q:$P(SEG,DL1,3)'="RADIOLOGY"
  1. S SEG=$$SEG("ORC",.LP)
  1. Q:'LP
  1. S ORDSTS=$P(SEG,DL1,6) ; Order Status
  1. S ACTION=$P(SEG,DL1,2) ; Order Control
  1. I ACTION?2U,$L($T(@ACTION)) D @ACTION
  1. Q
  1. ;
  1. ;
  1. ; Return specified segment, starting at line LP
  1. SEG(TYP,LP) ;
  1. F S LP=$O(RAMSG(LP)) Q:'LP Q:$E(RAMSG(LP),1,$L(TYP))=TYP
  1. Q $S(LP:RAMSG(LP),1:"")
  1. ;
  1. ;
  1. SN ; New Order (doesn't create visit - "PCC" node absent)
  1. Q
  1. ;
  1. ;
  1. SC ; Status Change (scheduled, registered, or unverified)
  1. ; Status Change (registered - ORSTS="ZR", ACTION="SC")
  1. ; Status Change (examined - ORSTS="", ACTION="SC")
  1. ; Status Change (unverified - ORSTS=ZU, ACTION="SC")
  1. ;
  1. ;Released report was unverified
  1. I ORDSTS="ZU" D
  1. .D UPDTIMP^BRAPCC($G(RADFN),$G(RADTI))
  1. .D UPDATE^BRAWH($G(RADFN),$G(RADTI),$G(RACNI))
  1. ;
  1. ;
  1. ;Don't create visit for registered
  1. ;Do create visit if examined and 'Send PCC at Examined' is YES
  1. I ORDSTS="" D
  1. .I RAPCC D
  1. ..D CREATE^BRAPCC
  1. ..D CREATE^BRAWH($G(RADFN),$G(RADTI),$G(RACNI))
  1. Q
  1. ;
  1. ;
  1. OH ; Exam on Hold, not even registered yet so no action necessary
  1. Q
  1. ;
  1. ;
  1. OD ; Delete Exam and request
  1. I RAPCC D
  1. .D DELETE^BRAPCC
  1. .D UPDATE^BRAWH($G(RADFN),$G(RADTI),$G(RACNI))
  1. Q
  1. ;
  1. ;
  1. OC ; Cancelled
  1. DC ; Discontinued
  1. D DELETE^BRAPCC
  1. D UPDATE^BRAWH($G(RADFN),$G(RADTI),$G(RACNI))
  1. Q
  1. ;
  1. ;
  1. RE ; Report verification
  1. ;
  1. I +$G(RADFN)=0 Q
  1. I +$G(RADTI)=0 Q
  1. I +$G(RACNI)=0 Q
  1. ;
  1. ;We have a verified report and 'Send PCC at Examined' is NO,
  1. ;then create the PCC Visit and create the Women's Health entry
  1. I $P($G(RA74("0")),U,5)="V",'RAPCC D Q
  1. .D CREATE^BRAPCC
  1. .D CREATE^BRAWH($G(RADFN),$G(RADTI),$G(RACNI))
  1. ;
  1. ;We have a verified report and 'Send PCC at Examined' is YES,
  1. ;but no PCC visit has been created,
  1. ;then create the PCC Visit and create the Women's Health entry
  1. I $P($G(RA74("0")),U,5)="V",RAPCC D Q
  1. .I +$P($G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"PCC")),U,3) Q
  1. .D CREATE^BRAPCC
  1. .D CREATE^BRAWH($G(RADFN),$G(RADTI),$G(RACNI))
  1. ;
  1. ;We have a verified report and 'Send PCC at Examined' is YES,
  1. ;and we have a PCC visit already created,
  1. ;then update the V Rad entry and update the Women's Health entry
  1. I $P($G(RA74("0")),U,5)="V",RAPCC D Q
  1. .I +$P($G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"PCC")),U,3)=0 Q
  1. .D UPDTIMP^BRAPCC($G(RADFN),$G(RADTI))
  1. .D UPDTDX^BRAWH($G(RADFN),$G(RADTI),$G(RACNI))
  1. ;
  1. ;Create visit and V RAD if exam status override to complete
  1. ;and No PCC Visit exists
  1. I $P(^RA(72,$P(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0),U,3),0),U)["COMPLETE" D Q
  1. .I +$P($G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"PCC")),U,3) Q
  1. .D CREATE^BRAPCC
  1. .D CREATE^BRAWH($G(RADFN),$G(RADTI),$G(RACNI))
  1. ;
  1. ;Update visit and V Rad if exam status override to complete,
  1. ;and a PCC Visit exists
  1. I $P(^RA(72,$P(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0),U,3),0),U)["COMPLETE" D Q
  1. .I +$P($G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"PCC")),U,3)=0 Q
  1. .D UPDTIMP^BRAPCC($G(RADFN),$G(RADTI))
  1. .D UPDTDX^BRAWH($G(RADFN),$G(RADTI),$G(RACNI))
  1. ;
  1. Q