Пример #1
0
 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ữ";
 }
Пример #2
0
 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);
     }
 }
Пример #3
0
 public static void UpdatePatient(LPatientInfo pitems)
 {
     try
     {
         if (LPatientInfo.FetchByID(pitems.PatientId) != null)
         {
             pitems.IsNew = false;
             pitems.Save();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #4
0
        public static string InsertPatienttoLpatientDelte(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.FetchByID(pitems.PatientId) != null)
                {
                    pitems.IsNew = true;
                    pitems.Save(i);

                    return(_QueryRS.GetMax(LPatientInfo.Columns.PatientId).ToString());
                }
                else
                {
                    return("-1");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #5
0
        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);
            }
        }