mirror of
https://github.com/pcvolkmer/bzkf-rwdp-check.git
synced 2025-07-16 21:52:54 +00:00
feat: enable messages with 'histologie_zytologie' using optional flag
This commit is contained in:
15
src/cli.rs
15
src/cli.rs
@ -63,6 +63,11 @@ pub enum SubCommand {
|
||||
ignore_exports_since: Option<String>,
|
||||
#[arg(long, help = "Meldungen mit externer Diagnose einschließen")]
|
||||
include_extern: bool,
|
||||
#[arg(
|
||||
long,
|
||||
help = "Meldungen mit Meldeanlass 'histologie_zytologie' einschließen"
|
||||
)]
|
||||
include_histo_zyto: bool,
|
||||
},
|
||||
#[command(
|
||||
about = "Erstellt eine (reduzierte) CSV-Datei zum direkten Vergleich mit der OPAL-CSV-Datei"
|
||||
@ -99,6 +104,11 @@ pub enum SubCommand {
|
||||
xls_csv: bool,
|
||||
#[arg(long, help = "Meldungen mit externer Diagnose einschließen")]
|
||||
include_extern: bool,
|
||||
#[arg(
|
||||
long,
|
||||
help = "Meldungen mit Meldeanlass 'histologie_zytologie' einschließen"
|
||||
)]
|
||||
include_histo_zyto: bool,
|
||||
},
|
||||
#[command(about = "Abgleich zwischen CSV-Datei für OPAL und Onkostar-Datenbank")]
|
||||
Compare {
|
||||
@ -131,6 +141,11 @@ pub enum SubCommand {
|
||||
ignore_exports_since: Option<String>,
|
||||
#[arg(long, help = "Meldungen mit externer Diagnose einschließen")]
|
||||
include_extern: bool,
|
||||
#[arg(
|
||||
long,
|
||||
help = "Meldungen mit Meldeanlass 'histologie_zytologie' einschließen"
|
||||
)]
|
||||
include_histo_zyto: bool,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -40,13 +40,19 @@ impl DatabaseSource {
|
||||
year: &str,
|
||||
ignore_exports_since: &str,
|
||||
include_extern: bool,
|
||||
include_histo_zyto: bool,
|
||||
) -> Result<Vec<Icd10GroupSize>, ()> {
|
||||
match Pool::new(self.0.as_str()) {
|
||||
Ok(pool) => {
|
||||
if let Ok(mut connection) = pool.try_get_conn(Duration::from_secs(3)) {
|
||||
return match connection.exec_map(
|
||||
SQL_QUERY,
|
||||
params! {"year" => year, "ignore_exports_since" => ignore_exports_since, "include_extern" => if include_extern { 1 } else { 0 } },
|
||||
params! {
|
||||
"year" => year,
|
||||
"ignore_exports_since" => ignore_exports_since,
|
||||
"include_extern" => if include_extern { 1 } else { 0 },
|
||||
"include_histo_zyto" => if include_histo_zyto { 1 } else { 0 }
|
||||
},
|
||||
|(icd10_group, count)| Icd10GroupSize {
|
||||
name: icd10_group,
|
||||
size: count,
|
||||
@ -71,13 +77,19 @@ impl DatabaseSource {
|
||||
ignore_exports_since: &str,
|
||||
use_pat_id: bool,
|
||||
include_extern: bool,
|
||||
include_histo_zyto: bool,
|
||||
) -> Result<Vec<ExportData>, ()> {
|
||||
match Pool::new(self.0.as_str()) {
|
||||
Ok(pool) => {
|
||||
if let Ok(mut connection) = pool.try_get_conn(Duration::from_secs(3)) {
|
||||
return match connection.exec_map(
|
||||
EXPORT_QUERY,
|
||||
params! {"year" => year, "ignore_exports_since" => ignore_exports_since, "include_extern" => if include_extern { 1 } else { 0 } },
|
||||
params! {
|
||||
"year" => year,
|
||||
"ignore_exports_since" => ignore_exports_since,
|
||||
"include_extern" => if include_extern { 1 } else { 0 },
|
||||
"include_histo_zyto" => if include_histo_zyto { 1 } else { 0 }
|
||||
},
|
||||
|(condition_id, icd_10_code, diagnosis_date, pat_id)| ExportData {
|
||||
condition_id,
|
||||
icd_10_code,
|
||||
|
@ -120,6 +120,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
year,
|
||||
ignore_exports_since,
|
||||
include_extern,
|
||||
include_histo_zyto,
|
||||
} => {
|
||||
let password = request_password_if_none(password);
|
||||
let year = sanitize_year(year);
|
||||
@ -136,6 +137,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
&year,
|
||||
&ignore_exports_since.unwrap_or("9999-12-31".into()),
|
||||
include_extern,
|
||||
include_histo_zyto,
|
||||
)
|
||||
.map_err(|_e| "Fehler bei Zugriff auf die Datenbank")?;
|
||||
|
||||
@ -156,6 +158,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
ignore_exports_since,
|
||||
xls_csv,
|
||||
include_extern,
|
||||
include_histo_zyto,
|
||||
} => {
|
||||
let password = request_password_if_none(password);
|
||||
let year = sanitize_year(year);
|
||||
@ -173,6 +176,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
&ignore_exports_since.unwrap_or("9999-12-31".into()),
|
||||
pat_id,
|
||||
include_extern,
|
||||
include_histo_zyto,
|
||||
)
|
||||
.map_err(|_e| "Fehler bei Zugriff auf die Datenbank")?;
|
||||
|
||||
@ -215,6 +219,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
year,
|
||||
ignore_exports_since,
|
||||
include_extern,
|
||||
include_histo_zyto,
|
||||
} => {
|
||||
let password = request_password_if_none(password);
|
||||
let year = sanitize_year(year);
|
||||
@ -232,6 +237,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
&ignore_exports_since.unwrap_or("9999-12-31".into()),
|
||||
pat_id,
|
||||
include_extern,
|
||||
include_histo_zyto,
|
||||
)
|
||||
.map_err(|_e| "Fehler bei Zugriff auf die Datenbank")?;
|
||||
|
||||
|
@ -37,7 +37,7 @@ FROM (
|
||||
WHERE lm.xml_daten LIKE '%ICD_Version%'
|
||||
AND SUBSTRING_INDEX(SUBSTRING_INDEX(EXTRACTVALUE(lm.xml_daten, '//Diagnosedatum'), ' ', 1), '.', -1) = :year
|
||||
AND (lm.xml_daten LIKE '%<cTNM%' OR lm.xml_daten LIKE '%<pTNM%' OR lm.xml_daten LIKE '%<Menge_Histologie>%' OR lm.xml_daten LIKE '%<Menge_Weitere_Klassifikation>%')
|
||||
AND (lm.xml_daten NOT LIKE '%histologie_zytologie%')
|
||||
AND (lm.xml_daten NOT LIKE '%histologie_zytologie%' OR 1 = :include_histo_zyto)
|
||||
) o1
|
||||
LEFT OUTER JOIN (
|
||||
|
||||
|
@ -122,7 +122,7 @@ FROM (
|
||||
WHERE lme.xml_daten LIKE '%ICD_Version%'
|
||||
AND SUBSTRING_INDEX(SUBSTRING_INDEX(EXTRACTVALUE(lm.xml_daten, '//Diagnosedatum'), ' ', 1), '.', -1) = :year
|
||||
AND (lm.xml_daten LIKE '%<cTNM%' OR lm.xml_daten LIKE '%<pTNM%' OR lm.xml_daten LIKE '%<Menge_Histologie>%' OR lm.xml_daten LIKE '%<Menge_Weitere_Klassifikation>%')
|
||||
AND (lm.xml_daten NOT LIKE '%histologie_zytologie%')
|
||||
AND (lm.xml_daten NOT LIKE '%histologie_zytologie%' OR 1 = :include_histo_zyto)
|
||||
) o1
|
||||
LEFT OUTER JOIN (
|
||||
|
||||
|
Reference in New Issue
Block a user