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

MCARUTL3.m

Go to the documentation of this file.
  1. MCARUTL3 ;HOIFO/WAA-Utility Routine #3;11/29/00 09:55
  1. ;;2.3;Medicine;**30**;09/13/1996
  1. ;;
  1. ;;This API is referenced in DBIA 3280
  1. ;
  1. MEDLKUP(ARRAY,FN,IEN) ; This sub-routine will return the following information
  1. ; Input:
  1. ; ARRAY = the array for the return array
  1. ; FN = the medicine file number
  1. ; IEN = the Internal Entry Number
  1. ; Output:
  1. ; piece 1 =0 (failure) or 1 (success, 2nd piece is message text.)
  1. ; piece 2 = Medicine file
  1. ; piece 3 = Medicine ien
  1. ; piece 4 & 5 =Medicine patient (internal ^ external)
  1. ; piece 6 & 7 =Medicine date/time (internal ^ external)
  1. ; piece 8 & 9 =Medicine Procedure (internal ^ external)
  1. ; piece 10 & 11 =i~_Image (Med,2005,IEN) ^ external pointer to 2005)
  1. N LINE,PDATE,EDATE,DFN,PATNAM,PROC,PROCN,IMG,IMAGE,DILN,%,I,DISYS
  1. S ARRAY=0
  1. S FN=$G(FN) I FN="" S ARRAY="0^No File indicated." Q
  1. I FN=690 S ARRAY="0^Cannot look-up on MEDICAL PATIENT File." Q
  1. I FN<690!(FN>701) S ARRAY="0^Non-Medicine File indicated." Q
  1. I FN=697.2 S ARRAY="0^Cannot look-up on PROCEDURE/SUBSPECIALTY File." Q
  1. I ($O(^MCAR(697.2,"C","MCAR("_FN,0)))<1 S ARRAY="0^"_FN_" is not a procedure file." Q
  1. S IEN=$G(IEN) I IEN="" S ARRAY="0^No IEN indicated." Q
  1. S LINE=$G(^MCAR(FN,IEN,0))
  1. I LINE="" S ARRAY="0^Entry "_IEN_" in file "_FN_" not found." Q
  1. S PDATE=$P(LINE,U,1) ; Procedure Date
  1. I PDATE<1 S ARRAY="0^Incomplete data, NO Procedure Date in entry "_IEN_" for file "_FN Q
  1. S EDATE=$$FMTE^XLFDT(PDATE,8) ; External Date
  1. S DFN=$P(LINE,U,2) ; Get Patient
  1. I DFN<1 S ARRAY="0^Incomplete data, NO Patient in entry "_IEN_" for file "_FN Q
  1. S PATNAM=$$GET1^DIQ(2,DFN_",",.01,"I") ; Patient Name
  1. S PROC="" ; setup for getting indicated procedure
  1. I FN=699 S PROC=$P(LINE,U,12) ; Screening
  1. I FN=699.5 S PROC=$P(LINE,U,6) ; Screening
  1. I FN=694 S PROC=$P(LINE,U,3) ; Screening
  1. I PROC="" S PROC=$O(^MCAR(697.2,"C","MCAR("_FN,0)) ; Verify the procedure
  1. I PROC<1 S ARRAY="0^No Procedure indicated." Q ; Bad Procedure
  1. S PROCN=$P($G(^MCAR(697.2,PROC,0)),U) ; get procedure number
  1. I PROCN="" S ARRAY="0^No Procedure Name indicated." Q ; again Bad
  1. S ARRAY="1"_U_FN_U_IEN_U_DFN_U_PATNAM_U_PDATE_U_EDATE_U_PROC_U_PROCN
  1. S IMG=+$P($G(^MCAR(FN,IEN,2005,0)),U,3) I IMG D
  1. . S IMAGE=+$P($G(^MCAR(FN,IEN,2005,IMG,0)),U)
  1. . S ARRAY=ARRAY_U_IMG_U_IMAGE
  1. . Q
  1. ; Getting Image and passing back
  1. Q