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

MAGMC2CP.m

Go to the documentation of this file.
  1. MAGMC2CP ;WOIFO/JSL,SAF - Imaging API for Med conversion to CP
  1. ;;3.0;IMAGING;**47**;Feb 02, 2005
  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. ;; | |
  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. Q
  1. ; CALL WITH:
  1. ; MODE = Boolean value 0: TEST mode, 1: Real mode
  1. ; VPtr = Variable pointer to Medicine file report that is being converted
  1. ; MAGTIU = The internal entry number of TIU note that VI is converting the medicine pointer to
  1. ; IPtr = The internal entry number was stored in the Medicine file pointer pointed back to MAG(2005
  1. ;
  1. ; RETURN:
  1. ; Error -1^Description of error
  1. ; No Action Needed 0^No Action
  1. ; OK 1^Success message
  1. ;
  1. TIU(MODE,VP,MAGTIU,IP) ;
  1. N MAGIEN,MEDIEN,MSG,MAGRET,Y,D0,D1
  1. S MAGRET="0^No Action",MSG=""
  1. S MODE=$S($G(MODE)="":0,1:MODE)
  1. S MEDIEN=+$G(VP) I 'MEDIEN Q "-1^No Medicine IEN"
  1. S TIUIEN=+$G(MAGTIU) I 'TIUIEN Q "-1^No TIU IEN"
  1. S MAGIEN=IP I '$G(MAGIEN) Q "-1^No MAG IEN"
  1. I '$D(^MAG(2005,MAGIEN,0)) Q "-1^No image file "_MAGIEN
  1. I '$$CHKMED(MEDIEN,MAGIEN) Q "-1^No Medicine report found - "_MSG
  1. I MODE D
  1. . D FILE^MAGGSTI(.MAGRET,MAGIEN,TIUIEN) I 'MAGRET S MAGRET="-1^Fail" Q
  1. . D LOG(MAGIEN,"TIU MEDICINE CONVERSION"_U_MODE_U_MEDIEN_U_MAGTIU_U_MEDIEN)
  1. . S MAGRET="1^Success"
  1. E Q "0^No action"
  1. Q MAGRET
  1. ;
  1. CHKMED(MEDIEN,MAGIEN) ;
  1. I '$G(MEDIEN)!'$G(MAGIEN) Q 0
  1. S Y=$G(^MAG(2005,MAGIEN,2)),D0=$P(Y,U,6),D1=$P(Y,U,7)
  1. I 'D0!'D1 S MSG="No report file "_MAGIEN_" found." Q 0
  1. S MAGRPT=$G(^DIC(D0,0,"GL")),LN=$L(MAGRPT) Q:MAGRPT="" 0
  1. S GLB=MAGRPT_$S($E(MAGRPT,LN)="(":"",$E(MAGRPT,LN)=",":"",1:",")_D1_")" ;report global
  1. I $Q(@GLB)'[MAGRPT S MSG="No report file "_MAGRPT_" found." Q 0
  1. Q 1 ;ok
  1. LOG(IEN,STR) ;
  1. S ^MAGTMP("MAGZTIU",IEN)=STR
  1. Q
  1. ;