Ejemplo n.º 1
0
        private DataTable GetHyxm(string yq, string jyrq, string ybh, ref string errsql)
        {
            string sqlWhere = "";

            //医院编码
            if (UserInfo.Yybm.Length > 0)
            {
                sqlWhere = sqlWhere + string.Format(" and T_JK_lis_result_re.yybm='{0}'", UserInfo.Yybm);
            }
            //仪器
            if (yq.Length > 0)
            {
                sqlWhere = sqlWhere + string.Format(" and  T_JK_lis_result_re.yq='{0}'", yq);
            }
            //检验日期
            if (jyrq.Length > 0)
            {
                sqlWhere = sqlWhere + string.Format(" and T_JK_lis_result_re.jyrq='{0}'", jyrq);
            }
            //样本号
            if (ybh.Length > 0)
            {
                sqlWhere = sqlWhere + string.Format(" and T_JK_lis_result_re.ybh='{0}'", ybh);
            }
            errsql = "sql045+sqlwhere:" + sqlWhere;
            //取得化验结果
            Form_lisBll form_lisbll = new Form_lisBll();

            return(form_lisbll.GetMoHuList(sqlWhere, "sql045"));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 再次处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button_save_sys_again(DataTable dt_all, string sqlcode)
        {
            try
            {
                if (dt_all.Rows.Count > 0)
                {
                    DataRow[] drs = dt_all.Select("xmdh='NAME'");
                    for (int i = 0; i < drs.Length; i++)
                    {
                        DBAccess dbjkdah = new DBAccess();

                        //获取以对应的人的信息   不一定与心电工作站中的条码号对应
                        DataTable dt_access_no = dbjkdah.ExecuteQueryBySql(@"select testno from T_JK_lis_result_re where ybh='" + drs[i]["ybh"].ToString() + "'");
                        if (dt_access_no == null || dt_access_no.Rows.Count <= 0)
                        {
                            continue;
                        }

                        //获取以对应的人员的信息
                        DataTable dt_access = dbjkdah.ExecuteQueryBySql(@"select jkdah,sfzh from T_JK_TJRY_TXM where (txmbh='" + dt_access_no.Rows[0]["testno"].ToString()
                                                                        + "' or jkdah ='" + dt_access_no.Rows[0]["testno"].ToString() + "') and yljgbm='" + drs[i]["yybm"].ToString() + "'");
                        //没有对应的人员信息时直接退出
                        if (dt_access == null || dt_access.Rows.Count <= 0)
                        {
                            continue;
                        }
                        ////更新化验结果表(T_JK_lis_result_re),确定化验结果与人员关系
                        //DataTable dt_update = new DataTable();
                        ////医院编码
                        //dt_update.Columns.Add("yybm");
                        ////仪器编码
                        //dt_update.Columns.Add("yq");
                        ////样本号
                        //dt_update.Columns.Add("ybh");
                        ////体检日期
                        //dt_update.Columns.Add("jyrq");
                        ////健康档案号
                        //dt_update.Columns.Add("testno");
                        ////年度
                        //dt_update.Columns.Add("nd");

                        //dt_update.Rows.Add();
                        //dt_update.AcceptChanges();

                        //dt_update.Rows[0]["yybm"] = UserInfo.Yybm;
                        //dt_update.Rows[0]["yq"] = "MECG200";
                        //dt_update.Rows[0]["ybh"] = drs[i]["ybh"].ToString();
                        //dt_update.Rows[0]["jyrq"] = Convert.ToDateTime(drs[i]["jyrq"].ToString()).ToString("yyyy-MM-dd");
                        //dt_update.Rows[0]["testno"] = dt_access.Rows[0]["jkdah"].ToString();
                        ////dt_update.Rows[0]["nd"] = Convert.ToDateTime(jyrq_tem).Year .ToString();
                        //dt_update.Rows[0]["nd"] = DateTime.Now.Year.ToString();

                        Form_lisBll form_lisbll = new Form_lisBll();

                        ////标本与人员的对应关系保存
                        //form_lisbll.Upd(dt_update, "sql_lis_result_ryxx_update");

                        //更新体检人员状态表
                        //form_lisbll.Upd(dt_update, "sql077");
                        //体检状态信息
                        ArrayList TJRYXXList = save_T_JK_TJZT(dt_access.Rows[0]["jkdah"].ToString(), dt_access.Rows[0]["sfzh"].ToString(), drs[i]["xmmc"].ToString(), drs[i]["jyrq"].ToString(), Common.TJTYPE.健康体检表, Common.ZT.确定状态);
                        if (TJRYXXList != null && TJRYXXList.Count > 0)
                        {
                            DBAccess dbaccess = new DBAccess();
                            dbaccess.ExecuteNonQueryBySql(TJRYXXList);
                        }

                        //保存体检结果到体检结果表
                        string sqlWhere = "";
                        //医院编码
                        if (UserInfo.Yybm.Length > 0)
                        {
                            sqlWhere = sqlWhere + string.Format(" and T_JK_lis_result_re.yybm='{0}'", UserInfo.Yybm);
                        }
                        //仪器
                        if (UserInfo.Yybm.Length > 0)
                        {
                            sqlWhere = sqlWhere + string.Format(" and  T_JK_lis_result_re.yq='{0}'", drs[i]["yq"].ToString());
                        }
                        //检验日期
                        if (UserInfo.Yybm.Length > 0)
                        {
                            sqlWhere = sqlWhere + string.Format(" and T_JK_lis_result_re.jyrq='{0}'", drs[i]["jyrq"].ToString());
                        }
                        //样本号
                        if (UserInfo.Yybm.Length > 0)
                        {
                            sqlWhere = sqlWhere + string.Format(" and T_JK_lis_result_re.ybh='{0}'", drs[i]["ybh"].ToString());
                        }

                        //取得化验结果
                        DataTable dt_dyxm = form_lisbll.GetMoHuList(sqlWhere, "sql045");

                        //更新健康体检表
                        DataTable dt_tjjgUpdate = new DataTable();
                        dt_tjjgUpdate.Rows.Add();

                        for (int j = 0; j < dt_dyxm.Rows.Count; j++)
                        {
                            if (dt_tjjgUpdate.Columns.Contains(dt_dyxm.Rows[j]["HIS_DB"].ToString()) == false)
                            {
                                DataColumn dtColumn = new DataColumn(dt_dyxm.Rows[j]["HIS_DB"].ToString());
                                dtColumn.DefaultValue = dt_dyxm.Rows[j]["result"].ToString();
                                dt_tjjgUpdate.Columns.Add(dtColumn);
                            }
                        }

                        if (dt_tjjgUpdate.Columns.Contains("D_GRDABH") == false)
                        {
                            DataColumn dtColumn = new DataColumn("D_GRDABH");
                            dtColumn.DefaultValue = dt_access.Rows[0]["jkdah"].ToString();
                            dt_tjjgUpdate.Columns.Add(dtColumn);
                        }

                        if (dt_tjjgUpdate.Columns.Contains("HAPPENTIME") == false)
                        {
                            DataColumn dtColumn = new DataColumn("HAPPENTIME");
                            dtColumn.DefaultValue = Convert.ToDateTime(drs[i]["jyrq"].ToString()).ToString("yyyy-MM-dd");
                            dt_tjjgUpdate.Columns.Add(dtColumn);
                        }

                        if (dt_tjjgUpdate.Columns.Contains("czy") == false)
                        {
                            DataColumn dtColumn = new DataColumn("czy");
                            dtColumn.DefaultValue = UserInfo.userId;
                            dt_tjjgUpdate.Columns.Add(dtColumn);
                        }

                        if (dt_tjjgUpdate.Columns.Contains("gzz") == false)
                        {
                            DataColumn dtColumn = new DataColumn("gzz");
                            dtColumn.DefaultValue = UserInfo.gzz;
                            dt_tjjgUpdate.Columns.Add(dtColumn);
                        }


                        //体检结果是否已经存在
                        string Guid = "";
                        //true:新的Guid  false:已经存在的Guid
                        bool GuidResult = true;
                        GuidResult = getNewGuid(dt_access.Rows[0]["jkdah"].ToString(), drs[i]["jyrq"].ToString(), out Guid);

                        if (dt_tjjgUpdate.Columns.Contains("guid") == false)
                        {
                            DataColumn dtColumn = new DataColumn("guid");
                            dtColumn.DefaultValue = Guid;
                            dt_tjjgUpdate.Columns.Add(dtColumn);
                        }


                        string[] sqllist = sqlcode.Split(new char[] { '|' });

                        if (sqlcode.Length == 0 || sqllist.Length < 2)
                        {
                            MessageBox.Show("仪器sql设定错误!");
                            return;
                        }
                        //体检结果
                        if (GuidResult == true)
                        {
                            //体检结果插入
                            form_lisbll.Add(dt_tjjgUpdate, sqllist[0]);
                        }
                        else
                        {
                            //体检结果更新
                            dt_tjjgUpdate.AcceptChanges();
                            dt_tjjgUpdate.Rows[0]["guid"] = Guid;
                            form_lisbll.Upd(dt_tjjgUpdate, sqllist[1]);
                        }

                        //签名
                        SaveJktjSignname(drs[i]["jyrq"].ToString(), dt_access.Rows[0]["jkdah"].ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新健康体检表
        /// </summary>
        /// <returns></returns>
        public string updateLis_jktj(DataTable dtList_ryxx)
        {
            //没有需要同步的人员
            if (dtList_ryxx == null || dtList_ryxx.Rows.Count == 0)
            {
                return("1");
            }
            try
            {
                Form_lisBll form_lisbll = new Form_lisBll();
                string      JKDAH       = "";
                string      tjsj        = "";
                for (int i = 0; i < dtList_ryxx.Rows.Count; i++)
                {
                    JKDAH = dtList_ryxx.Rows[i]["JKDAH"].ToString();
                    //获取人员的信息(条码号 条码类型)
                    string    sqlWhere   = string.Format(" and  YLJGBM='{0}' and JKDAH='{1}'  and nd='{2}' ", UserInfo.Yybm, JKDAH, DateTime.Now.Year.ToString());
                    DataTable dt_txmList = form_lisbll.GetMoHuList(sqlWhere, "sql_select_people_txm");
                    if (dt_txmList != null && dt_txmList.Rows.Count > 0)
                    {
                        //按照条码号同步lis信息
                        for (int j = 0; j < dt_txmList.Rows.Count; j++)
                        {
                            //按照条码号获取lis检验信息
                            string    sqlWhereLis          = string.Format(" and  testno='{0}' ", dt_txmList.Rows[i]["TXMBH"].ToString());
                            DataTable dt_lis_reqresultList = form_lisbll.GetMoHuList(sqlWhereLis, "sql_select_lis_reqresult");
                            if (dt_lis_reqresultList != null && dt_lis_reqresultList.Rows.Count > 0)
                            {
                                //获取检验项目与健康体检表的项目对应关系
                                string yq = dt_lis_reqresultList.Rows[0]["instrument"].ToString();
                                tjsj = dt_lis_reqresultList.Rows[0]["resulttime"].ToString();
                                string    sqlWhereLisItems = string.Format(" and (YQLX='' or YQLX is null or YQLX='{0}') and YLJGBM='{1}' ", yq, UserInfo.Yybm);
                                DataTable dt_LisItemsList  = form_lisbll.GetMoHuList(sqlWhereLisItems, "sql_select_lis_reqresult");
                                if (dt_LisItemsList != null && dt_LisItemsList.Rows.Count > 0)
                                {
                                    DataTable dt_tjjgUpdate = new DataTable();
                                    dt_tjjgUpdate.Rows.Add();

                                    //获取对应的数据值
                                    for (int k = 0; k < dt_LisItemsList.Rows.Count; k++)
                                    {
                                        //lis结果
                                        for (int m = 0; m < dt_lis_reqresultList.Rows.Count; m++)
                                        {
                                            if (dt_LisItemsList.Rows[k]["XMBM_LIS"].ToString().ToUpper().Equals(dt_lis_reqresultList.Rows[m]["itemno"].ToString().ToUpper()))
                                            {
                                                if (dt_tjjgUpdate.Columns.Contains(dt_LisItemsList.Rows[k]["XMBM"].ToString()) == false)
                                                {
                                                    DataColumn dtColumn = new DataColumn(dt_LisItemsList.Rows[k]["XMBM"].ToString());
                                                    dtColumn.DefaultValue = dt_lis_reqresultList.Rows[m]["testresult"].ToString();
                                                    dt_tjjgUpdate.Columns.Add(dtColumn);
                                                }
                                                else
                                                {
                                                    dt_tjjgUpdate.Rows[dt_tjjgUpdate.Rows.Count - 1][dt_LisItemsList.Rows[k]["XMBM"].ToString()] = dt_lis_reqresultList.Rows[m]["testresult"].ToString();
                                                }
                                                break;
                                            }
                                        }
                                    }
                                    //数据更新到健康体检结果中
                                    Update_jktj(dt_tjjgUpdate, JKDAH, tjsj);
                                }
                            }
                        }
                    }
                }
                return("");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }