private void SelectSymptom_Tap(object sender, SelectionChangedEventArgs e) { Reported_Symptom current = SymptomLv.SelectedItem as Reported_Symptom; if (current.symptom == "Diarrhea") { DiarrheaIntensity.Visibility = Visibility.Visible; urineOutput.Visibility = Visibility.Collapsed; skinTurgor.Visibility = Visibility.Collapsed; thirst.Visibility = Visibility.Collapsed; } else if (current.symptom == "Decreased skin turgor") { DiarrheaIntensity.Visibility = Visibility.Collapsed; urineOutput.Visibility = Visibility.Collapsed; skinTurgor.Visibility = Visibility.Visible; thirst.Visibility = Visibility.Collapsed; } else if (current.symptom == "Reduced urine") { DiarrheaIntensity.Visibility = Visibility.Collapsed; urineOutput.Visibility = Visibility.Visible; skinTurgor.Visibility = Visibility.Collapsed; thirst.Visibility = Visibility.Collapsed; } else if (current.symptom == "Thirst") { DiarrheaIntensity.Visibility = Visibility.Collapsed; urineOutput.Visibility = Visibility.Collapsed; skinTurgor.Visibility = Visibility.Collapsed; thirst.Visibility = Visibility.Visible; } else { DiarrheaIntensity.Visibility = Visibility.Collapsed; urineOutput.Visibility = Visibility.Collapsed; skinTurgor.Visibility = Visibility.Collapsed; thirst.Visibility = Visibility.Collapsed; } }
private async void Submit_Click(object sender, RoutedEventArgs e) { try { string error_msg = " is required*"; Submit.IsEnabled = false; if (ShowNameTbl.Text == "") { errorTbl.Text = "Patient name" + error_msg; } else if (ShowTelTbl.Text == "") { errorTbl.Text = "Patient telephone" + error_msg; } else if (OtherRBtn.IsChecked == true && OtherTb.Text == "") { errorTbl.Text = "Patient location" + error_msg; } else if (addSymptom.Items.Count == 0) { errorTbl.Text = "Symptom" + error_msg; } else { string patient_location = ""; if (CurrentLocationRBtn.IsChecked == true) { patient_location = AddressTB.Text; } else { patient_location = OtherTb.Text; } double h = 0; double w = 0; if (ShowWeightTbl.Text != "") { w = Convert.ToDouble(ShowWeightTbl.Text); } if (ShowHeightTbl.Text != "") { h = Convert.ToDouble(ShowHeightTbl.Text); } IMobileServiceTable <Patient> pTable = App.MobileService.GetTable <Patient>(); Patient p = new Patient() { name = ShowNameTbl.Text, address = patient_location, dob = DOBDpk.Date.UtcDateTime, gender = latestGender, height = h, weight = w, telephone = ShowTelTbl.Text }; await pTable.InsertAsync(p); var bTable = await App.MobileService.GetTable <Bayesian_Prob>().Where(bp => bp.id == "0002D6DB-71B6-4C2F-BCD6-AAD4710B6662").ToListAsync(); string empty = bTable[0].Fever; string stool_frequency_per_day = empty; string nature_of_stool = empty; string stool_type = empty; string skin_turgor = "delay 2 5s"; string urine_output = empty; string thirst = empty; string fever = empty; string vomiting = empty; string skin_temperature = empty; string eyes = empty; foreach (Symptom item in addSymptom.Items) { if (item.symptom == "Diarrhea") { stool_frequency_per_day = stoolfrequency; nature_of_stool = stoolnature; stool_type = stooltype; } else if (item.symptom == "Decreased skin turgor") { skin_turgor = skinturgor; } else if (item.symptom == "Reduced urine") { urine_output = urine; } else if (item.symptom == "Thirst") { thirst = thirststate; } else if (item.symptom == "Fever") { fever = "present"; } else if (item.symptom == "Vomiting") { vomiting = "present"; } else if (item.symptom == "Cold skin") { skin_temperature = "cold"; } else if (item.symptom == "Sunken eyes") { eyes = "sunken"; } } var Prob = await App.MobileService.GetTable <Bayesian_Prob>().Where(prob => prob.Stool_Frequency_per_Day == stool_frequency_per_day && prob.Stool_Type == stool_type && prob.Nature_of_Stool == nature_of_stool && prob.Skin_Turgor == skin_turgor && prob.Urine_Output == urine_output && prob.Thirst == thirst && prob.Fever == fever && prob.Vomiting == vomiting && prob.Skin_Temperature == skin_temperature && prob.Eyes == eyes && prob.Food == empty && prob.Water == empty).ToListAsync(); IMobileServiceTable <Disease_Report> dTable = App.MobileService.GetTable <Disease_Report>(); Disease_Report d = new Disease_Report() { description = DescriptionTb.Text, hw_id = user.id, #if WINDOWS_APP longitude = Bing.Maps.MapLayer.GetPosition(pin).Longitude, latitude = Bing.Maps.MapLayer.GetPosition(pin).Latitude, #endif #if WINDOWS_PHONE_APP longitude = MapControl.GetLocation(pin).Position.Longitude, latitude = MapControl.GetLocation(pin).Position.Latitude, #endif reported_time = DateTime.Today, occurred_time = DatePicker.Date.UtcDateTime, patient_id = p.id, prob_id = Prob[0].id, cholera = Prob[0].Cholera, salmonella = Prob[0].Samonella, rotavirus = Prob[0].Rotavirus, shigella = Prob[0].Shigella, others = Prob[0].Others }; await dTable.InsertAsync(d); IMobileServiceTable <Reported_Symptom> rTable = App.MobileService.GetTable <Reported_Symptom>(); foreach (Symptom item in addSymptom.Items) { if (item.symptom == "Diarrhea") { Reported_Symptom r = new Reported_Symptom() { disease_report_id = d.id, symptom = "stool_frequency_per_day", intensity = stoolfrequency }; await rTable.InsertAsync(r); r = new Reported_Symptom() { disease_report_id = d.id, symptom = "nature_of_stool", intensity = stoolnature }; await rTable.InsertAsync(r); r = new Reported_Symptom() { disease_report_id = d.id, symptom = "stool_type", intensity = stooltype }; await rTable.InsertAsync(r); } else if (item.symptom == "Decreased skin turgor") { Reported_Symptom r = new Reported_Symptom() { disease_report_id = d.id, symptom = "skin_turgor", intensity = skinturgor }; await rTable.InsertAsync(r); } else if (item.symptom == "Reduced urine") { Reported_Symptom r = new Reported_Symptom() { disease_report_id = d.id, symptom = "urine_output", intensity = urine }; await rTable.InsertAsync(r); } else if (item.symptom == "Thirst") { Reported_Symptom r = new Reported_Symptom() { disease_report_id = d.id, symptom = "thirst", intensity = thirststate }; await rTable.InsertAsync(r); } else if (item.symptom == "Fever") { Reported_Symptom r = new Reported_Symptom() { disease_report_id = d.id, symptom = "fever", intensity = "present" }; await rTable.InsertAsync(r); } else if (item.symptom == "Vomiting") { Reported_Symptom r = new Reported_Symptom() { disease_report_id = d.id, symptom = "vomiting", intensity = "present" }; await rTable.InsertAsync(r); } else if (item.symptom == "Cold skin") { Reported_Symptom r = new Reported_Symptom() { disease_report_id = d.id, symptom = "skin_temperature", intensity = "cold" }; await rTable.InsertAsync(r); } else if (item.symptom == "Sunken eyes") { Reported_Symptom r = new Reported_Symptom() { disease_report_id = d.id, symptom = "eyes", intensity = "sunken" }; await rTable.InsertAsync(r); } } //this.Frame.Navigate(typeof(ReportsView), user); MessageDialog dialog; //string Title = "Chance of cholera:" + disease_reports[0].cholera + "\nChance of shigella:" + disease_reports[0].shigella + "\nChance of salmonella:" + disease_reports[0].simolnelle + "\nChance of rotavirus:" + disease_reports[0].rotavirus + "\nChance of others:" + disease_reports[0].others; string Title = "Probability of this disease report"; string Content = "Cholera: " + d.cholera + "\n" + "Shigella: " + d.shigella + "\n" + "Salmoella: " + d.salmonella + "\n" + "Rotavirus: " + d.rotavirus + "\n" + "Others: " + d.others + "\n\n" + d.occurred_time.Date; dialog = new MessageDialog(Content, Title); dialog.Commands.Add(new UICommand( "OK", new UICommandInvokedHandler(this.GotoReportPage))); await dialog.ShowAsync(); } this.Frame.Navigate(typeof(ReportsView), user); Submit.IsEnabled = true; } catch (Exception ex) { } }