MAGDQR22 ;WOIFO/EdM,MLH - Pt ID / SSN logic for C-FIND - find matching rad studies in new DB structure ; 23 Dec 2011 12:55 AM
;;3.0;IMAGING;**118**;Mar 19, 2002;Build 4525;May 01, 2013
;; Per VHA Directive 2004-038, this routine should not be modified.
;; +---------------------------------------------------------------+
;; | Property of the US Government. |
;; | No permission to copy or redistribute this software is given. |
;; | Use of unreleased versions of this software requires the user |
;; | to execute a written test agreement with the VistA Imaging |
;; | Development Office of the Department of Veterans Affairs, |
;; | telephone (301) 734-0100. |
;; | The Food and Drug Administration classifies this software as |
;; | a medical device. As such, it may not be changed in any way. |
;; | Modifications to this software may result in an adulterated |
;; | medical device under 21CFR820, the use of which is considered |
;; | to be a violation of US Federal Statutes. |
;; +---------------------------------------------------------------+
;;
Q
;
PATSSNNU(P,REQ,RESULT,MAGDUZ,PAT,SSN,UID,FD,LD,ERROR,FATAL) ; Generate response data to pt ID / SSN query from new DB structure - called from PATSSN^MAGDQR20
N PATIX,PATREC,PATDFN,PROCIX,STYIX,STYDATE,SERIX,SOPIX,SOPQUIT,SERQUIT
S FD=$G(FD),LD=$G(LD)
S PATIX="" F S PATIX=$O(^MAGV(2005.6,"B",P,PATIX)) Q:'PATIX D
. S PATREC=$G(^MAGV(2005.6,PATIX,0)) Q:PATREC="" Q:$P(PATREC,"^",3)'="D"
. S PATDFN=$P(PATREC,"^",1)
. S PROCIX="" F S PROCIX=$O(^MAGV(2005.61,"C",PATIX,PROCIX)) Q:'PROCIX D
. . Q:$P($G(^MAGV(2005.61,PROCIX,0)),"^",5)'="A" ; not active
. . S STYIX="" F S STYIX=$O(^MAGV(2005.62,"C",PROCIX,STYIX)) Q:'STYIX D
. . . S STYDATE=$P($G(^MAGV(2005.62,STYIX,2)),"^",1)
. . . I STYDATE Q:FD&(STYDATE<FD) Q:LD&(STYDATE>LD) ; study out of date range (if specified)
. . . Q:$P($G(^MAGV(2005.62,STYIX,5)),"^",2)="I" ; study marked inaccessible
. . . S SERIX="" F S SERIX=$O(^MAGV(2005.63,"C",STYIX,SERIX)) Q:'SERIX D Q:$G(SERQUIT)
. . . . S SOPIX="" F S SOPIX=$O(^MAGV(2005.64,"C",SERIX,SOPIX)) Q:'SOPIX D Q:$G(SOPQUIT)
. . . . . D RESULT^MAGDQR03("N",.REQ,RESULT,SOPIX,MAGDUZ,PATDFN,0,0,.ERROR,.FATAL)
. . . . . S SOPQUIT=1 ; always true for study & series level query - adjust later for SOP level
. . . . . Q
. . . . S SERQUIT=1 ; always true for study level query - adjust later for series, SOP level
. . . . Q
. . . Q
. . Q
. Q
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGDQR22 2591 printed Dec 13, 2024@02:01:03 Page 2
MAGDQR22 ;WOIFO/EdM,MLH - Pt ID / SSN logic for C-FIND - find matching rad studies in new DB structure ; 23 Dec 2011 12:55 AM
+1 ;;3.0;IMAGING;**118**;Mar 19, 2002;Build 4525;May 01, 2013
+2 ;; Per VHA Directive 2004-038, this routine should not be modified.
+3 ;; +---------------------------------------------------------------+
+4 ;; | Property of the US Government. |
+5 ;; | No permission to copy or redistribute this software is given. |
+6 ;; | Use of unreleased versions of this software requires the user |
+7 ;; | to execute a written test agreement with the VistA Imaging |
+8 ;; | Development Office of the Department of Veterans Affairs, |
+9 ;; | telephone (301) 734-0100. |
+10 ;; | The Food and Drug Administration classifies this software as |
+11 ;; | a medical device. As such, it may not be changed in any way. |
+12 ;; | Modifications to this software may result in an adulterated |
+13 ;; | medical device under 21CFR820, the use of which is considered |
+14 ;; | to be a violation of US Federal Statutes. |
+15 ;; +---------------------------------------------------------------+
+16 ;;
+17 QUIT
+18 ;
PATSSNNU(P,REQ,RESULT,MAGDUZ,PAT,SSN,UID,FD,LD,ERROR,FATAL) ; Generate response data to pt ID / SSN query from new DB structure - called from PATSSN^MAGDQR20
+1 NEW PATIX,PATREC,PATDFN,PROCIX,STYIX,STYDATE,SERIX,SOPIX,SOPQUIT,SERQUIT
+2 SET FD=$GET(FD)
SET LD=$GET(LD)
+3 SET PATIX=""
FOR
SET PATIX=$ORDER(^MAGV(2005.6,"B",P,PATIX))
if 'PATIX
QUIT
Begin DoDot:1
+4 SET PATREC=$GET(^MAGV(2005.6,PATIX,0))
if PATREC=""
QUIT
if $PIECE(PATREC,"^",3)'="D"
QUIT
+5 SET PATDFN=$PIECE(PATREC,"^",1)
+6 SET PROCIX=""
FOR
SET PROCIX=$ORDER(^MAGV(2005.61,"C",PATIX,PROCIX))
if 'PROCIX
QUIT
Begin DoDot:2
+7 ; not active
if $PIECE($GET(^MAGV(2005.61,PROCIX,0)),"^",5)'="A"
QUIT
+8 SET STYIX=""
FOR
SET STYIX=$ORDER(^MAGV(2005.62,"C",PROCIX,STYIX))
if 'STYIX
QUIT
Begin DoDot:3
+9 SET STYDATE=$PIECE($GET(^MAGV(2005.62,STYIX,2)),"^",1)
+10 ; study out of date range (if specified)
IF STYDATE
if FD&(STYDATE<FD)
QUIT
if LD&(STYDATE>LD)
QUIT
+11 ; study marked inaccessible
if $PIECE($GET(^MAGV(2005.62,STYIX,5)),"^",2)="I"
QUIT
+12 SET SERIX=""
FOR
SET SERIX=$ORDER(^MAGV(2005.63,"C",STYIX,SERIX))
if 'SERIX
QUIT
Begin DoDot:4
+13 SET SOPIX=""
FOR
SET SOPIX=$ORDER(^MAGV(2005.64,"C",SERIX,SOPIX))
if 'SOPIX
QUIT
Begin DoDot:5
+14 DO RESULT^MAGDQR03("N",.REQ,RESULT,SOPIX,MAGDUZ,PATDFN,0,0,.ERROR,.FATAL)
+15 ; always true for study & series level query - adjust later for SOP level
SET SOPQUIT=1
+16 QUIT
End DoDot:5
if $GET(SOPQUIT)
QUIT
+17 ; always true for study level query - adjust later for series, SOP level
SET SERQUIT=1
+18 QUIT
End DoDot:4
if $GET(SERQUIT)
QUIT
+19 QUIT
End DoDot:3
+20 QUIT
End DoDot:2
+21 QUIT
End DoDot:1
+22 QUIT