Пример #1
0
        /// <summary>
        ///  获得门诊卡信息_病人ID
        /// </summary>
        /// <param name="patientid">病人ID</param>
        /// <returns>0-成功  大于0-失败   小于0-异常</returns>
        public int DB_GetmzkInforStr(string patientid, out PatientInfo paintentInfo, out string msg)
        {
            msg = "";

            OracleConnection connection = new OracleConnection(WebConfigParameter.ConnectionHisString);
            OracleDataReader dr         = null;

            int ret = -1;

            paintentInfo = new PatientInfo();
            try
            {
                bool _flag = false;

                string findText = _builder.GetGetmzkInforStrSql(patientid, out _flag, out msg);
                UtilLog.GetInstance().WriteProgramLog(System.Reflection.MethodBase.GetCurrentMethod().Name, findText);

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

                dr = DbHelperOra.ExecuteReader(findText, connection);

                if (dr.Read())
                {
                    paintentInfo.bklx     = !dr.IsDBNull(0) ? dr.GetString(0) : "";
                    paintentInfo.cardname = !dr.IsDBNull(1) ? dr.GetString(1) : "";
                    paintentInfo.bkhm     = !dr.IsDBNull(2) ? dr.GetString(2) : "";
                    paintentInfo.sfzh     = !dr.IsDBNull(3) ? dr.GetString(3) : "";
                    paintentInfo.brid     = !dr.IsDBNull(4) ? dr.GetString(4) : "";
                    paintentInfo.brxm     = !dr.IsDBNull(5) ? dr.GetString(5) : "";
                    paintentInfo.birthday = !dr.IsDBNull(6) ? dr.GetDateTime(6).ToString("yyyy-MM-dd") : "";
                    paintentInfo.lxdh     = !dr.IsDBNull(7) ? dr.GetString(7) : "";
                    paintentInfo.balance  = !dr.IsDBNull(8) ? dr.GetString(8) : "";
                    paintentInfo.cost     = !dr.IsDBNull(9) ? dr.GetString(9) : "";
                    ret = 0;
                }
                else
                {
                    msg = "医院端未找到,请核对信息后重试";
                    ret = 10;
                }
                dr.Close();
                return(ret);
            }
            catch (Exception ex)
            {
                UtilLog.GetInstance().WriteProgramLog(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);

                msg = GetExceptionInfo(ex);
                ret = -1;
                return(ret);
            }
            finally
            {
                if (null != dr)
                {
                    dr.Close();
                }
                connection.Close();
            }
        }