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

RAHLBKVR.m

Go to the documentation of this file.
  1. RAHLBKVR ;HIRMFO/GJC-Bridge, Kurzweil compatible to HL7 v1.5 ;12/31/97 12:05
  1. ;;5.0;Radiology/Nuclear Medicine;;Mar 16, 1998
  1. EN1 ; Build the ^TMP("RARPT-REC" global when we
  1. ; receive the message from HL7.
  1. ; HLDA-ien of the record in ^HL(772, should be defined.
  1. K ^TMP("RARPT-REC",$J) S RASUB=HLDA
  1. I '$G(HLDUZ) S RAERR="Invalid Access Code" D XIT Q
  1. S ^TMP("RARPT-REC",$J,RASUB,"RADATE")=$$DT^XLFDT()
  1. S ^TMP("RARPT-REC",$J,RASUB,"VENDOR")="KURZWEIL"
  1. ;If OBR-32 exists use it as verifying phys even if HLDUZ has resident
  1. ; or staff classif
  1. S CNT=2,SEGMNT=$G(^HL(772,RASUB,"IN",CNT,0))
  1. PID ; Pick data off the 'PID' segment.
  1. I $P(SEGMNT,HLFS)="PID" D
  1. . S SEGMNT=$P(SEGMNT,HLFS,2,99999)
  1. . I $P($P(SEGMNT,HLFS,3),$E(HLECH))]"" D
  1. .. S ^TMP("RARPT-REC",$J,RASUB,"RADFN")=$P($P(SEGMNT,HLFS,3),$E(HLECH))
  1. .. Q
  1. . I $P(SEGMNT,HLFS,19)]"" D
  1. .. S ^TMP("RARPT-REC",$J,RASUB,"RASSN")=$P(SEGMNT,HLFS,19)
  1. .. Q
  1. . Q
  1. E S RAERR="Missing PID segment" D XIT Q
  1. ; Save off E-Sig information (if it exists)
  1. S:$D(HLESIG) ^TMP("RARPT-REC",$J,RASUB,"RAESIG")=HLESIG
  1. ;
  1. OBR ; Pick data off the 'OBR' segment.
  1. K SEGMNT F S CNT=$O(^HL(772,RASUB,"IN",CNT)) Q:CNT="" S SEGMNT=$G(^(CNT,0)) Q:$P(SEGMNT,HLFS)="OBR" ; find the 'OBR' segment
  1. I $P($G(SEGMNT),HLFS)'="OBR" S RAERR="Missing OBR segment" D XIT Q
  1. S SEGMNT=$P(SEGMNT,HLFS,2,99999)
  1. I $P(SEGMNT,HLFS,4)]"" D
  1. . N RADTCN S RADTCN=$P(SEGMNT,HLFS,4)
  1. . S:$P($P(RADTCN,$E(HLECH)),"-")]"" ^TMP("RARPT-REC",$J,RASUB,"RADTI")=$P($P(RADTCN,$E(HLECH)),"-")
  1. . S:$P($P(RADTCN,$E(HLECH)),"-",2)]"" ^TMP("RARPT-REC",$J,RASUB,"RACNI")=$P($P(RADTCN,$E(HLECH)),"-",2)
  1. . S:$P(RADTCN,$E(HLECH),2)]"" ^TMP("RARPT-REC",$J,RASUB,"RALONGCN")=$P(RADTCN,$E(HLECH),2)
  1. . Q
  1. ; note: must use $D on hlesig, as it's alphanumeric
  1. S ^TMP("RARPT-REC",$J,RASUB,"RASTAT")=$S($D(HLESIG):"V",1:"P")
  1. I $P(SEGMNT,HLFS,16)']"" S RAERR="Missing Provider ID" D XIT Q
  1. S ^TMP("RARPT-REC",$J,RASUB,"RAVERF")=$S($D(HLESIG):HLDUZ,1:"")
  1. S ^TMP("RARPT-REC",$J,RASUB,"RATRANSCRIPT")=$G(HLDUZ)
  1. S ^TMP("RARPT-REC",$J,RASUB,"RASTAFF")=$S(+$P(SEGMNT,HLFS,32):+$P(SEGMNT,HLFS,32),1:$G(HLDUZ))
  1. S ^TMP("RARPT-REC",$J,RASUB,"RARESIDENT")=$S(+$P(SEGMNT,HLFS,33):+$P(SEGMNT,HLFS,33),1:"")
  1. S ^TMP("RARPT-REC",$J,RASUB,"RAWHOCHANGE")=$G(HLDUZ)
  1. ;
  1. OBX ; Pick data off the 'OBX' segments
  1. K SEGMNT F S CNT=$O(^HL(772,RASUB,"IN",CNT)) Q:CNT="" S SEGMNT=$G(^(CNT,0)) D:$P(SEGMNT,HLFS)="OBX" Q:$D(RAERR)
  1. . S SEGMNT=$P(SEGMNT,HLFS,2,9999)
  1. . I $P(SEGMNT,HLFS,3)']"" S RAERR="Missing Observation Identifier" Q
  1. . S OBXTYP=$P($P(SEGMNT,HLFS,3),$E(HLECH))
  1. . I "IDR"'[OBXTYP S RAERR="Invalid Observation Identifier" Q
  1. . D:OBXTYP="I" IMP D:OBXTYP="R" RPT D:OBXTYP="D" DIAG
  1. . Q
  1. XIT ; Clean up environment, quit
  1. I $D(^TMP("RARPT-REC",$J,RASUB)),('$D(RAERR)) D EN1^RAHLO
  1. K ^TMP("RARPT-REC",$J,RASUB)
  1. ; Compile the 'ACK' segment
  1. I $D(RAERR) S X1=HLSDATA(1) K HLSDATA S HLSDATA(1)=X1,HLERR=RAERR
  1. S HLMTN="ACK",HLSDATA(2)="MSA"_HLFS_$S($D(HLERR):"AE",1:"AA")_HLFS_HLMID_$S($D(HLERR):HLFS_HLERR,1:"")
  1. D:$D(HLTRANS) EN1^HLTRANS K CNT,OBXTYPE
  1. K RADATE,RADCNT,RADTCN,RAERR,RAESIG,RAICNT,RARCNT,RASUB,RAVERF,SEGMNT
  1. K RATRANSC,RAPRIMAR
  1. Q
  1. DIAG ; Save off Diagnostic Code data.
  1. S RADCNT=+$G(RADCNT)+1
  1. I $P(SEGMNT,HLFS,5)]"" D ; strip off leading spaces, save Dx code
  1. . N DXSTR,X ; DXSTR=Dx code entered by user, X=char pos following space
  1. . S DXSTR=$P(SEGMNT,HLFS,5)
  1. . F S X=$F(DXSTR," ") Q:X'=2 S DXSTR=$E(DXSTR,X,999)
  1. . S ^TMP("RARPT-REC",$J,RASUB,"RADX",RADCNT)=DXSTR
  1. . Q
  1. Q
  1. IMP ; Save off Impression Text data.
  1. S RAICNT=+$G(RAICNT)+1
  1. S ^TMP("RARPT-REC",$J,RASUB,"RAIMP",RAICNT)=$P(SEGMNT,HLFS,5)
  1. Q
  1. RPT ; Save off Report Text data.
  1. S RARCNT=+$G(RARCNT)+1
  1. S ^TMP("RARPT-REC",$J,RASUB,"RATXT",RARCNT)=$P(SEGMNT,HLFS,5)
  1. Q