/// <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; } }
public override void guardarMensajes(List <DOM.Mensaje> Mensajes) { var sqlConexion = new System.Data.Odbc.OdbcConnection("Dsn=prova"); var sqlComando = new System.Data.Odbc.OdbcCommand(); sqlComando.CommandText = "INSERT INTO mensajeria.Mensaje (IDMensaje, Mensaje) VALUES ('@IdMensaje','@Descripcion');"; sqlComando.CommandType = System.Data.CommandType.Text; sqlComando.Connection = sqlConexion; System.Data.Odbc.OdbcTransaction Transaccion = null; try { sqlConexion.Open(); Transaccion = sqlConexion.BeginTransaction(); sqlComando.Transaction = Transaccion; foreach (DDD_MSJ.DOM.Mensaje MensajeAInserir in Mensajes) { sqlComando.Parameters.AddWithValue("@IdMensaje", MensajeAInserir.IdMensaje); sqlComando.Parameters.AddWithValue("@Descripcion", MensajeAInserir.Descripcion); sqlComando.ExecuteNonQuery(); } } catch { if (Transaccion != null) { Transaccion.Rollback(); } } finally { if (Transaccion != null) { Transaccion.Commit(); } sqlConexion.Close(); } }
/// <summary> /// 导出患者费用信息 /// </summary> /// <param name="path">路径</param> /// <param name="tablename">表名,同文件名</param> /// <param name="idCard">身份号码</param> /// <param name="regNO">医保端流水号</param> /// <param name="alFeeDetail">费用信息</param> /// <param name="errTxt">错误信息</param> /// <returns>1成功 -1失败</returns> public static int ExportFeedetails(string path, string tablename, string idCard, string regNO, ArrayList alFeeDetail, ref string errTxt) { if (!System.IO.Directory.Exists(path)) { System.IO.Directory.CreateDirectory(path); } if (tablename.Substring(0, 1).ToUpper() != "Y") { tablename = "Y" + tablename; } string connect = @"Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277; Dbq=" + path; System.Data.Odbc.OdbcConnection myconn = new System.Data.Odbc.OdbcConnection(connect); string drop = "drop table " + tablename; string create = "create table " + tablename + @"(GMSFHM CHAR(20) , ZYH CHAR(14) , XMXH NUMERIC , XMBH CHAR(20) , XMMC CHAR(50) , FLDM CHAR(10), YPGG CHAR(30),YPJX CHAR(10), JG NUMERIC , MCYL NUMERIC , JE NUMERIC , ZFBL NUMERIC , ZFJE NUMERIC , BZ1 CHAR(20) , BZ2 CHAR(20) , BZ3 CHAR(20), FYRQ CHAR(20))"; System.Data.Odbc.OdbcCommand cmDrop = new System.Data.Odbc.OdbcCommand(drop, myconn); System.Data.Odbc.OdbcCommand cmCreate = new System.Data.Odbc.OdbcCommand(create, myconn); System.Data.Odbc.OdbcTransaction trans = null; myconn.Open(); try { cmDrop.ExecuteNonQuery(); } catch (Exception e) { } try { cmCreate.ExecuteNonQuery(); } catch (Exception ex) { errTxt = "导出文件出错" + ex.Message; return(-1); } trans = myconn.BeginTransaction(System.Data.IsolationLevel.ReadCommitted); System.Data.Odbc.OdbcCommand cmInsert = new System.Data.Odbc.OdbcCommand(); cmInsert.Connection = myconn; cmInsert.Transaction = trans; int i = 1; foreach (Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList f in alFeeDetail) { //个人身份号码 住院号 项目序号 项目编号 项目名称 分类代码 规范 药品剂型 价格 //每次用量 金额 自费比例 自费金额 处方号 费用日期 标志3 费用日期 string insert = "insert into " + tablename + @"(GMSFHM, ZYH, XMXH, XMBH , XMMC , FLDM ,YPGG ,YPJX ,JG , MCYL, JE, ZFBL,ZFJE, BZ1, BZ2, BZ3, FYRQ ) values ( '{0}','{1}',{2},'{3}', '{4}', '{5}','{6}','{7}',{8},{9},{10},{11},{12},'{13}','{14}','{15}','{16}' )"; try { insert = string.Format(insert, idCard, regNO, i.ToString(), f.Compare.CenterItem.ID, f.Compare.CenterItem.Name, f.Compare.CenterItem.SysClass, f.Compare.CenterItem.Specs, f.Compare.CenterItem.DoseCode, f.Item.Price, f.Item.Qty, f.Item.Price * f.Item.Qty, f.Compare.CenterItem.Rate, f.Item.Price * f.Item.Qty * f.Compare.CenterItem.Rate, f.RecipeNO + f.SequenceNO.ToString().PadLeft(2, '0'), f.FeeOper.OperTime.ToString("yyyy.MM.dd"), "", f.FeeOper.OperTime.ToString("yyyyMMdd")); } catch (Exception ex) { trans.Rollback(); errTxt = "导出文件出错" + ex.Message; return(0); } i++; cmInsert.CommandText = insert; try { cmInsert.ExecuteNonQuery(); } catch (Exception ex) { trans.Rollback(); errTxt = "导出文件出错" + ex.Message; return(-1); } } trans.Commit(); cmInsert.Dispose(); cmCreate.Dispose(); cmDrop.Dispose(); myconn.Close(); try { string file = path + "\\" + tablename + ".dbf"; System.IO.FileInfo fileInfo = new System.IO.FileInfo(file); if (!System.IO.Directory.Exists(path + "\\Backup")) { System.IO.Directory.CreateDirectory(path + "\\Backup"); } fileInfo.CopyTo(path + "\\Backup\\" + tablename + ".dbf"); } catch { } return(1); }
/// <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; } }
/// <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; } }
/// <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; } }
/// <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); } }