Example #1
0
 /// <summary>
 /// 对象赋值
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 private object[] GetInfo(Neusoft.HISFC.Models.HealthRecord.ChildbirthRecord info)
 {
     try
     {
         object[] s = new object[12];
         s[0]  = info.Patient.ID;                                                      //住院流水号
         s[1]  = info.HappenNO;                                                        //序号
         s[2]  = Neusoft.FrameWork.Function.NConvert.ToInt32(info.IsNormalChildbirth); //是否正常分娩
         s[3]  = Neusoft.FrameWork.Function.NConvert.ToInt32(info.IsDystocia);         //是否难产
         s[4]  = info.FamilyPlanning.ID;                                               // 计划生育方式
         s[5]  = Neusoft.FrameWork.Function.NConvert.ToInt32(info.IsPerineumBreak);    // 是否会阴破裂
         s[6]  = info.WomenKind.ID;                                                    //产妇类型
         s[7]  = Neusoft.FrameWork.Function.NConvert.ToInt32(info.IsBreak);            // 是否破裂
         s[8]  = info.BreakLevel.ID;                                                   //破裂程度
         s[9]  = info.BabySex.ToString();                                              //小孩性别
         s[10] = info.BabyWeight;                                                      //小孩体重
         s[11] = info.Oper.ID;
         return(s);
     }
     catch (Exception ex)
     {
         this.Err = ex.Message;
         return(null);
     }
 }
Example #2
0
        /// <summary>
        /// 更新一条记录
        /// </summary>
        /// <param name="obj">分娩记录实体</param>
        /// <returns></returns>
        public int Update(Neusoft.HISFC.Models.HealthRecord.ChildbirthRecord obj)
        {
            string strSql = "";

            if (this.Sql.GetSql("Case.ChildbirthRecord.Update", ref strSql) == -1)
            {
                return(-1);
            }
            try
            {
                obj.Oper.ID = this.Operator.ID;
                object[] mm = GetInfo(obj);
                if (mm == null)
                {
                    this.Err = "业务层从实体中获取字符数组出错";
                    return(-1);
                }
                strSql = string.Format(strSql, mm);
            }
            catch (Exception ee)
            {
                this.Err = ee.Message;
                return(-1);
            }
            return(this.ExecNoQuery(strSql));
        }
Example #3
0
        /// <summary>
        /// 删除一条记录
        /// </summary>
        /// <param name="obj">分娩记录实体</param>
        /// <returns></returns>
        public int Delete(Neusoft.HISFC.Models.HealthRecord.ChildbirthRecord obj)
        {
            string strSql = "";

            if (this.Sql.GetSql("Case.ChildbirthRecord.Delete", ref strSql) == -1)
            {
                return(-1);
            }
            try
            {
                //格式化字符串
                strSql = string.Format(strSql, obj.Patient.ID, obj.HappenNO);
            }
            catch (Exception ee)
            {
                this.Err = ee.Message;
                return(-1);
            }
            return(this.ExecNoQuery(strSql));
        }
Example #4
0
        /// <summary>
        /// 根据住院号查询患者分娩记录
        /// </summary>
        /// <param name="inpatientNO">患者住院流水号</param>
        /// <returns></returns>
        public List <Neusoft.HISFC.Models.HealthRecord.ChildbirthRecord> QueryChildbirthRecord(string inpatientNO)
        {
            List <Neusoft.HISFC.Models.HealthRecord.ChildbirthRecord> record = null;

            string strSql = "";

            if (this.Sql.GetSql("Case.ChildbirthRecord.Select", ref strSql) == -1)
            {
                return(null);
            }

            try
            {
                strSql = string.Format(strSql, inpatientNO);

                this.ExecQuery(strSql);

                Neusoft.HISFC.Models.HealthRecord.ChildbirthRecord info = null;

                record = new List <Neusoft.HISFC.Models.HealthRecord.ChildbirthRecord>();

                while (this.Reader.Read())
                {
                    //is_normal,   --是否正常分娩
                    //is_dystocia,   --是否难产
                    //familyplanning,   --计划生育方式
                    //is_perineumbreak,   --是否会阴破裂
                    //womenkind,   --产妇类型
                    //isbreak,   --是否破裂
                    //breaklevel,   --破裂程度
                    //babysex,   --婴儿性别
                    //babyweight   --婴儿体重

                    info            = new Neusoft.HISFC.Models.HealthRecord.ChildbirthRecord();
                    info.Patient.ID = inpatientNO;
                    //是否正常分娩
                    if (Reader[0] != DBNull.Value)
                    {
                        info.IsNormalChildbirth = Neusoft.FrameWork.Function.NConvert.ToBoolean(Reader[0].ToString());
                    }
                    else
                    {
                        info.IsNormalChildbirth = false;
                    }
                    //是否难产
                    if (Reader[1] != DBNull.Value)
                    {
                        info.IsDystocia = Neusoft.FrameWork.Function.NConvert.ToBoolean(Reader[1].ToString());
                    }
                    else
                    {
                        info.IsDystocia = false;
                    }
                    //计划生育方式
                    info.FamilyPlanning.ID = Reader[2].ToString();
                    //是否会阴破裂
                    if (Reader[3] != DBNull.Value)
                    {
                        info.IsPerineumBreak = Neusoft.FrameWork.Function.NConvert.ToBoolean(Reader[3].ToString());
                    }
                    else
                    {
                        info.IsPerineumBreak = false;
                    }
                    //产妇类型
                    info.WomenKind.ID = Reader[4].ToString();

                    //是否破裂
                    if (Reader[5] != DBNull.Value)
                    {
                        info.IsBreak = Neusoft.FrameWork.Function.NConvert.ToBoolean(Reader[5].ToString());
                    }
                    else
                    {
                        info.IsBreak = false;
                    }
                    //破裂程度

                    info.BreakLevel.ID = Reader[6].ToString();

                    //婴儿性别
                    switch (Reader[7].ToString())
                    {
                    case "U":
                        info.BabySex = Neusoft.HISFC.Models.Base.EnumSex.U;
                        break;

                    case "M":
                        info.BabySex = Neusoft.HISFC.Models.Base.EnumSex.M;
                        break;

                    case "F":
                        info.BabySex = Neusoft.HISFC.Models.Base.EnumSex.F;
                        break;
                        //{8893D34B-09AA-460f-9158-A1F48BE8B6C8} wbo 20100918
                        //case "O":
                        //    info.BabySex = Neusoft.HISFC.Models.Base.EnumSex.O;
                        //    break;
                        //case "A":
                        //    info.BabySex = Neusoft.HISFC.Models.Base.EnumSex.A;
                        break;
                    }
                    //婴儿体重
                    if (Reader[8] != DBNull.Value)
                    {
                        info.BabyWeight = Neusoft.FrameWork.Function.NConvert.ToDecimal(Reader[8].ToString());
                    }
                    else
                    {
                        info.BabyWeight = 0;
                    }
                    record.Add(info);
                    info = null;
                }
                this.Reader.Close();
            }
            catch (Exception e)
            {
                this.Err = e.Message;
                if (!this.Reader.IsClosed)
                {
                    this.Reader.Close();
                }
                record = null;
            }
            return(record);
        }
        /// <summary>
        /// 保存数据
        /// </summary>
        private void SaveData()
        {
            if (this.patientInfo.ID == "" || this.patientInfo.ID == null)
            {
                return;
            }

            Neusoft.FrameWork.Management.PublicTrans.BeginTransaction();

            //Neusoft.FrameWork.Management.Transaction t = new Neusoft.FrameWork.Management.Transaction(Neusoft.FrameWork.Management.Connection.Instance);
            //t.BeginTransaction();

            this.record.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);

            try
            {
                //清除原来数据
                if (this.record.DeleteAllByInpatientNO(this.patientInfo.ID) == -1)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    MessageBox.Show(this, "数据保存出错!" + this.record.Err, "错误", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                //装入新数据
                Neusoft.HISFC.Models.HealthRecord.ChildbirthRecord obj = new Neusoft.HISFC.Models.HealthRecord.ChildbirthRecord();
                for (int i = 0; i < this.neuSpread1_Sheet1.RowCount; i++)
                {
                    obj.Patient            = this.patientInfo;
                    obj.IsNormalChildbirth = this.neuSpread1_Sheet1.Cells[i, 0].Text == "是" ? true : false;
                    obj.IsDystocia         = this.neuSpread1_Sheet1.Cells[i, 1].Text == "是" ? true : false;
                    obj.FamilyPlanning.ID  = this.familyPlanning.GetID(this.neuSpread1_Sheet1.Cells[i, 2].Text.ToString());
                    obj.IsPerineumBreak    = this.neuSpread1_Sheet1.Cells[i, 3].Text == "是" ? true : false;
                    obj.WomenKind.ID       = this.womenKind.GetID(this.neuSpread1_Sheet1.Cells[i, 4].Text.ToString());
                    obj.IsBreak            = this.neuSpread1_Sheet1.Cells[i, 5].Text == "是" ? true : false;
                    obj.BreakLevel.ID      = this.breakLevel.GetID(this.neuSpread1_Sheet1.Cells[i, 6].Text.ToString());

                    if (this.neuSpread1_Sheet1.Cells[i, 7].Value != null)
                    {
                        switch (this.neuSpread1_Sheet1.Cells[i, 7].Value.ToString())
                        {
                        //{0E9F748A-DE93-4642-9A4F-075DE33CCEF6}

                        //case "A":
                        //    obj.BabySex = Neusoft.HISFC.Models.Base.EnumSex.A;
                        //    break;
                        //case "F":
                        //    obj.BabySex = Neusoft.HISFC.Models.Base.EnumSex.F;
                        //    break;
                        //case "M":
                        //    obj.BabySex = Neusoft.HISFC.Models.Base.EnumSex.M;
                        //    break;
                        //case "O":
                        //    obj.BabySex = Neusoft.HISFC.Models.Base.EnumSex.O;
                        //    break;
                        //case "U":
                        //    obj.BabySex = Neusoft.HISFC.Models.Base.EnumSex.U;
                        //    break;
                        //case "全部":
                        //    obj.BabySex = Neusoft.HISFC.Models.Base.EnumSex.A;
                        //    break;
                        case "女":
                            obj.BabySex = Neusoft.HISFC.Models.Base.EnumSex.F;
                            break;

                        case "男":
                            obj.BabySex = Neusoft.HISFC.Models.Base.EnumSex.M;
                            break;
                            //case "其他":
                            //    obj.BabySex = Neusoft.HISFC.Models.Base.EnumSex.O;
                            break;

                        case "未知":
                            obj.BabySex = Neusoft.HISFC.Models.Base.EnumSex.U;
                            break;
                        }
                    }
                    obj.BabyWeight = Neusoft.FrameWork.Function.NConvert.ToDecimal(this.neuSpread1_Sheet1.Cells[i, 8].Value);



                    //数据更新
                    if (this.record.Insert(obj) != 1)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        if (this.record.DBErrCode == 1)
                        {
                            this.neuSpread1_Sheet1.ActiveRowIndex = i;
                            MessageBox.Show("数据重复,已有相同的记录存在.请维护不同的记录.", "保存提示");
                        }
                        else
                        {
                            this.neuSpread1_Sheet1.ActiveRowIndex = i;
                            MessageBox.Show(this, "数据保存出错!" + this.record.Err, "保存错误", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        return;
                    }
                }
            }
            catch (Exception e)
            {
                Neusoft.FrameWork.Management.PublicTrans.RollBack();
                MessageBox.Show(e.Message);
                return;
            }

            Neusoft.FrameWork.Management.PublicTrans.Commit();
            MessageBox.Show("保存成功!");
        }