Skip to content

SQL-034: BillQueryProvider.GetStrippedCbpDiagnosis

This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by BillQueryProvider.GetStrippedCbpDiagnosis.

Classification

Field Value
SQL ID SQL-034
Operation type Read
Execution method ORM (NHibernate LINQ)
Database Oracle*
Schema [unqualified]**
Command type N/A (ORM-generated)
Business object BillQueryProvider
Criteria property N/A — ORM
Lifecycle method GetStrippedCbpDiagnosis

Parameters

Parameter Direction Type Max length Description
diagnosisInformation Input string N/A Method argument of BillQueryProvider.GetStrippedCbpDiagnosis bound into the ORM expression; NHibernate generates the bind variable at runtime
icdVersion Input string N/A Method argument of BillQueryProvider.GetStrippedCbpDiagnosis bound into the ORM expression; NHibernate generates the bind variable at runtime

Tables

Table Access Columns used
CBP_DIAGNOSIS SELECT DIAGNOSIS_CODE, UPDATE_NUM, ICD_VERSION_CODE, DIAGNOSIS_DESCR, DIAGNOSIS_SHORT_DESCR, DIAGNOSIS_CATEGORY_CODE, VALID_MEDICARE_REPORT_FLAG, EFF_DATE, EXP_DATE, UPDATE_USER, UPDATE_DATE

LINQ statement

Source: Data/SAIF.Data/Queries/Claims/BillQueryProvider.cs:119.

var singleOrDefault = Factory.GetRepository<CbpDiagnosis>()
    .Query()
    .SingleOrDefault(x => x.DiagnosisCode.Replace(".", "") == diagnosisInformation && x.IcdVersionCode == icdVersion);

Sample SQL

Inferred SQL: This SQL was inferred from the LINQ statement above and the NHibernate mappings. It is not concrete SQL from source code; NHibernate generates the executed statement at runtime, so aliases, column order, join syntax, and bind-parameter names may differ.

-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
SELECT
  CD.DIAGNOSIS_CODE,
  CD.UPDATE_NUM,
  CD.ICD_VERSION_CODE,
  CD.DIAGNOSIS_DESCR,
  CD.DIAGNOSIS_SHORT_DESCR,
  CD.DIAGNOSIS_CATEGORY_CODE,
  CD.VALID_MEDICARE_REPORT_FLAG,
  CD.EFF_DATE,
  CD.EXP_DATE,
  CD.UPDATE_USER,
  CD.UPDATE_DATE
FROM CBP_DIAGNOSIS CD
WHERE REPLACE(CD.DIAGNOSIS_CODE, '.', '') = :diagnosisInformation
  AND CD.ICD_VERSION_CODE = :icdVersion
-- NHibernate expects at most one row

Translation notes: - string.Replace maps to Oracle REPLACE. Because the function is applied to the column, the DIAGNOSIS_CODE index cannot be used. - The caller only reads DiagnosisCode from the result, but the query still selects the full entity.

Operations and processes

Business rules

Sources

  • Data/SAIF.Data/Queries/Claims/BillQueryProvider.cs:119