private void setMedications(PatientMedicationVoCollection patientMedicationVoCollection) { form.lyrContent().tabNursing().grdMedications().getRows().clear(); if (patientMedicationVoCollection == null) return; patientMedicationVoCollection.sort(new MedicationComparator(SortOrder.ASCENDING)); for (int i = 0; i < patientMedicationVoCollection.size(); i++) { PatientMedicationVo medication = patientMedicationVoCollection.get(i); if (medication == null) continue; setMedicationRow(form.lyrContent().tabNursing().grdMedications().getRows().newRow(), medication); } }
private void save() { PatientMedicationVoCollection voCopyColl = new PatientMedicationVoCollection(); DynamicGridColumn colCopy = form.dyngrdMedicationOverView().getColumns().getByIdentifier(new Integer(9)); for (int i = 0 ; i < form.dyngrdMedicationOverView().getRows().size() ; i++) { if (form.dyngrdMedicationOverView().getRows().get(i).getValue() instanceof PatientMedicationVo) { DynamicGridCell cellCopy = form.dyngrdMedicationOverView().getRows().get(i).getCells().get(colCopy); if (cellCopy != null && cellCopy.getType() == DynamicCellType.BOOL && ((Boolean)cellCopy.getValue()) == Boolean.TRUE ) voCopyColl.add((PatientMedicationVo)form.dyngrdMedicationOverView().getRows().get(i).getValue()); } } MedicationOverViewVo voMedOver = form.getGlobalContext().Clinical.getCurrentMedicationOverView(); if (voCopyColl.size() > 0) { voMedOver.setMedication(voCopyColl); voMedOver.setCorrectness(form.cmbCorrectness().getValue()); form.getGlobalContext().Clinical.setCurrentMedicationOverView(voMedOver); } else form.getGlobalContext().Clinical.setCurrentMedicationOverView(null); }
private void populateMedicationsGrid(PatientMedicationVoCollection medications) { // Clear dynamic grid form.dyngrdMedications().getRows().clear(); // Check medication collection if (medications == null) return; for (int i = 0; i < medications.size(); i++) { PatientMedicationVo patientMedication = medications.get(i); if (patientMedication == null) continue; populateMedicationRow(form.dyngrdMedications().getRows().newRow(), patientMedication); } }
private PatientMedicationVoCollection getSelectedMedications() { if (form.dyngrdMedications().getRows().size() == 0) return null; PatientMedicationVoCollection medications = new PatientMedicationVoCollection(); DynamicGridColumn column = form.dyngrdMedications().getColumns().getByIdentifier(COL_SELECT); for (int i = 0; i < form.dyngrdMedications().getRows().size(); i++) { DynamicGridRow row = form.dyngrdMedications().getRows().get(i); if (row == null || !(row.getValue() instanceof PatientMedicationVo) || !Boolean.TRUE.equals(row.getCells().get(column).getValue())) continue; medications.add((PatientMedicationVo) row.getValue()); } return medications; }
private void setHasMedications() { form.getLocalContext().setHasMedications(Boolean.FALSE); PatientMedicationVoCollection medications = domain.listMedicationOnAdmission(null, form.getGlobalContext().Core.getCurrentCareContext()); if (medications == null || medications.size() > 0) { form.getLocalContext().setHasMedications(Boolean.TRUE); } }
public PatientMedicationVoCollection listMedicationOnAdmission(ClinicalContactShortVo clinicalContactShortVo, CareContextRefVo careContextRefVo) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from PatientMedication t "; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); String andStr = " "; if (clinicalContactShortVo != null) { hql.append(andStr + " t.clinicalContact.id = :Id"); markers.add("Id"); values.add(clinicalContactShortVo.getID_ClinicalContact()); andStr = " and "; } if (careContextRefVo != null) { hql.append(andStr + " t.careContext.id = :IdCX"); markers.add("IdCX"); values.add(careContextRefVo.getID_CareContext()); andStr = " and "; } if (markers.size() > 0) query += " where "; query += hql.toString(); return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(factory.find(query, markers, values)); }
/** * Lists Medication */ public PatientMedicationVoCollection listMedicationOnAdmission(ClinicalContactShortVo clinicalContactShortVo, CareContextRefVo careContextRefVo, Boolean isDiscontinued) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from PatientMedication t "; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); String andStr = " "; if (clinicalContactShortVo != null) { hql.append(andStr + " t.clinicalContact.id = :Id"); markers.add("Id"); values.add(clinicalContactShortVo.getID_ClinicalContact()); andStr = " and "; } if (careContextRefVo != null) { hql.append(andStr + " t.careContext.id = :IdCX"); markers.add("IdCX"); values.add(careContextRefVo.getID_CareContext()); andStr = " and "; } if (isDiscontinued != null) { hql.append(andStr + " t.isDiscontinued = :IsDiscontinued"); markers.add("IsDiscontinued"); values.add(isDiscontinued); andStr = " and "; } if (markers.size() > 0) query += " where "; query += hql.toString(); return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(factory.find(query, markers, values)); }
public PatientMedicationVoCollection listMedications(MedicationOverviewRefVo medOverview) { if (medOverview==null) { throw new DomainRuntimeException("Invalid Medication Overview"); } String hql = "from PatientMedication as p1_1 where (p1_1.id in (select p1_1.id from MedicationOverview as m1_1 left join m1_1.medication as p1_1 where (m1_1.id = :MedicationOverview_id)))"; return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(getDomainFactory().find(hql, new String[]{"MedicationOverview_id"}, new Object[]{medOverview.getID_MedicationOverview()})); }
private void copyMedicationOverViewDropAuthoringHCPAndDiscontinuedMeds(MedicationOverViewVo currentMedicationOverView) { currentMedicationOverView.setAuthoringInformation(null); PatientMedicationVoCollection copyOfMeds = new PatientMedicationVoCollection(); for(int i = 0 ; i < currentMedicationOverView.getMedication().size() ; i++) { PatientMedicationVo voMed = currentMedicationOverView.getMedication().get(i); if ( (voMed.getIsDiscontinued() == null) || (voMed.getIsDiscontinuedIsNotNull() && (voMed.getIsDiscontinued().booleanValue() == false)) && (voMed.getPrescribedDosesIsNotNull())) { MedicationDoseCollection copyOfDoses = new MedicationDoseCollection(); boolean bAllDosesAreDiscontinued = true; MedicationDose voDose = null; //Loop thru to see if collection has any non-discontinued Doses. for (int k = 0 ; k < voMed.getPrescribedDoses().size() ; k++) { voDose = voMed.getPrescribedDoses().get(k); if ((voDose.getIsStopped() == null) || (voDose.getIsStoppedIsNotNull() && (voDose.getIsStopped().booleanValue() == false)) ) bAllDosesAreDiscontinued = false; } //If there is then copy valid doses and the med itself. if (!bAllDosesAreDiscontinued) { for(int j = 0 ; j < voMed.getPrescribedDoses().size() ; j++) { voDose = voMed.getPrescribedDoses().get(j); if ((voDose.getIsStopped() == null) || (voDose.getIsStoppedIsNotNull() && (voDose.getIsStopped().booleanValue() == false)) ) { voDose.setID_PatientMedicationDose(null); voDose.setAuthoringInformation(form.customControlAuthoringInfo().getValue()); voDose.setIsCopied(new Boolean(true)); copyOfDoses.add(voDose); } } voMed.setPrescribedDoses(copyOfDoses); voMed.setID_PatientMedication(null); voMed.setAuthoringInformation(form.customControlAuthoringInfo().getValue()); voMed.setCareContext(form.getGlobalContext().Core.getCurrentCareContext()); voMed.setNoDaysSupply(null);//wdev-1462 voMed.setIsInTTO(null);//wdev-1462 voMed.setIsCopied(new Boolean(true)); copyOfMeds.add(voMed); } } } currentMedicationOverView.setMedication(copyOfMeds); currentMedicationOverView.setCareContext(form.getGlobalContext().Core.getCurrentCareContext()); form.getLocalContext().setCurrentOverView(currentMedicationOverView); }
protected void onFormDialogClosed(FormName formName, DialogResult result) throws PresentationLogicException { /*if (formName.equals(form.getForms().Core.YesNoDialog) && result.equals(DialogResult.YES)) { saveInactiveRecord(); }*/ if( formName.equals(form.getForms().Clinical.ReasonDialog) && result.equals(DialogResult.OK)) { saveInactiveRecord(); } else if (formName.equals(form.getForms().Clinical.CopyLastMedication) && result.equals(DialogResult.OK)) { PatientMedicationVoCollection voCollMedication = form.getGlobalContext().Clinical.getPatientMedicationCollection(); if(voCollMedication != null) { for(int i=0; i<voCollMedication.size();i++) { voCollMedication.get(i).setID_PatientMedication(null); // Check prescribed doses and clear the ID's if (voCollMedication.get(i).getPrescribedDosesIsNotNull() && voCollMedication.get(i).getPrescribedDoses().size() > 0) { voCollMedication.get(i).getPrescribedDoses().get(0).setID_PatientMedicationDose(null); } voCollMedication.get(i).setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); voCollMedication.get(i).setCareContext(form.getGlobalContext().Core.getCurrentCareContext()); voCollMedication.get(i).validate(); try { domain.saveMedicationOnAdmission(voCollMedication.get(i)); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); onFormOpen(); break; } } } open(); } }
public PatientMedicationVoCollection listMedications(PatientRefVo patientRef, DateTime startDateTime) { // Check patient if (patientRef == null || !patientRef.getID_PatientIsNotNull()) return null; // Get last care context (of type INPATIET) StringBuilder ccQuery = new StringBuilder(); ccQuery.append("select cc from PatientMedication as pmed join pmed.careContext as cc where pmed.patient.id = :PAT_ID and cc.context.id = :CC_TYPE and (pmed.isRIE is null or pmed.isRIE = 0) and (pmed.isDiscontinued is null or pmed.isDiscontinued = 0)"); ArrayList<String> paramCCNames = new ArrayList<String>(); ArrayList<Object> paramCCValues = new ArrayList<Object>(); paramCCNames.add("PAT_ID"); paramCCNames.add("CC_TYPE"); paramCCValues.add(patientRef.getID_Patient()); paramCCValues.add(ContextType.INPATIENT.getID()); if (startDateTime != null) { ccQuery.append(" and cc.startDateTime <= :DATE"); paramCCNames.add("DATE"); paramCCValues.add(startDateTime.getJavaDate()); } ccQuery.append(" order by cc.startDateTime desc"); CareContextLiteVo careContext = CareContextLiteVoAssembler.create((CareContext) getDomainFactory().findFirst(ccQuery.toString(), paramCCNames, paramCCValues)); if (careContext == null || !careContext.getID_CareContextIsNotNull()) return null; String hqlQuery = "select pmed from PatientMedication as pmed where pmed.patient.id = :PAT_ID and pmed.careContext.id = :CC_ID and (pmed.isDiscontinued is null or pmed.isDiscontinued is false)"; ArrayList<String> paramPMedNames = new ArrayList<String>(); ArrayList<Object> paramPMedValues = new ArrayList<Object>(); paramPMedNames.add("PAT_ID"); paramPMedNames.add("CC_ID"); paramPMedValues.add(patientRef.getID_Patient()); paramPMedValues.add(careContext.getID_CareContext()); return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(getDomainFactory().find(hqlQuery, paramPMedNames, paramPMedValues)); }