public bool patientAdd(PatientModels pm) { String[] prm = new String[] { "sid", "LName", "FName", "MName", "studCourse", "studYear", "studDept", "BDay", "studAge", "studSex", "CS", "studNat", "HA", "BA", "FN", "FO", "FTCN", "MN", "MO", "MTCN", "LLN", "LTCN", "ECN", "Rel", "ETCN", "studFMP", "studLMP", "WKG", "HCM", "studBMI", "studBP", "studPR", "studRR", "studTemp" }; string[] val = new string[] { pm.studentId.ToString(), pm.lastName, pm.firstName, pm.middleName, pm.course, pm.year.ToString(), pm.department, pm.birthday, pm.age.ToString(), pm.sex, pm.civilStatus, pm.nationality, pm.homeAddress, pm.boardingAddress, pm.fatherName, pm.fatherOccupation, pm.fatherNumber, pm.motherName, pm.motherOccupation, pm.motherNumber, pm.landladyName, pm.landladyNumber, pm.emergencyCall, pm.relation, pm.emergencyNumber.ToString(), pm.firstMenstrualdate, pm.lastMenstrualdate, pm.weight.ToString(), pm.height.ToString(), pm.bmi, pm.bp, pm.pr, pm.rr, pm.temp }; bool valid = false; try { con.command.Parameters.Clear(); con.ConnectToDB(); con.command.CommandText = "CreateStudents"; con.command.CommandType = CommandType.StoredProcedure; for (int ctr = 0; ctr <= 33; ctr++) { con.command.Parameters.AddWithValue(prm[ctr], val[ctr]); } if (con.command.ExecuteNonQuery() == 1) { con.close(); valid = true; } } catch (MySqlException ex) { MessageBox.Show("" + ex); } return(valid); }
public ActionResult Add(string id) { var patientAdd = new PatientAdd(); var savePath = Server.MapPath("~/Uploads/"); var fileName = "default.jpg"; try { patientAdd.ImageStream = ImageHelper.BaseDateImage(savePath + "/" + fileName); var strValue = "1990-01-01"; DateTime objDate; DateTime.TryParse(strValue, out objDate); patientAdd.Dob = objDate; patientModel = new PatientModels { patientAdd = patientAdd, checkPost = false }; } catch (Exception ex) { log.Error(ex); ModelState.AddModelError(string.Empty, Translator.UnexpectedError); } ViewData["referrerId"] = id; return(View(patientModel)); }
public ActionResult ChangePass(string oldPass, string newPass1, string newPass2) { int r = new PatientModels().changePass(Session[Constants.SESSION_ID] as string, oldPass, newPass1, newPass2); if (r == -1) { ViewBag.Err1 = "Hãy nhập mật khẩu mới"; return(View()); } if (r == -2) { ViewBag.Err2 = "Nhập lại không đúng"; return(View()); } if (r == -3) { ViewBag.Err3 = "Sai mật khẩu"; return(View()); } if (r == 0) { ViewBag.Err4 = "Hệ thống đang cập nhập, vui lòng quay lại sau"; return(View()); } ViewBag.Success = "Cập nhật mật khẩu thành công"; return(View()); }
public bool Check(PatientModels PatientModel) { bool result = true; string connectionString = @"Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-WebApplication1-20201104082923.mdf;Initial Catalog=aspnet-WebApplication1-20201104082923;Integrated Security=True"; string sqlExpression = "UPDATE Zayavki SET Status=@Status WHERE Email=@Email"; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand sql = new SqlCommand(sqlExpression, connection); sql.Parameters.Add("@Email", SqlDbType.NVarChar); sql.Parameters["@Email"].Value = PatientModel.Email; sql.Parameters.Add("@Status", SqlDbType.NVarChar); sql.Parameters["@Status"].Value = "Check out"; try { connection.Open(); Int32 rowsAffected = sql.ExecuteNonQuery(); Console.WriteLine("RowsAffected: {0}", rowsAffected); } catch (Exception) { result = false; } return(result); } }
public ActionResult Edit(MyClinic.Infrastructure.PatientEdit patientEdit) { bool checkError = true; try { Patient originPatient = patientRepository.GetPatientById(patientEdit.Id); if (ModelState.IsValid) { Patient newPatient = Utilities.ObjectCopier.Copy <Patient>(originPatient); var objSession = Session["user"] as MyClinic.Infrastructure.SessUser; var savePathImage = Server.MapPath("~/Uploads/patient/") + originPatient.Id; ImageHelper.SaveImage(savePathImage, originPatient.Id + ".jpg", patientEdit.ImageStream); patientEdit.Age = 0; newPatient.Name = patientEdit.Name; newPatient.Email = patientEdit.Email; newPatient.Sex = patientEdit.Sex; newPatient.Tel = patientEdit.Tel; newPatient.Dob = patientEdit.Dob; newPatient.Image = newPatient.Id + ".jpg"; string diffString = originPatient.EnumeratePropertyDifferencesInString(newPatient); patientRepository.UpdateFieldChangedOnly(originPatient, newPatient); /*For Add New Record to LogTable*/ logTran.UserId = objSession.UserId; logTran.ProcessType = "Edit User"; logTran.Description = "Edit User value as follow: " + diffString; logTran.LogDate = DateTime.Now; logRepository.Add(logTran); checkError = false; } if (checkError == true) { patientModel = new PatientModels { patient = originPatient, patientEdit = patientEdit, checkError = checkError, checkPost = true }; return(View(patientModel)); } else { return(RedirectToAction("Index", "Patient")); } } catch (Exception ex) { log.Error(ex); ModelState.AddModelError(string.Empty, Translator.UnexpectedError); } return(View(patientModel)); }
public async Task <IActionResult> UpdatePatientResources(int patientId) { var patientModels = new PatientModels(); // Use viewmodel PatientModels to bring in both patient data and the list of all resources patientModels.Patient = await _patientService.GetPatientById(patientId); patientModels.AllResources = await _resourceService.GetAllResources(); return(View(patientModels)); }
public ActionResult Edit(huyetap ha) { try { // TODO: Add update logic here PatientModels pa_model = new PatientModels(); pa_model.update(ha.benhsu.benhnhan); HuyetapModels ha_model = new HuyetapModels(); ha_model.update(ha); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(string id) { PatientEdit patientEdit = new PatientEdit(); var intId = 0; int.TryParse(id, out intId); try { Patient patient = patientRepository.GetPatientById(intId); if (patient == null) { return(RedirectToAction("Error404", "Error")); } else { var path = ""; var fileName = patient.Id + ".jpg"; var savePath = Server.MapPath("~/Uploads/patient/") + patient.Id; // Check for Directory, If not exist, then create it if (Directory.Exists(savePath)) { path = "/Uploads/patient/" + patient.Id + "/" + fileName; patient.Image = path; } else { savePath = Server.MapPath("~/Uploads/"); fileName = "default.jpg"; } patientEdit.ImageStream = ImageHelper.BaseDateImage(savePath + "/" + fileName); patient.Image = Common.ConcatHost(path); } patientModel = new PatientModels { patient = patient, patientEdit = patientEdit, checkPost = false }; } catch (Exception ex) { log.Error(ex); ModelState.AddModelError("error", Translator.UnexpectedError); } return(View(patientModel)); }
// // GET: /Bloodpressure/Edit/5 public ActionResult Edit(string id) { TayBacDBContext dbContext = new TayBacDBContext(); List <object> ls = new List <object>(); HospitalModels hp_model = new HospitalModels(); HuyetapModels ha_model = new HuyetapModels(); huyetap ha = ha_model.getByID(id); benhnhan pa = new benhnhan(); KhoaModels kh_model = new KhoaModels(); GiuongModels gi_model = new GiuongModels(); List <benhvien> lsbv = hp_model.getAll(); List <khoa> lskhoa = new List <khoa>(); if (lsbv.Count() > 0) { lskhoa = kh_model.getListByIdBV(lsbv.First().idbv); } List <giuong> lsgiuong = new List <giuong>(); if (lskhoa.Count() > 0) { lsgiuong = gi_model.getListByIdKhoa(lskhoa.First().idkhoa); } // BenhsuModels bs_model = new BenhsuModels(); benhsu bs_data = bs_model.getByID(ha.idbs); PatientModels pa_model = new PatientModels(); benhnhan pa_data = pa_model.detail(bs_data.idbn); benhvien bv_data = hp_model.details(pa_data.idbv); pa_data.benhvien = bv_data; bs_data.benhnhan = pa_data; ha.benhsu = bs_data; // ls.Add(lsbv); ls.Add(ha); ls.Add(pa); ls.Add(lskhoa); ls.Add(lsgiuong); return(View(ls)); }
public ActionResult Edit([Bind(Exclude = "")] PatientModels PatientModel) { try { if (Patietn.Edit(PatientModel)) { return(RedirectToAction("Index")); } else { return(View("Edit")); } } catch { return(View("Edit")); } }
private void OnDoNameCheck() { PatientIdFailToOpen.Clear(); PatientModels.Clear(); foreach (var s in PatientIdCollection) { var patient = app.OpenPatientById(s.PatientId); if (null != patient) { PatientModels.Add(new PatientModel(patient)); } else { PatientIdFailToOpen.Add(s.PatientId); } app.ClosePatient(); } }
public ActionResult Detail(string id) { var intId = 0; int.TryParse(id, out intId); IEnumerable <DTODiagnosis> listDiagnosis = null; try { IDiagnosisRepository diagnosisRepository = new DiagnosisRepository(); Patient patient = patientRepository.GetPatientById(intId); if (patient == null) { return(RedirectToAction("Error404", "Error")); } else { listDiagnosis = diagnosisRepository.GetListDiagnosisByPatientId(intId); var path = "/Uploads/default.jpg"; var fileName = patient.Id + ".jpg"; var savePath = Server.MapPath("~/Uploads/Patient/") + patient.Id; // Check for Directory, If exist if (Directory.Exists(savePath)) { path = "/Uploads/Patient/" + patient.Id + "/" + fileName; } patient.Image = Common.ConcatHost(path); patientModel = new PatientModels { patient = patient, listDiagnosis = listDiagnosis }; } } catch (Exception ex) { log.Error(ex); ModelState.AddModelError("error", Translator.UnexpectedError); } return(View(patientModel)); }
public bool Create(PatientModels PatientModel) { bool result = true; string connectionString = @"Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-WebApplication1-20201104082923.mdf;Initial Catalog=aspnet-WebApplication1-20201104082923;Integrated Security=True"; string sqlExpression = "INSERT INTO Patient ([Gender], [FIO], [Date_of_Birth], [Policy_number], [PassportID], [Job], [Disability], [Chronic_diseases], [Email]) VALUES (@Gender, @FIO, @Date_of_Birth, @Policy_number, @PassportID, @Job, @Disability, @Chronic_diseases, @Email)"; //AND Update AspNetUsers SET Policy_number=@Policy_number WHERE Email=@Email"; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand sql = new SqlCommand(sqlExpression, connection); sql.Parameters.Add("@Gender", SqlDbType.NVarChar); sql.Parameters["@Gender"].Value = PatientModel.Gender; sql.Parameters.Add("@FIO", SqlDbType.NVarChar); sql.Parameters["@FIO"].Value = PatientModel.FIO; sql.Parameters.Add("@Date_of_Birth", SqlDbType.Date); sql.Parameters["@Date_of_Birth"].Value = PatientModel.Date_of_Birth; sql.Parameters.Add("@Policy_number", SqlDbType.NVarChar); sql.Parameters["@Policy_number"].Value = PatientModel.Policy_number; sql.Parameters.Add("@PassportID", SqlDbType.NVarChar); sql.Parameters["@PassportID"].Value = PatientModel.PassportID; sql.Parameters.Add("@Job", SqlDbType.NVarChar); sql.Parameters["@Job"].Value = PatientModel.Job; sql.Parameters.Add("@Disability", SqlDbType.NVarChar); sql.Parameters["@Disability"].Value = PatientModel.Disability; sql.Parameters.Add("@Chronic_diseases", SqlDbType.NVarChar); sql.Parameters["@Chronic_diseases"].Value = PatientModel.Chronic_diseases; sql.Parameters.Add("@Email", SqlDbType.NVarChar); sql.Parameters["@Email"].Value = PatientModel.Email; try { connection.Open(); int rowsAffected = sql.ExecuteNonQuery(); Console.WriteLine("RowsAffected: {0}", rowsAffected); } catch (Exception) { result = false; } return(result); } }
public bool Edit(PatientModels PatientModel) { bool result = true; string connectionString = @"Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-WebApplication1-20201104082923.mdf;Initial Catalog=aspnet-WebApplication1-20201104082923;Integrated Security=True"; string sqlExpression = "UPDATE Patient SET FIO=@FIO, FIO=@FIO, Gender=@Gender, Date_of_Birth=@Date_of_Birth, Policy_number=@Policy_number, PassportID=@PassportID, Job=@Job, Disability=@Disability, Chronic_diseases=@Chronic_diseases WHERE Id=@Id"; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand sql = new SqlCommand(sqlExpression, connection); sql.Parameters.Add("@Id", SqlDbType.Int); sql.Parameters["@Id"].Value = PatientModel.Id; sql.Parameters.Add("@Gender", SqlDbType.NVarChar); sql.Parameters["@Gender"].Value = PatientModel.Gender; sql.Parameters.Add("@FIO", SqlDbType.NVarChar); sql.Parameters["@FIO"].Value = PatientModel.FIO; sql.Parameters.Add("@Date_of_Birth", SqlDbType.Date); sql.Parameters["@Date_of_Birth"].Value = PatientModel.Date_of_Birth; sql.Parameters.Add("@Policy_number", SqlDbType.NVarChar); sql.Parameters["@Policy_number"].Value = PatientModel.Policy_number; sql.Parameters.Add("@PassportID", SqlDbType.NVarChar); sql.Parameters["@PassportID"].Value = PatientModel.PassportID; sql.Parameters.Add("@Job", SqlDbType.NVarChar); sql.Parameters["@Job"].Value = PatientModel.Job; sql.Parameters.Add("@Disability", SqlDbType.NVarChar); sql.Parameters["@Disability"].Value = PatientModel.Disability; sql.Parameters.Add("@Chronic_diseases", SqlDbType.NVarChar); sql.Parameters["@Chronic_diseases"].Value = PatientModel.Chronic_diseases; try { connection.Open(); int rowsAffected = sql.ExecuteNonQuery(); Console.WriteLine("RowsAffected: {0}", rowsAffected); } catch (Exception) { result = false; } return(result); } }
public bool Detali(PatientModels PatientModel) { bool result = true; string connectionString = @"Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-WebApplication1-20201104082923.mdf;Initial Catalog=aspnet-WebApplication1-20201104082923;Integrated Security=True"; string sqlExpression = "SELECT * From Patient"; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand sql = new SqlCommand(sqlExpression, connection); try { connection.Open(); Int32 rowsAffected = sql.ExecuteNonQuery(); Console.WriteLine("RowsAffected: {0}", rowsAffected); } catch (Exception) { result = false; } return(result); } }
public ActionResult Edit(string id = "0") { benhnhan model = new PatientModels().detail(id); ViewBag.getListHospitals = new HospitalModels().getListHospitals(); ViewBag.getListTinhs = new TinhModels().getListTinhs(); ViewBag.getListXas = new XaModels().getListXas(); ViewBag.getListHuyens = new HuyenModels().getListHuyens(); if (((Session[Constants.SESSION_GROUPID] as string) == Constants.G_MANAGER || (Session[Constants.SESSION_GROUPID] as string) == Constants.G_STAFF) && model.idbv.Trim() != (Session[Constants.SESSION_HOSPITAL_ID] as string).Trim()) { return(RedirectToAction(actionName: "NotAuthorize", controllerName: "Login")); } if ((Session[Constants.SESSION_GROUPID] as string) == Constants.G_PATIENT && model.idbn.Trim() != (Session[Constants.SESSION_ID] as string).Trim()) { return(RedirectToAction(actionName: "NotAuthorize", controllerName: "Login")); } return(View(model)); }
public ActionResult Ajindex(int?pageNo, int?pageSize, int?pageStatus, string orderBy, string order, string searchBy, string keyword) { try { var objSession = Session["user"] as MyClinic.Infrastructure.SessUser; string userType = objSession.UserType; MyClinic.Infrastructure.User user = new MyClinic.Infrastructure.User(); var _pageNo = pageNo ?? 1; var _pageSize = pageSize ?? Common.defaultPageSize; var _pageStatus = pageStatus ?? 1; orderBy = orderBy.Replace(" ", "") ?? Common.defaultOrderBy; order = order ?? Common.defaultListOrder; int totalRecords = 0; var patients = patientRepository.Search(searchBy, keyword, orderBy, order, _pageNo, _pageSize, out totalRecords); var listResult = Paging.GetResultInfo(totalRecords, _pageNo, _pageSize); var paging = Paging.GetPaging(totalRecords, _pageNo, _pageSize, _pageStatus, Common.defaultNoOfPageLinkList, "$common.pagingClick", orderBy, order); var itemPerPage = Paging.getItemPerPage(totalRecords, _pageSize, orderBy, order); PageUtilities pageUtilities = new PageUtilities() { listHeader = listResult, listFooter = paging + itemPerPage, order = order, orderBy = orderBy }; patientModel = new PatientModels { patients = patients, pageUtilities = pageUtilities, }; } catch (Exception ex) { log.Error(ex); ModelState.AddModelError("error", Translator.UnexpectedError); } return(View("Ajindex", "_LayoutBlank", patientModel)); }
//public ActionResult Create(FormCollection collection) public ActionResult Create(benhnhan pa, huyetap ha) { try { PatientModels pa_model = new PatientModels(); pa.idbn = StandString.generateBNID(8); pa_model.create(pa); benhsu bes = new benhsu(); bes.idbn = pa.idbn; bes.idbs = StandString.generateBESID(8); BenhsuModels bes_model = new BenhsuModels(); bes_model.insert(bes); HuyetapModels ha_model = new HuyetapModels(); ha.idhuyetap = bes.idbs; ha.idbs = bes.idbs; ha_model.insert(ha); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create([Bind(Exclude = "")] PatientModels PatientModel) { using (var context = new ApplicationDbContext()) { var copy = @"Update AspNetUserRoles SET RoleId='3' WHERE AspNetUserRoles.UserId ='" + User.Identity.GetUserId() + "'"; var resultcopy = context.Database.SqlQuery <ZayavkiModels>(copy).ToList(); } try { if (Patietn.Create(PatientModel)) { return(RedirectToAction("Index")); } else { return(View("Create")); } } catch { return(View("Create")); } }
public ActionResult Index() { try{ string searchBy = ""; string keyword = ""; var orderBy = Common.defaultOrderBy; var order = Common.defaultListOrder; var _pageNo = 1; var _pageSize = 10; var _pageStatus = 1; var totalRecords = 0; var patients = patientRepository.Search(searchBy, keyword, orderBy, order, _pageNo, _pageSize, out totalRecords); var listResult = Paging.GetResultInfo(totalRecords, _pageNo, _pageSize); var paging = Paging.GetPaging(totalRecords, _pageNo, _pageSize, _pageStatus, Common.defaultNoOfPageLinkList, "$common.pagingClick", orderBy, order); var itemPerPage = Paging.getItemPerPage(totalRecords, _pageSize, orderBy, order); PageUtilities pageUtilities = new PageUtilities() { listHeader = listResult, listFooter = paging + itemPerPage, order = order, orderBy = orderBy }; patientModel = new PatientModels { patients = patients, pageUtilities = pageUtilities, }; } catch (Exception ex) { log.Error(ex); ModelState.AddModelError("error", Translator.UnexpectedError); } return(View(patientModel)); }
public ActionResult Details(string id = "0") { var model = new PatientModels().detail(id); return(View(model)); }
public ActionResult Import(HttpPostedFileBase uploadFile) { StringBuilder strValidations = new StringBuilder(string.Empty); try { if (uploadFile.ContentLength > 0) { //string filePath = Path.Combine(HttpContext.Server.MapPath("../Uploads"), //Path.GetFileName(uploadFile.FileName)); //uploadFile.SaveAs(filePath); //ExcelDataReader works on binary excel file Stream stream = uploadFile.InputStream; //We need to written the Interface. IExcelDataReader reader = null; if (uploadFile.FileName.EndsWith(".xls")) { //reads the excel file with .xls extension reader = ExcelReaderFactory.CreateBinaryReader(stream); } else if (uploadFile.FileName.EndsWith(".xlsx")) { //reads excel file with .xlsx extension reader = ExcelReaderFactory.CreateOpenXmlReader(stream); } else { //Shows error if uploaded file is not Excel file ModelState.AddModelError("File", "This file format is not supported"); //return View(); } //treats the first row of excel file as Coluymn Names //reader.IsFirstRowAsColumnNames = true; //Adding reader data to DataSet() DataSet result = reader.AsDataSet(); reader.Close(); //Standardized data var table = result.Tables[0]; var numrow = table.Rows.Count; var break_firstline = 0; foreach (DataRow row in table.Rows) { if (row[table.Columns[0].ColumnName] != null && !string.IsNullOrEmpty(Convert.ToString(row[table.Columns[0].ColumnName]))) { //break first row if (break_firstline > 0) { //hospital benhvien hp = new benhvien(); //patient benhnhan pa = new benhnhan(); //benh su benhsu bes = new benhsu(); //Huyetap huyetap ha = new huyetap(); for (int i = 0; i < table.Columns.Count; i++) { var col = row[table.Columns[i].ColumnName]; if (i == 0) { //dau thoi gian } else if (i == 1) { //benh vien hp.tenbv = Convert.ToString(row[table.Columns[i].ColumnName]); hp.idbv = StandHAModels.generateBVID(8); //check insert hospital at here //if exist //else } else if (i == 2) { //khoa } else if (i == 3) { //giuong } else if (i == 4) { //so luu tru pa.soluutru = Convert.ToString(row[table.Columns[i].ColumnName]); } else if (i == 5) { //ma y te } else if (i == 6) { //ma benh nhan } else if (i == 7) { //ho va ten pa.tenbn = Convert.ToString(row[table.Columns[i].ColumnName]); } else if (i == 8) { //sinh ngay try { DateTime d = new DateTime(int.Parse(Convert.ToString(row[table.Columns[i].ColumnName])), 1, 1); pa.ngaysinh = d; } catch { } } else if (i == 9) { //gioi tinh String gender = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName])); if (gender == "nam") { pa.gioitinh = true; } else if (gender == "nu") { pa.gioitinh = false; } else { pa.gioitinh = true; } } else if (i == 10) { //nghe nghiep pa.nghenghiep = Convert.ToString(row[table.Columns[i].ColumnName]); } else if (i == 11) { //dan toc pa.dantoc = Convert.ToString(row[table.Columns[i].ColumnName]); } else if (i == 12) { //dia chi pa.diachi = Convert.ToString(row[table.Columns[i].ColumnName]); } else if (i == 13) { //huyen } else if (i == 14) { //thanh pho } else if (i == 15) { //tinh } else if (i == 16) { //noi lam viec pa.noilamviec = Convert.ToString(row[table.Columns[i].ColumnName]); } else if (i == 17) { //ngay vao vien } else if (i == 18) { //dien thoai pa.dienthoai = Convert.ToString(row[table.Columns[i].ColumnName]); } else if (i == 19) { //ly do vao vien ha.HA_I = Convert.ToString(row[table.Columns[i].ColumnName]); } else if (i == 20) { //A.Benh su ha.HA_II_A = Convert.ToString(row[table.Columns[i].ColumnName]); } else if (i == 21) { //Bản thân có mắc bệnh đái tháo đường không, rối loạn lipit máu, bệnh mạch vành, bệnh thận, có hút thuốc lá không string HA_II_B_1 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName])); if (HA_II_B_1 == "co") { ha.HA_II_B_1 = true; } else if (HA_II_B_1 == "khong") { ha.HA_II_B_1 = false; } } else if (i == 22) { //* Diễn giải mục 1 ha.HA_II_B_1_1 = Convert.ToString(row[table.Columns[i].ColumnName]); } else if (i == 23) { //2. Có dùng thuốc gì? Thuốc nội tiết, thuốc cường giao cảm, salbutamol, costisol string HA_II_B_2 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName])); if (HA_II_B_2 == "co") { ha.HA_II_B_2 = true; } else if (HA_II_B_2 == "khong") { ha.HA_II_B_2 = false; } } else if (i == 24) { //* Diễn giải mục 2 ha.HA_II_B_2_1 = Convert.ToString(row[table.Columns[i].ColumnName]); } else if (i == 25) { //3. Có thừa cân, béo phì (chiều cao, cân nặng BMI), lối sống ít vận động, ăn uống có thể liên quan đến tăng huyết áp string HA_II_B_3 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName])); if (HA_II_B_3 == "co") { ha.HA_II_B_3 = true; } else if (HA_II_B_3 == "khong") { ha.HA_II_B_3 = false; } } else if (i == 26) { //* Diễn giải mục 3 ha.HA_II_B_3_1 = Convert.ToString(row[table.Columns[i].ColumnName]); } else if (i == 27) { //4. Nếu là nữ có thai hay không? string HA_II_B_4 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName])); if (HA_II_B_4 == "co") { ha.HA_II_B_4 = true; } else if (HA_II_B_4 == "khong") { ha.HA_II_B_4 = false; } } else if (i == 28) { //* Diễn giải mục 4 ha.HA_II_B_4_1 = Convert.ToString(row[table.Columns[i].ColumnName]); } else if (i == 29) { //5. Tuổi xuất hiện cao huyết áp ha.HA_II_B_5 = Convert.ToString(row[table.Columns[i].ColumnName]); } else if (i == 30) { //6. Gia đình có ai mắc bệnh mãn tính gì không? string HA_II_B6 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName])); if (HA_II_B6 == "co") { ha.HA_II_B_6 = true; } else if (HA_II_B6 == "khong") { ha.HA_II_B_6 = false; } } else if (i == 31) { //* Diễn giải mục 6 ha.HA_II_B_6_1 = Convert.ToString(row[table.Columns[i].ColumnName]); } else if (i == 32) { //Mạch toàn thân (lần/phút) try { ha.HA_III_1_1 = float.Parse(Convert.ToString(row[table.Columns[i].ColumnName])); } catch { } } else if (i == 33) { //Nhiệt độ (độ C) try { ha.HA_III_1_2 = float.Parse(Convert.ToString(row[table.Columns[i].ColumnName])); } catch { } } else if (i == 34) { //Huyết áp ngưỡng thấp (mmHg) try { ha.HA_III_1_3_1 = int.Parse(Convert.ToString(row[table.Columns[i].ColumnName])); } catch { } } else if (i == 35) { //Huyết áp ngưỡng cao (mmHg) try { ha.HA_III_1_3_1 = int.Parse(Convert.ToString(row[table.Columns[i].ColumnName])); } catch { } } else if (i == 36) { //Nhịp thở (lần/phút) try { ha.HA_III_1_4 = int.Parse(Convert.ToString(row[table.Columns[i].ColumnName])); } catch { } } else if (i == 37) { //Cân nặng (Kg) try { ha.HA_III_1_5 = int.Parse(Convert.ToString(row[table.Columns[i].ColumnName])); } catch { } } else if (i == 38) { //Chiều cao (mét) try { ha.HA_III_1_6 = int.Parse(Convert.ToString(row[table.Columns[i].ColumnName])); } catch { } } else if (i == 39) { //2. Khám các bộ phận ha.HA_III_2 = Convert.ToString(row[table.Columns[i].ColumnName]); } else if (i == 40) { //- Công thức máu ha.HA_IV_1 = Convert.ToString(row[table.Columns[i].ColumnName]); } else if (i == 41) { //Glucose máu try { ha.HA_IV_2 = float.Parse(Convert.ToString(row[table.Columns[i].ColumnName])); } catch { } } else if (i == 42) { //Ure try { ha.HA_IV_3 = float.Parse(Convert.ToString(row[table.Columns[i].ColumnName])); } catch { } } else if (i == 43) { //CRP try { ha.HA_IV_4 = float.Parse(Convert.ToString(row[table.Columns[i].ColumnName])); } catch { } } else if (i == 44) { //Acid uric try { ha.HA_IV_5 = float.Parse(Convert.ToString(row[table.Columns[i].ColumnName])); } catch { } } else if (i == 45) { //Creatinin try { ha.HA_IV_6 = float.Parse(Convert.ToString(row[table.Columns[i].ColumnName])); } catch { } } else if (i == 46) { //7. Cholesteol bao nhiêu string HA_IV_7 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName])); if (HA_IV_7 == "cao") { ha.HA_IV_7 = true; } else if (HA_IV_7 == "binhthuong") { ha.HA_IV_7 = false; } } else if (i == 47) { //* Diễn giải mục 7 } else if (i == 48) { //8. Triglycerid bao nhiêu : string HA_IV_8 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName])); if (HA_IV_8 == "cao") { ha.HA_IV_8 = true; } else if (HA_IV_8 == "binhthuong") { ha.HA_IV_8 = false; } } else if (i == 50) { //* Diễn giải mục 8 } else if (i == 51) { //9. HDL-C bao nhiêu string HA_IV_9 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName])); if (HA_IV_9 == "binhthuong") { ha.HA_IV_9 = true; } else if (HA_IV_9 == "khongbinhthuong") { ha.HA_IV_9 = false; } } else if (i == 52) { //* Diễn giải mục 9 } else if (i == 53) { //10. LDL-C bao nhiêu string HA_IV_10 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName])); if (HA_IV_10 == "caohonbinhthuong") { ha.HA_IV_10 = true; } else if (HA_IV_10 == "binhthuong") { ha.HA_IV_10 = false; } } else if (i == 54) { //* Diễn giải mục 10 } else if (i == 55) { //11 a. XN: Điện giải đồ Na string HA_IV_11 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName])); if (HA_IV_11 == "khonglam") { ha.HA_IV_11 = false; } else { ha.HA_IV_11 = true; } } else if (i == 56) { //11 b. XN: Điện giải đồ Kali } else if (i == 57) { //* Diễn giải mục 11b Kali bao nhiêu } else if (i == 58) { //12. X-quang tim phổi string HA_IV_12 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName])); if (HA_IV_12 == "binhthuong") { ha.HA_IV_12 = true; } else if (HA_IV_12 == "khongbinhthuong") { ha.HA_IV_12 = false; } } else if (i == 59) { //* Diễn giải mục 12 } } System.Diagnostics.Debug.WriteLine(hp.tenbv); //Compare let insert data to db HospitalModels hphandler = new HospitalModels(); List <benhvien> lshp = hphandler.getAll(); benhvien check_hp = null; for (int i = 0; i < lshp.Count; i++) { benhvien hp_in_db = lshp[i]; //System.Diagnostics.Debug.WriteLine(StandString.FinalStandString(hp_in_db.tenbv)); if (StandString.FinalStandString(hp_in_db.tenbv).Contains(StandString.FinalStandString(hp.tenbv))) { check_hp = hp_in_db; } } if (check_hp != null) { pa.idbv = check_hp.idbv; } else { HospitalModels hpm = new HospitalModels(); hpm.insert(hp); pa.idbv = hp.idbv; } pa.idbn = StandString.generateBNID(8); bes.idbn = pa.idbn; bes.idbs = StandString.generateBESID(8); ha.idbs = bes.idbs; ha.idhuyetap = bes.idbs; //insert to db PatientModels pa_model = new PatientModels(); pa_model.create(pa); BenhsuModels bes_model = new BenhsuModels(); bes_model.insert(bes); HuyetapModels ha_model = new HuyetapModels(); ha_model.insert(ha); } break_firstline++; } } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } return(View()); }
public ActionResult Add(MyClinic.Infrastructure.PatientAdd patientAdd) { bool checkError = true; try { if (ModelState.IsValid) { Patient patient = new Patient(); Dictionary <string, string> dictItem = TransactionHelper.processGenerateArray(patient); patient = TransactionHelper.TransDict <Patient>(dictItem, patient); var objSession = Session["user"] as MyClinic.Infrastructure.SessUser; patient.Image = patient.Id + "jpg"; patient.Status = 1; patient.Age = 0; patientRepository.Add(patient); Session["patient"] = patient; var fileName = patient.Id + ".jpg"; var savePath = Server.MapPath("~/Uploads/patient/") + patient.Id; ImageHelper.SaveImage(savePath, patient.Id + ".jpg", patientAdd.ImageStream); Patient newPatient = Utilities.ObjectCopier.Copy <Patient>(patient); newPatient.Image = patient.Id + ".jpg"; patientRepository.UpdateFieldChangedOnly(patient, newPatient); /*For Add New Record to LogTable*/ int userId = objSession.UserId; logTran.UserId = userId; logTran.ProcessType = "Add User"; logTran.Description = "Add User Name : " + patient.Name; logTran.LogDate = DateTime.Now; logRepository.Add(logTran); checkError = false; } } catch (Exception ex) { log.Error(ex); ModelState.AddModelError(string.Empty, Translator.UnexpectedError); } if (checkError == true) { patientAdd.Dob = patientAdd.DateOfBirth; patientModel = new PatientModels { patientAdd = patientAdd, checkPost = true }; return(View(patientModel)); } else { var referrerId = Request.Form["referrerId"]; if (referrerId == "1")/*Add Patient from patient Controller*/ { //Session["patient"] = null; return(RedirectToAction("Index", "Patient")); } else/*Add Patient from patient Diagnosis*/ { return(RedirectToAction("Add", "Diagnosis")); } } }
public ActionResult Alls() { var model = new PatientModels().getAll(); return(View(model)); }