public TreatmentRepresentation(TreatmentDto treatmentDTO, UriInfo context) {
   this.diagnosis = treatmentDTO.getDiagnosis();
   this.patient.setRelation(Representation.RELATION_PATIENT);
   this.patient.setMediaType(Representation.MEDTA_TYPE);
   UriBuilder ub1 = context.getBaseUriBuilder();
   this.patient.setUrl(
       ub1.path("patient").path("{id}").build(treatmentDTO.getPatientId()).toString());
   this.provider.setRelation(Representation.RELATION_PROVIDER);
   this.provider.setMediaType(Representation.MEDTA_TYPE);
   UriBuilder ub2 = context.getBaseUriBuilder();
   this.provider.setUrl(
       ub2.path("provider").path("{id}").build(treatmentDTO.getPatientId()).toString());
   if (treatmentDTO.TreatmentType instanceof DrugTreatmentType) {
     DrugTreatmentType dt = (DrugTreatmentType) treatmentDTO.TreatmentType;
     this.drugTreatment.setDosage(dt.getDosage());
     this.drugTreatment.setName(dt.getName());
   } else if (treatmentDTO.TreatmentType instanceof SurgeryType) {
     this.surgery.setDate(((SurgeryType) treatmentDTO.TreatmentType).getDate());
   } else if (treatmentDTO.TreatmentType instanceof RadiologyType) {
     List<Date> dates = ((RadiologyType) treatmentDTO.TreatmentType).getDate();
     List<Date> treatmentDates = this.radiology.getDate();
     for (Date i : dates) {
       treatmentDates.add(i);
     }
   }
 }
 public TreatmentDto createTreatmentDto(DrugTreatment t) {
   TreatmentDto treatment = factory.createTreatmentDto();
   treatment.setDiagnosis(t.getDiagnosis());
   DrugTreatmentType drugTreatment = new DrugTreatmentType();
   drugTreatment.setDosage(t.getDosage());
   drugTreatment.setName(t.getDrug());
   treatment.setDrugTreatment(drugTreatment);
   return treatment;
 }