예제 #1
0
        //Add By Tany 2015-06-04
        /// <summary>
        /// 获取EMR简要病史
        /// </summary>
        /// <param name="inpatientNo"></param>
        /// <param name="inpatientBANo"></param>
        /// <returns></returns>
        public static DataTable GetEmrInpatientSummary(string inpatientNo, string inpatientBANo)
        {
            try
            {
                System.Data.DataTable   tb = new DataTable();
                EMRWS.WebSActionService ws = new EMRWS.WebSActionService();

                string returnXml = ws.manageWS("INPATIENTSUMMARY", Convert.ToInt64(inpatientNo).ToString());//
                returnXml = returnXml.Replace("<?xml version=\"1.0\" standalone=\"yes\"?>", "");
                DataSet ds = HisFunctions.ConvertXmlToDataSet(returnXml);
                if (ds.Tables["DocumentElement"].Rows[0]["ResultCode"].ToString() == "0")
                {
                    tb = ds.Tables["INPATIENTSUMMARY"];
                }
                else
                {
                    throw new Exception("获取EMR简要病史时出错!错误代码【" + ds.Tables["DocumentElement"].Rows[0]["ResultCode"].ToString() + "】错误描述【" + ds.Tables["DocumentElement"].Rows[0]["ResultContent"].ToString().Trim() + "】");
                }
                return(tb);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
        /// <summary>
        /// 获取老HIS的项目药品编码
        /// </summary>
        /// <param name="xmly"></param>
        /// <param name="hoitemid"></param>
        /// <returns></returns>
        public static string GetOldHISXmYpBM(string xmly, string hoitemid, out bool isKbxm, RelationalDatabase db)
        {
            string bm = "";

            isKbxm = false;

            if (xmly == "1")
            {
                bm = HisFunctions.ConvertNewhisidToOldHisid(HisFunctions.DataMapType.YP_YPCJD, hoitemid, db);
            }
            else
            {
                string    sql = "select * from JC_HOI_HDI where HOITEM_ID=" + hoitemid;
                DataTable tb  = db.GetDataTable(sql);

                if (tb.Rows[0]["tc_flag"].ToString() == "0")
                {
                    bm = HisFunctions.ConvertNewhisidToOldHisid(HisFunctions.DataMapType.JC_HSITEM, tb.Rows[0]["hditem_id"].ToString(), db);
                }
                else
                {
                    bm     = HisFunctions.ConvertNewhisidToOldHisid(HisFunctions.DataMapType.JC_TC_T, tb.Rows[0]["tcid"].ToString(), db);
                    isKbxm = true;
                }
            }

            return(bm);
        }
예제 #3
0
        /// <summary>
        /// 获取EMR系统的诊断信息
        /// </summary>
        /// <param name="inpatientNo">住院号</param>
        /// <param name="inpatientBANo">病案号</param>
        /// <returns></returns>
        public static DataTable GetEmrDiagnosoisDataTable(string inpatientNo, string inpatientBANo)
        {
            try
            {
                System.Data.DataTable tb = new DataTable();
                TrasenWS.TrasenWS     ws = new TrasenHIS.TrasenWS.TrasenWS();
                string strXml            = "<message msgType=\"call\" msgId=\"1\" timestampCreated=\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\" version=\"1\">" +
                                           "<call timestampCreated=\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\" crfCallMode=\"alwaysRespond\">" +
                                           "<targetLogicService>CIS_GET_DIAGNOSIS</targetLogicService> " +
                                           "<targetLogicApp>HIS</targetLogicApp>" +
                                           "<bizid></bizid>" +
                                           "</call>" +
                                           "<body bodyId=\"1\">" +
                                           "<inhospPatient>" +
                                           "<inhospId>" + Convert.ToInt64(inpatientNo).ToString().Trim() + "</inhospId>" +
                                           "<patientid>" + inpatientBANo + "</patientid>" +
                                           "</inhospPatient>" +
                                           "</body></message>";

                string  returnXml = ws.ExeWebService("GetEmrDiagnosois", strXml);
                DataSet ds        = HisFunctions.ConvertXmlToDataSet(returnXml);
                if (ds.Tables["response"].Rows[0]["code"].ToString() == "0")
                {
                    XmlDocument xml = new XmlDocument();
                    xml.LoadXml(returnXml);

                    tb.Columns.Add("code", typeof(System.String));
                    tb.Columns.Add("name", typeof(System.String));
                    XmlNode root = xml.SelectSingleNode("/message/body/outhos");//查找<Employees>
                    if (root.ChildNodes.Count == 0)
                    {
                        root = xml.SelectSingleNode("/message/body/inhos");
                        if (root.ChildNodes.Count > 0)
                        {
                            MessageBox.Show("未获取到出院诊断,但是获取到入院诊断!");
                        }
                    }
                    foreach (XmlNode xn in root.ChildNodes)
                    {
                        System.Data.DataRow r = tb.NewRow();
                        r["code"] = xn.ChildNodes[0].InnerText.Replace("\"", "");
                        r["name"] = xn.ChildNodes[1].InnerText.Replace("\"", "");
                        if (Convertor.IsNull(r["code"], "null").ToLower() == "null" || Convertor.IsNull(r["name"], "null").ToLower() == "null")
                        {
                            continue;
                        }
                        tb.Rows.Add(r);
                    }
                }
                else
                {
                    throw new Exception("获取EMR诊断时出错!错误代码【" + ds.Tables["response"].Rows[0]["code"].ToString() + "】错误描述【" + ds.Tables["response"].Rows[0]["description"].ToString() + "】");
                }
                return(tb);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #4
0
        /// <summary>
        /// 取消门诊发药状态
        /// </summary>
        /// <param name="dset"></param>
        /// <param name="db"></param>
        /// <returns></returns>
        public static string SaveMzQxFyzt(DataSet dset, RelationalDatabase db)
        {
            try
            {
                DataTable tb    = dset.Tables[0];
                string    ssql  = "";
                DataRow   row   = tb.Rows[0];
                string    BIZID = row["BIZID"].ToString();
                string    DH    = row["DH"].ToString();

                #region 老HIS事务处理
                System.Data.Odbc.OdbcConnection  connection = new System.Data.Odbc.OdbcConnection(DAL.BaseDal.oldhis_constr);
                System.Data.Odbc.OdbcTransaction tx         = null;
                System.Data.Odbc.OdbcCommand     cmd        = new System.Data.Odbc.OdbcCommand();
                try
                {
                    connection.Open();
                    cmd.Connection  = connection;
                    tx              = connection.BeginTransaction();
                    cmd.Transaction = tx;

                    cmd.CommandText = "update MZ_CFD_ZB set sfty='N',qrty='',tyr='', tyrq=null  where dh='" + DH + "' and sftf='N'";
                    cmd.ExecuteNonQuery();
                    cmd.CommandText = "update MZ_CFD_CB set sfty='N',qrty='',tyr=''  where dh='" + DH + "'";
                    cmd.ExecuteNonQuery();

                    tx.Commit();
                    cmd.Dispose();
                    connection.Close();
                }
                catch (Exception ex)
                {
                    //事务回滚
                    tx.Rollback();
                    cmd.Dispose();
                    connection.Close();
                    tx.Dispose();
                    throw new Exception(ex.Message);
                }

                #endregion

                #region 回填新HIS记录
                for (int nrow = 0; nrow <= tb.Rows.Count - 1; nrow++)
                {
                    ssql = "update EVENTLOG set FINISH=1 ,FINISH_DATE='" + DateTime.Now.ToString() + "' where EVENT='MZQXFYZT' AND BIZID='" + BIZID + "'";
                    db.DoCommand(ssql);
                }
                #endregion

                System.String[] str = { "0", "保存成功" };
                return(HisFunctions.GetResponseString("SaveKcph", str));
            }
            catch (Exception err)
            {
                throw err;
            }
        }
예제 #5
0
        public static string SaveFee(DataSet dset, RelationalDatabase db)
        {
            //TrasenFrame.Forms.FrmMdiMain.Database = db;
            TrasenFrame.Forms.FrmMdiMain.JgYybm = 1000;
            TrasenFrame.Forms.FrmMdiMain.Jgbm   = 1000;
            TrasenFrame.Forms.FrmMdiMain.Jgmc   = "";
            try
            {
                db.BeginTransaction();

                DataRow row        = dset.Tables[0].Rows[0];
                string  zyh        = Convertor.IsNull(row["zyh"], "");
                string  bz         = Convertor.IsNull(row["bz"], "");
                string  je         = Convertor.IsNull(row["je"], "");
                string  xmbm       = Convertor.IsNull(row["xmbm"], "");
                string  lb         = Convertor.IsNull(row["lb"], "");
                string  yy         = Convertor.IsNull(row["yy"], "");
                string  rq         = Convertor.IsNull(row["rq"], "");
                string  lxks       = Convertor.IsNull(row["lxks"], "");
                string  djm        = Convertor.IsNull(row["djm"], "");
                string  djh        = Convertor.IsNull(row["djh"], "");
                string  zffs       = Convertor.IsNull(row["zffs"], "");
                string  qqje       = Convertor.IsNull(row["qqje"], "");
                string  jyje       = Convertor.IsNull(row["jyje"], "");
                string  sfjs       = Convertor.IsNull(row["sfjs"], "");
                string  dyfl       = Convertor.IsNull(row["dyfl"], "");
                string  pzr        = Convertor.IsNull(row["pzr"], "");
                string  zjzh       = Convertor.IsNull(row["zjzh"], "");
                string  czy        = Convertor.IsNull(row["czy"], "");
                string  sl         = Convertor.IsNull(row["sl"], "");
                string  dh         = Convertor.IsNull(row["dh"], "");
                string  xmpzr      = Convertor.IsNull(row["xmpzr"], "");
                string  sfyp       = Convertor.IsNull(row["sfyp"], "");
                string  sjh        = Convertor.IsNull(row["sjh"], "");
                string  czgg       = Convertor.IsNull(row["czgg"], "");
                string  dw         = Convertor.IsNull(row["dw"], "");
                string  dj         = Convertor.IsNull(row["dj"], "");
                string  eventid    = Convertor.IsNull(row["id"], "");
                string  czlx       = Convertor.IsNull(row["czlx"], "");
                string  oldhisdjsj = Convertor.IsNull(row["djsj"], "");

                string ssql = "insert into whzxyy_yw_zyfymx (zyh,bz,je,xmbm,lb,yy,rq,lxks,djm,djh,zffs,qqje,jyje,sfjs,dyfl,pzr,zjzh,czy,sl,dh,xmpzr,sfyp,sjh,czgg,dw,dj,eventid,czlx,oldhisdjsj,djsj)values('" +
                              zyh + "','" + bz + "'," + je + ",'" + xmbm + "','" + lb + "','" + yy + "','" + rq + "','" + lxks + "','" + djm + "','" + djh + "','" + zffs + "'," + qqje + "," + jyje + ",'" + sfjs + "','" +
                              dyfl + "','" + pzr + "','" + zjzh + "','" + czy + "'," + sl + ",'" + dh + "','" + xmpzr + "','" + sfyp + "','" + sjh + "','" + czgg + "','" + dw + "'," + dj + "," + eventid + "," + czlx + ",'" + oldhisdjsj + "',getdate())";
                db.DoCommand(ssql);

                db.CommitTransaction();
                System.String[] str = { "0", "保存成功", "", "" };
                //TrasenFrame.Forms.FrmMdiMain.Database.Close();
                return(HisFunctions.GetResponseString("SaveFee", str));
            }
            catch (Exception err)
            {
                db.RollbackTransaction();
                //TrasenFrame.Forms.FrmMdiMain.Database.Close();
                throw err;
            }
        }
예제 #6
0
파일: mzpatient.cs 프로젝트: Wooyme/HIS-1
        public static string SaveMztf(DataSet dset, RelationalDatabase db)
        {
            try
            {
                db.BeginTransaction();
                DataTable tb        = dset.Tables["examReqInfoType"];
                string    ssql      = "";
                DataRow   row       = tb.Rows[0];
                string    examReqId = row["examReqId"].ToString();
                string    id        = row["id"].ToString();

                ParameterEx[] parameters = new ParameterEx[4];

                string sSql = "SP_WHZXYY_mz_cfb_tf";
                parameters[0].Value         = examReqId;
                parameters[0].Text          = "@jsdjh";
                parameters[1].ParaDirection = ParameterDirection.Output;
                parameters[1].Text          = "@Err_Code";
                parameters[1].ParaSize      = 50;
                parameters[2].ParaDirection = ParameterDirection.Output;
                parameters[2].Text          = "@err_text";
                parameters[2].ParaSize      = 1000;
                parameters[3].Value         = "";
                parameters[3].Text          = "@tfy";
                db.DoCommand(sSql, parameters, 60);

                int    errocde = Convert.ToInt32(parameters[1].Value);
                string errtext = parameters[2].Value.ToString();
                if (errocde != 0)
                {
                    throw new Exception(errtext);
                }

                db.CommitTransaction();

                System.String[] str = { errocde.ToString(), "保存成功" };
                return(HisFunctions.GetResponseString("SaveMzcf", str));
            }
            catch (Exception err)
            {
                db.RollbackTransaction();
                throw err;
            }
            finally
            {
            }
        }
예제 #7
0
        //Add BY Tany 2015-04-01
        /// <summary>
        /// 同步新系统的医生给老系统
        /// </summary>
        /// <param name="zyh"></param>
        /// <param name="db"></param>
        /// <returns></returns>
        public static void SyncDoc(Guid inpatientId, RelationalDatabase db)
        {
            string    ssql = @"select inpatient_no,inpatient_id,zy_doc doc_id from zy_inpatient where inpatient_id='" + inpatientId + "'";
            DataTable tb   = db.GetDataTable(ssql);

            if (tb == null || tb.Rows.Count == 0)
            {
                throw new Exception("【同步老系统责任医生出错】在新系统中未找到该病人信息,请检查!");
            }
            string zyh  = Convert.ToInt64(tb.Rows[0]["inpatient_no"].ToString()).ToString();
            string zrys = HisFunctions.ConvertNewhisidToOldHisid(HisFunctions.DataMapType.JC_EMPLOYEE_PROPERTY, tb.Rows[0]["doc_id"].ToString(), db);

            if (zrys == "")
            {
                throw new Exception("【同步老系统责任医生出错】未找到对应的责任医生,请检查!");
            }

            InstanceOldHISDb();
            ssql = "UPDATE ZY_ZYBRXX SET zrys='" + zrys + "' WHERE ZYH='" + zyh + "'";
            InFomixDb.DoCommand(ssql);
        }
예제 #8
0
        /// <summary>
        /// 医保出院登记
        /// </summary>
        /// <param name="zyh"></param>
        /// <param name="db"></param>
        /// <returns></returns>
        private static bool Ybcydj(string zyh, RelationalDatabase db)
        {
            InstanceOldHISDb();
            string    ls_zyjslb = "", ls_fyjsms = "", ls_tsbz = "";
            string    ls_return = "", ls_bzlx = "", ls_lxmc = "", ls_jzlb = "";
            decimal   ld_tczf1 = 0;//统筹支付一
            string    ssql     = "";
            DataTable tb       = new DataTable();
            DataTable patTb    = new DataTable();

            Ts_zygl_ybgl.FrmDataGridView frmDv = new Ts_zygl_ybgl.FrmDataGridView();

            try
            {
                ssql  = "select * from vi_zy_vinpatient_all where inpatient_no='" + zyh + "'";
                patTb = db.GetDataTable(ssql);
                if (patTb == null || patTb.Rows.Count == 0)
                {
                    throw new Exception("在新系统中未找到住院号【" + zyh + "】的病人信息!");
                }
                zyh  = Convert.ToInt64(zyh).ToString();
                ssql = "select ZYJSLB,FYJSMS,jzlb from yb_brxx where zyh = '" + zyh + "'";
                tb   = InFomixDb.GetDataTable(ssql);
                if (tb == null || tb.Rows.Count == 0)
                {
                    throw new Exception("未找到住院号【" + zyh + "】的yb_brxx信息!");
                }
                //ls_zyjslb = DAL.BaseDal.GetEncodingString(Convertor.IsNull(tb.Rows[0]["ZYJSLB"], ""));
                //ls_fyjsms = DAL.BaseDal.GetEncodingString(Convertor.IsNull(tb.Rows[0]["FYJSMS"], ""));
                //ls_jzlb = DAL.BaseDal.GetEncodingString(Convertor.IsNull(tb.Rows[0]["jzlb"], ""));
                ls_zyjslb = (Convertor.IsNull(tb.Rows[0]["ZYJSLB"], ""));
                ls_fyjsms = (Convertor.IsNull(tb.Rows[0]["FYJSMS"], ""));
                ls_jzlb   = (Convertor.IsNull(tb.Rows[0]["jzlb"], ""));

                if (ls_jzlb == "31" || ls_jzlb == "38")
                {
                    MessageBox.Show("该患者为工伤类别,请病区携住院志、病程记录、出院小结到医保办办理审核手续");
                }

                if (ls_zyjslb == "4" || ls_jzlb == "8D")//生育类及居保生育类弹出选择结算种类窗口
                {
                    //openwithparm(w_bq_yzgl_djcysj_ybzx,"xxlx=sylx;cslb=2;"+"ksdm="+is_DeptId+";");
                    //ls_return = message.stringparm;
                    ssql = "SELECT xxlx,lxbm,lxmc,cslb FROM yb_csxx WHERE xxlx = 'sylx' AND cslb = '2'";
                    tb   = InFomixDb.GetDataTable(ssql);
                    if (tb == null || tb.Rows.Count == 0)
                    {
                        throw new Exception("未找到yb_csxx表xxlx=sylx;cslb=2的信息!");
                    }
                    //做转换
                    //for (int r = 0; r < tb.Rows.Count; r++)
                    //{
                    //    for (int c = 0; c < tb.Columns.Count; c++)
                    //    {
                    //        tb.Rows[r][c] = DAL.BaseDal.GetEncodingString(Convertor.IsNull(tb.Rows[r][c], ""));
                    //    }
                    //}
                    frmDv = new Ts_zygl_ybgl.FrmDataGridView();
                    frmDv.dgv.DataSource  = tb;
                    frmDv.dgv.MultiSelect = false;
                    frmDv.ShowDialog();
                    if (frmDv.DialogResult == System.Windows.Forms.DialogResult.Yes)
                    {
                        if (frmDv.dgv.SelectedRows.Count == 0)
                        {
                            throw new Exception("未选择数据!");
                        }
                        else
                        {
                            ls_return = Convertor.IsNull(tb.Rows[frmDv.dgv.SelectedRows[0].Index]["lxbm"], "");
                        }
                    }
                    if (ls_return == "")
                    {
                        return(false);
                    }
                    else
                    {
                        //ssql = "update yb_brxx set sylb = '" + DAL.BaseDal.GetEncodingStringToInforMix(ls_return) + "' where zyh = '" + zyh + "'";
                        ssql = "update yb_brxx set sylb = '" + ls_return + "' where zyh = '" + zyh + "'";
                        InFomixDb.DoCommand(ssql);
                    }
                }

                if (ls_fyjsms == "4")//病种限额结算
                {
                    //openwithparm(w_bq_yzgl_djcysj_ybzx,"xxlx=bzlx;cslb=2;")
                    //ls_return = message.stringparm
                    ssql = "SELECT xxlx,lxbm,lxmc,cslb FROM yb_csxx WHERE xxlx = 'bzlx' AND cslb = '2'";
                    tb   = InFomixDb.GetDataTable(ssql);
                    if (tb == null || tb.Rows.Count == 0)
                    {
                        throw new Exception("未找到yb_csxx表xxlx=bzlx;cslb=2的信息!");
                    }
                    //做转换
                    //for (int r = 0; r < tb.Rows.Count; r++)
                    //{
                    //    for (int c = 0; c < tb.Columns.Count; c++)
                    //    {
                    //        tb.Rows[r][c] = DAL.BaseDal.GetEncodingString(Convertor.IsNull(tb.Rows[r][c], ""));
                    //    }
                    //}
                    frmDv = new Ts_zygl_ybgl.FrmDataGridView();
                    frmDv.dgv.DataSource  = tb;
                    frmDv.dgv.MultiSelect = false;
                    frmDv.ShowDialog();
                    if (frmDv.DialogResult == System.Windows.Forms.DialogResult.Yes)
                    {
                        if (frmDv.dgv.SelectedRows.Count == 0)
                        {
                            throw new Exception("未选择数据!");
                        }
                        else
                        {
                            ls_return = Convertor.IsNull(tb.Rows[frmDv.dgv.SelectedRows[0].Index]["lxbm"], "");
                        }
                    }
                    if (ls_return == "")
                    {
                        return(false);
                    }
                    else
                    {
                        //ssql = "update yb_brxx set jsbzlx = '" + DAL.BaseDal.GetEncodingStringToInforMix(ls_return) + "' where zyh = '" + zyh + "'";
                        ssql = "update yb_brxx set jsbzlx = '" + ls_return + "' where zyh = '" + zyh + "'";
                        InFomixDb.DoCommand(ssql);
                    }
                }

                ssql = "select bzlx from yb_brxx where zyh = '" + zyh + "'";
                //ls_bzlx = DAL.BaseDal.GetEncodingString(Convertor.IsNull(InFomixDb.GetDataResult(ssql), ""));
                ls_bzlx = (Convertor.IsNull(InFomixDb.GetDataResult(ssql), ""));
                //ssql = "select lxmc from yb_csxx where xxlx='bzlx' and lxbm='" + DAL.BaseDal.GetEncodingStringToInforMix(ls_bzlx) + "'";
                ssql    = "select lxmc from yb_csxx where xxlx='bzlx' and lxbm='" + ls_bzlx + "'";
                ls_lxmc = (Convertor.IsNull(InFomixDb.GetDataResult(ssql), ""));
                if (ls_lxmc != "")
                {
                    MessageBox.Show("医生已选择过病种:[ " + ls_lxmc + " ],请参照选择");
                }

                if (patTb.Rows[0]["cur_dept_name"].ToString().IndexOf("心血管内科") >= 0)
                {
                    ssql     = "select jbyltczf from yb_zyjs where zyh='" + zyh + "'";
                    ld_tczf1 = Convert.ToDecimal(Convertor.IsNull(InFomixDb.GetDataResult(ssql), "0"));
                    if (ld_tczf1 < 5000)
                    {
                        MessageBox.Show("该病人统筹支付1在5000以内,只能选择3300多定额(心内)或多定额(介入)病种");
                    }
                    else
                    {
                        MessageBox.Show("该病人统筹支付1在5000以上:\r\n1)有糖尿病的选糖尿病专科定额\r\n2)无糖尿病选综合定额4400标准结算");
                    }
                }
                //openwithparm(w_bq_yzgl_djcysj_ybzx,"xxlx=bzlx;cslb=2;")
                //ls_return = message.stringparm
                ssql = "SELECT xxlx,lxbm,lxmc,cslb FROM yb_csxx WHERE xxlx = 'bzlx' AND cslb = '2'";
                tb   = InFomixDb.GetDataTable(ssql);
                if (tb == null || tb.Rows.Count == 0)
                {
                    throw new Exception("未找到yb_csxx表xxlx=bzlx;cslb=2的信息!");
                }
                //做转换
                //for (int r = 0; r < tb.Rows.Count; r++)
                //{
                //    for (int c = 0; c < tb.Columns.Count; c++)
                //    {
                //        tb.Rows[r][c] = DAL.BaseDal.GetEncodingString(Convertor.IsNull(tb.Rows[r][c], ""));
                //    }
                //}
                frmDv = new Ts_zygl_ybgl.FrmDataGridView();
                frmDv.dgv.DataSource  = tb;
                frmDv.dgv.MultiSelect = false;
                frmDv.ShowDialog();
                if (frmDv.DialogResult == System.Windows.Forms.DialogResult.Yes)
                {
                    if (frmDv.dgv.SelectedRows.Count == 0)
                    {
                        throw new Exception("未选择数据!");
                    }
                    else
                    {
                        ls_return = Convertor.IsNull(tb.Rows[frmDv.dgv.SelectedRows[0].Index]["lxbm"], "");
                    }
                }
                if (patTb.Rows[0]["cur_dept_name"].ToString().IndexOf("肿瘤") < 0 && ls_return == "109")
                {
                    MessageBox.Show("非肿瘤科的病人不能选择肿瘤病种");
                    return(false);
                }
                if (patTb.Rows[0]["cur_dept_name"].ToString().IndexOf("心血管内科") >= 0)
                {
                    //	select jbyltczf into :ld_tczf1 from yb_zyjs where zyh=:is_zyh using T_OLTP;
                    //	if isnull(ld_tczf1) then ld_tczf1 =0
                    if (ld_tczf1 < 5000)
                    {
                        if (ls_return != "104" && ls_return != "105")
                        {
                            MessageBox.Show("该病人统筹支付1在5000以内,只能选择3300多定额(心内)或多定额(介入)病种");
                            return(false);
                        }
                    }
                    else
                    {
                        if (ls_return != "104" && ls_return != "105" && ls_return != "101" && ls_return != "115")
                        {
                            MessageBox.Show("该病人统筹支付1在5000以上:\r\n1)有糖尿病的选糖尿病专科定额\r\n2)无糖尿病选综合定额4400标准结算");
                            return(false);
                        }
                    }
                }
                if (patTb.Rows[0]["cur_dept_name"].ToString().IndexOf("心血管外科") >= 0 && ls_return != "106" && ls_return != "101")
                {
                    MessageBox.Show("心血管外科的病人只能选择多定额(心外)或多定额(综合)病种");
                    return(false);
                }
                if ((patTb.Rows[0]["cur_dept_name"].ToString().IndexOf("心血管外科") < 0 && patTb.Rows[0]["cur_dept_name"].ToString().IndexOf("心血管内科") < 0) && (ls_return == "106" || ls_return == "104" || ls_return == "105"))
                {
                    if ((patTb.Rows[0]["cur_dept_name"].ToString().IndexOf("内分泌") >= 0 || patTb.Rows[0]["cur_dept_name"].ToString().IndexOf("细胞治疗部") >= 0) && ls_return == "105")//内分泌可以选介入
                    {
                    }
                    else
                    {
                        if (patTb.Rows[0]["cur_dept_name"].ToString().IndexOf("重症医学科") >= 0 && ls_return == "106")//ICU可以选心外
                        {
                        }
                        else
                        {
                            MessageBox.Show("非心血管内科或心血管外科的病人不能选择多定额(心外)或多定额(心内)或多定额(介入)病种");
                            return(false);
                        }
                    }
                }
                ssql    = "select tsbz from rs_bm where bmh = '" + HisFunctions.ConvertNewhisidToOldHisid(HisFunctions.DataMapType.JC_DEPT_PROPERTY, patTb.Rows[0]["dept_id"].ToString(), db) + "'";
                ls_tsbz = Convertor.IsNull(InFomixDb.GetDataResult(ssql), "");
                if (ls_tsbz != "T" && ls_return == "115")
                {
                    MessageBox.Show("该科室不能选择糖尿病病种");
                    return(false);
                }

                if (ls_return == "")
                {
                    return(false);
                }
                else
                {
                    ssql = "update yb_brxx set bzlx = '" + ls_return + "' where zyh = '" + zyh + "'";
                    InFomixDb.DoCommand(ssql);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(true);
        }
예제 #9
0
        /// <summary>
        /// 发药状态更新到老HIS 门诊状态
        /// </summary>
        /// <param name="dset"></param>
        /// <param name="db"></param>
        /// <returns></returns>
        public static string SaveMzFyzt(DataSet dset, RelationalDatabase db)
        {
            try
            {
                DataTable tb      = dset.Tables[0];
                string    ssql    = "";
                DataRow   row     = tb.Rows[0];
                string    BIZID   = row["BIZID"].ToString();
                string    FY_DATE = Convert.ToDateTime(row["FY_DATE"]).ToString("yyyy-MM-dd HH:mm:ss");
                string    FY_USER = row["FY_USER"].ToString();
                string    PY_USER = row["PY_USER"].ToString();
                string    DH      = row["DH"].ToString();
                decimal   ZJE     = Convert.ToDecimal(row["zje"]);

                FY_USER = HisFunctions.ConvertNewhisidToOldHisid(HisFunctions.DataMapType.JC_EMPLOYEE_PROPERTY, FY_USER, db);
                PY_USER = HisFunctions.ConvertNewhisidToOldHisid(HisFunctions.DataMapType.JC_EMPLOYEE_PROPERTY, PY_USER, db);

                #region 老HIS事务处理
                System.Data.Odbc.OdbcConnection  connection = new System.Data.Odbc.OdbcConnection(DAL.BaseDal.oldhis_constr);
                System.Data.Odbc.OdbcTransaction tx         = null;
                System.Data.Odbc.OdbcCommand     cmd        = new System.Data.Odbc.OdbcCommand();
                try
                {
                    connection.Open();
                    cmd.Connection  = connection;
                    tx              = connection.BeginTransaction();
                    cmd.Transaction = tx;

                    if (ZJE >= 0)
                    {
                        cmd.CommandText = "update MZ_CFD_ZB set sffy='Y',fyy='" + FY_USER + "', fysj='" + FY_DATE + "',pzr='" + PY_USER + "' where dh='" + DH + "'";
                        cmd.ExecuteNonQuery();
                        cmd.CommandText = "update MZ_CFD_CB set sffy='Y',fyy='" + FY_USER + "'  where dh='" + DH + "'";
                        cmd.ExecuteNonQuery();
                    }
                    else
                    {
                        cmd.CommandText = "update MZ_CFD_ZB set sfty='Y',qrty='" + FY_USER + "',tyr='" + FY_USER + "', tyrq='" + FY_DATE + "'  where dh='" + DH + "'";
                        cmd.ExecuteNonQuery();
                        cmd.CommandText = "update MZ_CFD_CB set sfty='Y',qrty='" + FY_USER + "',tyr='" + FY_USER + "'  where dh='" + DH + "'";
                        cmd.ExecuteNonQuery();
                    }

                    tx.Commit();
                    cmd.Dispose();
                    connection.Close();
                }
                catch (Exception ex)
                {
                    //事务回滚
                    tx.Rollback();
                    cmd.Dispose();
                    connection.Close();
                    tx.Dispose();
                    throw new Exception(ex.Message);
                }

                #endregion

                #region 回填新HIS记录
                if (ZJE > 0)
                {
                    ssql = "update EVENTLOG set FINISH=1 ,FINISH_DATE='" + DateTime.Now.ToString() + "' where EVENT='MZFYZT' AND BIZID='" + BIZID + "'";
                }
                else
                {
                    ssql = "update EVENTLOG set FINISH=1 ,FINISH_DATE='" + DateTime.Now.ToString() + "' where EVENT='MZFYZTTY' AND BIZID='" + BIZID + "'";
                }
                db.DoCommand(ssql);

                #endregion

                System.String[] str = { "0", "保存成功" };
                return(HisFunctions.GetResponseString("SaveKcph", str));
            }
            catch (Exception err)
            {
                throw err;
            }
        }
예제 #10
0
        /// <summary>
        /// 发药状态更新到老HIS  住院状态
        /// </summary>
        /// <param name="dset"></param>
        /// <param name="db"></param>
        /// <returns></returns>
        public static string SaveFyzt(DataSet dset, RelationalDatabase db)
        {
            try
            {
                DataTable tb      = dset.Tables[0];
                string    ssql    = "";
                DataRow   row     = tb.Rows[0];
                string    BIZID   = row["BIZID"].ToString();
                string    FY_DATE = Convert.ToDateTime(row["FY_DATE"]).ToString("yyyy-MM-dd HH:mm:ss");
                string    FY_USER = row["FY_USER"].ToString();
                string    PY_USER = row["PY_USER"].ToString();
                string    ZYH     = row["ZYH"].ToString();
                string    YZXH    = row["YZXH"].ToString();
                string    YZZXH   = row["YZZXH"].ToString();
                decimal   num     = Convert.ToDecimal(row["NUM"].ToString());

                FY_USER = HisFunctions.ConvertNewhisidToOldHisid(HisFunctions.DataMapType.JC_EMPLOYEE_PROPERTY, FY_USER, db);
                PY_USER = HisFunctions.ConvertNewhisidToOldHisid(HisFunctions.DataMapType.JC_EMPLOYEE_PROPERTY, PY_USER, db);

                #region 老HIS事务处理
                System.Data.Odbc.OdbcConnection  connection = new System.Data.Odbc.OdbcConnection(DAL.BaseDal.oldhis_constr);
                System.Data.Odbc.OdbcTransaction tx         = null;
                System.Data.Odbc.OdbcCommand     cmd        = new System.Data.Odbc.OdbcCommand();
                try
                {
                    connection.Open();
                    cmd.Connection  = connection;
                    tx              = connection.BeginTransaction();
                    cmd.Transaction = tx;

                    if (num > 0)
                    {
                        cmd.CommandText = "update zy_yzlxd set zjfysj='" + FY_DATE + "' where zyh='" + ZYH + "' and xh=" + YZXH + " and zxh=" + YZZXH + "";
                        cmd.ExecuteNonQuery();
                        cmd.CommandText = "update zy_cqlsyzd set sffy='Y' where zyh='" + ZYH + "' and xh=" + YZXH + " and zxh=" + YZZXH + "";
                        cmd.ExecuteNonQuery();
                    }
                    else
                    {
                        cmd.CommandText = "update zy_yzlxd set sfty='Y' where zyh='" + ZYH + "' and xh=" + YZXH + " and zxh=" + YZZXH + "";
                        cmd.ExecuteNonQuery();
                        cmd.CommandText = "update zy_cqlsyzd set sfty='Y' where zyh='" + ZYH + "' and xh=" + YZXH + " and zxh=" + YZZXH + "";
                        cmd.ExecuteNonQuery();
                    }

                    tx.Commit();
                    cmd.Dispose();
                    connection.Close();
                }
                catch (Exception ex)
                {
                    //事务回滚
                    tx.Rollback();
                    cmd.Dispose();
                    connection.Close();
                    tx.Dispose();
                    throw new Exception(ex.Message);
                }

                #endregion

                #region 回填新HIS记录
                for (int nrow = 0; nrow <= tb.Rows.Count - 1; nrow++)
                {
                    ssql = "update EVENTLOG set FINISH=1 ,FINISH_DATE='" + DateTime.Now.ToString() + "' where EVENT='FYZT' AND BIZID='" + BIZID + "'";
                    db.DoCommand(ssql);
                }
                #endregion

                System.String[] str = { "0", "保存成功" };
                return(HisFunctions.GetResponseString("SaveKcph", str));
            }
            catch (Exception err)
            {
                throw err;
            }
        }
예제 #11
0
        /// <summary>
        /// 同步批号
        /// </summary>
        /// <param name="dset"></param>
        /// <param name="db"></param>
        /// <returns></returns>
        public static string SaveKcph(DataSet dset, RelationalDatabase db)
        {
            try
            {
                DataTable tb   = dset.Tables[0];
                string    ssql = "";

                List <System.String[]> listUpdate = new List <System.String[]>();
                List <System.String[]> listInsert = new List <System.String[]>();
                for (int nrow = 0; nrow <= tb.Rows.Count - 1; nrow++)
                {
                    #region 变量
                    DataRow       row        = tb.Rows[nrow];
                    ParameterEx[] parameters = new ParameterEx[13];
                    string        _sdeptid   = HisFunctions.ConvertNewhisidToOldHisid(HisFunctions.DataMapType.JC_DEPT_PROPERTY, Convertor.IsNull(row["deptid"], ""), db);
                    if (_sdeptid == "")
                    {
                        throw new Exception("没有找到科室匹配信息");
                    }
                    parameters[0].Text     = "yfh";
                    parameters[0].DataType = System.Data.DbType.String;
                    parameters[0].Value    = _sdeptid;
                    string yppc = _sdeptid.ToString() + row["cjid"].ToString();
                    // yppm=left('0000000000',
                    string temp = "0000000000";
                    int    N    = yppc.Length;
                    if (N < 10)
                    {
                        yppc = temp.Substring(0, 10 - N) + yppc;
                    }
                    yppc = "10" + yppc;
                    parameters[1].Text     = "yppc";
                    parameters[1].DataType = System.Data.DbType.String;
                    parameters[1].Value    = yppc;
                    string cjid = row["cjid"].ToString();
                    parameters[2].Text      = "ypbm";
                    parameters[2].Value     = row["cjid"];
                    parameters[3].Text      = "ypmc";
                    parameters[3].DataType  = System.Data.DbType.String;
                    parameters[3].Value     = row["s_yppm"].ToString().Replace("'", "");
                    parameters[4].Text      = "czgg";
                    parameters[4].DataType  = System.Data.DbType.String;
                    parameters[4].Value     = row["s_ypgg"].ToString().Replace("'", "");
                    parameters[5].Text      = "dw";
                    parameters[5].DataType  = System.Data.DbType.String;
                    parameters[5].Value     = Convertor.IsNull(row["s_zxdw"], "");
                    parameters[6].Text      = "cjbm";
                    parameters[6].Value     = row["sccj"].ToString();
                    parameters[7].Text      = "grdj";
                    parameters[7].Value     = row["grdj"].ToString();
                    parameters[8].Text      = "pfj";
                    parameters[8].Value     = row["pfj"].ToString();
                    parameters[9].Text      = "lsj";
                    parameters[9].Value     = row["lsj"].ToString();
                    parameters[10].Text     = "ccrq";
                    parameters[10].DataType = System.Data.DbType.String;
                    parameters[10].Value    = Convert.ToDateTime(row["djsj"]).ToString("yyyy-MM-dd HH:mm:ss");
                    parameters[11].Text     = "sxrq";
                    parameters[11].DataType = System.Data.DbType.String;
                    parameters[11].Value    = Convert.ToDateTime(row["ypxq"]).ToString("yyyy-MM-dd HH:mm:ss");
                    parameters[12].Text     = "sl";
                    parameters[12].Value    = Convertor.IsNull(row["kcl"], "");

                    #endregion

                    #region 插入语句
                    ssql = "insert into yk_kcb(";
                    for (int i = 0; i <= parameters.Length - 1; i++)
                    {
                        ssql = ssql + parameters[i].Text + ",";
                    }
                    ssql = ssql.Substring(0, ssql.Length - 1) + ")";

                    ssql = ssql + "values(";
                    for (int i = 0; i <= parameters.Length - 1; i++)
                    {
                        if (parameters[i].DataType != null)
                        {
                            ssql = ssql + "'" + TrasenHIS.DAL.BaseDal.GetEncodingStringToInforMix(parameters[i].Value.ToString()) + "',";//TrasenHIS.DAL.BaseDal.GetEncodingStringToInforMix(parameters[i].Value.ToString())
                        }
                        else
                        {
                            ssql = ssql + parameters[i].Value + ",";
                        }
                    }
                    ssql = ssql.Substring(0, ssql.Length - 1) + ")";

                    //用于记录生成的SQL语句,医嘱主键,操作类型。。在一面的事务中一次性处理
                    System.String[] str_insert = { row["id"].ToString(), _sdeptid, yppc, cjid, ssql, "add" };
                    listInsert.Add(str_insert);
                    #endregion

                    #region 更新语句
                    ssql = "update yk_kcb set ";
                    for (int i = 0; i <= parameters.Length - 1; i++)
                    {
                        if (parameters[i].DataType != null)
                        {
                            ssql = ssql + " " + parameters[i].Text + "= '" + TrasenHIS.DAL.BaseDal.GetEncodingStringToInforMix(parameters[i].Value.ToString()) + "',";//TrasenHIS.DAL.BaseDal.GetEncodingStringToInforMix(parameters[i].Value.ToString())
                        }
                        else
                        {
                            ssql = ssql + " " + parameters[i].Text + "= " + parameters[i].Value + ",";
                        }
                    }
                    ssql = ssql.Substring(0, ssql.Length - 1) + "";
                    ssql = ssql + " where yfh='" + _sdeptid + "' and yppc='" + yppc + "' and ypbm=" + cjid + "";
                    //用于记录生成的SQL语句,医嘱主键,操作类型。。在一面的事务中一次性处理
                    System.String[] str_update = { row["id"].ToString(), _sdeptid, yppc, cjid, ssql, "update" };
                    listUpdate.Add(str_update);
                    #endregion
                }

                #region 老HIS事务处理
                System.Data.Odbc.OdbcConnection  connection = new System.Data.Odbc.OdbcConnection(DAL.BaseDal.oldhis_constr);
                System.Data.Odbc.OdbcTransaction tx         = null;
                System.Data.Odbc.OdbcCommand     cmd        = new System.Data.Odbc.OdbcCommand();
                try
                {
                    connection.Open();
                    cmd.Connection  = connection;
                    tx              = connection.BeginTransaction();
                    cmd.Transaction = tx;

                    for (int i = 0; i <= listInsert.Count - 1; i++)
                    {
                        //插入和更新老HIS
                        ssql            = "select * from yk_kcb where yfh='" + listInsert[i][1].ToString() + "' and yppc='" + listInsert[i][2].ToString() + "' and ypbm=" + listInsert[i][3].ToString() + "";
                        cmd.CommandText = ssql;
                        object o = cmd.ExecuteScalar();
                        if (o != null)
                        {
                            cmd.CommandText = listUpdate[i][4];
                        }
                        else
                        {
                            cmd.CommandText = listInsert[i][4];
                        }
                        cmd.ExecuteNonQuery();
                    }

                    tx.Commit();
                    cmd.Dispose();
                    connection.Close();
                }
                catch (Exception ex)
                {
                    //事务回滚
                    tx.Rollback();
                    cmd.Dispose();
                    connection.Close();
                    tx.Dispose();
                    throw new Exception(ex.Message);
                }

                #endregion

                #region 回填新HIS记录
                for (int nrow = 0; nrow <= tb.Rows.Count - 1; nrow++)
                {
                    ssql = "update EVENTLOG set FINISH=1 ,FINISH_DATE='" + DateTime.Now.ToString() + "' where EVENT='KCBH' AND BIZID='" + tb.Rows[nrow]["ID"].ToString() + "'";
                    db.DoCommand(ssql);
                }
                #endregion

                System.String[] str = { "0", "保存成功" };
                return(HisFunctions.GetResponseString("SaveKcph", str));
            }
            catch (Exception err)
            {
                throw err;
            }
        }
예제 #12
0
        public static bool GetOldHISInpatientInfo(string zyh, RelationalDatabase db)
        {
            //Modify By Tany 2015-01-30 如果连接不是正式库,则不验证
            string conn = db.ConnectionString;

            string[] s = conn.Split(';');
            if (s.Length > 0)
            {
                for (int i = 0; i < s.Length; i++)
                {
                    if (s[i].IndexOf("initial catalog=") >= 0)
                    {
                        if (s[i].Replace("initial catalog=", "").ToLower() != "trasen")
                        {
                            return(true);
                        }
                    }
                }
            }

            InstanceOldHISDb();

            string oldzyh = "";
            string sql    = "";
            string msg    = "";
            string xml    = "";

            try
            {
                if (zyh.Trim() == "")
                {
                    throw new Exception("住院号为空,请检查!");
                }
                oldzyh = Convert.ToInt64(zyh).ToString();
                sql    = @" select a.zyh zyh,b.id as patientid,b.xm xm,b.xb xb,b.rq as csrq,b.jg jg,b.mz mz,
                        b.hk hk,b.zycs zycs,b.zy zy,b.csd csd,b.blh blh,b.gj gj,1 zjlx,b.sfzh sfzh,b.dwmc dwmc,b.dwdz dwdz,
                        b.dwdh dwdh,b.dwyzbm dwyzbm,b.jtdz jtdz,b.jtdh jtdh,b.jtyzbm jtyzbm,b.lxr lxr,b.gx gx,b.lxrdz lxrdz,
                        b.lxrdh lxrdh,b.gfdwbm gfdwbm,b.ylzh ylzh,b.gflb as gflbmc,a.ks as deptid,a.rybq as szbq,
                        a.ryrq as inhostime,a.cyrq as outhostime,a.ryzd ryzd,a.cwh as bedno,a.zrys zrys,'Pat_In' as event
                        from zy_zybrxx a inner join zy_brjbxx b on a.zyh=b.zyh
                        inner join yw_zybrzh AS C on a.zyh=c.zyh 
                        where a.ks not in ('000041','000034','000172') and c.bz='N' and  a.zyh='" + oldzyh + "'";
                DataTable oldPatTb = InFomixDb.GetDataTable(sql);
                if (oldPatTb == null || oldPatTb.Rows.Count == 0)
                {
                    throw new Exception("在老系统未找到住院号为【" + oldzyh + "】的病人信息!");
                }
                else
                {
                    string ss = "在老系统找到病人信息如下:\r\n";
                    ss += "住院号:" + oldPatTb.Rows[0]["zyh"].ToString().Trim() + "\r\n";
                    ss += "姓名:" + oldPatTb.Rows[0]["xm"].ToString().Trim() + "\r\n";
                    ss += "入院日期:" + oldPatTb.Rows[0]["inhostime"].ToString().Trim() + "\r\n";
                    ss += "\r\n请核对病人信息是否正确,以及病人姓名是否乱码(如果是乱码请点否退出操作)\r\n是否继续?";
                    if (MessageBox.Show(ss, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                    {
                        return(false);
                    }
                }

                msg = GetPatMsg(oldPatTb);

                sql = "select * from vi_zy_vinpatient_all where flag<>10 and inpatient_no like '%" + zyh + "%'";
                DataTable newPatTb = db.GetDataTable(sql);

                TrasenWS.TrasenWS ws = new TrasenHIS.TrasenWS.TrasenWS();
                if (newPatTb == null || newPatTb.Rows.Count == 0)
                {
                    //如果没有找到病人信息,则要调用WS获取
                    xml = ws.ExeWebService("SaveInpatient", msg);
                    DataSet dset = HisFunctions.ConvertXmlToDataSet(xml);
                    if (dset.Tables["HEAD"].Rows.Count > 0)
                    {
                        if (dset.Tables["HEAD"].Rows[0]["ERRCODE"].ToString() == "-1")
                        {
                            throw new Exception("调用WS保存病人信息时出现错误,消息格式:" + msg);
                        }
                        else if (dset.Tables["HEAD"].Rows[0]["ERRCODE"].ToString() == "0")
                        {
                            MessageBox.Show("同步成功,请刷新病人列表!");
                        }
                    }
                }
                else
                {
                    //如果有病人信息,也调用WS Add By Tany 2015-02-11
                    ws.ExeWebService("SaveInpatient", msg);//只是调用,不管结果

                    //如果找到了,则需要验证新老系统病人一致性
                    sql = "select deptid from vi_zy_newhishsz where deptid=" + newPatTb.Rows[0]["dept_id"].ToString();
                    DataTable hszTb = db.GetDataTable(sql);
                    if (hszTb != null && hszTb.Rows.Count > 0)
                    {
                        //throw new Exception("该病人已经在上了新护士站的科室,请以新系统的数据为准!");
                        //如果上了新系统,则调用检查病人信息
                        if (CheckPatientInfo.Check(newPatTb.Rows[0]["inpatient_no"].ToString(), db))
                        {
                            MessageBox.Show("同步到老系统成功,请在老系统中检查病人信息!");
                        }
                    }
                    string oldKs = HisFunctions.ConvertOldhisidToNewHisid(HisFunctions.DataMapType.JC_DEPT_PROPERTY, oldPatTb.Rows[0]["deptid"].ToString().Trim(), db);
                    if (oldKs == "")
                    {
                        throw new Exception("未找到该科室[" + oldPatTb.Rows[0]["deptid"].ToString().Trim() + "]对应的科室信息!");
                    }
                    string oldCwh = oldPatTb.Rows[0]["bedno"].ToString().Trim();

                    //如果老系统科室和新系统不一样,则调用老系统到新系统的转科事件
                    if (oldKs != newPatTb.Rows[0]["dept_id"].ToString())
                    {
                        MessageBox.Show("该病人在新系统中的科室与老系统的科室不符,系统将尝试修复新系统数据!\r\n\r\n点击确定后将继续操作......", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        xml = ws.ExeWebService("TransDept", msg);
                        DataSet dset = HisFunctions.ConvertXmlToDataSet(xml);
                        if (dset.Tables["HEAD"].Rows.Count > 0)
                        {
                            if (dset.Tables["HEAD"].Rows[0]["ERRCODE"].ToString() == "-1")
                            {
                                throw new Exception("调用WS病人转科时出现错误,消息格式:" + msg);
                            }
                            else if (dset.Tables["HEAD"].Rows[0]["ERRCODE"].ToString() == "0")
                            {
                                MessageBox.Show("同步成功,请刷新病人列表!");
                            }
                        }
                    }
                    else if (oldCwh != "" && oldCwh != newPatTb.Rows[0]["bed_no"].ToString())
                    {
                        //如果床位不同,则调用转床
                        MessageBox.Show("该病人在新系统中的床位与老系统的床位不符,系统将尝试修复新系统数据!\r\n\r\n点击确定后将继续操作......", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        xml = ws.ExeWebService("ChangeBed", msg);
                        DataSet dset = HisFunctions.ConvertXmlToDataSet(xml);
                        if (dset.Tables["HEAD"].Rows.Count > 0)
                        {
                            if (dset.Tables["HEAD"].Rows[0]["ERRCODE"].ToString() == "-1")
                            {
                                throw new Exception("调用WS病人转床时出现错误,消息格式:" + msg);
                            }
                            else if (dset.Tables["HEAD"].Rows[0]["ERRCODE"].ToString() == "0")
                            {
                                MessageBox.Show("同步成功,请刷新病人列表!");
                            }
                        }
                    }
                }

                try
                {
                    //调用一下EMR的方法 Modify By Tany 2016-01-20
                    sql = "select inpatient_id from zy_inpatient where flag<>10 and inpatient_no like '%" + zyh + "%'";
                    msg = ws.GetXml("n2oFpcw.EMR", Convertor.IsNull(db.GetDataResult(sql), Guid.Empty.ToString()));
                    xml = ws.ExeWebService("n2oFpcw.EMR", msg);

                    MessageBox.Show("同步EMR成功,请刷新EMR病人信息!");
                }
                catch
                {
                    throw new Exception("同步EMR时出错,请手工同步!");
                }

                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(false);
            }
        }
예제 #13
0
        /// <summary>
        /// 检查并修正病人信息
        /// </summary>
        /// <param name="zyh"></param>
        /// <param name="db"></param>
        /// <returns></returns>
        public static bool Check(string zyh, RelationalDatabase db)
        {
            //Modify By Tany 2015-01-30 如果连接不是正式库,则不验证
            string conn = db.ConnectionString;

            string[] s = conn.Split(';');
            if (s.Length > 0)
            {
                for (int i = 0; i < s.Length; i++)
                {
                    if (s[i].IndexOf("initial catalog=") >= 0)
                    {
                        if (s[i].Replace("initial catalog=", "").ToLower() != "trasen")
                        {
                            return(true);
                        }
                    }
                }
            }

            InstanceOldHISDb();

            string oldzyh = "";
            string sql    = "";

            try
            {
                if (zyh.Trim() == "")
                {
                    throw new Exception("住院号为空,请检查!");
                }
                oldzyh = Convert.ToInt64(zyh).ToString();
                sql    = "select * from vi_zy_vinpatient_all where flag<>10 and inpatient_no='" + zyh + "' and dept_id in (select deptid from vi_zy_newhishsz)";
                DataTable newPatTb = db.GetDataTable(sql);
                //上线新护士站的病人才进行验证
                if (newPatTb != null && newPatTb.Rows.Count > 0)
                {
                    sql = "select * from zy_zybrxx where zyh='" + oldzyh + "'";
                    DataTable oldPatTb = InFomixDb.GetDataTable(sql);
                    if (oldPatTb == null || oldPatTb.Rows.Count == 0)
                    {
                        throw new Exception("在老系统未找到住院号为【" + oldzyh + "】的病人!");
                    }
                    string oldKs = HisFunctions.ConvertOldhisidToNewHisid(HisFunctions.DataMapType.JC_DEPT_PROPERTY, oldPatTb.Rows[0]["ks"].ToString().Trim(), db);
                    if (oldKs == "")
                    {
                        throw new Exception("未找到该科室[" + oldPatTb.Rows[0]["ks"].ToString().Trim() + "]对应的科室信息!");
                    }
                    string oldCwh = oldPatTb.Rows[0]["cwh"].ToString().Trim();

                    bool isTs = false;
                    //如果老系统科室和新系统不一样,则调用新系统到老系统的转科事件
                    if (oldKs != newPatTb.Rows[0]["dept_id"].ToString())
                    {
                        isTs = true;
                        MessageBox.Show("该病人在新系统中的科室与老系统的科室不符,系统将尝试修复老系统数据!\r\n\r\n点击确定后将继续操作......", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        //不能调用转科WS,只能直接更新数据
                        string _ks = HisFunctions.ConvertNewhisidToOldHisid(HisFunctions.DataMapType.JC_DEPT_PROPERTY, newPatTb.Rows[0]["dept_id"].ToString(), db);;
                        sql = "SELECT BQ FROM zy_bqksdzb Where KS = '" + _ks + "'";
                        string _bq = Convertor.IsNull(InFomixDb.GetDataResult(sql), "");

                        System.Data.Odbc.OdbcConnection  connection = new System.Data.Odbc.OdbcConnection(DAL.BaseDal.oldhis_constr);
                        System.Data.Odbc.OdbcTransaction tx         = null;
                        System.Data.Odbc.OdbcCommand     cmd        = new System.Data.Odbc.OdbcCommand();
                        try
                        {
                            connection.Open();
                            cmd.Connection  = connection;
                            tx              = connection.BeginTransaction();
                            cmd.Transaction = tx;

                            //清空老床位信息
                            sql             = "UPDATE ZY_CWXX Set zyh = '',xm = '',APZ = '',ZT = '空闲' Where zyh = '" + oldzyh + "'";
                            cmd.CommandText = sql;
                            cmd.ExecuteNonQuery();

                            //更新病人信息
                            sql             = "UPDATE ZY_ZYBRXX SET CWH='',BQ='" + _bq + "',ks='" + _ks + "',bf='',sfapcw='N' WHERE ZYH='" + oldzyh + "'";
                            cmd.CommandText = sql;
                            cmd.ExecuteNonQuery();

                            tx.Commit();
                        }
                        catch (Exception err)
                        {
                            tx.Rollback();
                            throw err;
                        }
                        finally
                        {
                            cmd.Dispose();
                            connection.Close();
                        }
                    }
                    //这里需要在检查一下这个病人的床位号如果不为空的情况下,在老系统床位表上是不是有信息 Modify By Tany 2015-01-22
                    string cwZyh = "";
                    if (oldCwh != "")
                    {
                        sql   = "select zyh from zy_cwxx where ks='" + oldPatTb.Rows[0]["ks"].ToString() + "' and cwh='" + oldCwh + "'";
                        cwZyh = Convertor.IsNull(InFomixDb.GetDataResult(sql), "");
                    }
                    //如果老系统科室和新系统或者床位不一样,则调用新系统到老系统的转床事件
                    //if (oldKs != newPatTb.Rows[0]["dept_id"].ToString() || oldCwh != newPatTb.Rows[0]["bed_no"].ToString() || cwZyh != oldzyh)
                    //Modify By Tany 2015-05-05 修正这里的判断,因为新老系统床位名称可能不一致,判断床位的时候,需要通过对应关系去验证床号是否正确
                    string   mapCwh = HisFunctions.ConvertNewhisidToOldHisid(HisFunctions.DataMapType.ZY_BEDDICTION, newPatTb.Rows[0]["bed_id"].ToString(), db);
                    string[] ss     = mapCwh.Replace("||", "|").Split("|".ToCharArray());
                    if (ss.Length > 1)
                    {
                        mapCwh = ss[1];
                    }
                    if (oldKs != newPatTb.Rows[0]["dept_id"].ToString() || oldCwh != mapCwh || cwZyh != oldzyh)
                    {
                        if (!isTs)
                        {
                            isTs = true;
                            MessageBox.Show("该病人在新系统中的床位与老系统的床位不符,系统将尝试修复老系统数据!\r\n\r\n点击确定后将继续操作......", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        TrasenWS.TrasenWS ws     = new TrasenHIS.TrasenWS.TrasenWS();
                        string            strXML = "";
                        strXML = ws.GetXml("n2oZc.HIS", newPatTb.Rows[0]["inpatient_id"].ToString());
                        strXML = ws.ExeWebService("n2oZc.HIS", strXML);
                        DataSet dset = HisFunctions.ConvertXmlToDataSet(strXML);
                        if (dset.Tables["HEAD"].Rows.Count > 0)
                        {
                            if (dset.Tables["HEAD"].Rows[0]["ERRCODE"].ToString() == "-1")
                            {
                                throw new Exception("调用WS转床时出现错误:" + dset.Tables["HEAD"].Rows[0]["ERRTEXT"].ToString());
                            }
                        }
                    }
                    if (isTs)
                    {
                        MessageBox.Show("老系统数据修复完成,将继续完成您的操作!");
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show("检查新老系统病人状态时出错,您的操作将不能继续!\r\n\r\n" + ex.Message);
                return(false);
            }
        }
예제 #14
0
        //Add By Tany 2016-04-13
        /// <summary>
        ///  检查病人老系统是否结算,如果老系统结算新系统未结算,则同步调用结算方法
        /// </summary>
        /// <param name="zyh">住院号</param>
        /// <param name="db">新系统数据库连接</param>
        public static void CheckPatJszt(string zyh, RelationalDatabase db)
        {
            try
            {
                InstanceOldHISDb();

                bool iscyjs = false;

                string    sql = "select * from yw_zybrzh where zyh='" + Convert.ToInt64(zyh) + "'";
                DataTable tb  = InFomixDb.GetDataTable(sql);
                if (tb != null && tb.Rows.Count > 0)
                {
                    if (Convertor.IsNull(tb.Rows[0]["bz"], "").ToUpper() == "Y")
                    {
                        iscyjs = true;
                    }
                }
                if (!iscyjs)
                {
                    MessageBox.Show("住院号【" + zyh + "】的病人在老系统还未结算!");
                    return;
                }
                else
                {
                    sql = "select * from vi_zy_vinpatient_all where convert(bigint,inpatient_no)='" + Convert.ToInt64(zyh) + "'";
                    tb  = db.GetDataTable(sql);
                    if (tb == null || tb.Rows.Count == 0)
                    {
                        MessageBox.Show("住院号【" + zyh + "】的病人在新系统未找到信息!");
                        return;
                    }
                    int flag = Convert.ToInt32(tb.Rows[0]["flag"]);
                    if (flag == 2 || flag == 6)
                    {
                        MessageBox.Show("住院号【" + zyh + "】的病人在新系统已经结算!");
                        return;
                    }
                    else
                    {
                        //调用WS同步结算状态
                        string xml = "";
                        sql = "select zyh,id as patientid,xm,zt as jszt,jsdjh,cyrq,ryrq as ksrq,jsrq,0 as yjj,zfy as ylzfy,gfje as ybzf,zfje,djrq,czy as djybm from v_brfy where zyh='" + Convert.ToInt64(zyh) + "'";
                        tb  = InFomixDb.GetDataTable(sql);
                        if (tb != null && tb.Rows.Count > 0)
                        {
                            xml = ConvertToXML.DataTableToXmlEx(tb, "message");
                            TrasenWS.TrasenWS ws     = new TrasenHIS.TrasenWS.TrasenWS();
                            string            strXML = "";
                            strXML = ws.ExeWebService("SaveCyzt", xml);
                            DataSet dset = HisFunctions.ConvertXmlToDataSet(strXML);
                            if (dset.Tables["HEAD"].Rows.Count > 0)
                            {
                                if (dset.Tables["HEAD"].Rows[0]["ERRCODE"].ToString() == "-1")
                                {
                                    throw new Exception("调用WS出院结算时出现错误:" + dset.Tables["HEAD"].Rows[0]["ERRTEXT"].ToString());
                                }
                            }
                            MessageBox.Show("同步结算状态成功,请继续您的操作!");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #15
0
파일: mzpatient.cs 프로젝트: Wooyme/HIS-1
        public static string SaveMzcf(DataSet dset, RelationalDatabase db)
        {
            RelationalDatabase old_db = DAL.BaseDal.GetDb_InFormix();

            try
            {
                db.BeginTransaction();
                DataTable tb        = dset.Tables["examReqInfoType"];
                string    ssql      = "";
                DataRow   row       = tb.Rows[0];
                string    examReqId = row["examReqId"].ToString();
                string    id        = row["id"].ToString();



                List <System.String[]> listInsert;

                ssql = "select * from mz_brjbxxb where id='" + id + "'";
                DataTable tbpatient = old_db.GetDataTable(ssql);
                listInsert = HisFunctions.GetInsertSql("whzxyy_mz_brjbxxb", tbpatient);
                for (int i = 0; i <= listInsert.Count - 1; i++)
                {
                    ssql = "select * from whzxyy_mz_brjbxxb where id='" + id + "'";
                    DataTable tbpa = db.GetDataTable(ssql);
                    if (tbpa.Rows.Count == 0)
                    {
                        db.DoCommand(listInsert[i][0]);
                    }
                }

                ssql = "select * from mz_cfd_zb where djhm='" + examReqId + "'";
                DataTable tb_zb = old_db.GetDataTable(ssql);
                listInsert = HisFunctions.GetInsertSql("whzxyy_mz_cfb_zb", tb_zb);
                for (int i = 0; i <= listInsert.Count - 1; i++)
                {
                    db.DoCommand(listInsert[i][0]);
                }

                ssql = " select  b.* from mz_cfd_zb a inner join mz_cfd_cb b on a.dh=b.dh where djhm='" + examReqId + "'";
                DataTable tb_cb = old_db.GetDataTable(ssql);
                listInsert = HisFunctions.GetInsertSql("whzxyy_mz_cfb_cb", tb_cb);
                for (int i = 0; i <= listInsert.Count - 1; i++)
                {
                    db.DoCommand(listInsert[i][0]);
                }


                ParameterEx[] parameters = new ParameterEx[4];

                string sSql = "SP_WHZXYY_mz_cfb";
                parameters[0].Value         = examReqId;
                parameters[0].Text          = "@jsdjh";
                parameters[1].ParaDirection = ParameterDirection.Output;
                parameters[1].Text          = "@Err_Code";
                parameters[1].ParaSize      = 50;
                parameters[2].ParaDirection = ParameterDirection.Output;
                parameters[2].Text          = "@err_text";
                parameters[2].ParaSize      = 1000;
                parameters[3].Value         = id;
                parameters[3].Text          = "@id";

                db.DoCommand(sSql, parameters, 60);

                int    errocde = Convert.ToInt32(parameters[1].Value);
                string errtext = parameters[2].Value.ToString();
                if (errocde != 0)
                {
                    throw new Exception(errtext);
                }

                db.CommitTransaction();

                System.String[] str = { errocde.ToString(), "保存成功" };
                return(HisFunctions.GetResponseString("SaveMzcf", str));
            }
            catch (Exception err)
            {
                db.RollbackTransaction();
                throw err;
            }
            finally
            {
                old_db.Close();
            }
        }