| 1 | RAO7UTL1 ;HISC/GJC,FPT-Utilities for HL7 messages. ;9/14/98 08:00
|
---|
| 2 | ;;5.0;Radiology/Nuclear Medicine;**2,76**;Mar 16, 1998;Build 4
|
---|
| 3 | BRKOUT ; Breakout the 'MSH', 'ORC' & 'PID' segments.
|
---|
| 4 | ; Called from: RAO7RON & RAO7RCH
|
---|
| 5 | N RADATA,RAHEAD,RASEG,X S X=0
|
---|
| 6 | F S X=$O(RAMSG(X)) Q:X'>0 D
|
---|
| 7 | . S RASEG=$G(RAMSG(X)),RAHEAD=$P(RASEG,RAHLFS)
|
---|
| 8 | . Q:RAHEAD'="PID"&(RAHEAD'="ORC")&(RAHEAD'="MSH")
|
---|
| 9 | . S RADATA=$P(RASEG,RAHLFS,2,999)
|
---|
| 10 | . S:RAHEAD="MSH" RAMSH3=$P(RADATA,RAHLFS,3)
|
---|
| 11 | . S:RAHEAD="ORC" RAORC2=$P(RADATA,RAHLFS,2),RAORC3=$P(RADATA,RAHLFS,3)
|
---|
| 12 | . S:RAHEAD="PID" RAPID3=$P(RADATA,RAHLFS,3),RAPID5=$P(RADATA,RAHLFS,5)
|
---|
| 13 | . Q
|
---|
| 14 | S RADIV(.119)=$P($G(^RA(79,RAMSH3,.1)),U,19)
|
---|
| 15 | S:RADIV(.119)="" RADIV(.119)="n"
|
---|
| 16 | Q
|
---|
| 17 | ABNOR(RAOIFN,RADFN,RADTI) ; test code to find 'Diagnostic Code' for
|
---|
| 18 | ; descendents and adopted procedures. Called from RAO7CMP.
|
---|
| 19 | ; 'RAOIFN'-> ien of file 75.1
|
---|
| 20 | ; 'RADFN' -> ien of the Rad/Nuc Med Patient
|
---|
| 21 | ; 'RADTI' -> inverse date of the registered exam
|
---|
| 22 | Q:'($D(^RADPT("AO",RAOIFN,RADFN,RADTI))\10) ""
|
---|
| 23 | N RABN,RACNI,RAXAM S RABN="",RACNI=0
|
---|
| 24 | F S RACNI=$O(^RADPT("AO",RAOIFN,RADFN,RADTI,RACNI)) Q:RACNI'>0 D Q:RABN]""
|
---|
| 25 | . S RAXAM(0)=$G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0))
|
---|
| 26 | . Q:'$P(RAXAM(0),"^",25) ; Quit if not part of the set.
|
---|
| 27 | . S RABN=$$DIAG^RAO7UTL(RADFN,RADTI,RACNI)
|
---|
| 28 | . Q
|
---|
| 29 | Q RABN
|
---|
| 30 | ;
|
---|
| 31 | XAMDT(RADFN) ;Return exam date/time for interpreted non-cancelled case. The
|
---|
| 32 | ;'Cancelled' EXAMINATION STATUS record has an order number of zero.
|
---|
| 33 | ;IA#: 4875 Private w/MPI
|
---|
| 34 | ; input: RADFN=The DFN of the patient
|
---|
| 35 | ;return: RAXAMDT=The exam date/time (FM internal) of the most recent
|
---|
| 36 | ; non-cancelled interpreted case, else "0^an active exam
|
---|
| 37 | ; with interpretation was not found for this patient"
|
---|
| 38 | N RAXAMDT S RAXAMDT="0^an active exam with interpretation was not found for this patient"
|
---|
| 39 | S RADTI=0 F S RADTI=$O(^RADPT(RADFN,"DT",RADTI)) Q:'RADTI D Q:RAXAMDT
|
---|
| 40 | .S RACNI=0
|
---|
| 41 | .F S RACNI=$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI)) Q:'RACNI D Q:RAXAMDT
|
---|
| 42 | ..S RAX=$G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0)) Q:$P(RAX,U,17)="" ;no rpt
|
---|
| 43 | ..Q:$P($G(^RA(72,+$P(RAX,U,3),0)),U,3)=0 ;cancelled case
|
---|
| 44 | ..S RAXAMDT=(9999999.9999-RADTI)
|
---|
| 45 | ..Q
|
---|
| 46 | .Q
|
---|
| 47 | K RACNI,RADTI,RAX
|
---|
| 48 | Q RAXAMDT
|
---|
| 49 | ;
|
---|