private void LoadPatientInfo() { patientInfo = LPatientInfo.FetchByID(patientId); txtPatientName.Text = patientInfo.PatientName; txtAge.Text = (DateTime.Now.Year - patientInfo.YearBirth).ToString(); txtSex.Text = patientInfo.Sex == true ? "Nam" : "Nữ"; }
public static ActionResult UpdatePatientInfo(LPatientInfo pitems) { try { using (var scope = new TransactionScope()) { using (var sp = new SharedDbConnectionScope()) { if (LPatientInfo.FetchByID(pitems.PatientId) != null) { new Update(LPatientInfo.Schema) .Set(LPatientInfo.Columns.YearBirth).EqualTo(pitems.YearBirth) .Set(LPatientInfo.Columns.PatientName).EqualTo(pitems.PatientName) .Set(LPatientInfo.Columns.ObjectType).EqualTo(pitems.ObjectType) .Set(LPatientInfo.Columns.DepartmentID).EqualTo(pitems.DepartmentID) .Set(LPatientInfo.Columns.Sex).EqualTo(pitems.Sex) .Set(LPatientInfo.Columns.Address).EqualTo(pitems.Address) .Set(LPatientInfo.Columns.Room).EqualTo(pitems.Room) .Set(LPatientInfo.Columns.Bed).EqualTo(pitems.Bed) .Set(LPatientInfo.Columns.InsuranceNum).EqualTo(pitems.InsuranceNum) .Set(LPatientInfo.Columns.IdentifyNum).EqualTo(pitems.IdentifyNum) .Where(LPatientInfo.Columns.PatientId).IsEqualTo(pitems.PatientId).Execute(); } scope.Complete(); return(ActionResult.Success); } } } catch (Exception exception) { return(ActionResult.Error); } }
private void ActionDepartment(action vAction) { try { if (grdDepartment.CurrentRow == null && (vAction == action.Update || vAction == action.Delete)) { return; } switch (vAction) { case action.Normal: dtDepartment = new Select().From(LDepartment.Schema.Name).ExecuteDataSet().Tables[0]; grdDepartment.DataSource = dtDepartment; break; case action.Delete: if ( LPatientInfo.CreateQuery().WHERE(LPatientInfo.Columns.DepartmentID, Utility.Int32Dbnull(grdDepartment.GetValue("ID"))). GetRecordCount() > 0) { Utility.ShowMsg("Danh mục đang được sử dụng. Không được xóa"); return; } if (Utility.AcceptQuestion("Thực hiện xóa " + grdDepartment.GetValue("sName"), "Thông báo", true)) { new Delete().From(LDepartment.Schema.Name).Where(LDepartment.Columns.Id).IsEqualTo( Utility.Int32Dbnull(grdDepartment.GetValue("ID"))).Execute(); grdDepartment.CurrentRow.Delete(); grdDepartment.UpdateData(); } dtDepartment.AcceptChanges(); break; default: var oForm = new frmDepartmentList_AU(); oForm.vAction = vAction; oForm.drList = Utility.GetDataRow(dtDepartment, LDepartment.Columns.Id, grdDepartment.GetValue("ID")); oForm.dtList = dtDepartment; oForm.ShowDialog(); break; } } catch (Exception ex) { Utility.ShowMsg(ex.Message); } }
public static void UpdatePatient(LPatientInfo pitems) { try { if (LPatientInfo.FetchByID(pitems.PatientId) != null) { pitems.IsNew = false; pitems.Save(); } } catch (Exception ex) { throw ex; } }
private bool AddPatient() { try { LPatientInfo obj = new LPatientInfo(); obj.Pid = txtPID.Text; obj.PatientName = txtPName.Text; obj.Address = txtAddress.Text; if (chkIsBirth.Checked) { if (chkDOB.Checked) { obj.Dob = dtpDOB.Value; obj.YearBirth = dtpDOB.Value.Year; } else { obj.YearBirth = Utility.Int32Dbnull(txtYearOfBirth.Text); } } obj.HosStatus = cboHosStatus.SelectedIndex; obj.LotID = Utility.Int32Dbnull(cboLot.SelectedValue, -1); obj.Sex = DBNull.Value == cboSex.SelectedValue ? (bool?)null : Utility.Int16Dbnull(cboSex.SelectedValue) == 1; obj.Diagnostic = txtDiagnostic.Text; obj.IdentifyNum = txtCMT.Text; obj.InsuranceNum = txtInsuranceNum.Text; obj.DepartmentID = Utility.Int16Dbnull(cboDepartment.SelectedValue); obj.CanLamSangId = txtCanLamSangID.Text; obj.Room = txtRoom.Text; obj.Bed = txtBed.Text; obj.Dateupdate = dtmDate.Value; obj.ObjectType = Convert.ToInt32(cboObject.SelectedValue); obj.UserId = Utility.sDbnull(globalVariables.UserName); obj.IsNew = true; obj.Save(); txtPatient_ID.Text = Utility.sDbnull(obj.PatientId); return(true); } catch (Exception ex) { Utility.ShowMsg(ex.Message); return(false); } }
/// <summary> /// hàm thực hiện khởi tạo thông tin bệnh nhân /// </summary> /// <returns></returns> private LPatientInfo CreatePatientInfo() { var pItem = new LPatientInfo(); pItem.Pid = GetPid(""); pItem.PatientName = txtName.Text; pItem.Sex = (byte?)Convert.ToInt16(cboSex.SelectedIndex); pItem.Age = Convert.ToInt16(txtAge.Text); pItem.IdentifyNum = txtInvoiceNumber.Text; pItem.YearBirth = Utility.Int32Dbnull(txtYearOfBirth.Text, 0); pItem.DepartmentID = Convert.ToInt16(cboDepartment.SelectedValue); pItem.ObjectType = Convert.ToInt16(cboObject.SelectedValue); pItem.Address = txtAddress.Text; pItem.Diagnostic = txtDiagnose.Text; pItem.InsuranceNum = txtInsurance.Text; pItem.Bed = txtBed.Text; pItem.Room = txtRoom.Text; if (em_Action == action.Update) { pItem.PatientId = Utility.Int32Dbnull(drPatientInfo[LPatientInfo.Columns.PatientId], -1); } return(pItem); }
public static string InsertPatientInfo(LPatientInfo pitems) { int i = 0; Query _QueryRS = LPatientInfo.CreateQuery(); try { if (!LUser.FetchByParameter(LPatientInfo.Columns.PatientId, Comparison.Equals, pitems.PatientId).Read()) { pitems.IsNew = true; pitems.Save(i); return(_QueryRS.GetMax(LPatientInfo.Columns.PatientId).ToString()); } else { return("-1"); //throw new Exception(string.Format("Name:{0} Đã tồn tại", pitems.IPAddress)); } } catch (Exception ex) { throw ex; } }
public void Insert(string Pid,string PatientName,string Address,int? YearBirth,bool? Sex,string InsuranceNum,DateTime? Dateupdate,string Diagnostic,string IdentifyNum,short? DepartmentID,string Room,string Bed,int? ObjectType,int? HosStatus,DateTime? Dob,int? LotID,string CanLamSangId,byte? TestCount,byte? TestHasResult,byte? PrintStatus,short? HasAllResult,short? IsFinal,string UserId) { LPatientInfo item = new LPatientInfo(); item.Pid = Pid; item.PatientName = PatientName; item.Address = Address; item.YearBirth = YearBirth; item.Sex = Sex; item.InsuranceNum = InsuranceNum; item.Dateupdate = Dateupdate; item.Diagnostic = Diagnostic; item.IdentifyNum = IdentifyNum; item.DepartmentID = DepartmentID; item.Room = Room; item.Bed = Bed; item.ObjectType = ObjectType; item.HosStatus = HosStatus; item.Dob = Dob; item.LotID = LotID; item.CanLamSangId = CanLamSangId; item.TestCount = TestCount; item.TestHasResult = TestHasResult; item.PrintStatus = PrintStatus; item.HasAllResult = HasAllResult; item.IsFinal = IsFinal; item.UserId = UserId; item.Save(UserName); }
private bool AddPatient() { try { LPatientInfo obj = new LPatientInfo(); obj.Pid = txtPID.Text; obj.PatientName = txtPName.Text; obj.Address = txtAddress.Text; if (chkIsBirth.Checked) { if (chkDOB.Checked) { obj.Dob = dtpDOB.Value; obj.YearBirth = dtpDOB.Value.Year; } else { obj.YearBirth = Utility.Int32Dbnull(txtYearOfBirth.Text); } } obj.HosStatus = cboHosStatus.SelectedIndex; obj.LotID = Utility.Int32Dbnull(cboLot.SelectedValue, -1); obj.Sex = DBNull.Value == cboSex.SelectedValue ? (bool?) null : Utility.Int16Dbnull(cboSex.SelectedValue) == 1; obj.Diagnostic = txtDiagnostic.Text; obj.IdentifyNum = txtCMT.Text; obj.InsuranceNum = txtInsuranceNum.Text; obj.DepartmentID = Utility.Int16Dbnull(cboDepartment.SelectedValue); obj.CanLamSangId = txtCanLamSangID.Text; obj.Room = txtRoom.Text; obj.Bed = txtBed.Text; obj.Dateupdate = dtmDate.Value; obj.ObjectType = Convert.ToInt32(cboObject.SelectedValue); obj.UserId = Utility.sDbnull(globalVariables.UserName); obj.IsNew = true; obj.Save(); txtPatient_ID.Text = Utility.sDbnull(obj.PatientId); return true; } catch (Exception ex) { Utility.ShowMsg(ex.Message); return false; } }
public static string InsertPatient(LPatientInfo pitems) { if (pitems.Pid == null) { pitems.Pid = ""; } if (pitems.PatientName == null) { pitems.PatientName = ""; } if (pitems.Address == null) { pitems.Address = ""; } if (pitems.Age == null) { pitems.Age = 0; } if (pitems.YearBirth == null) { pitems.YearBirth = 0; } if (pitems.Sex == null) { pitems.Sex = 0; } pitems.Dateupdate = DateTime.Now; if (pitems.Diagnostic == null) { pitems.Diagnostic = ""; } if (pitems.IdentifyNum == null) { pitems.IdentifyNum = ""; } if (pitems.DepartmentID == null) { pitems.DepartmentID = -1; } if (pitems.Room == null) { pitems.Room = ""; } if (pitems.Bed == null) { pitems.Bed = ""; } if (pitems.ObjectType == null) { pitems.ObjectType = -1; } int i = 0; Query _QueryRS = LPatientInfo.CreateQuery(); try { if (!LPatientInfo.FetchByParameter(LPatientInfo.Columns.Pid, Comparison.Equals, pitems.Pid).Read() || pitems.Pid == "") { pitems.IsNew = true; pitems.Save(i); return(_QueryRS.GetMax(LPatientInfo.Columns.PatientId).ToString()); } else { return("-1"); } } catch (Exception ex) { throw ex; } }
private void LoadData() { try { txtPatient_ID.Text = Utility.sDbnull(mv_DR["Patient_ID"]); LPatientInfo obj = LPatientInfo.FetchByID(Utility.Int32Dbnull(txtPatient_ID.Text)); if (obj == null) { Utility.ShowMsg("Bệnh nhân không tồn tại"); return; } { //txtPID.Enabled = (m_iAction == action.Insert); txtPID.Text = obj.Pid; if (obj.YearBirth != null) { chkIsBirth.Checked = true; if (obj.Dob.HasValue) { chkDOB.Checked = true; try { dtpDOB.Value = Convert.ToDateTime(obj.Dob); } catch (Exception) { dtpDOB.Value = errDate; } } else { chkDOB.Checked = false; } txtYearOfBirth.Value = obj.YearBirth; } else { chkIsBirth.Checked = false; } txtPName.Text = obj.PatientName; txtInsuranceNum.Text = obj.InsuranceNum; txtAddress.Text = obj.Address; txtDiagnostic.Text = obj.Diagnostic; txtCMT.Text = obj.IdentifyNum; txtRoom.Text = obj.Room; txtBed.Text = obj.Bed; txtCanLamSangID.Text = obj.CanLamSangId; if ((obj.Dateupdate != null)) { try { dtmDate.Value = Convert.ToDateTime(obj.Dateupdate); } catch (Exception) { dtmDate.Value = errDate; } } if (obj.Sex == null) { cboSex.SelectedIndex = 1; } else { cboSex.SelectedValue = Utility.Int16Dbnull(obj.Sex, 0); } cboDepartment.SelectedIndex = Utility.GetSelectedIndex(cboDepartment, Utility.sDbnull(obj.DepartmentID, -1)); //cboDepartment.SelectedValue = Utility.Int32Dbnull(obj.DepartmentID,-1); cboObject.SelectedValue = Utility.Int32Dbnull(obj.ObjectType, 0); cboHosStatus.SelectedIndex = Utility.Int16Dbnull(obj.HosStatus, 0); cboLot.SelectedValue = Utility.Int32Dbnull(obj.LotID); } } catch (Exception ex) { Utility.ShowMsg(ex.Message); } }
private void LoadPatientInfo() { patientInfo = LPatientInfo.FetchByID(patientId); txtPName.Text = patientInfo.PatientName; txtAge.Text = (DateTime.Now.Year - patientInfo.YearBirth).ToString().Trim(); cboSex.Text = patientInfo.Sex == true ? "Nam" : "Nữ"; txtAddress.Text = Utility.sDbnull(patientInfo.Address); txtCMT.Text = Utility.sDbnull(patientInfo.IdentifyNum); txtDiagnostic.Text = Utility.sDbnull(patientInfo.Diagnostic); txtInsuranceNum.Text = Utility.sDbnull(patientInfo.InsuranceNum); txtRoom.Text = Utility.sDbnull(patientInfo.Room); txtBed.Text = Utility.sDbnull(patientInfo.Bed); txtYearOfBirth.Text = Utility.sDbnull(patientInfo.YearBirth).Trim(); cboDepartment.SelectedValue = Utility.Int16Dbnull(patientInfo.DepartmentID); cboObject.SelectedValue = Utility.Int16Dbnull(patientInfo.ObjectType); // dtpDOB.Value =Convert.ToDateTime(patientInfo.Dob); }