diff --git a/src/cli.rs b/src/cli.rs index 930e309..9379b65 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -62,6 +62,8 @@ pub enum SubCommand { year: String, #[arg(long, value_parser = value_is_date, help = "Ignoriere LKR-Exporte seit Datum")] ignore_exports_since: Option, + #[arg(long, help = "Ignoriere Meldungen, die nicht im oBDS 2.x Format sind")] + ignore_non_obds_2: bool, #[arg(long, help = "Meldungen mit externer Diagnose einschließen")] include_extern: bool, #[arg( @@ -103,6 +105,8 @@ pub enum SubCommand { year: String, #[arg(long, value_parser = value_is_date, help = "Ignoriere LKR-Exporte seit Datum")] ignore_exports_since: Option, + #[arg(long, help = "Ignoriere Meldungen, die nicht im oBDS 2.x Format sind")] + ignore_non_obds_2: bool, #[arg(long, help = "Export mit Trennzeichen ';' für Excel")] xls_csv: bool, #[arg(long, help = "Meldungen mit externer Diagnose einschließen")] @@ -142,6 +146,8 @@ pub enum SubCommand { year: String, #[arg(long, value_parser = value_is_date, help = "Ignoriere LKR-Exporte seit Datum")] ignore_exports_since: Option, + #[arg(long, help = "Ignoriere Meldungen, die nicht im oBDS 2.x Format sind")] + ignore_non_obds_2: bool, #[arg(long, help = "Meldungen mit externer Diagnose einschließen")] include_extern: bool, #[arg( diff --git a/src/database.rs b/src/database.rs index 61c8a2f..4860b50 100644 --- a/src/database.rs +++ b/src/database.rs @@ -55,6 +55,7 @@ impl DatabaseSource { &self, year: &str, ignore_exports_since: &str, + ignore_non_obds_2: bool, include_extern: bool, include_histo_zyto: bool, schema_versions: bool, @@ -62,6 +63,7 @@ impl DatabaseSource { let params = params! { "year" => year, "ignore_exports_since" => ignore_exports_since, + "ignore_non_obds_2" => if ignore_non_obds_2 { 1 } else { 0 }, "include_extern" => if include_extern { 1 } else { 0 }, "include_histo_zyto" => if include_histo_zyto { 1 } else { 0 } }; @@ -97,6 +99,7 @@ impl DatabaseSource { &self, year: &str, ignore_exports_since: &str, + ignore_non_obds_2: bool, use_pat_id: bool, include_extern: bool, include_histo_zyto: bool, @@ -109,6 +112,7 @@ impl DatabaseSource { params! { "year" => year, "ignore_exports_since" => ignore_exports_since, + "ignore_non_obds_2" => if ignore_non_obds_2 { 1 } else { 0 }, "include_extern" => if include_extern { 1 } else { 0 }, "include_histo_zyto" => if include_histo_zyto { 1 } else { 0 } }, diff --git a/src/main.rs b/src/main.rs index 89ed0b2..e433939 100644 --- a/src/main.rs +++ b/src/main.rs @@ -129,6 +129,7 @@ fn main() -> Result<(), Box> { user, year, ignore_exports_since, + ignore_non_obds_2, include_extern, include_histo_zyto, schema_versions, @@ -148,6 +149,7 @@ fn main() -> Result<(), Box> { .check( &year, &ignore_exports_since.unwrap_or("9999-12-31".into()), + ignore_non_obds_2, include_extern, include_histo_zyto, schema_versions, @@ -169,6 +171,7 @@ fn main() -> Result<(), Box> { output, year, ignore_exports_since, + ignore_non_obds_2, xls_csv, include_extern, include_histo_zyto, @@ -188,6 +191,7 @@ fn main() -> Result<(), Box> { .export( &year, &ignore_exports_since.unwrap_or("9999-12-31".into()), + ignore_non_obds_2, pat_id, include_extern, include_histo_zyto, @@ -232,6 +236,7 @@ fn main() -> Result<(), Box> { file, year, ignore_exports_since, + ignore_non_obds_2, include_extern, include_histo_zyto, } => { @@ -250,6 +255,7 @@ fn main() -> Result<(), Box> { .export( &year, &ignore_exports_since.unwrap_or("9999-12-31".into()), + ignore_non_obds_2, pat_id, include_extern, include_histo_zyto, diff --git a/src/resources/export.sql b/src/resources/export.sql index a2a8188..4bc83b6 100644 --- a/src/resources/export.sql +++ b/src/resources/export.sql @@ -39,6 +39,7 @@ FROM ( AND (lme.xml_daten LIKE '%%' OR lme.xml_daten LIKE '%%') AND (lme.xml_daten NOT LIKE '%histologie_zytologie%' OR 1 = :include_histo_zyto) AND (EXTRACTVALUE(lme.xml_daten, '//Meldende_Stelle') NOT LIKE '%9999%' OR 1 <= :include_extern) + AND (EXTRACTVALUE(lme.xml_daten, '//ADT_GEKID/@Schema_Version') LIKE '2.%' OR 1 = :ignore_non_obds_2) ) o1 LEFT OUTER JOIN ( diff --git a/src/resources/query.sql b/src/resources/query.sql index f8852b1..9e88b98 100644 --- a/src/resources/query.sql +++ b/src/resources/query.sql @@ -125,6 +125,7 @@ FROM ( AND (lme.xml_daten LIKE '%%' OR lme.xml_daten LIKE '%%') AND (lme.xml_daten NOT LIKE '%histologie_zytologie%' OR 1 = :include_histo_zyto) AND (EXTRACTVALUE(lme.xml_daten, '//Meldende_Stelle') NOT LIKE '%9999%' OR 1 <= :include_extern) + AND (EXTRACTVALUE(lme.xml_daten, '//ADT_GEKID/@Schema_Version') LIKE '2.%' OR 1 = :ignore_non_obds_2) ) o1 LEFT OUTER JOIN ( SELECT DISTINCT diff --git a/src/resources/query_with_schema_version.sql b/src/resources/query_with_schema_version.sql index aa4aa53..700af36 100644 --- a/src/resources/query_with_schema_version.sql +++ b/src/resources/query_with_schema_version.sql @@ -125,6 +125,7 @@ FROM ( AND (lme.xml_daten LIKE '%%' OR lme.xml_daten LIKE '%%') AND (lme.xml_daten NOT LIKE '%histologie_zytologie%' OR 1 = :include_histo_zyto) AND (EXTRACTVALUE(lme.xml_daten, '//Meldende_Stelle') NOT LIKE '%9999%' OR 1 <= :include_extern) + AND (EXTRACTVALUE(lme.xml_daten, '//ADT_GEKID/@Schema_Version') LIKE '2.%' OR 1 = :ignore_non_obds_2) ) o1 LEFT OUTER JOIN ( SELECT DISTINCT