public PatientPastMedicalHistoryVo savePMH(PatientPastMedicalHistoryVo voPMH)
      throws StaleObjectException, UniqueKeyViolationException {
    // Ensure the value object has been validated
    if (!voPMH.isValidated()) throw new DomainRuntimeException("PMH has not been validated");

    DomainFactory factory = getDomainFactory();
    PastMedicalHistory doPMH =
        PatientPastMedicalHistoryVoAssembler.extractPastMedicalHistory(factory, voPMH);

    factory.save(doPMH);

    return PatientPastMedicalHistoryVoAssembler.create(doPMH);
  }
  /** PMH for a Patient */
  public PatientPastMedicalHistoryVo getPastMedicalHistory(PatientRefVo patient) {
    DomainFactory factory = getDomainFactory();

    PastMedicalHistory domPmh =
        PastMedicalHistory.getPastMedicalHistoryFromPatient(factory, patient.getID_Patient());

    PatientPastMedicalHistoryVo voPatientPastHistory =
        PatientPastMedicalHistoryVoAssembler.create(domPmh);
    if (voPatientPastHistory != null && voPatientPastHistory.getDiagnosisIsNotNull())
      voPatientPastHistory.getDiagnosis().sort(SortOrder.ASCENDING);
    if (voPatientPastHistory != null && voPatientPastHistory.getProcedureIsNotNull())
      voPatientPastHistory.getProcedure().sort(SortOrder.ASCENDING);
    return voPatientPastHistory;
  }