MAGMC2CP ;WOIFO/JSL,SAF - Imaging API for Med conversion to CP
;;3.0;IMAGING;**47**;Feb 02, 2005
;; +---------------------------------------------------------------+
;; | 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
; CALL WITH:
; MODE = Boolean value 0: TEST mode, 1: Real mode
; VPtr = Variable pointer to Medicine file report that is being converted
; MAGTIU = The internal entry number of TIU note that VI is converting the medicine pointer to
; IPtr = The internal entry number was stored in the Medicine file pointer pointed back to MAG(2005
;
; RETURN:
; Error -1^Description of error
; No Action Needed 0^No Action
; OK 1^Success message
;
TIU(MODE,VP,MAGTIU,IP) ;
N MAGIEN,MEDIEN,MSG,MAGRET,Y,D0,D1
S MAGRET="0^No Action",MSG=""
S MODE=$S($G(MODE)="":0,1:MODE)
S MEDIEN=+$G(VP) I 'MEDIEN Q "-1^No Medicine IEN"
S TIUIEN=+$G(MAGTIU) I 'TIUIEN Q "-1^No TIU IEN"
S MAGIEN=IP I '$G(MAGIEN) Q "-1^No MAG IEN"
I '$D(^MAG(2005,MAGIEN,0)) Q "-1^No image file "_MAGIEN
I '$$CHKMED(MEDIEN,MAGIEN) Q "-1^No Medicine report found - "_MSG
I MODE D
. D FILE^MAGGSTI(.MAGRET,MAGIEN,TIUIEN) I 'MAGRET S MAGRET="-1^Fail" Q
. D LOG(MAGIEN,"TIU MEDICINE CONVERSION"_U_MODE_U_MEDIEN_U_MAGTIU_U_MEDIEN)
. S MAGRET="1^Success"
E Q "0^No action"
Q MAGRET
;
CHKMED(MEDIEN,MAGIEN) ;
I '$G(MEDIEN)!'$G(MAGIEN) Q 0
S Y=$G(^MAG(2005,MAGIEN,2)),D0=$P(Y,U,6),D1=$P(Y,U,7)
I 'D0!'D1 S MSG="No report file "_MAGIEN_" found." Q 0
S MAGRPT=$G(^DIC(D0,0,"GL")),LN=$L(MAGRPT) Q:MAGRPT="" 0
S GLB=MAGRPT_$S($E(MAGRPT,LN)="(":"",$E(MAGRPT,LN)=",":"",1:",")_D1_")" ;report global
I $Q(@GLB)'[MAGRPT S MSG="No report file "_MAGRPT_" found." Q 0
Q 1 ;ok
LOG(IEN,STR) ;
S ^MAGTMP("MAGZTIU",IEN)=STR
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGMC2CP 2658 printed Dec 13, 2024@02:07:08 Page 2
MAGMC2CP ;WOIFO/JSL,SAF - Imaging API for Med conversion to CP
+1 ;;3.0;IMAGING;**47**;Feb 02, 2005
+2 ;; +---------------------------------------------------------------+
+3 ;; | Property of the US Government. |
+4 ;; | No permission to copy or redistribute this software is given. |
+5 ;; | Use of unreleased versions of this software requires the user |
+6 ;; | to execute a written test agreement with the VistA Imaging |
+7 ;; | Development Office of the Department of Veterans Affairs, |
+8 ;; | telephone (301) 734-0100. |
+9 ;; | |
+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 ; CALL WITH:
+19 ; MODE = Boolean value 0: TEST mode, 1: Real mode
+20 ; VPtr = Variable pointer to Medicine file report that is being converted
+21 ; MAGTIU = The internal entry number of TIU note that VI is converting the medicine pointer to
+22 ; IPtr = The internal entry number was stored in the Medicine file pointer pointed back to MAG(2005
+23 ;
+24 ; RETURN:
+25 ; Error -1^Description of error
+26 ; No Action Needed 0^No Action
+27 ; OK 1^Success message
+28 ;
TIU(MODE,VP,MAGTIU,IP) ;
+1 NEW MAGIEN,MEDIEN,MSG,MAGRET,Y,D0,D1
+2 SET MAGRET="0^No Action"
SET MSG=""
+3 SET MODE=$SELECT($GET(MODE)="":0,1:MODE)
+4 SET MEDIEN=+$GET(VP)
IF 'MEDIEN
QUIT "-1^No Medicine IEN"
+5 SET TIUIEN=+$GET(MAGTIU)
IF 'TIUIEN
QUIT "-1^No TIU IEN"
+6 SET MAGIEN=IP
IF '$GET(MAGIEN)
QUIT "-1^No MAG IEN"
+7 IF '$DATA(^MAG(2005,MAGIEN,0))
QUIT "-1^No image file "_MAGIEN
+8 IF '$$CHKMED(MEDIEN,MAGIEN)
QUIT "-1^No Medicine report found - "_MSG
+9 IF MODE
Begin DoDot:1
+10 DO FILE^MAGGSTI(.MAGRET,MAGIEN,TIUIEN)
IF 'MAGRET
SET MAGRET="-1^Fail"
QUIT
+11 DO LOG(MAGIEN,"TIU MEDICINE CONVERSION"_U_MODE_U_MEDIEN_U_MAGTIU_U_MEDIEN)
+12 SET MAGRET="1^Success"
End DoDot:1
+13 IF '$TEST
QUIT "0^No action"
+14 QUIT MAGRET
+15 ;
CHKMED(MEDIEN,MAGIEN) ;
+1 IF '$GET(MEDIEN)!'$GET(MAGIEN)
QUIT 0
+2 SET Y=$GET(^MAG(2005,MAGIEN,2))
SET D0=$PIECE(Y,U,6)
SET D1=$PIECE(Y,U,7)
+3 IF 'D0!'D1
SET MSG="No report file "_MAGIEN_" found."
QUIT 0
+4 SET MAGRPT=$GET(^DIC(D0,0,"GL"))
SET LN=$LENGTH(MAGRPT)
if MAGRPT=""
QUIT 0
+5 ;report global
SET GLB=MAGRPT_$SELECT($EXTRACT(MAGRPT,LN)="(":"",$EXTRACT(MAGRPT,LN)=",":"",1:",")_D1_")"
+6 IF $QUERY(@GLB)'[MAGRPT
SET MSG="No report file "_MAGRPT_" found."
QUIT 0
+7 ;ok
QUIT 1
LOG(IEN,STR) ;
+1 SET ^MAGTMP("MAGZTIU",IEN)=STR
+2 QUIT
+3 ;