*/
private MedicinePatient convertToLocalPatientMedicine(PatientMedicineWs patientMedicineWs, Patient patient) throws ExceptionDAO {
if (patientMedicineWs == null) {
return null;
}
Medicine medicine = FacadeDB.getInstance().getMedicineSyncBroker().getMedicineByRemoteId(patientMedicineWs.getMedicineId());
if (medicine == null) {
return null;
}
MedicinePatient medicinePatient = new MedicinePatient();
MedicinePatientId id = new MedicinePatientId(medicine.getId(), patient.getId());
medicinePatient.setId(id);
medicinePatient.setMedicine(medicine);
medicinePatient.setPatient(patient);
Integer difAges = patient.getAge() - patientMedicineWs.getAgeAtStart();
medicinePatient.setAgeAtStartAsInteger(difAges);