Esempio n. 1
0
 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);
            }
        }
Esempio n. 3
0
        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;
            }
        }
Esempio n. 4
0
        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;
            }
        }
Esempio n. 6
0
        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;
            }
        }