Merge branch 'decimals' into develop

This commit is contained in:
Daniel Kraus 2015-08-25 20:26:41 +02:00
commit 7b9157320a
6 changed files with 89 additions and 23 deletions

View File

@ -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

View File

@ -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
{

View File

@ -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)
{

View File

@ -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; }

View File

@ -89,6 +89,18 @@ namespace zaaReloaded2.Thesaurus
}
}
/// <summary>
/// Returns the desired number of decimals for a given parameter.
/// </summary>
/// <param name="laurisName">Laboratory item to look up;
/// this must be an original Lauris string.</param>
/// <returns>Number of decimals for the parameter, or -1 if
/// undefined.</returns>
public int GetPrecision(string laurisName)
{
return LookUpValue(laurisName, 3, -1);
}
/// <summary>
/// Returns whether or not reference limits shall always
/// be displayed for a given item, regardless whether it
@ -99,7 +111,7 @@ namespace zaaReloaded2.Thesaurus
/// <returns></returns>
public bool GetForceReferenceDisplay(string laurisName)
{
return LookUpValue(laurisName, 3, false);
return LookUpValue(laurisName, 4, false);
}
/// <summary>
@ -112,7 +124,7 @@ namespace zaaReloaded2.Thesaurus
/// false if not. Default is false.</returns>
public bool GetIsBlacklisted(string laurisName)
{
return LookUpValue(laurisName, 4, false);
return LookUpValue(laurisName, 5, false);
}
#endregion

View File

@ -153,6 +153,48 @@ namespace zaaReloaded2.Thesaurus
catch { }
}
/// <summary>
/// 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.
/// </summary>
/// <param name="key">Key to look up.</param>
/// <param name="fieldNum">Zero-based index of the field to look up
/// (note that field 0 is the key itself).</param>
/// <param name="defaultValue">Default value that will be returned
/// if the field is empty or contains only dashes.</param>
/// <returns>Value of the requested field, or <paramref name="defaultValue"/>
/// if the field is empty or contains only dashes.</returns>
/// <exception cref="System.IndexOutOfRangeException">if fieldNum is negative.</exception>
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;
}
}
/// <summary>
/// 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.