private void listOrderingHospitals() { LocSiteLiteMappingsVoCollection orderingHospitals = domain.listLocSites(); PatientShort ps = form.getGlobalContext().Core.getPatientShort(); if (ps==null) return; PatientIdCollection ids= ps.getIdentifiers(); if (ids==null) return; for (LocSiteLiteMappingsVo locationLiteMappingsVo : orderingHospitals) { for (PatientId patientId : ids) { if (patientId.getType().equals(PatIdType.PASID)&&patientId.getValue().startsWith(locationLiteMappingsVo.getPathMapping())) { form.cmbOrderingHosp().newRow(locationLiteMappingsVo.getProviderHospital(), locationLiteMappingsVo.getProviderHospital().getName()); continue; } } } }
private String getNHS(PatientIdCollection identifiers) { if(identifiers == null) return null; for (int i = 0; i < identifiers.size(); i++) { ims.core.vo.PatientId id = identifiers.get(i); if (id.getType().equals(PatIdType.NHSN)) { return id.getValue(); } } return null; }
private PatientId getPatientIdFromColl(PatientIdCollection coll, PatIdType idType) { if (coll == null) return null; for (int i = 0; i < coll.size(); i++) { ims.core.vo.PatientId id = coll.get(i); if (id.getType().equals(idType)) { return id; } } return null; }
private Object getIdentifier(SpecimenWorkListItemListVo item) { String patIdValue = ""; String patIdentifier = ConfigFlag.UI.DISPLAY_PATID_TYPE.getValue(); PatIdType patIdType = PatIdType.getNegativeInstance(patIdentifier); if(patIdType != null) { PatientIdCollection patIdsColl = null; if(item.getSpecimen().getOrderIsNotNull() && item.getSpecimen().getOrder().getPatientIsNotNull()) patIdsColl = item.getSpecimen().getOrder().getPatient().getIdentifiers(); for (int i = 0; patIdsColl != null && i < patIdsColl.size(); i++) { if(patIdsColl.get(i).getTypeIsNotNull() && patIdsColl.get(i).getType().equals(patIdType)) { patIdValue = patIdsColl.get(i).getValue(); break; } } } return patIdType.toString() + " " + patIdValue; }
private Object getIdentifier(SpecimenWorkListItemListVo item) { String patIdValue = ""; String patIdentifier = ConfigFlag.UI.DISPLAY_PATID_TYPE.getValue(); PatIdType patIdType = PatIdType.getNegativeInstance(patIdentifier); if (patIdType != null) { PatientIdCollection patIdsColl = null; //WDEV-16232 if (item.getSpecimenIsNotNull() && item.getSpecimen().getOrderIsNotNull() && item.getSpecimen().getOrder().getPatientIsNotNull()) patIdsColl = item.getSpecimen().getOrder().getPatient().getIdentifiers(); else if (item.getDFTOrderInvestigationIsNotNull() && item.getDFTOrderInvestigation().getOrderDetailsIsNotNull() && item.getDFTOrderInvestigation().getOrderDetails().getPatientIsNotNull()) patIdsColl = item.getDFTOrderInvestigation().getOrderDetails().getPatient().getIdentifiers(); for (int i = 0; patIdsColl != null && i < patIdsColl.size(); i++) { if (patIdsColl.get(i).getTypeIsNotNull() && patIdsColl.get(i).getType().equals(patIdType)) { patIdValue = patIdsColl.get(i).getValue(); break; } } } return patIdType.toString() + " " + patIdValue; }
protected void open() { populateDemoData(); PatientShort patientShort = form.getGlobalContext().Core.getPatientShort(); form.lyrPain().tabPageACutePainRefDet().txtName().setValue(patientShort.getName().toString()); form.lyrPain().tabPageACutePainRefDet().txtAddress().setValue(patientShort.getAddressIsNotNull() ? patientShort.getAddress().toDisplayString(): null); form.lyrPain().tabPageACutePainRefDet().txtDOB().setValue(patientShort.getDobIsNotNull() ? patientShort.getDob().toString() : null); form.lyrPain().tabPageACutePainRefDet().txtWard().setValue(patientShort.getWardIsNotNull() ? patientShort.getWard().getName() : null); PatientIdCollection identifiers = patientShort.getIdentifiers(); for (int i = 0 ; identifiers!= null && i<identifiers.size() ; i++) { if (PatIdType.NHSN.equals(identifiers.get(i).getType())) { form.lyrPain().tabPageACutePainRefDet().txtNhs().setValue(identifiers.get(i).getValue()); } else if (PatIdType.CHARTNUM.equals(identifiers.get(i).getType())) { form.lyrPain().tabPageACutePainRefDet().txtCr().setValue(identifiers.get(i).getValue()); } } form.setMode(FormMode.VIEW); }
private boolean isNHSVerified(PatientShort pat) { PatientIdCollection identifers = pat.getIdentifiers(); if (identifers != null) { for (int i = 0; i < identifers.size(); i++) { ims.core.vo.PatientId id = identifers.get(i); if(typeIsActive(id.getType())) { if ((!id.getVerifiedIsNotNull() || (id.getVerifiedIsNotNull() && !id.getVerified())) && id.getType().equals(PatIdType.NHSN)) { return false; } } } } return true; }
private void displayHistory(Object[] args) { if (args != null && args.length == 1 && args[0] instanceof ISelectedPatient) { form.getGlobalContext().Core.setPatientShort(null); PatientShort ps = new ims.core.vo.PatientShort(((ISelectedPatient) args[0]).getISelectedPatientID(), 0); PatientId psId = new PatientId(); PatientIdCollection psColl = new PatientIdCollection(); ims.core.vo.lookups.PatIdType type = ims.core.vo.lookups.PatIdType.getNegativeInstance(((ISelectedPatient) args[0]).getISelectedPatientInterfaceIDType()); if (type != null) { psId.setType(type); psId.setValue(((ISelectedPatient) args[0]).getISelectedPatientInterfaceID()); if (psId.getValueIsNotNull()) { psColl.add(psId); ps.setIdentifiers(psColl); } } form.getGlobalContext().Core.setPatientToBeDisplayed(ps); } }
private String getnhsNumber(PatientIdCollection patidcoll) { if( patidcoll == null || patidcoll.size() == 0) return ""; for(int i = 0; i < patidcoll.size();i++) { if( PatIdType.NHSN.equals(patidcoll.get(i).getType())) { //nhsn format xxx xxx xxxx java.lang.StringBuffer nhsn = new java.lang.StringBuffer(""); String str = patidcoll.get(i).getIdValue().replace(" ", ""); if ( str.length() > 6) { nhsn.append(str.substring(0, 3)); nhsn.append(" "); nhsn.append(str.substring(3, 6)); nhsn.append(" "); nhsn.append(str.substring(6)); return nhsn.toString(); } else return patidcoll.get(i).getIdValue(); //return patidcoll.get(i).getIdValue(); } } for(int i = 0; i < patidcoll.size();i++) { if( PatIdType.HOSPNUM.equals(patidcoll.get(i).getType())) return PatIdType.HOSPNUM.getIItemText()+" : " +patidcoll.get(i).getIdValue(); } return ""; }
private String getnhsNumber(PatientIdCollection patidcoll) { if( patidcoll == null || patidcoll.size() == 0) return ""; for(int i = 0; i < patidcoll.size();i++) { if( PatIdType.NHSN.equals(patidcoll.get(i).getType())) { java.lang.StringBuffer nhsn = new java.lang.StringBuffer(""); String str = patidcoll.get(i).getIdValue().replace(" ", ""); if ( str.length() > 6) { nhsn.append(str.substring(0, 3)); nhsn.append(" "); nhsn.append(str.substring(3, 6)); nhsn.append(" "); nhsn.append(str.substring(6)); return nhsn.toString(); } else return patidcoll.get(i).getIdValue(); //return patidcoll.get(i).getIdValue(); } } for(int i = 0; i < patidcoll.size();i++) { if( PatIdType.HOSPNUM.equals(patidcoll.get(i).getType())) return PatIdType.HOSPNUM.getIItemText()+" : " +patidcoll.get(i).getIdValue(); } return ""; }
private void checkIfThereAreSameIdentifier(PatientIdCollection identifiers, DynamicGridRow parentRow, DynamicGridColumn column) { if(identifiers == null || identifiers.size() == 0 || parentRow == null) return; for(int j = identifiers.size() - 1; j>=0; j--) { if(identifiers.get(j) == null) continue; for(int i=0; i<parentRow.getRows().size(); i++) { if(parentRow.getRows().get(i).getValue().equals(identifiers.get(j).getType())) { DynamicGridCell sourceIdentifierValueCell = parentRow.getRows().get(i).getCells().get(getColumn(COL_SOURCE_PATIENT)); if(sourceIdentifierValueCell != null && sourceIdentifierValueCell.getValue() != null) { String destinationIdentifierValue = formatIdentifierValue(identifiers.get(j).getValue()); if(sourceIdentifierValueCell.getValue().equals(destinationIdentifierValue)) { DynamicGridCell cellNew = parentRow.getRows().get(i).getCells().newCell(column, DynamicCellType.STRING); cellNew.setValue(getColumn(COL_RESULT_DATA).equals(column) ? destinationIdentifierValue : identifiers.get(j).getValue()); cellNew.setReadOnly(true); identifiers.remove(j); break; } } } } } }
private PatientIdCollection mergePatientIdentifiers(DomainFactory factory, Patient srcPat, Patient destPat) throws SQLException, DomainInterfaceException, StaleObjectException, UniqueKeyViolationException { ims.core.vo.Patient sourcePatient = PatientAssembler.create(srcPat); PatientIdCollection sourceIds = (PatientIdCollection) sourcePatient.getIdentifiers().clone(); srcPat.getIdentifiers().clear(); // Source identifiers moved to destination factory.save(srcPat); // Need to save source pat with no ids before assigning to destination as otherwise, hibernate complains //add (source) identifiers to new (destination) patient for(int i=0;i<sourceIds.size();i++) { PatientId id = (PatientId) sourceIds.get(i).clone(); // wdev-6169 Do not move the nhsn over if it's the same as the nhsn for the destination patient if (id.getType().getId() == PatIdType.NHSN.getID()) { if (getNHSN(destPat.getIdentifiers()).equals(id.getValue())) continue; // wdev-6148 If moving an NHSN value over and it is verified, set it to unverified id.setVerified(false); } // wdev-10710 Only merge the PATNUM identifier if the source is NOT an ICABDummy Patient if (id.getType().getId() == PatIdType.PATNUM.getID()) { if (sourcePatient.getNameIsNotNull() && sourcePatient.getName().getSurnameIsNotNull() && sourcePatient.getName().getSurname().equals(DUMMY_PATIENT)) continue; // Do no insert them } id.setMerged(true); destPat.getIdentifiers().add(PatientIdAssembler.extractPatientId(factory,id)); } return sourceIds; }
private final void renderPatidCollectionToMrg(PatientIdCollection coll, MRG mrg, ProviderSystemVo providerSystem) throws Exception { if (coll == null) return; LOG.debug("VoMapper renderPatidCollectionToMrg: entry"); int posInMsg=0; for (int i = 0; i < coll.size(); i++) { PatientId patId = coll.get(i); //http://jira/browse/WDEV-10022 if(ConfigFlag.HL7.SEND_ONLY_VERIFIED_NHSN.getValue()==true &&patId.getTypeIsNotNull()&&patId.getType().equals(PatIdType.NHSN) &&(!patId.getVerifiedIsNotNull()||patId.getVerified()==false)) { continue; } String patIdType = svc.getRemoteLookup(patId.getType().getID(), providerSystem.getCodeSystem().getText()); if (patIdType == null) { continue; } CX id1 = mrg.getPriorPatientIdentifierList(posInMsg); posInMsg++; renderPatientIdtoCX( patId,id1, providerSystem); if(patId.getType().equals(providerSystem.getPrimaryPatientId())) { CX accNum = mrg.getPriorPatientAccountNumber(); renderPatientIdtoCX( patId,accNum, providerSystem); } } LOG.debug("VoMapper renderPatidCollectionToMrg: exit"); }
private void removePatId(PatientIdCollection coll, PatIdType remType) { for (int i = 0; i < coll.size(); i++) { PatientId id = coll.get(i); if (id.getType().equals(remType)) { coll.remove(i); return; } } }
private String generateA40Message(PatientRefVo patient, PatientRefVo priorPatient, PatientIdCollection priorPatIds, String hl7Application, ProviderSystemVo providerSystem) throws HL7Exception { Message msg; a40mapper.processedCount++; try { msg = a40mapper.populateMessage(patient, priorPatient, priorPatIds, hl7Application, providerSystem); if (msg != null) { String ret = parser.encode(msg); a40mapper.successCount++; a40mapper.lastSuccessDateTime = new DateTime(); a40mapper.lastSuccessMessage = ret; return ret; } } catch (Exception e) { a40mapper.errorCount++; a40mapper.lastFailedDateTime = new DateTime(); throw new HL7Exception("Exception occurred generating ADT Message for HL7App - " + hl7Application + " - " + e.getMessage(), e); } a40mapper.errorCount++; a40mapper.lastFailedDateTime = new DateTime(); throw new HL7Exception("generateA40Message: A null message cannot be parsed!"); }
private void populatePatientDetails(PatientShort voPatShort) { if (voPatShort == null) return; // Populates sex, age and dob form.cmbSex().setValue(voPatShort.getSexIsNotNull() ? voPatShort.getSex() : null); voPatShort.calculateAge(); form.intAge().setValue(voPatShort.getAgeIsNotNull() ? voPatShort.getAge() : null); form.pdtDateOfBirth().setValue(voPatShort.getDobIsNotNull() ? voPatShort.getDob() : null); PersonName personName = voPatShort.getName(); if (personName != null) { form.cmbTitle().setValue(personName.getTitle()); form.txtSurname().setValue(personName.getSurname()); form.txtForename().setValue(personName.getForename()); form.txtMiddleName().setValue(personName.getMiddleName()); } PersonAddress voPersonAddres = voPatShort.getAddress(); if (voPersonAddres != null) { form.txtAddress().setValue(voPersonAddres.toDisplayStringForMultiLineTextBox()); form.txtPostcode().setValue(voPatShort.getAddress().getPostCode()); } PatientIdCollection voCollIdentifiers = voPatShort.getIdentifiers(); form.grdIdentifiers().getRows().clear(); for (int i = 0; i < voCollIdentifiers.size(); i++) { ims.ocrr.forms.specimencollectioncliniccomponent.GenForm.grdIdentifiersRow row = form.grdIdentifiers().getRows().newRow(); row.setcolType(voCollIdentifiers.get(i).getTypeIsNotNull() ? voCollIdentifiers.get(i).getType().toString() : ""); row.setcolValue(voCollIdentifiers.get(i).getValue()); } }
private void populateResultClinicalDemographics(PatientShort patient) { if(patient == null) return; if(patient.getNameIsNotNull()) { form.txtName().setValue(patient.getName().toShortForm().toString()); } if(patient.getDobIsNotNull()) { form.txtDOB().setValue(patient.getDob().toString(DateFormat.STANDARD)); } if (patient.getIdentifiersIsNotNull()) { PatientIdCollection collIdentifiers = patient.getIdentifiers(); for (int i=0;i<collIdentifiers.size();i++) { if(collIdentifiers.get(i)!=null && PatIdType.HOSPNUM.equals(collIdentifiers.get(i).getType())) { form.txtHospnum().setValue(collIdentifiers.get(i).getValue()); } if(collIdentifiers.get(i)!=null && PatIdType.NHSN.equals(collIdentifiers.get(i).getType())) { form.txtNHSNo().setValue(collIdentifiers.get(i).getValue()); } } } if (patient.getSex() != null) { form.txtSex().setValue(patient.getSex().getText()); } }
private void populatePatientDetails(PatientShort voPatShort) { clearPatientDetails(); if (voPatShort == null) return; // Populates sex, age and dob populateScreenFromData(voPatShort); PersonName personName = voPatShort.getName(); if (personName != null) { form.lyrPatDetails().tabPagePatientDetails().cmbTitle().setValue(personName.getTitle()); form.lyrPatDetails().tabPagePatientDetails().txtSurname().setValue(personName.getSurname()); form.lyrPatDetails().tabPagePatientDetails().txtForename().setValue(personName.getForename()); form.lyrPatDetails().tabPagePatientDetails().txtMiddleName().setValue(personName.getMiddleName()); } PersonAddress voPersonAddres = voPatShort.getAddress(); if (voPersonAddres != null) { form.lyrPatDetails().tabPagePatientDetails().txtAddress().setValue(voPersonAddres.toDisplayStringForMultiLineTextBox()); form.lyrPatDetails().tabPagePatientDetails().txtPostcode().setValue(voPatShort.getAddress().getPostCode()); } PatientIdCollection voCollIdentifiers = voPatShort.getIdentifiers(); for (int i = 0; i < voCollIdentifiers.size(); i++) { grdIdentifiersRow row = form.lyrPatDetails().tabPagePatientDetails().grdIdentifiers().getRows().newRow(); row.setcolType(voCollIdentifiers.get(i).getTypeIsNotNull() ? voCollIdentifiers.get(i).getType().toString() : ""); row.setcolValue(voCollIdentifiers.get(i).getValue()); } }
private void populateDemographicINfo() { PatientShort pat = form.getGlobalContext().Core.getPatientShort(); if (pat == null) throw new DomainRuntimeException("No Patient Supplied"); if (pat.getNameIsNotNull()) { form.lblSurname().setValue(pat.getName().getSurname()); form.lblForename().setValue(pat.getName().getForename()); } form.lblSex().setValue(pat.getSexIsNotNull() ? pat.getSex().toString() : ""); form.lblDOB().setValue(pat.getDobIsNotNull() ? pat.getDob().toString() : ""); GenForm.grdIdentifiersRow row; PatientIdCollection identifers = pat.getIdentifiers(); if (identifers != null) { for (int i = 0; i < identifers.size(); i++) { ims.core.vo.PatientId id = identifers.get(i); row = form.grdIdentifiers().getRows().newRow(); bindColType(row, false); row.getcolIdType().setValue(id.getType()); row.setcolIdValue(id.getValue()); row.setValue(id); if (id.getVerifiedIsNotNull() && !id.getVerified() && id.getType().equals(PatIdType.NHSN)) { row.setBackColor(Color.Orange); row.setReadOnly(true); } if (id.getTypeIsNotNull() && id.getType().equals(PatIdType.NHSN) && !ConfigFlag.GEN.ALLOW_UPDATES_TO_NHS_NO.getValue()) row.setReadOnly(true); } } }
private void populateDemographicINfo() { PatientShort pat = form.getGlobalContext().Core.getPatientShort(); if (pat == null) throw new DomainRuntimeException("No Patient Supplied"); if (pat.getNameIsNotNull()) { form.lblSurname().setValue(pat.getName().getSurname()); form.lblForename().setValue(pat.getName().getForename()); } form.lblSex().setValue(pat.getSexIsNotNull() ? pat.getSex().toString() : ""); form.lblDOB().setValue(pat.getDobIsNotNull() ? pat.getDob().toString() : ""); PatientIdCollection identifers = pat.getIdentifiers(); if (identifers != null) { for (int i = 0; i < identifers.size(); i++) { ims.core.vo.PatientId id = identifers.get(i); ims.RefMan.forms.daycaseadmissiondialog.GenForm.grdIdentifiersRow row = form.grdIdentifiers().getRows().newRow(); bindColType(row, false); row.getcolIdType().setValue(id.getType()); row.setcolIdValue(id.getValue()); row.setValue(id); if (id.getVerifiedIsNotNull() && !id.getVerified() && id.getType().equals(PatIdType.NHSN)) { row.setBackColor(Color.Orange); row.setReadOnly(true); } if (id.getTypeIsNotNull() && id.getType().equals(PatIdType.NHSN) && !ConfigFlag.GEN.ALLOW_UPDATES_TO_NHS_NO.getValue()) row.setReadOnly(true); } } }
private PatientIdCollection getIdentifiersByType(PatIdType patIdType, PatientIdCollection identifiers) { PatientIdCollection coll = new PatientIdCollection(); if(identifiers == null) return coll; for(int i = 0; i < identifiers.size(); i++) { if(patIdType.equals(identifiers.get(i).getType())) coll.add(identifiers.get(i)); } return coll; }