예제 #1
0
        /// <summary>
        /// 一个检验报告单详细列表信息
        /// </summary>
        /// <param name="doctadviseno">条码号</param>
        /// <param name="msg">出错信息</param>
        /// <returns>0:成功  大于0:出错  小于0:异常</returns>
        public int DB_InspectionReportResultsInformation(string doctadviseno, out AlipayInspectionReport alipayInspectionReport, out string msg)
        {
            msg = "";
            alipayInspectionReport = new AlipayInspectionReport();

            OracleConnection oracleConnection = new OracleConnection(WebConfigParameter.ConnectionHisString);
            SqlConnection    sqlConnection    = new SqlConnection(WebConfigParameter.ConnectionLisString);
            OracleDataReader dr       = null;
            SqlDataReader    myReader = null;

            int ret = -1;

            try
            {
                bool   _flag     = false;
                string sqlstr    = "";
                string oraclestr = "";
                _builder.GetDInspectionReportResultsInformation(doctadviseno, out sqlstr, out oraclestr, out _flag, out msg);
                UtilLog.GetInstance().WriteProgramLog(System.Reflection.MethodBase.GetCurrentMethod().Name, sqlstr);
                UtilLog.GetInstance().WriteProgramLog(System.Reflection.MethodBase.GetCurrentMethod().Name, oraclestr);

                if (!_flag)
                {
                    return(10);
                }

                msg = "";
                dr  = DbHelperOra.ExecuteReader(oraclestr, oracleConnection);
                if (null != dr && dr.HasRows)
                {
                    if (dr.Read())
                    {
                        alipayInspectionReport.studyresult = !dr.IsDBNull(0) ? dr.GetString(0) : "";
                        alipayInspectionReport.diagresult  = !dr.IsDBNull(1) ? dr.GetString(1) : "";
                        ret = 0;
                    }
                    return(ret);
                }

                if (!string.IsNullOrEmpty(WebConfigParameter.ConnectionLisString))
                {
                    myReader = DbHelperSQL.ExecuteReader(sqlstr, sqlConnection);
                    if (null != myReader && myReader.HasRows)
                    {
                        if (myReader.Read())
                        {
                            alipayInspectionReport.studyresult = !myReader.IsDBNull(0) ? myReader.GetString(0) : "";
                            alipayInspectionReport.diagresult  = !myReader.IsDBNull(1) ? myReader.GetString(1) : "";
                            ret = 0;
                        }
                    }
                }
                else
                {
                    msg = "未能找到报告单";
                    ret = 17;
                }

                return(ret);
            }
            catch (Exception ex)
            {
                UtilLog.GetInstance().WriteProgramLog(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
                msg = GetExceptionInfo(ex);
                return(AppUtils.Default_Exception_Code);
            }
            finally
            {
                if (null != dr)
                {
                    dr.Close();
                }
                if (null != myReader)
                {
                    myReader.Close();
                }
                oracleConnection.Close();
                sqlConnection.Close();
                oracleConnection.Close();
                sqlConnection.Close();
            }
        }