public String getCCDocs() { String docName = ""; int i = 0; try { while (!getFullDocName( msg.getRESPONSE().getORDER_OBSERVATION(0).getOBR().getResultCopiesTo(i)) .equals("")) { if (i == 0) { docName = getFullDocName( msg.getRESPONSE().getORDER_OBSERVATION(0).getOBR().getResultCopiesTo(i)); } else { docName = docName + ", " + getFullDocName( msg.getRESPONSE().getORDER_OBSERVATION(0).getOBR().getResultCopiesTo(i)); } i++; } return (docName); } catch (Exception e) { logger.error("Could not return cc'ed doctors", e); return (""); } }
public String getDocName() { String docName = ""; int i = 0; try { while (!getFullDocName( msg.getRESPONSE().getORDER_OBSERVATION(0).getOBR().getOrderingProvider(i)) .equals("")) { if (i == 0) { docName = getFullDocName( msg.getRESPONSE().getORDER_OBSERVATION(0).getOBR().getOrderingProvider(i)); } else { docName = docName + ", " + getFullDocName( msg.getRESPONSE().getORDER_OBSERVATION(0).getOBR().getOrderingProvider(i)); } i++; } return (docName); } catch (Exception e) { logger.error("Could not return doctor names", e); return (""); } }
public ArrayList<String> getDocNums() { ArrayList<String> docNums = new ArrayList<String>(); String id; int i; try { String providerId = msg.getRESPONSE() .getORDER_OBSERVATION(0) .getOBR() .getOrderingProvider(0) .getIDNumber() .getValue(); docNums.add(providerId); i = 0; while ((id = msg.getRESPONSE() .getORDER_OBSERVATION(0) .getOBR() .getResultCopiesTo(i) .getIDNumber() .getValue()) != null) { if (!id.equals(providerId)) docNums.add(id); i++; } } catch (Exception e) { logger.error("Could not return doctor nums", e); } return (docNums); }
public String getOrderStatus() { try { String orderStatus = getString( msg.getRESPONSE().getORDER_OBSERVATION(0).getOBR().getResultStatus().getValue()); int obrCount = getOBRCount(); int obxCount; int count = 0; for (int i = 0; i < obrCount; i++) { obxCount = getOBXCount(i); for (int j = 0; j < obxCount; j++) { String obxStatus = getOBXResultStatus(i, j); if (obxStatus.equalsIgnoreCase("C")) count++; } } if (count >= 1) { // if any of the OBX's have been corrected, mark the entire report as corrected orderStatus = "C"; return orderStatus; } else { return orderStatus; } } catch (Exception e) { return (""); } }
/* * OBC METHODS */ public String getAccessionNum() { try { String str = msg.getRESPONSE() .getORDER_OBSERVATION(0) .getORC() .getFillerOrderNumber() .getEntityIdentifier() .getValue(); String accessionNum = getString(str); String[] nums = accessionNum.split("-"); if (nums.length == 3) { return nums[0]; } else if (nums.length == 5) { return nums[0] + "-" + nums[1] + "-" + nums[2]; } else { if (nums.length > 1) return nums[0] + "-" + nums[1]; else return ""; } } catch (Exception e) { logger.error("Could not return accession number", e); return (""); } }
/** Retrieve the possible segment headers from the OBX fields */ public ArrayList<String> getHeaders() { int i; int arraySize; int k = 0; ArrayList<String> headers = new ArrayList<String>(); String currentHeader; try { for (i = 0; i < msg.getRESPONSE().getORDER_OBSERVATIONReps(); i++) { currentHeader = getObservationHeader(i, 0); arraySize = headers.size(); if (arraySize == 0 || !currentHeader.equals(headers.get(arraySize - 1))) { logger.info("Adding header: '" + currentHeader + "' to list"); headers.add(currentHeader); } } return (headers); } catch (Exception e) { logger.error("Could not create header list", e); return (null); } }
public String getOBRComment(int i, int j) { try { return (getString( msg.getRESPONSE().getORDER_OBSERVATION(i).getNTE(j).getComment(0).getValue())); } catch (Exception e) { return (""); } }
public String getOBXResult(int i, int j) { try { return (getString( Terser.get( msg.getRESPONSE().getORDER_OBSERVATION(i).getOBSERVATION(j).getOBX(), 5, 0, 1, 1))); } catch (Exception e) { return (""); } }
public String getMsgDate() { // try { return (formatDateTime( getString(msg.getMSH().getDateTimeOfMessage().getTimeOfAnEvent().getValue()))); // return(formatDateTime(getString(msg.getRESPONSE().getORDER_OBSERVATION(0).getOBR().getObservationDateTime().getTimeOfAnEvent().getValue()))); // } catch (HL7Exception ex) { // return (""); // } }
public String getClientRef() { String docNum = ""; int i = 0; try { while (!getString( msg.getRESPONSE() .getORDER_OBSERVATION(0) .getOBR() .getOrderingProvider(i) .getIDNumber() .getValue()) .equals("")) { if (i == 0) { docNum = getString( msg.getRESPONSE() .getORDER_OBSERVATION(0) .getOBR() .getOrderingProvider(i) .getIDNumber() .getValue()); } else { docNum = docNum + ", " + getString( msg.getRESPONSE() .getORDER_OBSERVATION(0) .getOBR() .getOrderingProvider(i) .getIDNumber() .getValue()); } i++; } return (docNum); } catch (Exception e) { logger.error("Could not return doctor id numbers", e); return (""); } }
public String getWorkPhone() { String phone = ""; int i = 0; try { while (!getString( msg.getRESPONSE() .getPATIENT() .getPID() .getPhoneNumberBusiness(i) .get9999999X99999CAnyText() .getValue()) .equals("")) { if (i == 0) { phone = getString( msg.getRESPONSE() .getPATIENT() .getPID() .getPhoneNumberBusiness(i) .get9999999X99999CAnyText() .getValue()); } else { phone = phone + ", " + getString( msg.getRESPONSE() .getPATIENT() .getPID() .getPhoneNumberBusiness(i) .get9999999X99999CAnyText() .getValue()); } i++; } return (phone); } catch (Exception e) { logger.error("Could not return phone number", e); return (""); } }
public String getObservationHeader(int i, int j) { try { return (getString( msg.getRESPONSE() .getORDER_OBSERVATION(i) .getOBR() .getDiagnosticServiceSectionID() .getValue())); } catch (Exception e) { return (""); } }
public String getOBRName(int i) { try { return (getString( msg.getRESPONSE() .getORDER_OBSERVATION(i) .getOBR() .getUniversalServiceIdentifier() .getText() .getValue())); } catch (Exception e) { return (""); } }
public String getOBXResultStatus(int i, int j) { try { return (getString( msg.getRESPONSE() .getORDER_OBSERVATION(i) .getOBSERVATION(j) .getOBX() .getObservResultStatus() .getValue())); } catch (Exception e) { return (""); } }
public String getOBXReferenceRange(int i, int j) { try { return (getString( msg.getRESPONSE() .getORDER_OBSERVATION(i) .getOBSERVATION(j) .getOBX() .getReferencesRange() .getValue())); } catch (Exception e) { return (""); } }
public String getOBXAbnormalFlag(int i, int j) { try { return (getString( msg.getRESPONSE() .getORDER_OBSERVATION(i) .getOBSERVATION(j) .getOBX() .getAbnormalFlags(0) .getValue())); } catch (Exception e) { logger.error("Error retrieving obx abnormal flag", e); return (""); } }
public String getOBXName(int i, int j) { try { return (getString( msg.getRESPONSE() .getORDER_OBSERVATION(i) .getOBSERVATION(j) .getOBX() .getObservationIdentifier() .getText() .getValue())); } catch (Exception e) { return (""); } }
/* * OBX METHODS */ public int getOBXCount(int i) { int count = 0; try { count = msg.getRESPONSE().getORDER_OBSERVATION(i).getOBSERVATIONReps(); // if count is 1 there may only be an nte segment and no obx segments so check if (count == 1) { String test = msg.getRESPONSE() .getORDER_OBSERVATION(i) .getOBSERVATION(0) .getOBX() .getObservationIdentifier() .getText() .getValue(); logger.info("name: " + test); if (test == null) count = 0; } } catch (Exception e) { logger.error("Error retrieving obx count", e); count = 0; } return count; }
public String getOBXUnits(int i, int j) { try { return (getString( msg.getRESPONSE() .getORDER_OBSERVATION(i) .getOBSERVATION(j) .getOBX() .getUnits() .getIdentifier() .getValue())); } catch (Exception e) { return (""); } }
public String getRequestDate(int i) { try { return (formatDateTime( getString( msg.getRESPONSE() .getORDER_OBSERVATION(i) .getOBR() .getRequestedDateTime() .getTimeOfAnEvent() .getValue()))); } catch (Exception e) { return (""); } }
public String getServiceDate() { try { return (formatDateTime( getString( msg.getRESPONSE() .getORDER_OBSERVATION(0) .getOBR() .getObservationDateTime() .getTimeOfAnEvent() .getValue()))); // return(formatDateTime(getString(msg.getRESPONSE().getORDER_OBSERVATION(0).getOBR().getObservationDateTime().getTimeOfAnEvent().getValue()))); } catch (Exception e) { return (""); } }
public String getDOB() { try { return (formatDateTime( getString( msg.getRESPONSE() .getPATIENT() .getPID() .getDateOfBirth() .getTimeOfAnEvent() .getValue())) .substring(0, 10)); } catch (Exception e) { return (""); } }
public String getTimeStamp(int i, int j) { try { return (formatDateTime( getString( msg.getRESPONSE() .getORDER_OBSERVATION(i) .getOBSERVATION(j) .getOBX() .getDateTimeOfTheObservation() .getTimeOfAnEvent() .getValue()))); } catch (Exception e) { return (""); } }
public String getLastName() { return (getString( msg.getRESPONSE().getPATIENT().getPID().getPatientName().getFamilyName().getValue())); }
public String getFirstName() { return (getString( msg.getRESPONSE().getPATIENT().getPID().getPatientName().getGivenName().getValue())); }
public String getHealthNum() { return (getString( msg.getRESPONSE().getPATIENT().getPID().getPatientIDExternalID().getID().getValue())); }
public String getPatientLocation() { return (getString(msg.getMSH().getSendingFacility().getNamespaceID().getValue())); }
public int getOBRCount() { return (msg.getRESPONSE().getORDER_OBSERVATIONReps()); }
public String getSex() { return (getString(msg.getRESPONSE().getPATIENT().getPID().getSex().getValue())); }