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

MAGVSTDY.m

Go to the documentation of this file.
  1. MAGVSTDY ;WOIFO/RRB,MAT - Read a DICOM image file ; 5 Apr 2013 12:55 PM
  1. ;;3.0;IMAGING;**118**;Mar 19, 2002;Build 4525;May 01, 2013
  1. ;; Per VHA Directive 2004-038, this routine should not be modified.
  1. ;; +---------------------------------------------------------------+
  1. ;; | Property of the US Government. |
  1. ;; | No permission to copy or redistribute this software is given. |
  1. ;; | Use of unreleased versions of this software requires the user |
  1. ;; | to execute a written test agreement with the VistA Imaging |
  1. ;; | Development Office of the Department of Veterans Affairs, |
  1. ;; | telephone (301) 734-0100. |
  1. ;; | The Food and Drug Administration classifies this software as |
  1. ;; | a medical device. As such, it may not be changed in any way. |
  1. ;; | Modifications to this software may result in an adulterated |
  1. ;; | medical device under 21CFR820, the use of which is considered |
  1. ;; | to be a violation of US Federal Statutes. |
  1. ;; +---------------------------------------------------------------+
  1. ;;
  1. ;
  1. Q
  1. ;+++++ Lookup the patient/study for an imaging service.
  1. ;
  1. ; [RPC: MAGV STUDY LOOKUP]
  1. ;
  1. ; Calls LOOKUP^MAGVORDR
  1. ;
  1. ; Inputs
  1. ; ======
  1. ;
  1. ; RADATA Variable to contain the string to return.
  1. ; CASENUMB Day-Case/Accession Number (RAD package)
  1. ; IMGSVC Imaging Service (RAD, CON)
  1. ; PNAMEDCM DICOM Header (0010,0010) Patient Name
  1. ; PIDDCM " " (0010,0020) " ID
  1. ; PDOBDCM " " (0010,0030) " Date of Birth
  1. ; PSEXDCM " " (0010,0040) " Sex
  1. ; [PICNDCM] " " ???? " Integration Control Number
  1. ;
  1. ; Output
  1. ; ======
  1. ; ----From MAGVORDR---- --From PIDCHECK--
  1. ; Error Success Error Success
  1. ; "~"-1 -1 0
  1. ; -2 Errmsg1 DFN
  1. ; -3 --- Site ID
  1. ; -4 --- ----------> n<1 0
  1. ; -5 --- ----------> Errmsg2 PID OK
  1. ;
  1. ; Errmsg1______ If_____________
  1. ;
  1. ; -1~BAD CASE # RAD and Null RADPTx
  1. ; RAD - Null Exam Status pointer
  1. ; RAD - Null Exam Status
  1. ; -1~NO CASE # RAD,CON - Exam Status = CANCELLED
  1. ; RAD,CON - no patient demographic file pointer
  1. ; CON - incomplete consult study
  1. ;
  1. LOOKUP(RADATA,CASENUMB,IMGSVC,PNAMEDCM,PIDDCM,PDOBDCM,PSEXDCM,PICNDCM) ;
  1. ;
  1. S PICNDCM=$G(PICNDCM)
  1. ;
  1. ;--- Lookup DFN, SITE. Quit if -1, Else RADATA="0~"_DFN_"~"_SITE.
  1. S RADATA=$$LOOKUP^MAGVORDR(CASENUMB,IMGSVC)
  1. Q:+RADATA=-1
  1. ;
  1. ; Look up and compare Patient Data associated with the CASENUM
  1. N DFN S DFN=$P(RADATA,"~",2)
  1. S RADATA=RADATA_"~"_$$PIDCHECK(DFN,PNAMEDCM,PIDDCM,PDOBDCM,PSEXDCM,PICNDCM)
  1. Q
  1. ;+++++ Wrap call to PIDCHECK^MAGDIR8A() and change delimiter.
  1. ;
  1. ; Internal entry point called by tag LOOKUP.
  1. ; Lookup patient demographics by DFN to validate DICOM header values.
  1. ;
  1. ; Inputs
  1. ; ======
  1. ;
  1. ; DFN IEN in the RAD/NUC MED PATIENT File (#70)
  1. ;
  1. ; Other parameters as described at tag LOOKUP.
  1. ;
  1. ; Output
  1. ; ======
  1. ;
  1. ; If found & match: 0~PID OK
  1. ; On error: n<0~ERRMSG
  1. ;
  1. ; Notes
  1. ; =====
  1. ;
  1. ; PIDCHECK^MAGDIR8A expects:
  1. ;
  1. ; PID As passed to MAGDIR8 by the gateway. Here it is
  1. ; set to PIDDCM.
  1. ; CASENUMB
  1. ; [INSTLOC] Instrument Location: A Site ID from the gateway's
  1. ; INSTRUMENT DICTIONARY: ^MAGDICOM(2006.581,IEN, "^"-5
  1. ; used by DEM^MAGSPID.
  1. ;
  1. PIDCHECK(DFN,PNAMEDCM,PIDDCM,PDOBDCM,PSEXDCM,PICNDCM) ;
  1. ;
  1. ;--- Initialize additional expected variables.
  1. N FIRSTDCM,LASTDCM,MIDCM,PNAMEVAH
  1. N PID S PID=PIDDCM
  1. ;--- Next line check & transform copied from READFILE+27^MAGDIR6B.
  1. I $$ISIHS^MAGSPID() S PID=+PID ; P123 strip off leading zero(s)
  1. N RETURN
  1. S RETURN=$$PIDCHECK^MAGDIR8A()
  1. S RETURN=$S(RETURN=0:"0~PID OK",1:$TR(RETURN,",","~"))
  1. Q RETURN
  1. ;
  1. ; MAGVSTDY