private void KhamBenhBtn_Click(object sender, RoutedEventArgs e) { try { if (DSLuotKhamListView.SelectedIndex == -1) { return; } ThongTinLuotKhamTab.IsEnabled = true; BenhNhan bn = DSLuotKhamListView.SelectedItem as BenhNhan; LuotKham lk = LuotKhamDAO.getLuotKhamBaseOnDateAndPatient(DateTime.Today.ToString("dd/MM/yyyy"), bn.CMND); Bussiness.currentLuotKhamID = -1; BenhComboBox.SelectedItem = lk.Benh; Bussiness.currentLuotKhamID = lk.ID; LuotKhamIDLabel.Content = "ID: " + lk.ID; BenhComboBox.SelectedItem = lk.Benh; if (!lk.Benh.Equals("")) { Benh b = BenhDAO.getBenh(lk.Benh); TrieuChungTxtBlock.Text = b.TrieuChung; } TienKhamTxtBlock.Text = "Tien kham: " + lk.TienKham.ToString(); TienThuocTxtBlock.Text = "Tien thuoc: " + lk.TienThuoc.ToString(); TongChiPhiTxtBlock.Text = "Tong chi phi: " + lk.ChiPhi.ToString(); UserInfoTxtBlock.Text = bn.HoTen; Bussiness.listLuotThuoc.Clear(); foreach (LuotThuoc lt in lk.LuotThuocs) { Bussiness.listLuotThuoc.Add(lt); } ThongTinLuotKhamTab.IsSelected = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public static void init() { readSettings(); listAllBenh = BenhDAO.getAllList(); if (!listAllBenh.Any()) { BenhDAO.addOrUpdateBenh("unidentified", new QuanLyPhongKham.Benh()); listAllBenh.Add(new Benh()); } listAllThuoc = ThuocDAO.getAllList(); foreach (Thuoc t in listAllThuoc) { bindingListAllThuoc.Add(t); } IList <LuotKham> list = LuotKhamDAO.getAllLuotKhamOfCurrentDay(); listBenhNhan = new BindingList <BenhNhan>(); if (list.Any()) { for (int i = 0; i < list.Count; i++) { listBenhNhan.Add(list.ElementAt(i).BenhNhan1); } } listLuotKhamTrongNgay = new BindingList <LuotKham>(); listThongKeLuotkham = new BindingList <ThongKeLuotKham>(); listThongKeLuotThuoc = new BindingList <ThongKeLuotThuoc>(); }
public static string ChanDoanBenh(string trieuchung) { string res = "Cac benh lien quan: "; string[] tokens = trieuchung.Split(new string[] { " - " }, StringSplitOptions.RemoveEmptyEntries); IList <Benh> list = BenhDAO.getAllList(); int index = 0; foreach (Benh b in list) { bool check = true; for (int i = 0; i < tokens.Count(); i++) { if (!b.TrieuChung.Contains(tokens[i])) { check = false; break; } } if (check) { if (index != 0) { res += ", "; } res += b.LoaiBenh; index++; } } return(res); }
public static int addOrUpdateBenh(string loaibenh, string trieuchung) { Benh benh = BenhDAO.getBenh(loaibenh); if (benh == null) { benh = new QuanLyPhongKham.Benh(); } benh.LoaiBenh = loaibenh; benh.TrieuChung = trieuchung; int res = BenhDAO.addOrUpdateBenh(loaibenh, benh); if (res == 1) { listAllBenh.Add(benh); } if (res == 0) { foreach (Benh b in listAllBenh) { if (b.LoaiBenh.Equals(loaibenh)) { b.TrieuChung = trieuchung; } } } return(res); }
private void BenhComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (Bussiness.currentLuotKhamID == -1) { return; } if ((BenhComboBox.SelectedItem as string).Equals("unidentified")) { Bussiness.updateLuotKham(Bussiness.currentLuotKhamID, "unidentified"); } Benh benh = BenhDAO.getBenh(BenhComboBox.SelectedItem as string); TrieuChungTxtBlock.Text = benh.TrieuChung; Bussiness.updateLuotKham(Bussiness.currentLuotKhamID, benh.LoaiBenh); }