| 1 | MAGDTRLU ;WOIFO/OHH/PMK - Report discrepancies between files #2006.5849 & #123 and correct them ; 10/11/2006 08:53
 | 
|---|
| 2 |  ;;3.0;IMAGING;**46**;16-February-2007;;Build 1023
 | 
|---|
| 3 |  ;; Per VHA Directive 2004-038, this routine should not be modified.
 | 
|---|
| 4 |  ;; +---------------------------------------------------------------+
 | 
|---|
| 5 |  ;; | Property of the US Government.                                |
 | 
|---|
| 6 |  ;; | No permission to copy or redistribute this software is given. |
 | 
|---|
| 7 |  ;; | Use of unreleased versions of this software requires the user |
 | 
|---|
| 8 |  ;; | to execute a written test agreement with the VistA Imaging    |
 | 
|---|
| 9 |  ;; | Development Office of the Department of Veterans Affairs,     |
 | 
|---|
| 10 |  ;; | telephone (301) 734-0100.                                     |
 | 
|---|
| 11 |  ;; | The Food and Drug Administration classifies this software as  |
 | 
|---|
| 12 |  ;; | a medical device.  As such, it may not be changed in any way. |
 | 
|---|
| 13 |  ;; | Modifications to this software may result in an adulterated   |
 | 
|---|
| 14 |  ;; | medical device under 21CFR820, the use of which is considered |
 | 
|---|
| 15 |  ;; | to be a violation of US Federal Statutes.                     |
 | 
|---|
| 16 |  ;; +---------------------------------------------------------------+
 | 
|---|
| 17 |  ;;
 | 
|---|
| 18 |  ; This routine automatically checks the data in file telereader
 | 
|---|
| 19 |  ; read/unread list (file 2006.5849)and compares it with the
 | 
|---|
| 20 |  ; request/consultation (file #123). If a telereader study is locked
 | 
|---|
| 21 |  ; or unread and in the request/consult file it is completed or
 | 
|---|
| 22 |  ; cancelled, then it updates the status of the study in the telereader
 | 
|---|
| 23 |  ; read/unread list file, the "D" cross reference, and the reading
 | 
|---|
| 24 |  ; start field is updated.
 | 
|---|
| 25 |  Q
 | 
|---|
| 26 |  ;
 | 
|---|
| 27 | REPORT ; report problems with the Unread List
 | 
|---|
| 28 |  D PASS("REPORT")
 | 
|---|
| 29 |  Q
 | 
|---|
| 30 |  ;
 | 
|---|
| 31 | REPAIR ; repair problems with the Unread List
 | 
|---|
| 32 |  D PASS("REPAIR")
 | 
|---|
| 33 |  Q
 | 
|---|
| 34 |  ;
 | 
|---|
| 35 | PASS(MODE) ; report/repair problems for LOCKED and UNREAD studies
 | 
|---|
| 36 |  N MSG
 | 
|---|
| 37 |  S (MSG(1),MSG(3))=""
 | 
|---|
| 38 |  ;
 | 
|---|
| 39 |  ; PASS 1 - search for LOCKED cases that are completed/cancelled.
 | 
|---|
| 40 |  S MSG(2)="Check for completed studies that have LOCKED status"
 | 
|---|
| 41 |  I MODE="REPAIR" S MSG(2)=MSG(2)_" and correct them"
 | 
|---|
| 42 |  W !! D HEADING^MAGDTRDX(.MSG)
 | 
|---|
| 43 |  D SEARCH("LOCKED",MODE)
 | 
|---|
| 44 |  ;
 | 
|---|
| 45 |  ; PASS 2 - search for UNREAD cases that are completed/cancelled.
 | 
|---|
| 46 |  S MSG(2)="Now check for completed studies that have UNREAD status"
 | 
|---|
| 47 |  I MODE="REPAIR" S MSG(2)=MSG(2)_" and correct them"
 | 
|---|
| 48 |  W !! D HEADING^MAGDTRDX(.MSG)
 | 
|---|
| 49 |  D SEARCH("UNREAD",MODE)
 | 
|---|
| 50 |  Q
 | 
|---|
| 51 |  ;
 | 
|---|
| 52 | SEARCH(STATUS,MODE) ; go through studies for each site, specialty and procedure
 | 
|---|
| 53 |  N ACQSITE ; -- acquisition division number
 | 
|---|
| 54 |  N ISPECIDX ; - image index for specialty
 | 
|---|
| 55 |  N IPROCIDX ; - image index for procedure
 | 
|---|
| 56 |  N UNREAD ; --- IEN of file telereader read/undread file #2006.5849
 | 
|---|
| 57 |  N XREF ; ----- "D" cross reference: "L" for locked, "U" for unread
 | 
|---|
| 58 |  N I
 | 
|---|
| 59 |  ;
 | 
|---|
| 60 |  S XREF=$E(STATUS)
 | 
|---|
| 61 |  S ACQSITE=""
 | 
|---|
| 62 |  F  S ACQSITE=$O(^MAG(2006.5849,"D",ACQSITE)) Q:ACQSITE=""  D
 | 
|---|
| 63 |  . W !!,$$W("Acquisition Site:"),$$GET1^DIQ(4,ACQSITE,.01)
 | 
|---|
| 64 |  . S ISPECIDX=""
 | 
|---|
| 65 |  . F  S ISPECIDX=$O(^MAG(2006.5849,"D",ACQSITE,ISPECIDX)) Q:ISPECIDX=""  D
 | 
|---|
| 66 |  . . W !,$$W("Specialty:"),$$GET1^DIQ(2005.84,ISPECIDX,.01)
 | 
|---|
| 67 |  . . S IPROCIDX=""
 | 
|---|
| 68 |  . . F  S IPROCIDX=$O(^MAG(2006.5849,"D",ACQSITE,ISPECIDX,IPROCIDX)) Q:IPROCIDX=""  D
 | 
|---|
| 69 |  . . . N COUNT ; -- array of counts of problems
 | 
|---|
| 70 |  . . . W !,$$W("Procedure:"),$$GET1^DIQ(2005.85,IPROCIDX,.01) D
 | 
|---|
| 71 |  . . . S UNREAD=""
 | 
|---|
| 72 |  . . . F  S UNREAD=$O(^MAG(2006.5849,"D",ACQSITE,ISPECIDX,IPROCIDX,XREF,UNREAD)) Q:UNREAD=""  D CHECK
 | 
|---|
| 73 |  . . . I '$D(COUNT) D  Q
 | 
|---|
| 74 |  . . . . W !,$$W(""),"No inconsistencies were found.",!
 | 
|---|
| 75 |  . . . . Q
 | 
|---|
| 76 |  . . . S I="" F  S I=$O(COUNT(I)) Q:I=""  D
 | 
|---|
| 77 |  . . . . W !,$$W($S(MODE="REPORT":"Problem:",1:"Repaired:"))
 | 
|---|
| 78 |  . . . . W "Number of consults that have ",I," status in CPRS: ",COUNT(I)
 | 
|---|
| 79 |  . . . . W !
 | 
|---|
| 80 |  . . . . Q
 | 
|---|
| 81 |  . . . Q
 | 
|---|
| 82 |  . . Q
 | 
|---|
| 83 |  . Q
 | 
|---|
| 84 |  Q
 | 
|---|
| 85 |  ;
 | 
|---|
| 86 | CHECK ;check Unread List entry against that in CPRS Consult Requst Tracking
 | 
|---|
| 87 |  N GMRCIEN ; -- IEN of file request/consultation (file #123)
 | 
|---|
| 88 |  N GMRCSTS ; -- status of consult request - from ^ORD(100.01)
 | 
|---|
| 89 |  ;
 | 
|---|
| 90 |  S GMRCIEN=$P(^MAG(2006.5849,UNREAD,0),"^",1)
 | 
|---|
| 91 |  S GMRCSTS=$$GET1^DIQ(123,GMRCIEN,8) ; cprs status
 | 
|---|
| 92 |  I "^COMPLETE^CANCELLED^DISCONTINUED^DISCONTINUED/EDIT^EXPIRED^"[("^"_GMRCSTS_"^") D
 | 
|---|
| 93 |  . S COUNT(GMRCSTS)=$G(COUNT(GMRCSTS))+1
 | 
|---|
| 94 |  . I MODE="REPORT" D
 | 
|---|
| 95 |  . . W !,$$W(""),"Consult # ",GMRCIEN," has the status of ",GMRCSTS," in CPRS"
 | 
|---|
| 96 |  . . Q
 | 
|---|
| 97 |  . E  I MODE="REPAIR" D  ; correct the entry
 | 
|---|
| 98 |  . . W !,$$W("Fix:"),"Consult # ",GMRCIEN," which has the status of ",GMRCSTS," in CPRS"
 | 
|---|
| 99 |  . . ; Note: The variable & value MODE="REPAIR" are used in ^MAGDTR03
 | 
|---|
| 100 |  . . I GMRCSTS="COMPLETE" D
 | 
|---|
| 101 |  . . . D COMPLETE^MAGDTR03
 | 
|---|
| 102 |  . . . Q
 | 
|---|
| 103 |  . . E  D CANCEL^MAGDTR03
 | 
|---|
| 104 |  . . Q
 | 
|---|
| 105 |  . Q
 | 
|---|
| 106 |  Q
 | 
|---|
| 107 |  ;
 | 
|---|
| 108 | W(PROMPT) ; output prompt
 | 
|---|
| 109 |  Q $J(PROMPT,16)_" "
 | 
|---|