public async Task <ApiResponse> AddMedicineToPatient(string emrPatientId, [FromBody] MedicalConditionRequest request) { try { //emrPatientId = "1795445"; var result = await _fhirConditionService.AddPatientConditions(emrPatientId, request); return(new ApiResponse("success")); } catch (Exception ex) { throw new ApiException(ex); } }
public async Task <string> AddPatientConditions(string emrPatientId, MedicalConditionRequest MedicalRequestModel ) { //List<MedicalConditionEntity> medicalConditionList, List<AnatomyEntity> anatomyList if (string.IsNullOrEmpty(emrPatientId)) { throw new Exception("EMR Patient Id is invalid or not found."); } try { var request = new Condition { ClinicalStatus = Condition.ConditionClinicalStatusCodes.Active, VerificationStatus = Condition.ConditionVerificationStatus.Confirmed, Subject = new ResourceReference { Reference = $"Patient/{emrPatientId}", }, }; List <MedicalConditionEntity> medicalConditionList = MedicalRequestModel.MedicalConditions; List <AnatomyEntity> anatomyList = MedicalRequestModel.Anatomies; request.Category = GetCategories(medicalConditionList); request.Severity = GetSeverityList(medicalConditionList); request.Code = GetProblems(medicalConditionList); request.BodySite = GetBodySites(anatomyList); var fhirClient = new FhirClient("http://hapi.fhir.org/baseDstu3"); var result = await fhirClient.CreateAsync <Condition>(request); return(result.Id); } catch (Exception) { throw; } }
public async Task <DrugSuggestionModel> GetDrugSuggestionsAsync(MedicalConditionRequest medicalRequest) { List <MedicationSuggestionModel> demo; try { if (medicalRequest.MedicalConditions == null) { return(null); } var drugSuggestionList = await LoadFromFile(); if (drugSuggestionList == null) { return(null); } var conditionList = medicalRequest.MedicalConditions; if (conditionList == null) { return(null); } var medicinelist = drugSuggestionList.SelectMany(x => x.Medications).ToList(); foreach (var symptom in conditionList) { var item = medicinelist.Where(x => x.Symptoms.Contains(symptom.Text)); } return(null); } catch (Exception) { throw; } }