diff --git a/zaaReloaded2/Defaults/parameters.txt b/zaaReloaded2/Defaults/parameters.txt index 28ff259..f30528e 100755 --- a/zaaReloaded2/Defaults/parameters.txt +++ b/zaaReloaded2/Defaults/parameters.txt @@ -1,5 +1,5 @@ -# LAURIS-NAME "KANONISCHER NAME" MATERIAL "IMMER REFERENZBEREICH" "BLACKLIST" -# =========== ================== ======== ======================= =========== +# LAURIS-NAME "KANONISCHER NAME" MATERIAL DEZIMALSTELLEN "IMMER REFERENZBEREICH" "BLACKLIST" +# =========== ================== ======== ============== ======================= =========== "Übergangsepithelien (U)" Übergangsep. U "a1-Microglobulin (SU)" a1-Microglobulin SU "a1-Microglobulin (SU)/die" a1-Microglobulin SU @@ -8,8 +8,8 @@ "Albumin (SU)" Alb SU "Albumin (SU)/die" Alb SU Albumin Alb S -"Albumin/Creatinin (PU)" ACR U -"Alk. Phosphatase" AP S +"Albumin/Creatinin (PU)" ACR U +"Alk. Phosphatase" AP S 0 Amylase Amylase S "anorg. Phosphat" P S "Bakterien (U)" Bakt U @@ -24,37 +24,37 @@ Calcium-Phosphat-Produkt CaxP S Cholesterin Chol S CK gesamt" CK S "CK MB" CK-MB S -"Creatinin (PU)" Krea U -"Creatinin (SU)" Krea SU -Creatinin Krea S +"Creatinin (PU)" Krea U 0 +"Creatinin (SU)" Krea SU 0 +Creatinin Krea S 1 "Creatinin-Clearance (SU)/min" CrCl SU -"Cyclosporin-A vor Gabe" "CsA (C0)" S X -"Cystatin C (N Latex)" "Cystatin C" S X -"Cystatin C (Latex Gen. 2)" "Cystatin C" S X +"Cyclosporin-A vor Gabe" "CsA (C0)" S X +"Cystatin C (N Latex)" "Cystatin C" S X +"Cystatin C (Latex Gen. 2)" "Cystatin C" S X Eisen Fe S Eosinophile Eos E "Erythrozyten (U)" Ery U Erythrozyten Ery E Ferritin Ferr S -"freies T3" fT3 S X -"freies T4" fT4 S X +"freies T3" fT3 S X +"freies T4" fT4 S X Gesamt-Bilirubin Bilirubin S "Gesamt-Eiweiss (PU)" Protein U "Gesamt-Eiweiss (SU)" Protein SU "Gesamt-Eiweiss (SU)/die" Proteinurie SU Gesamt-Eiweiss Protein S "Gesamt-Eiweiss/Creatinin (PU)" TPCR U -GGT GGT S +GGT GGT S 0 "glomeruläre Filtrationsrate" GFR SU -"glomerul. Filtrationsr. (MDRD)" "eGFR (MDRD)" S --- X +"glomerul. Filtrationsr. (MDRD)" "eGFR (MDRD)" S --- X "glomerul. Filtrationsr. CKD-EP" "eGFR (CKD-EPI)" S "Glucose (U)" Glukose U Glucose Glukose S -"GOT (ASAT)" GOT S -"GPT (ALAT)" GPT S +"GOT (ASAT)" GOT S 0 +"GPT (ALAT)" GPT S 0 Hämatokrit Hkt E Hämoglobin Hb E -Haptoglobin Haptoglobin S X +Haptoglobin Haptoglobin S X Harnsäure Harnsäure S "Harnstoff (SU)" Hst SU "Harnstoff (SU)/die" Hst/Tag SU @@ -72,7 +72,7 @@ Kalium K S "Leukozyten (U)" Leu U Leukozyten Leu E Lymphozyten Lym E -Magnesium Mg S X +Magnesium Mg S X "MCH (HbE)" MCH E MCHC MCHC E MCV MCV E @@ -108,8 +108,8 @@ Unreife Granulozyten" Gran E "Thromboplastinzeit n. Quick" Quick Z PTT PTT Z "Ratio int. norm." INR Z -"Komplementfaktor C3c" C3c S X -"Komplementfaktor C4" C4 S X +"Komplementfaktor C3c" C3c S X +"Komplementfaktor C4" C4 S X "Anti-DNAse B" "Anti-DNAse B" S Anti-Streptolysin ASL S "PTH intakt" iPTH S diff --git a/zaaReloaded2/Formatter/ItemFormatter.cs b/zaaReloaded2/Formatter/ItemFormatter.cs index 7170964..c71baf9 100755 --- a/zaaReloaded2/Formatter/ItemFormatter.cs +++ b/zaaReloaded2/Formatter/ItemFormatter.cs @@ -153,7 +153,16 @@ namespace zaaReloaded2.Formatter { // Format the numerical value; this will convert // decimal points to commas as needed. - value = String.Format("{0}", LabItem.NumericalValue); + int precision = LabItem.PreferredPrecision; + if (precision >= 0) + { + value = LabItem.NumericalValue.ToString("F" + precision); + } + else + { + // PreferredPrecision is negative, i.e. use precision as-is + value = String.Format("{0}", LabItem.NumericalValue); + } } else { diff --git a/zaaReloaded2/Importer/ZaaImporter/LaurisItem.cs b/zaaReloaded2/Importer/ZaaImporter/LaurisItem.cs index 1b26a08..2aec4db 100755 --- a/zaaReloaded2/Importer/ZaaImporter/LaurisItem.cs +++ b/zaaReloaded2/Importer/ZaaImporter/LaurisItem.cs @@ -77,6 +77,7 @@ namespace zaaReloaded2.Importer.ZaaImporter AlwaysPrintLimits = parameterDictionary.GetForceReferenceDisplay(OriginalName); IsBlacklisted = parameterDictionary.GetIsBlacklisted(OriginalName); Material = parameterDictionary.GetMaterial(OriginalName, Material); + PreferredPrecision = parameterDictionary.GetPrecision(OriginalName); } if (unitDictionary != null) { diff --git a/zaaReloaded2/LabModel/LabItem.cs b/zaaReloaded2/LabModel/LabItem.cs index 4ada2c5..9eb5410 100755 --- a/zaaReloaded2/LabModel/LabItem.cs +++ b/zaaReloaded2/LabModel/LabItem.cs @@ -202,6 +202,8 @@ namespace zaaReloaded2.LabModel } } + public int PreferredPrecision { get; protected set; } + public bool AlwaysPrintLimits { get; protected set; } public Material Material { get; protected set; } diff --git a/zaaReloaded2/Thesaurus/Parameters.cs b/zaaReloaded2/Thesaurus/Parameters.cs index 7600e85..eb72447 100755 --- a/zaaReloaded2/Thesaurus/Parameters.cs +++ b/zaaReloaded2/Thesaurus/Parameters.cs @@ -89,6 +89,18 @@ namespace zaaReloaded2.Thesaurus } } + /// + /// Returns the desired number of decimals for a given parameter. + /// + /// Laboratory item to look up; + /// this must be an original Lauris string. + /// Number of decimals for the parameter, or -1 if + /// undefined. + public int GetPrecision(string laurisName) + { + return LookUpValue(laurisName, 3, -1); + } + /// /// Returns whether or not reference limits shall always /// be displayed for a given item, regardless whether it @@ -99,7 +111,7 @@ namespace zaaReloaded2.Thesaurus /// public bool GetForceReferenceDisplay(string laurisName) { - return LookUpValue(laurisName, 3, false); + return LookUpValue(laurisName, 4, false); } /// @@ -112,7 +124,7 @@ namespace zaaReloaded2.Thesaurus /// false if not. Default is false. public bool GetIsBlacklisted(string laurisName) { - return LookUpValue(laurisName, 4, false); + return LookUpValue(laurisName, 5, false); } #endregion diff --git a/zaaReloaded2/Thesaurus/ThesaurusBase.cs b/zaaReloaded2/Thesaurus/ThesaurusBase.cs index d8ee58b..b5a8596 100755 --- a/zaaReloaded2/Thesaurus/ThesaurusBase.cs +++ b/zaaReloaded2/Thesaurus/ThesaurusBase.cs @@ -153,6 +153,48 @@ namespace zaaReloaded2.Thesaurus catch { } } + /// + /// Looks up a dictionary key and returns an integer value from the requested field, + /// or a default value if the field is empty or contains only dashes. + /// + /// Key to look up. + /// Zero-based index of the field to look up + /// (note that field 0 is the key itself). + /// Default value that will be returned + /// if the field is empty or contains only dashes. + /// Value of the requested field, or + /// if the field is empty or contains only dashes. + /// if fieldNum is negative. + protected int LookUpValue(string key, int fieldNum, int defaultValue) + { + string[] record; + if (Records.TryGetValue(key, out record)) + { + if (fieldNum >= record.Length) return defaultValue; + string value = record[fieldNum]; + if (string.IsNullOrWhiteSpace(value) || _dashes.IsMatch(value)) + { + return defaultValue; + } + else + { + int intval; + if (int.TryParse(value, out intval)) + { + return intval; + } + else + { + return defaultValue; + } + } + } + else + { + return defaultValue; + } + } + /// /// Looks up a dictionary key and returns the value from the requested field, /// or a default value if the field is empty or contains only dashes.