Index: FOIAVistA/tag/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAHLR.m
===================================================================
--- FOIAVistA/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAHLR.m	(revision 631)
+++ FOIAVistA/tag/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAHLR.m	(revision 636)
@@ -1,4 +1,4 @@
 RAHLR ;HISC/CAH/BNT - Generate Common Order (ORM) Message ;11/10/99  10:42
- ;;5.0;Radiology/Nuclear Medicine;**2,12,10,25,71,82,75,80,84**;Mar 16, 1998;Build 13
+ ;;5.0;Radiology/Nuclear Medicine;**2,12,10,25,71,82,75,80**;Mar 16, 1998;Build 19
  ;Generates msg whenever a case is registered or cancelled or examined
  ;              registered        cancelled        examined
@@ -6,15 +6,4 @@
  ; Order status  : IP                CA               CM
  ;02/14/2006 BAY/KAM RA*5*71 Add ability to update exam data to V/R
- ;
- ;Integration Agreements
- ;----------------------
- ;NOW^%DTC(10000); ^%ZTLOAD(10063); $$GET1^DIQ(2056); ^DIWP(10011)
- ;$$HLDATE/$$HLNAME/$$M11^HLFNC(10106); INIT^HLFNC2(2161)
- ;GENERATE^HLMA(2164); DEM^VADPT(10061); $$EN^VAFHLPID(263)
- ;$$FMTHL7^XLFDT(10103)
- ;
- ;IA: 10039 global read .01 field WARD LOCATION (#42) file ^DIC(42,
- ;IA: 10040 global read .01 field HOSPITAL LOCATION (#44) file ^SC(
- ;
  S:$D(HLNDAP) ZTSAVE("HLNDAP")="" S:$D(HLDAP) ZTSAVE("HLDAP")="" S:$D(RAEXMDUN) ZTSAVE("RAEXMDUN")=""
  S:$D(RAEXEDT) ZTSAVE("RAEXEDT")=""
@@ -36,7 +25,7 @@
  ;RAEXMDUN passed from EXM^RAHLRPC if conditions are met
  Q:+$G(HL)=15  ;no known client(item) linked to the event driver protocol
- Q:$O(HL(""))=""  ;disabled server appl, or no server appl 
+ Q:$O(HL(""))=""  ;disabled server appl, or no server appl
  ;** branch to new HL7 logic when the HL7 version surpasses 2.3 **
- I HL("VER")>2.3,($T(^RAHLR1))'="" D EN^RAHLR1(RADFN,RADTI,RACNI,RAEID) Q
+ ;I HL("VER")]2.3 D EN^RAHLR1(RADFN,RADTI,RACNI,RAEID) Q
  ;** branch to new HL7 logic when the HL7 version surpasses 2.3 **
  S RACN0=$S($D(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0)):^(0),1:"") Q:RACN0']""
@@ -47,5 +36,5 @@
  S RAPRCNDE=$G(^RAMIS(71,+RAPROC,0)),RACPT=+$P(RAPRCNDE,U,9),RACPTNDE=$$NAMCODE^RACPTMSC(RACPT,DT)
  ;RA*5*82 RAEXEDT= Override the EXM conditions if Case edited
- ;I $G(RAEXMDUN)=1,'$G(RAEXEDT),$P(RACN0,U,30)'="",'$G(RATELE) Q  ;last chance to stop exm'd msg if it's already been sent RA*5*84 Is TELERAD ?? 
+ I $G(RAEXMDUN)=1,'$G(RAEXEDT),$P(RACN0,U,30)'="" Q  ;last chance to stop exm'd msg if it's already been sent
  ;Compile 'PID' Segment
  K VA,VADM,VAERR,RAVADM S DFN=RADFN D DEM^VADPT I VADM(1)']"" S HLP("ERRTEXT")="Invalid Patient Identifier" G EXIT
@@ -73,8 +62,5 @@
  ; S RAOBR4=$P(RACPTNDE,U)_$E(HLECH)_$$ESCAPE^RAHLRU($P(RACPTNDE,U,2))_$E(HLECH)_"C4"_$E(HLECH)_+RAPROC_$E(HLECH)_$$ESCAPE^RAHLRU($P(RAPRCNDE,U))_$E(HLECH)_"99RAP"
  I $P(RACPTNDE,U)']"" S $P(RAOBR4,$E(HLECH),1,3)=$P(RAOBR4,$E(HLECH),4,5)_$E(HLECH)_"LOCAL"
- ;OBR-7 change: from HLDT1 to $$HLDATE^HLFNC(9999999.9999-RADTI) d/t of registration
- ;Driver of change: CareStream Health PACS. Agfa requires a timestamp down to the second
- ;POC @ Boston is Maureen Sullivan
- S HLA("HLS",3)="OBR"_HLFS_HLFS_RADTE_HLFS_RADTI_"-"_RACNI_$E(HLECH)_RADTE_$E(HLECH)_"L"_HLFS_RAOBR4_HLFS_HLFS_HLFS_$$HLDATE^HLFNC(9999999.9999-RADTI)
+ S HLA("HLS",3)="OBR"_HLFS_HLFS_RADTE_HLFS_RADTI_"-"_RACNI_$E(HLECH)_RADTE_$E(HLECH)_"L"_HLFS_RAOBR4_HLFS_HLFS_HLFS_HLDT1
  S HLA("HLS",3)=HLA("HLS",3)_HLFS_HLQ_HLFS_HLQ_HLFS_HLFS_HLFS_HLFS_HLFS_HLQ_HLFS_HLFS
  S RAPRV=$$GET1^DIQ(200,+$P(RACN0,"^",14),.01)
@@ -126,6 +112,5 @@
  N HLEID,HLARYTYP,HLFORMAT,HLMTIEN,HLP
  S HLEID=EID,HLARYTYP="LM",HLFORMAT=1,HLMTIEN="",HLP("PRIORITY")="I"
- D:$D(RASSSX(HLEID)) GETHLP^RAHLRS1(HLEID,.HLP,"RASSSX")
- D:$D(RASSSX1(HLEID)) GETHLP^RAHLRS1(HLEID,.HLP,"RASSSX1")
+ D:$D(RASSSX(HLEID)) GETHLP^RAHLRS1(HLEID,.HLP)
  D GENERATE^HLMA(HLEID,HLARYTYP,HLFORMAT,.HLRESLT,HLMTIEN,.HLP)
  Q
@@ -134,10 +119,9 @@
 INIT ; initialize HL7 variables
  D NOW^%DTC S HLDT=%,HLDT1=$$HLDATE^HLFNC(%)
- ;Note: HLDT1 is used for HL7 fields: ORC-9 & OBR-22
  Q:'$G(RAEID)  S EID=RAEID
  S HL="HLS(""HLS"")",INT=1
  D INIT^HLFNC2(EID,.HL,INT)
  Q:'$D(HL("Q"))  ;no server application defined
- S HLQ=HL("Q")
+ S HLQ=HL("Q"),HLFS=HL("FS")
  S HLECH=HL("ECH")
  S HLFS=HL("FS")
