mirror of
https://github.com/pcvolkmer/bzkf-rwdp-check.git
synced 2025-04-19 19:16:51 +00:00
Merge pull request #3 from pcvolkmer/issue_2
Vergleich der LKR-Meldungen in Datenbank mit LKR-Export-Protokolldatei
This commit is contained in:
commit
8869090b08
@ -99,3 +99,11 @@ Die Anwendung kann auch die Conditions in der CSV-Datei mit der Onkostar-Datenba
|
|||||||
|
|
||||||
Hierzu kann der Befehl `compare` genutzt werden. Dieser verwendet alle Optionen für die Datenbank und die
|
Hierzu kann der Befehl `compare` genutzt werden. Dieser verwendet alle Optionen für die Datenbank und die
|
||||||
Option `--file` für die CSV-Datei und gibt eine Übersicht auf der Konsole aus.
|
Option `--file` für die CSV-Datei und gibt eine Übersicht auf der Konsole aus.
|
||||||
|
|
||||||
|
## Vergleich der XML-basierten LKR-Export-Protokolldatei mit der Datenbank
|
||||||
|
|
||||||
|
Mithilfe dieser Anwendung kann auch der aktuelle Inhalt der Datenbank gegen die LKR-Export-Protokolldatei für einen
|
||||||
|
Export verglichen werden.
|
||||||
|
|
||||||
|
Der Befehl `check-export` kann zusammen mit der Angabe der Protokolldatei (`--file`) und der Angabe des
|
||||||
|
Exports (`--export-package=...`) und den Optionen für den Datenbankzugriff ausgeführt werden.
|
26
src/cli.rs
26
src/cli.rs
@ -148,6 +148,32 @@ pub enum SubCommand {
|
|||||||
)]
|
)]
|
||||||
include_histo_zyto: bool,
|
include_histo_zyto: bool,
|
||||||
},
|
},
|
||||||
|
#[command(about = "Abgleich zwischen LKR-Export-Protokoll und Onkostar-Datenbank")]
|
||||||
|
CheckExport {
|
||||||
|
#[arg(short = 'D', long, help = "Datenbank-Name", default_value = "onkostar")]
|
||||||
|
database: String,
|
||||||
|
#[arg(
|
||||||
|
short = 'h',
|
||||||
|
long,
|
||||||
|
help = "Datenbank-Host",
|
||||||
|
default_value = "localhost"
|
||||||
|
)]
|
||||||
|
host: String,
|
||||||
|
#[arg(short = 'P', long, help = "Datenbank-Host", default_value = "3306")]
|
||||||
|
port: u16,
|
||||||
|
#[arg(
|
||||||
|
short = 'p',
|
||||||
|
long,
|
||||||
|
help = "Passwort. Wenn nicht angegeben, wird danach gefragt"
|
||||||
|
)]
|
||||||
|
password: Option<String>,
|
||||||
|
#[arg(short = 'u', long, help = "Benutzername")]
|
||||||
|
user: String,
|
||||||
|
#[arg(short, long, help = "LKR-Export-Protokoll-Datei")]
|
||||||
|
file: PathBuf,
|
||||||
|
#[arg(long, help = "Exportpaketnummer", default_value = "0")]
|
||||||
|
export_package: u16,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
fn value_is_date(value: &str) -> Result<String, String> {
|
fn value_is_date(value: &str) -> Result<String, String> {
|
||||||
|
@ -24,7 +24,7 @@ use mysql::prelude::Queryable;
|
|||||||
use mysql::{params, Pool};
|
use mysql::{params, Pool};
|
||||||
|
|
||||||
use crate::common::{ExportData, Icd10GroupSize};
|
use crate::common::{ExportData, Icd10GroupSize};
|
||||||
use crate::resources::{EXPORT_QUERY, SQL_QUERY};
|
use crate::resources::{EXPORTED_TO_LKR, EXPORT_QUERY, SQL_QUERY};
|
||||||
|
|
||||||
pub struct DatabaseSource(String);
|
pub struct DatabaseSource(String);
|
||||||
|
|
||||||
@ -111,4 +111,30 @@ impl DatabaseSource {
|
|||||||
|
|
||||||
Err(())
|
Err(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn exported(&self, export_id: u16) -> Result<Vec<(String, String)>, ()> {
|
||||||
|
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(
|
||||||
|
EXPORTED_TO_LKR,
|
||||||
|
params! {
|
||||||
|
"export_id" => export_id,
|
||||||
|
},
|
||||||
|
|(id, xml_data)| (id, xml_data),
|
||||||
|
) {
|
||||||
|
Ok(result) => Ok(result),
|
||||||
|
Err(_) => {
|
||||||
|
return Err(());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(_) => {
|
||||||
|
return Err(());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Err(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
224
src/lkrexport.rs
Normal file
224
src/lkrexport.rs
Normal file
@ -0,0 +1,224 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of bzkf-rwdp-check
|
||||||
|
*
|
||||||
|
* Copyright (C) 2024 Comprehensive Cancer Center Mainfranken and contributors.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use std::fs;
|
||||||
|
use std::path::Path;
|
||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
use itertools::Itertools;
|
||||||
|
use regex::Regex;
|
||||||
|
|
||||||
|
pub struct LkrExportProtocolFile {
|
||||||
|
pub patients: Vec<Patient>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl LkrExportProtocolFile {
|
||||||
|
pub fn parse_file(path: &Path) -> Result<LkrExportProtocolFile, ()> {
|
||||||
|
let xml_file_content = fs::read_to_string(path).map_err(|_| ())?;
|
||||||
|
Self::parse(&xml_file_content)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn parse(content: &str) -> Result<LkrExportProtocolFile, ()> {
|
||||||
|
let re = Regex::new(r"(?s)(?<patient><Patient>(.*?)</Patient>)").unwrap();
|
||||||
|
|
||||||
|
if re.is_match(content) {
|
||||||
|
let patients = re
|
||||||
|
.find_iter(content)
|
||||||
|
.map(|m| Patient {
|
||||||
|
raw_value: m.as_str().to_string(),
|
||||||
|
})
|
||||||
|
.collect_vec();
|
||||||
|
return Ok(LkrExportProtocolFile { patients });
|
||||||
|
}
|
||||||
|
|
||||||
|
Err(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn meldungen(&self) -> Vec<Meldung> {
|
||||||
|
self.patients
|
||||||
|
.iter()
|
||||||
|
.flat_map(|patient| patient.meldungen())
|
||||||
|
.collect_vec()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Patient {
|
||||||
|
pub raw_value: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Patient {
|
||||||
|
pub fn meldungen(&self) -> Vec<Meldung> {
|
||||||
|
let re = Regex::new(r"(?s)(?<meldung><Meldung(.*?)</Meldung>)").unwrap();
|
||||||
|
|
||||||
|
if re.is_match(&self.raw_value) {
|
||||||
|
return re
|
||||||
|
.find_iter(&self.raw_value)
|
||||||
|
.map(|m| Meldung {
|
||||||
|
raw_value: m.as_str().to_string(),
|
||||||
|
})
|
||||||
|
.collect_vec();
|
||||||
|
}
|
||||||
|
vec![]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Meldung {
|
||||||
|
pub raw_value: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromStr for Meldung {
|
||||||
|
type Err = ();
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
Ok(Meldung {
|
||||||
|
raw_value: s.to_string(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
|
impl Meldung {
|
||||||
|
pub fn id(&self) -> Option<String> {
|
||||||
|
let re = Regex::new(r#"Meldung_ID="(?<meldung_id>(.*?))""#).unwrap();
|
||||||
|
|
||||||
|
if re.is_match(&self.raw_value) {
|
||||||
|
let caps = re.captures(&self.raw_value).unwrap();
|
||||||
|
return Some(caps["meldung_id"].to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn icd10(&self) -> Option<String> {
|
||||||
|
let re = Regex::new(r"(?s)<Primaertumor_ICD_Code>(?<icd10>(.*?))</Primaertumor_ICD_Code>")
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
if re.is_match(&self.raw_value) {
|
||||||
|
let caps = re.captures(&self.raw_value).unwrap();
|
||||||
|
return Some(caps["icd10"].to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn database_id(&self) -> Option<String> {
|
||||||
|
match self.id() {
|
||||||
|
Some(id) => to_database_id(&id),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn no_linebreak(&self) -> String {
|
||||||
|
let re = Regex::new(r"\n\s*").unwrap();
|
||||||
|
re.replace_all(&self.raw_value, "").trim().to_string()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn to_database_id(id: &str) -> Option<String> {
|
||||||
|
let re1 = Regex::new(r"^(?<id>[0-9A-F]+)").unwrap();
|
||||||
|
let re2 = Regex::new(r"(?<id>[0-9]+)$").unwrap();
|
||||||
|
|
||||||
|
if re1.is_match(id) {
|
||||||
|
match re1.find(id).map(|m| m.as_str().to_string()) {
|
||||||
|
Some(val) => match u64::from_str_radix(&val, 16) {
|
||||||
|
Ok(val) => Some(val.to_string()),
|
||||||
|
_ => None,
|
||||||
|
},
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
} else if re2.is_match(id) {
|
||||||
|
re2.find(id).map(|m| m.as_str().to_string())
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use crate::lkrexport::{LkrExportProtocolFile, Meldung};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_read_xml_file_content() {
|
||||||
|
let actual = LkrExportProtocolFile::parse(include_str!("../testdaten/testdaten_1.xml"));
|
||||||
|
|
||||||
|
assert!(actual.is_ok());
|
||||||
|
assert_eq!(actual.unwrap().patients.len(), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_get_meldungen() {
|
||||||
|
let actual = LkrExportProtocolFile::parse(include_str!("../testdaten/testdaten_1.xml"));
|
||||||
|
|
||||||
|
assert!(actual.is_ok());
|
||||||
|
|
||||||
|
let patients = actual.unwrap().patients;
|
||||||
|
|
||||||
|
assert_eq!(patients[0].meldungen().len(), 1);
|
||||||
|
assert_eq!(patients[1].meldungen().len(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_get_meldung_database_id() {
|
||||||
|
let actual = LkrExportProtocolFile::parse(include_str!("../testdaten/testdaten_1.xml"));
|
||||||
|
|
||||||
|
assert!(actual.is_ok());
|
||||||
|
|
||||||
|
let patients = actual.unwrap().patients;
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
patients[0].meldungen()[0].database_id(),
|
||||||
|
Some("1727528".to_string())
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
patients[1].meldungen()[0].database_id(),
|
||||||
|
Some("1727824".to_string())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_get_meldung_icd10() {
|
||||||
|
let actual = LkrExportProtocolFile::parse(include_str!("../testdaten/testdaten_1.xml"));
|
||||||
|
|
||||||
|
assert!(actual.is_ok());
|
||||||
|
|
||||||
|
let patients = actual.unwrap().patients;
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
patients[0].meldungen()[0].icd10(),
|
||||||
|
Some("C17.1".to_string())
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
patients[1].meldungen()[0].icd10(),
|
||||||
|
Some("C17.2".to_string())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_get_meldung_with_trimmed_margin() {
|
||||||
|
let meldung = Meldung {
|
||||||
|
raw_value: " <Test>\n <Test2>TestInhalt 3</Test2>\n</Test>\n".into(),
|
||||||
|
};
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
meldung.no_linebreak(),
|
||||||
|
"<Test><Test2>TestInhalt 3</Test2></Test>".to_string()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
176
src/main.rs
176
src/main.rs
@ -18,6 +18,7 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use std::collections::HashMap;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
@ -28,10 +29,12 @@ use itertools::Itertools;
|
|||||||
use crate::cli::{Cli, SubCommand};
|
use crate::cli::{Cli, SubCommand};
|
||||||
use crate::common::{Check, DiffRecord, Icd10GroupSize};
|
use crate::common::{Check, DiffRecord, Icd10GroupSize};
|
||||||
use crate::database::DatabaseSource;
|
use crate::database::DatabaseSource;
|
||||||
|
use crate::lkrexport::{to_database_id, LkrExportProtocolFile, Meldung};
|
||||||
|
|
||||||
mod cli;
|
mod cli;
|
||||||
mod common;
|
mod common;
|
||||||
mod database;
|
mod database;
|
||||||
|
mod lkrexport;
|
||||||
mod opal;
|
mod opal;
|
||||||
mod resources;
|
mod resources;
|
||||||
|
|
||||||
@ -421,6 +424,179 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
));
|
));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
SubCommand::CheckExport {
|
||||||
|
database,
|
||||||
|
host,
|
||||||
|
password,
|
||||||
|
port,
|
||||||
|
user,
|
||||||
|
file,
|
||||||
|
export_package,
|
||||||
|
} => {
|
||||||
|
let password = request_password_if_none(password);
|
||||||
|
|
||||||
|
let _ = term.write_line(
|
||||||
|
&style(format!(
|
||||||
|
"Warte auf Daten für den LKR-Export '{}'...",
|
||||||
|
export_package
|
||||||
|
))
|
||||||
|
.blue()
|
||||||
|
.to_string(),
|
||||||
|
);
|
||||||
|
|
||||||
|
let db = DatabaseSource::new(&database, &host, &password, port, &user);
|
||||||
|
|
||||||
|
let db_entries = db
|
||||||
|
.exported(export_package)
|
||||||
|
.map_err(|_e| "Fehler bei Zugriff auf die Datenbank")?;
|
||||||
|
|
||||||
|
let db_meldungen = db_entries
|
||||||
|
.iter()
|
||||||
|
.map(|entry| LkrExportProtocolFile::parse(&entry.1))
|
||||||
|
.filter(|entry| entry.is_ok())
|
||||||
|
.flat_map(|entry| entry.unwrap().meldungen())
|
||||||
|
.filter(|meldung| meldung.id().is_some())
|
||||||
|
.map(|meldung| (meldung.id().unwrap(), meldung))
|
||||||
|
.collect::<HashMap<_, _>>();
|
||||||
|
|
||||||
|
let xml_meldungen = LkrExportProtocolFile::parse_file(file.as_path())
|
||||||
|
.map_err(|_e| "Fehler bei Zugriff auf die Protokolldatei")?
|
||||||
|
.meldungen()
|
||||||
|
.into_iter()
|
||||||
|
.filter(|meldung| meldung.id().is_some())
|
||||||
|
.map(|meldung| (meldung.id().unwrap(), meldung))
|
||||||
|
.collect::<HashMap<_, _>>();
|
||||||
|
|
||||||
|
let missing_xml_ids = db_meldungen
|
||||||
|
.keys()
|
||||||
|
.filter(|&key| !xml_meldungen.contains_key(key))
|
||||||
|
.collect_vec();
|
||||||
|
|
||||||
|
let _ = term.clear_last_lines(1);
|
||||||
|
|
||||||
|
let _ = term.write_line(
|
||||||
|
&style(format!(
|
||||||
|
"{} Datenbankeinträge mit {} Meldungen abgerufen",
|
||||||
|
db_entries.len(),
|
||||||
|
db_meldungen.len()
|
||||||
|
))
|
||||||
|
.green()
|
||||||
|
.to_string(),
|
||||||
|
);
|
||||||
|
|
||||||
|
if db_meldungen.len() != xml_meldungen.len() {
|
||||||
|
let _ = term.write_line(
|
||||||
|
&style("\nNicht übereinstimmende Anzahl an Meldungen:")
|
||||||
|
.yellow()
|
||||||
|
.to_string(),
|
||||||
|
);
|
||||||
|
let _ = term.write_line(&format!(
|
||||||
|
"Datenbank: {:>10}\nProtokolldatei: {:>10}",
|
||||||
|
db_meldungen.len(),
|
||||||
|
xml_meldungen.len()
|
||||||
|
));
|
||||||
|
|
||||||
|
let missing_db_ids = xml_meldungen
|
||||||
|
.keys()
|
||||||
|
.filter(|&key| !db_meldungen.contains_key(key))
|
||||||
|
.collect_vec();
|
||||||
|
|
||||||
|
if !missing_db_ids.is_empty() {
|
||||||
|
let _ = term.write_line(
|
||||||
|
&style("\nIn der Datenbank fehlende Meldungen:")
|
||||||
|
.yellow()
|
||||||
|
.to_string(),
|
||||||
|
);
|
||||||
|
|
||||||
|
missing_db_ids.iter().sorted().for_each(|&item| {
|
||||||
|
let _ = term.write_line(&format!(
|
||||||
|
"{} ({})",
|
||||||
|
item,
|
||||||
|
to_database_id(item).unwrap_or("?".into())
|
||||||
|
));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if !missing_xml_ids.is_empty() {
|
||||||
|
let _ = term.write_line(
|
||||||
|
&style("\nIn der Protokolldatei fehlende Meldungen:")
|
||||||
|
.yellow()
|
||||||
|
.to_string(),
|
||||||
|
);
|
||||||
|
|
||||||
|
missing_xml_ids.iter().sorted().for_each(|&item| {
|
||||||
|
let _ = term.write_line(&format!(
|
||||||
|
"{} ({})",
|
||||||
|
item,
|
||||||
|
to_database_id(item).unwrap_or("?".into())
|
||||||
|
));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let multiple_meldung_entries = db_entries
|
||||||
|
.iter()
|
||||||
|
.map(|(lkr_meldung, meldung)| (lkr_meldung, LkrExportProtocolFile::parse(meldung)))
|
||||||
|
.filter_map(|(lkr_meldung, meldung)| {
|
||||||
|
if meldung.unwrap().meldungen().len() > 1 {
|
||||||
|
Some(lkr_meldung)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.sorted()
|
||||||
|
.collect_vec();
|
||||||
|
|
||||||
|
if !multiple_meldung_entries.is_empty() {
|
||||||
|
let _ = term.write_line(
|
||||||
|
&style("\nFolgende Einträge in `lkr_meldung_export` haben mehrere Meldungsinhalte in `xml_daten`:")
|
||||||
|
.yellow()
|
||||||
|
.to_string(),
|
||||||
|
);
|
||||||
|
|
||||||
|
multiple_meldung_entries.iter().for_each(|item| {
|
||||||
|
let _ = term.write_line(&item.to_string());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let different_content = db_meldungen
|
||||||
|
.iter()
|
||||||
|
.filter(|(id, _)| !missing_xml_ids.contains(id))
|
||||||
|
.filter(|(id, meldung)| {
|
||||||
|
xml_meldungen
|
||||||
|
.get(&id.to_string())
|
||||||
|
.unwrap_or(&Meldung {
|
||||||
|
raw_value: String::new(),
|
||||||
|
})
|
||||||
|
.no_linebreak()
|
||||||
|
!= meldung.no_linebreak()
|
||||||
|
})
|
||||||
|
.map(|(_, meldung)| meldung.id().unwrap_or("?".into()))
|
||||||
|
.collect_vec();
|
||||||
|
|
||||||
|
if !different_content.is_empty() {
|
||||||
|
let _ = term.write_line(
|
||||||
|
&style(&format!(
|
||||||
|
"\nFolgende {} Meldungen unterscheiden sich in der Datenbank und der Protokolldatei:",
|
||||||
|
different_content.len()
|
||||||
|
))
|
||||||
|
.yellow()
|
||||||
|
.to_string(),
|
||||||
|
);
|
||||||
|
|
||||||
|
let _ = term.write_line(
|
||||||
|
"Dies kann auch aufgrund der verwendeten XML-Encodierung auftreten und bedeutet nicht immer eine inhaltliche Abweichung."
|
||||||
|
);
|
||||||
|
|
||||||
|
different_content.iter().sorted().for_each(|id| {
|
||||||
|
let _ = term.write_line(&format!(
|
||||||
|
"{} ({})",
|
||||||
|
id,
|
||||||
|
to_database_id(id).unwrap_or("?".into())
|
||||||
|
));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
26
src/resources/exported-to-lkr.sql
Normal file
26
src/resources/exported-to-lkr.sql
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of bzkf-rwdp-check
|
||||||
|
*
|
||||||
|
* Copyright (C) 2024 Comprehensive Cancer Center Mainfranken and contributors.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
CONVERT(id,char) AS id,
|
||||||
|
xml_daten
|
||||||
|
FROM lkr_meldung_export
|
||||||
|
WHERE typ <> -1
|
||||||
|
AND (lkr_export = :export_id OR (0 = :export_id AND lkr_export IN (SELECT MAX(lkr_export) FROM lkr_meldung_export)));
|
@ -21,3 +21,5 @@
|
|||||||
pub const SQL_QUERY: &str = include_str!("query.sql");
|
pub const SQL_QUERY: &str = include_str!("query.sql");
|
||||||
|
|
||||||
pub const EXPORT_QUERY: &str = include_str!("export.sql");
|
pub const EXPORT_QUERY: &str = include_str!("export.sql");
|
||||||
|
|
||||||
|
pub const EXPORTED_TO_LKR: &str = include_str!("exported-to-lkr.sql");
|
||||||
|
89
testdaten/testdaten_1.xml
Normal file
89
testdaten/testdaten_1.xml
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ADT_GEKID xmlns="http://www.gekid.de/namespace" Schema_Version="2.2.3">
|
||||||
|
<Absender Absender_ID="TEST" Software_ID="ONKOSTAR" Installations_ID="2011">
|
||||||
|
<Absender_Bezeichnung>TEST</Absender_Bezeichnung>
|
||||||
|
<Absender_Anschrift>Musterstraße 1, 012345 Musterhausen</Absender_Anschrift>
|
||||||
|
</Absender>
|
||||||
|
<Menge_Patient>
|
||||||
|
<Patient>
|
||||||
|
<Patienten_Stammdaten Patient_ID="20001234">
|
||||||
|
<KrankenversichertenNr>E123456789</KrankenversichertenNr>
|
||||||
|
<KrankenkassenNr>123456789</KrankenkassenNr>
|
||||||
|
<Patienten_Nachname>Tester</Patienten_Nachname>
|
||||||
|
<Patienten_Titel></Patienten_Titel>
|
||||||
|
<Patienten_Vornamen>Patrick</Patienten_Vornamen>
|
||||||
|
<Patienten_Geburtsname>Tester</Patienten_Geburtsname>
|
||||||
|
<Patienten_Geschlecht>M</Patienten_Geschlecht>
|
||||||
|
<Patienten_Geburtsdatum>01.01.1980</Patienten_Geburtsdatum>
|
||||||
|
<Menge_Adresse>
|
||||||
|
<Adresse>
|
||||||
|
<Patienten_Strasse>Testweg</Patienten_Strasse>
|
||||||
|
<Patienten_Hausnummer>1</Patienten_Hausnummer>
|
||||||
|
<Patienten_Land>DE</Patienten_Land>
|
||||||
|
<Patienten_PLZ>01234</Patienten_PLZ>
|
||||||
|
<Patienten_Ort>Musterhausen</Patienten_Ort>
|
||||||
|
</Adresse>
|
||||||
|
</Menge_Adresse>
|
||||||
|
</Patienten_Stammdaten>
|
||||||
|
<Menge_Meldung>
|
||||||
|
<Meldung Meldung_ID="TEST1727528" Melder_ID="TEST">
|
||||||
|
<Meldedatum>11.06.2024</Meldedatum>
|
||||||
|
<Meldebegruendung>I</Meldebegruendung>
|
||||||
|
<Meldeanlass>statusaenderung</Meldeanlass>
|
||||||
|
<Tumorzuordnung Tumor_ID="1">
|
||||||
|
<Primaertumor_ICD_Code>C17.1</Primaertumor_ICD_Code>
|
||||||
|
<Primaertumor_ICD_Version>10 2015 GM</Primaertumor_ICD_Version>
|
||||||
|
<Diagnosedatum>10.06.2024</Diagnosedatum>
|
||||||
|
<Seitenlokalisation>T</Seitenlokalisation>
|
||||||
|
</Tumorzuordnung>
|
||||||
|
<Menge_Tumorkonferenz>
|
||||||
|
<Tumorkonferenz Tumorkonferenz_ID="1234567">
|
||||||
|
<Tumorkonferenz_Datum>11.06.2024</Tumorkonferenz_Datum>
|
||||||
|
<Tumorkonferenz_Typ>praeth</Tumorkonferenz_Typ>
|
||||||
|
</Tumorkonferenz>
|
||||||
|
</Menge_Tumorkonferenz>
|
||||||
|
</Meldung>
|
||||||
|
</Menge_Meldung>
|
||||||
|
</Patient>
|
||||||
|
<Patient>
|
||||||
|
<Patienten_Stammdaten Patient_ID="20004321">
|
||||||
|
<KrankenversichertenNr>E123456789</KrankenversichertenNr>
|
||||||
|
<KrankenkassenNr>123456789</KrankenkassenNr>
|
||||||
|
<Patienten_Nachname>Tester</Patienten_Nachname>
|
||||||
|
<Patienten_Titel></Patienten_Titel>
|
||||||
|
<Patienten_Vornamen>Patricia</Patienten_Vornamen>
|
||||||
|
<Patienten_Geburtsname>Tester</Patienten_Geburtsname>
|
||||||
|
<Patienten_Geschlecht>W</Patienten_Geschlecht>
|
||||||
|
<Patienten_Geburtsdatum>01.01.1980</Patienten_Geburtsdatum>
|
||||||
|
<Menge_Adresse>
|
||||||
|
<Adresse>
|
||||||
|
<Patienten_Strasse>Testweg</Patienten_Strasse>
|
||||||
|
<Patienten_Hausnummer>1</Patienten_Hausnummer>
|
||||||
|
<Patienten_Land>DE</Patienten_Land>
|
||||||
|
<Patienten_PLZ>01234</Patienten_PLZ>
|
||||||
|
<Patienten_Ort>Musterhausen</Patienten_Ort>
|
||||||
|
</Adresse>
|
||||||
|
</Menge_Adresse>
|
||||||
|
</Patienten_Stammdaten>
|
||||||
|
<Menge_Meldung>
|
||||||
|
<Meldung Meldung_ID="001A5D50-TEST" Melder_ID="TEST">
|
||||||
|
<Meldedatum>11.06.2024</Meldedatum>
|
||||||
|
<Meldebegruendung>I</Meldebegruendung>
|
||||||
|
<Meldeanlass>statusaenderung</Meldeanlass>
|
||||||
|
<Tumorzuordnung Tumor_ID="1">
|
||||||
|
<Primaertumor_ICD_Code>C17.2</Primaertumor_ICD_Code>
|
||||||
|
<Primaertumor_ICD_Version>10 2015 GM</Primaertumor_ICD_Version>
|
||||||
|
<Diagnosedatum>01.01.2024</Diagnosedatum>
|
||||||
|
<Seitenlokalisation>T</Seitenlokalisation>
|
||||||
|
</Tumorzuordnung>
|
||||||
|
<Menge_Tumorkonferenz>
|
||||||
|
<Tumorkonferenz Tumorkonferenz_ID="1234568">
|
||||||
|
<Tumorkonferenz_Datum>10.01.2024</Tumorkonferenz_Datum>
|
||||||
|
<Tumorkonferenz_Typ>praeth</Tumorkonferenz_Typ>
|
||||||
|
</Tumorkonferenz>
|
||||||
|
</Menge_Tumorkonferenz>
|
||||||
|
</Meldung>
|
||||||
|
</Menge_Meldung>
|
||||||
|
</Patient>
|
||||||
|
</Menge_Patient>
|
||||||
|
</ADT_GEKID>
|
Loading…
x
Reference in New Issue
Block a user