コード例 #1
0
  @Override
  public void forSave(Encounter encounter, EncounterTransaction encounterTransaction) {
    List<EncounterTransaction.Diagnosis> diagnoses = encounterTransaction.getDiagnoses();
    if (!diagnoses.isEmpty()) {
      Set<Obs> obsAtTopLevel = encounter.getObsAtTopLevel(false);
      Concept bahmniDiagnosisStatusConcept =
          bahmniDiagnosisMetadata.diagnosisSchemaContainsStatus()
              ? bahmniDiagnosisMetadata.getBahmniDiagnosisStatusConcept()
              : null;
      Concept bahmniInitialDiagnosisConcept =
          bahmniDiagnosisMetadata.getBahmniInitialDiagnosisConcept();
      Concept bahmniDiagnosisRevisedConcept =
          bahmniDiagnosisMetadata.getBahmniDiagnosisRevisedConcept();

      for (EncounterTransaction.Diagnosis diagnosis : diagnoses) {
        BahmniDiagnosisRequest bahmniDiagnosisRequest = (BahmniDiagnosisRequest) diagnosis;
        addExtraMetadata(
            obsAtTopLevel,
            bahmniDiagnosisRequest,
            bahmniInitialDiagnosisConcept,
            bahmniDiagnosisStatusConcept,
            bahmniDiagnosisRevisedConcept);
        updateRevisedFlagOfPreviousDiagnosis(bahmniDiagnosisRequest, bahmniDiagnosisRevisedConcept);
      }
    }
  }
コード例 #2
0
  private void addExtraMetadata(
      Set<Obs> obsAtTopLevel,
      BahmniDiagnosisRequest bahmniDiagnosisRequest,
      Concept bahmniInitialDiagnosisConcept,
      Concept bahmniDiagnosisStatusConcept,
      Concept bahmniDiagnosisRevisedConcept) {
    Obs matchingDiagnosisObs =
        bahmniDiagnosisMetadata.findMatchingDiagnosis(obsAtTopLevel, bahmniDiagnosisRequest);

    updateInitialDiagnosis(
        matchingDiagnosisObs, bahmniDiagnosisRequest, bahmniInitialDiagnosisConcept);
    if (bahmniDiagnosisStatusConcept != null) {
      updateDiagnosisStatus(
          matchingDiagnosisObs, bahmniDiagnosisRequest, bahmniDiagnosisStatusConcept);
    }
    updateRevisedFlag(matchingDiagnosisObs, false, bahmniDiagnosisRevisedConcept);
  }