private static string GetBBSQInfo(string Ssbz, string Debug, int Flag, string sftqbb) { string constring1 = f.ReadString("GDSY", "hisstring", "DSN=pathnethisgdsy;UID=pathnetuser;PWD=userpathnet;"); ODBCHelper bb = new ODBCHelper(constring1); if (Flag == 4) { int a = 0; if (int.TryParse(Ssbz, out a) == false) { Ssbz = Ssbz.Substring(4); } } OdbcCommand cmd = bb.GetStoredProcCommond("{call pGetFunctionRequestForPathNet(?,?,?,?,?,?,?,?)}"); bb.AddInParameter(cmd, "@In_Flag", DbType.Int16, Flag); bb.AddInParameter(cmd, "@In_StartDate", DbType.String, ""); bb.AddInParameter(cmd, "@In_EndDate", DbType.String, ""); bb.AddInParameter(cmd, "@In_RequestDepartmentNos", DbType.String, ""); if (Flag == 1) { bb.AddInParameter(cmd, "@In_IPSeqNoText", DbType.String, ""); bb.AddInParameter(cmd, "@In_RegisterDate", DbType.DateTime, Ssbz.Substring(0, 10)); int mzls; try { mzls = int.Parse(Ssbz.Substring(11)); } catch { MessageBox.Show("请检查输入的门诊号格式是否正确!"); return("0"); } bb.AddInParameter(cmd, "@In_SeqNo", DbType.Int32, mzls); bb.AddInParameter(cmd, "@In_FunctionSampleLabelID", DbType.Int32, 0); } else if (Flag == 2) { bb.AddInParameter(cmd, "@In_IPSeqNoText", DbType.String, Ssbz); bb.AddInParameter(cmd, "@In_RegisterDate", DbType.String, ""); bb.AddInParameter(cmd, "@In_SeqNo", DbType.Int32, 0); bb.AddInParameter(cmd, "@In_FunctionSampleLabelID", DbType.Int32, 0); } else if (Flag == 4) { bb.AddInParameter(cmd, "@In_IPSeqNoText", DbType.String, ""); bb.AddInParameter(cmd, "@In_RegisterDate", DbType.String, ""); bb.AddInParameter(cmd, "@In_SeqNo", DbType.String, ""); bb.AddInParameter(cmd, "@In_FunctionSampleLabelID", DbType.Int32, Ssbz); } else { GDSYSQForm sqform = new GDSYSQForm(); if (sqform.DialogResult == DialogResult.OK) { return(sqform.rexml); } } OdbcDataAdapter sqlda = new OdbcDataAdapter(cmd); DataSet ds = new DataSet(); sqlda.Fill(ds); if (ds.Tables == null || ds.Tables.Count < 1) { return(GetBBInfo(bb, Ssbz, Debug, Flag, sftqbb)); } DataTable dt = ds.Tables[0]; if (Debug == "1") { MessageBox.Show("查询到数据条数:" + dt.Rows.Count.ToString()); } if (dt == null || dt.Rows.Count < 1) { return(GetBBInfo(bb, Ssbz, Debug, Flag, sftqbb)); } GDSYUNIForm uniform = new GDSYUNIForm(); uniform.indt = dt; if (uniform.ShowDialog() == DialogResult.OK) { DataRow outdr = uniform.outdr; if (outdr == null) { return(GetBBInfo(bb, Ssbz, Debug, Flag, sftqbb)); } //DataRow outdr = dt.Rows[0]; LogeneXmlHelper lxp = new LogeneXmlHelper(); lxp.F_ZYH = outdr["IPSeqNoText"] == null ? "" : outdr["IPSeqNoText"].ToString().Trim(); lxp.F_BRBH = outdr["PatientID"] == null ? "" : outdr["PatientID"].ToString().Trim(); //empiid存职业字段 lxp.F_ZY = GetEMPIID(lxp.F_BRBH); lxp.F_CH = outdr["SickBedNo"] == null ? "" : outdr["SickBedNo"].ToString().Trim(); lxp.F_XM = outdr["PatientName"] == null ? "" : outdr["PatientName"].ToString().Trim(); lxp.F_XB = outdr["PatientSex"] == null ? "" : outdr["PatientSex"].ToString().Trim(); //string birth = outdr["PatientBirthDay"] == null ? "" : outdr["PatientBirthDay"].ToString().Trim(); //lxp.F_NL = CalculateAgeCorrect(DateTime.Parse(birth), DateTime.Now).ToString(); ; lxp.F_NL = outdr["PatientAge"] == null ? "" : outdr["PatientAge"].ToString().Trim(); lxp.F_MZH = outdr["SeqNo"] == null ? "" : (outdr["SeqNo"].ToString().Trim() == "-1" ? " " : outdr["SeqNo"].ToString().Trim()); lxp.F_SJKS = outdr["RequestDepartmentName"] == null ? "" : outdr["RequestDepartmentName"].ToString().Trim(); lxp.F_SJYS = outdr["RequestEmployeeName"] == null ? "" : outdr["RequestEmployeeName"].ToString().Trim(); lxp.F_JZID = outdr["InPatientID"] == null ? "" : outdr["InPatientID"].ToString().Trim(); lxp.F_SQXH = outdr["FunctionRequestID"] == null ? "" : outdr["FunctionRequestID"].ToString().Trim(); lxp.F_YZXM = outdr["ItemName"] == null ? "" : outdr["ItemName"].ToString().Trim(); lxp.F_HY = outdr["Marriage"] == null ? "" : outdr["Marriage"].ToString(); lxp.F_ADDRESS = outdr["Address"] == null ? "" : outdr["Address"].ToString(); lxp.F_TELEPHONE = outdr["Phone"] == null ? "" : outdr["Phone"].ToString(); lxp.F_SFZH = outdr["IdentityCardNo"] == null ? "" : outdr["IdentityCardNo"].ToString(); lxp.F_MZ = outdr["RaceDesc"] == null ? "" : outdr["RaceDesc"].ToString(); // lxp.F_ZY = outdr["ProfessionDesc"] == null ? "" : outdr["ProfessionDesc"].ToString(); lxp.F_LCZD = outdr["diseaseName"] == null ? "" : outdr["diseaseName"].ToString(); lxp.F_BQ = outdr["IPDepartmentName"] == null ? "" : outdr["IPDepartmentName"].ToString(); if (Flag == 1) { lxp.F_BRLB = "门诊"; } else if (Flag == 2) { lxp.F_BRLB = "住院"; } if (sftqbb == "1") { lxp.BBLBLIST = TQBBLB(bb, Ssbz); if (Debug == "1") { MessageBox.Show("标本数量:" + lxp.BBLBLIST.Count.ToString()); } if (lxp.BBLBLIST == null) { MessageBox.Show("未查询到标本信息"); } else { if (Debug == "1") { MessageBox.Show("返回XML:" + lxp.ReturnBBLBXML()); } return(lxp.ReturnBBLBXML()); } } if (Debug == "1") { MessageBox.Show("返回XML:" + lxp.ReturnLogeneXML()); } return(lxp.ReturnLogeneXML()); } //GDSYMutiForm mutiform = new GDSYMutiForm(); //mutiform.indt = dt; //if (mutiform.ShowDialog() == DialogResult.OK) //{ // return mutiform.rexml; //} return(GetBBInfo(bb, Ssbz, Debug, Flag, sftqbb)); }
private static string GetBBInfo(ODBCHelper bb, string Ssbz, string Debug, int Flag, string sftqbb) { OdbcCommand cmd = bb.GetStoredProcCommond("{call pGETPatientInfoForPathNet(?,?,?,?,?)}"); bb.AddInParameter(cmd, "@In_Flag", DbType.Int16, Flag); if (Flag == 1) { bb.AddInParameter(cmd, "@In_IPSeqNoText", DbType.String, ""); bb.AddInParameter(cmd, "@In_RegisterDate", DbType.DateTime, Ssbz.Substring(0, 10)); int mzls; try { mzls = int.Parse(Ssbz.Substring(11)); } catch { MessageBox.Show("请检查输入的门诊号格式是否正确!"); return("0"); } bb.AddInParameter(cmd, "@In_SeqNo", DbType.Int32, mzls); bb.AddInParameter(cmd, "@In_FunctionSampleLabelID", DbType.Int32, 0); } else if (Flag == 2) { bb.AddInParameter(cmd, "@In_IPSeqNoText", DbType.String, Ssbz); bb.AddInParameter(cmd, "@In_RegisterDate", DbType.String, ""); bb.AddInParameter(cmd, "@In_SeqNo", DbType.String, ""); bb.AddInParameter(cmd, "@In_FunctionSampleLabelID", DbType.Int32, 0); } else if (Flag == 4) { bb.AddInParameter(cmd, "@In_IPSeqNoText", DbType.String, ""); bb.AddInParameter(cmd, "@In_RegisterDate", DbType.String, ""); bb.AddInParameter(cmd, "@In_SeqNo", DbType.String, ""); bb.AddInParameter(cmd, "@In_FunctionSampleLabelID", DbType.Int32, Ssbz); } OdbcDataAdapter sqlda = new OdbcDataAdapter(cmd); DataSet ds = new DataSet(); sqlda.Fill(ds); if (ds.Tables == null || ds.Tables.Count < 1) { return("0"); } DataTable dt = ds.Tables[0]; if (dt == null || dt.Rows.Count < 1) { return("0"); } LogeneXmlHelper lxp = new LogeneXmlHelper(); lxp.F_ZYH = dt.Rows[0]["IPSeqNOText"] == null ? "" : dt.Rows[0]["IPSeqNOText"].ToString().Trim(); lxp.F_BRBH = dt.Rows[0]["patientid"] == null ? "" : dt.Rows[0]["patientid"].ToString().Trim(); //empiid存职业字段 lxp.F_ZY = GetEMPIID(lxp.F_BRBH); lxp.F_CH = dt.Rows[0]["sickbedno"] == null ? "" : dt.Rows[0]["sickbedno"].ToString().Trim(); lxp.F_XM = dt.Rows[0]["patientname"] == null ? "" : dt.Rows[0]["patientname"].ToString().Trim(); string birthday = dt.Rows[0]["patientbirthday"] == null ? "" : dt.Rows[0]["patientbirthday"].ToString().Trim(); if (birthday != "") { try { DateTime birth = DateTime.Parse(birthday); int nl = CalculateAgeCorrect(birth, DateTime.Now); lxp.F_NL = nl.ToString() + "岁"; } catch { lxp.F_NL = ""; } } lxp.F_XB = dt.Rows[0]["patientsex"] == null ? "" : dt.Rows[0]["patientsex"].ToString().Trim(); lxp.F_HY = dt.Rows[0]["marriage"] == null ? "" : dt.Rows[0]["marriage"].ToString().Trim(); lxp.F_SJKS = dt.Rows[0]["departmentname"] == null ? "" : dt.Rows[0]["departmentname"].ToString().Trim(); lxp.F_ADDRESS = dt.Rows[0]["address"] == null ? "" : dt.Rows[0]["address"].ToString().Trim(); lxp.F_TELEPHONE = dt.Rows[0]["phone"] == null ? "" : dt.Rows[0]["phone"].ToString().Trim(); switch (Flag) { case 1: lxp.F_BRLB = "门诊"; break; case 2: lxp.F_BRLB = "住院"; break; default: lxp.F_BRLB = dt.Rows[0]["PatientTypeListName"] == null ? "" : dt.Rows[0]["PatientTypeListName"].ToString().Trim(); break; } if (sftqbb == "1") { if (Debug == "1") { MessageBox.Show("取标本列表"); } lxp.BBLBLIST = TQBBLB(bb, Ssbz); if (lxp.BBLBLIST == null) { MessageBox.Show("未查询到标本信息"); } else { if (Debug == "1") { MessageBox.Show("返回XML:" + lxp.ReturnBBLBXML()); } return(lxp.ReturnBBLBXML()); } } return(lxp.ReturnLogeneXML()); }