/// <summary>
        /// 修改常规结果
        /// </summary>
        /// <param name="SQLlist"></param>
        private void InsertResult(SortedList SQLlist, DataTable dt, DataRow dr)
        {
            DAResult _resultRequestcode = new DAResult();

            if (dr["RequestCode"] != DBNull.Value)
            {
                _resultRequestcode.Requestcode = dr["RequestCode"].ToString();//更新条件
            }
            SQLlist.Add(new Hashtable()
            {
                { "UPDATE", "UpdateDAResultByRequestcode" }
            }, _resultRequestcode);

            if (dt == null)
            {
                return;
            }

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow  drresult = dt.Rows[i];
                DAResult _result  = new DAResult();
                if (dt.Columns.Contains("seqno") && drresult["seqno"] != DBNull.Value)
                {
                    _result.Seqno = drresult["seqno"].ToString();
                }
                if (dr["RequestCode"] != DBNull.Value)
                {
                    _result.Requestcode = dr["RequestCode"].ToString();//更新条件
                }
                if (dt.Columns.Contains("SingleItem") && drresult["SingleItem"] != DBNull.Value)
                {
                    _result.Datestcode = drresult["SingleItem"].ToString();//更新条件
                }
                //if (dt.Columns.Contains("Singleitemname") && drresult["Singleitemname"] != DBNull.Value)
                //{
                //    _result.Datestname = drresult["Singleitemname"].ToString();//更新条件
                //}
                if (dt.Columns.Contains("itemresult") && drresult["itemresult"] != DBNull.Value)
                {
                    _result.Testresult = drresult["itemresult"].ToString();
                }
                if (dt.Columns.Contains("unit") && drresult["unit"] != DBNull.Value)
                {
                    _result.Unit = drresult["unit"].ToString();
                }
                if (dt.Columns.Contains("hlflag") && drresult["hlflag"] != DBNull.Value)
                {
                    _result.Hlflag = drresult["hlflag"].ToString();
                }
                if (dt.Columns.Contains("resultcomment") && drresult["resultcomment"] != DBNull.Value)
                {
                    _result.Resultcomment = drresult["resultcomment"].ToString();
                }
                if (dt.Columns.Contains("Reference") && drresult["Reference"] != DBNull.Value)
                {
                    _result.Reference = drresult["Reference"].ToString();
                }
                if (dt.Columns.Contains("ReleaseDate") && drresult["ReleaseDate"] != DBNull.Value)
                {
                    _result.Releasedate = Convert.ToDateTime(drresult["ReleaseDate"]);
                }
                if (dt.Columns.Contains("ReleaseByName") && drresult["ReleaseByName"] != DBNull.Value)
                {
                    _result.Releasebyname = drresult["ReleaseByName"].ToString();
                }
                if (dt.Columns.Contains("authorizedate") && drresult["authorizedate"] != DBNull.Value)
                {
                    _result.Authorizedate = Convert.ToDateTime(drresult["authorizedate"]);
                }
                if (dt.Columns.Contains("AuthorizeByName") && drresult["AuthorizeByName"] != DBNull.Value)
                {
                    _result.Authorizebyname = drresult["AuthorizeByName"].ToString();
                }
                _result.Status = "1";
                if (dt.Columns.Contains("reportremark") && drresult["reportremark"] != DBNull.Value)
                {
                    _result.Reportremark = drresult["reportremark"].ToString();
                }
                if (dt.Columns.Contains("panicflag") && drresult["panicflag"] != DBNull.Value)
                {
                    _result.Panicflag = drresult["panicflag"].ToString();
                }

                SQLlist.Add(new Hashtable()
                {
                    { "UPDATE", "UpdateDAResult" }
                }, _result);
            }
        }
        /// <summary>
        /// 添加病理结果
        /// </summary>
        /// <param name="SQLlist"></param>
        private void InsertPathologyResult(SortedList SQLlist, DataTable dt, DataRow dr)
        {
            SQLlist.Add(new Hashtable()
            {
                { "DELETE", "DeleteDAPathologyresultByRequestCode" }
            }, dr["RequestCode"]);


            if (dt == null)
            {
                return;
            }

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow drpathology = dt.Rows[i];

                DAPathologyresult _pathologyresult = new DAPathologyresult();
                _pathologyresult.Requestcode = dr["RequestCode"].ToString();
                if (dr["HospSampleID"] != DBNull.Value && dr["HospSampleID"].ToString() != string.Empty)
                {
                    _pathologyresult.Hospsampleid = dr["HospSampleID"].ToString();
                }
                else if (dr["HospSampleNumber"] != DBNull.Value && dr["HospSampleNumber"].ToString() != string.Empty)
                {
                    _pathologyresult.Hospsamplenumber = dr["HospSampleNumber"].ToString();
                }
                if (dt.Columns.Contains("TestID") && drpathology["TestID"] != DBNull.Value)
                {
                    _pathologyresult.Testid = Convert.ToDecimal(drpathology["TestID"]);
                }
                if (dt.Columns.Contains("parentid") && drpathology["parentid"] != DBNull.Value)
                {
                    _pathologyresult.Parentid = Convert.ToDecimal(drpathology["parentid"]);
                }
                if (dt.Columns.Contains("treelevel") && drpathology["treelevel"] != DBNull.Value)
                {
                    _pathologyresult.Treelevel = Convert.ToDecimal(drpathology["treelevel"]);
                }
                if (dt.Columns.Contains("itemname") && drpathology["itemname"] != DBNull.Value)
                {
                    _pathologyresult.Itemname = drpathology["itemname"].ToString();
                }
                if (dt.Columns.Contains("result") && drpathology["result"] != DBNull.Value)
                {
                    _pathologyresult.Result = drpathology["result"].ToString();
                }
                if (dt.Columns.Contains("displayorder") && drpathology["displayorder"] != DBNull.Value)
                {
                    _pathologyresult.Displayorder = Convert.ToDecimal(drpathology["displayorder"]);
                }
                SQLlist.Add(new Hashtable()
                {
                    { "INSERT", "InsertDAPathologyresult" }
                }, _pathologyresult);
            }
            #region >>>> qianz 修改病理标本DA
            DAResult _result = new DAResult();


            if (dr["RequestCode"] != DBNull.Value)
            {
                _result.Requestcode = dr["RequestCode"].ToString();//更新条件
                _result.Testresult  = dt.Rows[0]["result"].ToString();
                if (dt.Columns.Contains("ReleaseDate") && dt.Rows[0]["ReleaseDate"] != DBNull.Value)
                {
                    _result.Releasedate = Convert.ToDateTime(dt.Rows[0]["ReleaseDate"]);
                }
                if (dt.Columns.Contains("ReleaseByName") && dt.Rows[0]["ReleaseByName"] != DBNull.Value)
                {
                    _result.Releasebyname = dt.Rows[0]["ReleaseByName"].ToString();
                }
                if (dt.Columns.Contains("authorizedate") && dt.Rows[0]["authorizedate"] != DBNull.Value)
                {
                    _result.Authorizedate = Convert.ToDateTime(dt.Rows[0]["authorizedate"]);
                }
                if (dt.Columns.Contains("AuthorizeByName") && dt.Rows[0]["AuthorizeByName"] != DBNull.Value)
                {
                    _result.Authorizebyname = dt.Rows[0]["AuthorizeByName"].ToString();
                }
                if (dt.Columns.Contains("resultflag") && dt.Rows[0]["resultflag"] != DBNull.Value)
                {
                    _result.Resultflag = dt.Rows[0]["resultflag"].ToString();
                }
            }
            SQLlist.Add(new Hashtable()
            {
                { "UPDATE", "UpdateDAResultByRequestcodeBl" }
            }, _result);

            #endregion
        }
예제 #3
0
        // 扫描达安条码 插入订单
        private void txtDaanBarcode_KeyPress(object sender, KeyPressEventArgs e)
        {
            //是否回车键
            if (e.KeyChar != (char)Keys.Enter)
            {
                return;
            }
            string barcode = this.txtDaanBarcode.Text.Trim();

            this.txtDaanBarcode.Text = string.Empty;
            if (barcode == "")
            {
                ShowMessageHelper.ShowBoxMsg("达安条码不能为空!"); return;
            }
            Regex r = new Regex(@"^\d*00$|\:");  //正则12位数字尾数必须为0

            //达安条码为12位
            if (barcode.Length != 12)
            {
                ShowMessageHelper.ShowBoxMsg("请核对达安条码为12位数字!"); return;
            }
            //达安条码为数字

            if (!r.IsMatch(barcode))
            {
                ShowMessageHelper.ShowBoxMsg("请核对达安条码后两位为0的12位数字!"); return;
            }


            if (gvLisrequest.RowCount == 0)
            {
                ShowMessageHelper.ShowBoxMsg("无医院相关信息!"); return;
            }

            BindingSource TestData = gvDaLis.DataSource as BindingSource;

            if (TestData.Count == 0)
            {
                ShowMessageHelper.ShowBoxMsg("没有项目,不能添加!"); return;
            }

            try
            {
                #region >>>> zhouy  添加过滤
                //选中的当前行
                VDaLisrequest vda = (VDaLisrequest)gvLisrequest.Rows[gvLisrequest.CurrentCell.RowIndex].DataBoundItem;
                //是否存在相同的达安条码
                List <DAOutspecimen> daoutlist = outspecimenbll.GetOutspecimenList(new Hashtable()
                {
                    { "txtRequestcode", barcode }
                });

                if (daoutlist.Count > 0)
                {
                    ShowMessageHelper.ShowBoxMsg("已存在相同的达安条码!"); return;
                }


                #endregion

                #region  >>>插入订单主表、从表、结果表


                //项目列表 取列表项目,可见见即可得
                List <VDaLisrequesttest> VTestList = ((BindingCollection <VDaLisrequesttest>)TestData.List).ToList().FindAll(c => c.IsSelect);
                //项目是否匹配
                if (VTestList.FindAll(c => c.Datestcode == "").Count != 0)
                {
                    ShowMessageHelper.ShowBoxMsg("项目不匹配,数据添加失败!"); return;
                }
                SortedList SQLlist = new SortedList(new MySort());

                #region >>>> zhouy 申请单
                DAOutspecimen daoutspecimen = new DAOutspecimen();
                int           age           = 0;
                if (vda.Age != null && vda.Age != "")
                {
                    if (!int.TryParse(vda.Age, out age))
                    {
                        ShowMessageHelper.ShowBoxMsg("年龄格式不对!"); return;
                    }
                    //如果年龄大于200岁
                    if (age > 200 && age < 0 && vda.Ageunit == "0")
                    {
                        ShowMessageHelper.ShowBoxMsg("年龄不能大于200岁!"); return;
                    }
                }

                daoutspecimen.Age          = age;
                daoutspecimen.Requestcode  = barcode;
                daoutspecimen.Hospsampleid = vda.Hospsampleid;
                //  if (chxHosNumer.Checked) {
                daoutspecimen.Hospsamplenumber = vda.Hospsamplenumber;
                //  }
                daoutspecimen.Customercode    = SystemConfig.Config.Username;
                daoutspecimen.Remark          = "";
                daoutspecimen.Patientnumber   = vda.Patientnumber;
                daoutspecimen.Bednumber       = vda.Bednumber;
                daoutspecimen.Samplingdate    = vda.Samplingdate;
                daoutspecimen.Patientsource   = vda.Patientnumber;
                daoutspecimen.Patientname     = vda.Pname;
                daoutspecimen.Bodystyle       = vda.Bodystyle;
                daoutspecimen.Sex             = vda.Sex;
                daoutspecimen.Patienttel      = vda.Patienttel;
                daoutspecimen.Location        = vda.Sectionoffice;
                daoutspecimen.Doctor          = vda.Doctor;
                daoutspecimen.Doctortel       = vda.Doctortel;
                daoutspecimen.Birthday        = vda.Birthday;
                daoutspecimen.Ageunit         = vda.Ageunit;
                daoutspecimen.Diagnostication = vda.Diagnostication;
                daoutspecimen.Status          = "0";
                daoutspecimen.Babycount       = vda.Babycount;
                daoutspecimen.Lmp             = vda.Lmp;
                daoutspecimen.Lmpdate         = vda.Lmpdate;
                daoutspecimen.Uninevolumn     = vda.Uninevolumn.ToString();
                daoutspecimen.Weight          = vda.Weight.ToString();
                daoutspecimen.Height          = vda.Height.ToString();
                daoutspecimen.Bultrasonic     = vda.Bultrasonic;
                daoutspecimen.Pregnant        = vda.Pregnant;
                daoutspecimen.Enterby         = SystemConfig.UserInfo.UserCode; //"";//录单人
                daoutspecimen.Enterbydate     = DateTime.Now;
                daoutspecimen.Lastupdatedate1 = DateTime.Now;
                daoutspecimen.Createdate      = DateTime.Now;
                daoutspecimen.Usertype        = SystemConfig.UserInfo.UserType.ToString();
                #endregion

                //显示校验医院项目是否与达安项目匹配
                List <string> strCoustomercode = new List <string>(); //客户项目代码
                List <string> strCoustomername = new List <string>(); //客户项目名称
                List <string> strDatecode      = new List <string>(); //达安项目代码
                List <string> strDatename      = new List <string>(); //达安项目名称

                //查询系统中 医院中的所有项目
                Hashtable ht = new Hashtable();
                ht.Add("Hospsampleid", daoutspecimen.Hospsampleid);
                List <DAResult> _daresult = new DAResultBLL().GetDAResultList(ht);   //显示基本信息

                foreach (VDaLisrequesttest vdl in VTestList)
                {
                    string[] dacodearr = vdl.Datestcode.Split(',');

                    #region >>>> 申请单项目表

                    for (int i = 0; i < dacodearr.Length; i++)
                    {
                        string dacode = dacodearr[i].Trim();
                        string daname = "";
                        IEnumerable <string> IEdaname = from a in DaTestList
                                                        where a.Datestcode.Trim() == dacode
                                                        select a.Datestname;

                        if (IEdaname.Count() == 0)
                        {
                            //dacode = daname = "";
                            ShowMessageHelper.ShowBoxMsg(string.Format("达安项目中不存在编号为[{0}]的项目!", dacode)); return;
                        }
                        //  else { daname = IEdaname.First(); }



                        DAOutspecimentest daouttest = new DAOutspecimentest();
                        daouttest.Hospsampleid = vda.Hospsampleid;
                        //if (chxHosNumer.Checked) {
                        daouttest.Hospsamplenumber = vda.Hospsamplenumber;
                        //  }
                        daouttest.Requestcode      = barcode;
                        daouttest.Customertestcode = vdl.Testcode;
                        daouttest.Customertestname = vdl.Testname;
                        daouttest.Datestcode       = dacode;
                        daouttest.Datestname       = daname;
                        daouttest.Createdate       = DateTime.Now;
                        SQLlist.Add(new Hashtable()
                        {
                            { "INSERT", "Da.InsertDAOutspecimentest" }
                        }, daouttest);
                    }

                    #endregion

                    //保存重复过的项目名称
                    string testnamelist = "";

                    #region >>>> 插入结果表

                    List <VDAListests> vdalisttest = new VDAListestsBLL().GetVDaListestsresultByCode(new Hashtable()
                    {
                        { "Testcode", vdl.Testcode }
                    });

                    foreach (VDAListests item in vdalisttest)
                    {
                        DAResult daResult = new DAResult();
                        daResult.Requestcode  = barcode;
                        daResult.Hospsampleid = vda.Hospsampleid;
                        //if (chxHosNumer.Checked) {
                        daResult.Hospsamplenumber = vda.Hospsamplenumber;
                        //  }
                        daResult.Testtype          = item.Testtype;
                        daResult.Customergroupcode = item.CustomerGroupCode; //医院组合代码
                        daResult.Customergroupname = item.CustomerGroupName; //医院组合名称
                        daResult.Customertestcode  = item.Subtestcode;       //医院单项代码
                        daResult.Customertestname  = item.Subtestname;       //医院单项名称
                        //不存在单项名 取组合名
                        if (item.Subtestcode == null || item.Subtestcode == "")
                        {
                            daResult.Customertestcode = item.CustomerGroupCode; //医院单项代码
                            daResult.Customertestname = item.CustomerGroupName; //医院单项名称
                        }

                        //如果已经插入系统的项目 再次扫描不允许插入
                        if (_daresult.FindAll(c => c.Customertestcode.Trim() == daResult.Customertestcode.Trim()).Count > 0)
                        {
                            testnamelist += daResult.Customertestname + ",";
                            continue;
                        }


                        daResult.Dagroupcode = string.Empty;
                        daResult.Dagroupname = string.Empty;
                        daResult.Datestcode  = string.Empty;  //达安单项代码
                        daResult.Datestname  = string.Empty;  //达安单项名称
                        SQLlist.Add(new Hashtable()
                        {
                            { "INSERT", "InsertDAResult" }
                        }, daResult);
                    }
                    #endregion

                    //同意医院条码有重复项目
                    if (testnamelist != "")
                    {
                        ShowMessageHelper.ShowBoxMsg(
                            string.Format("送检人【{0}】医院条码[{1}]的项目[{2}]已经添加到系统中,分开条码请先删除已添加的项目,或者去掉勾选",
                                          daoutspecimen.Patientname, daoutspecimen.Hospsampleid, testnamelist.TrimEnd(',')));
                        return;
                    }
                    daoutspecimen.Customertestcodes += vdl.Testcode + ",";
                    daoutspecimen.Customertestnames += vdl.Testname + ",";
                    daoutspecimen.Datestcodes       += vdl.Datestcode + ",";
                    daoutspecimen.Datestnames       += vdl.Datestname + ",";
                }

                daoutspecimen.Customertestcodes = daoutspecimen.Customertestcodes.TrimEnd(',');
                daoutspecimen.Customertestnames = daoutspecimen.Customertestnames.TrimEnd(',');
                daoutspecimen.Datestcodes       = daoutspecimen.Datestcodes.TrimEnd(',');
                daoutspecimen.Datestnames       = daoutspecimen.Datestnames.TrimEnd(',');
                SQLlist.Add(new Hashtable()
                {
                    { "INSERT", "Da.InsertDAOutspecimen" }
                }, daoutspecimen);

                #region >>>> 写操作日志

                DAOperationlog daoperationlog = new DAOperationlog();
                daoperationlog.Dictuserid   = SystemConfig.UserInfo.UserId == "" ? 0 : Convert.ToDecimal(SystemConfig.UserInfo.UserId);
                daoperationlog.Usercode     = SystemConfig.UserInfo.UserCode;
                daoperationlog.Username     = SystemConfig.UserInfo.UserName;
                daoperationlog.Usertype     = SystemConfig.UserInfo.UserType.ToString();
                daoperationlog.Optype       = "新增订单信息";
                daoperationlog.Createdate   = DateTime.Now;
                daoperationlog.Opcontent    = "生成订单号:" + barcode;
                daoperationlog.Requestcode  = barcode;
                daoperationlog.Hospsampleid = vda.Hospsampleid;
                //  if (chxHosNumer.Checked) {
                daoperationlog.Hospsamplenumber = vda.Hospsamplenumber;
                //  }
                SQLlist.Add(new Hashtable()
                {
                    { "INSERT", "InsertDAOperationlog" }
                }, daoperationlog);

                #endregion


                string errmsg = "";
                if (!outspecimenbll.ExecuteSqlTran(SQLlist, ref errmsg))
                {
                    ShowMessageHelper.ShowBoxMsg("添加失败!:" + errmsg); return;
                }

                DataBind(daoutspecimen);
                this.txtBarcode.Focus();

                #endregion
            }
            catch (Exception Ex)
            {
                ShowMessageHelper.ShowBoxMsg("添加订单异常:" + Ex.Message);
                return;
            }
        }
 /// <summary>
 /// 删除常规结果记录
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public object DeleteDAResult(DAResult config)
 {
     return(service.delete("DeleteDAResult", config));
 }
 /// <summary>
 /// 修改常规结果记录
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public int UpdateDAResultInfo(DAResult config)
 {
     return(service.update("UpdateDAResult", config));
 }
 /// <summary>
 /// 添加常规结果记录
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public object InsertDAResultInfo(DAResult config)
 {
     return(service.insert("InsertDAResult", config));
 }