68 Commits

Author SHA1 Message Date
bb67a993fb Merge branch 'release-2.0.0-beta.1' 2015-08-13 20:51:04 +02:00
193a83a769 Prepare release 2.0.0-beta.1 2015-08-13 20:50:53 +02:00
65e34cdf1d Write homepage. 2015-08-13 20:46:03 +02:00
8f9eb83e9d Use 'PTT' rather than 'aPTT'. 2015-08-13 19:57:53 +02:00
65ac72fb50 Use serialized Settings as defaults; fixes. 2015-08-13 19:20:20 +02:00
0461dfd66e Add more information to README.md. 2015-08-13 18:12:18 +02:00
63447def9b Multiple fixes for Views and ViewModels. 2015-08-13 17:59:23 +02:00
3a615eda8b Fix demoting elements while moving up. 2015-08-12 22:54:29 +02:00
a9d0e8ee7e Add IsExpanded property to ElementViewModel. 2015-08-12 22:29:31 +02:00
2bb0452a87 Implement moving of elements.
- NEU: Elemente können verschoben werden.
2015-08-12 22:03:25 +02:00
12c2412e38 Adjust size of SettingsView window. 2015-08-12 17:55:19 +02:00
e0b749382e Use buttons in SettingsView. 2015-08-12 17:54:23 +02:00
6f65340ca5 Use icons in SettingsRepositoryView. 2015-08-12 15:50:01 +02:00
f2cb30fabb Fix FormatElement labels if no content. 2015-08-12 10:05:50 +02:00
1afa9bb14f Fix views.
Needed to set all WindowStyles to ToolWindow and make the windows
topmost because Word and WPF do not play together all too well.
2015-08-12 10:04:59 +02:00
03a62ddf5a Fix SettingsRepositoryView layout. 2015-08-11 22:00:34 +02:00
5a0923e8e8 Implement reset settings feature.
- NEU: Auf Werkseinstellungen zurücksetzen.
2015-08-11 21:39:21 +02:00
0708f2a2b3 Implement import and export of Settings.
- NEU: Stile können importiert und exportiert werden.
2015-08-11 21:22:34 +02:00
00c60ba0ad Comment on serialization. 2015-08-11 19:51:23 +02:00
6af2243660 Do not return Null from SettingsRepository.Load(). 2015-08-11 16:16:26 +02:00
c9fc4a5fae Implement serialization of Settings and SettingsRepository.
- FIX: Stile werden jetzt gespeichert.
2015-08-11 16:12:39 +02:00
53d13b394e Do not expand elements tree by default. 2015-08-10 09:18:36 +02:00
947b53cf97 Fix material convertsion and units detection. 2015-08-10 06:55:57 +02:00
6c9f003134 Do not build headers from empty time stamps. 2015-08-09 21:21:56 +02:00
51bfdc760e Remove superfluous field from FormatElementViewModel. 2015-08-09 21:12:07 +02:00
a009c1ab39 Add control elements for columns.
- NEU: Steuer-Elemente für Spalten.
2015-08-09 20:54:43 +02:00
5833e0fcb7 Fix dev path in ExceptionViewModel. 2015-08-09 20:52:35 +02:00
750fb093b1 Show Word version and build number in exceptions. 2015-08-09 20:48:17 +02:00
11b9b9df54 Make formatter tests pass. 2015-08-09 19:54:48 +02:00
b59c9f2898 Wire up the views. 2015-08-09 13:24:44 +02:00
257e3e8568 Fix deleting settings. 2015-08-08 06:33:01 +02:00
c6121353e4 Make SettingsTest pass. 2015-08-07 21:40:12 +02:00
bde85e5651 Fix views and view models. 2015-08-07 21:37:14 +02:00
edaf88c4cd Implement blacklisting feature.
- NEU: Parameter können im Thesaurus als "blacklisted" markiert werden und werden dann bei Verwendung einer Wildcard ("*") nicht berücksichtigt.
2015-08-06 07:47:44 +02:00
b6c33971bd Fix thesaurus.
- FIX: Mehrere Thesaurus-Fehler behoben.
2015-08-06 06:42:08 +02:00
476f2d69be Improve date and time header (some tests failing now).
- NEU: Datumsangaben werden in eine Zeile "Laborwerte vom ..." eingebettet.
2015-08-05 22:04:07 +02:00
2cefede3c0 Output formatting.
- NEU: Formatierung der Ausgabe mit Absatzvorlage.
2015-08-05 21:52:06 +02:00
d0bd7dd2a5 Make sure to remember last used setting. 2015-08-05 21:43:08 +02:00
ed43497179 Implement copying of elements. 2015-08-05 21:22:03 +02:00
1205958eb1 Implement test to delete child element and make it pass. 2015-08-05 20:36:31 +02:00
60296602a9 Implement DeleteElementCommand. 2015-08-05 20:28:09 +02:00
742a588083 Make tests pass again (except not implemented ones). 2015-08-05 20:02:02 +02:00
b7fdf87ea5 Close view after sending UseSettingsMessage. 2015-08-05 06:47:30 +02:00
880e8b0bdc Fix importing of actual Word text.
- FIX: Datenimport funktioniert jetzt auch mit Word-Text und nicht nur in den Tests.
2015-08-05 06:46:52 +02:00
06a74992ef Make tests pass with refactored ZaaImporter. 2015-08-05 06:15:07 +02:00
285c6a2555 Add CanRun property to Formatter. 2015-08-04 23:26:21 +02:00
75c9c984c6 Refactor and harden ZaaImporter. 2015-08-04 23:21:38 +02:00
ae9cf7fa2e Improve demo document. 2015-08-04 20:17:36 +02:00
33d453cf73 Use ViewModelListBox dynamic resource. 2015-08-04 06:25:13 +02:00
8d6ed32a84 Fix LastSelected and LastSelectedElement properties. 2015-08-04 06:21:48 +02:00
5fe7250b53 Merge branch 'release-2.0.0-alpha.5' into develop 2015-08-04 02:46:46 +02:00
34006ba1e9 Merge branch 'release-2.0.0-alpha.5' 2015-08-04 02:46:21 +02:00
204139d16b Prepare release 2.0.0-alpha.5. 2015-08-04 02:46:12 +02:00
41b155e8be Begin implemenation of format and choose style commands. 2015-08-04 02:43:17 +02:00
b6209731ec Fix salutation regex in DanielsStyle.
- FIX: Daniels Spezial löscht nicht mehr die Unterschriften.
2015-08-04 01:19:19 +02:00
a128b76522 Implement tests for SettingsViewModel add and add child commands. 2015-08-04 01:17:14 +02:00
805da69d47 Implement passing test for ElementPickerViewModel. 2015-08-03 14:31:35 +02:00
8437f0907c Implement Demo feature.
- NEU: Eingebautes Demo-Dokument zum Ausprobieren.
2015-08-03 12:11:30 +02:00
db8f88c563 Fix SettingsViewModelTest.CannotAddChildElementToFormatElement. 2015-08-03 06:32:05 +02:00
14b09f89c5 Merge branch 'release-2.0.0-alpha.4' into develop 2015-08-02 22:05:39 +02:00
305baf2402 Merge branch 'release-2.0.0-alpha.4' 2015-08-02 22:05:08 +02:00
e4edd0f197 Prepare release 2.0.0-alpha.4. 2015-08-02 22:04:58 +02:00
23acb13019 Improve Daniel's style. 2015-08-02 22:01:51 +02:00
1e4c3681f2 Implement ElementPickerViewModel; initial SettingsViewModelTest. 2015-08-02 21:51:58 +02:00
9fd0907310 Implement unique IDs for settings. 2015-08-02 07:19:12 +02:00
286ddb1641 Fix cloning of SettingsViewModels. 2015-08-02 07:11:16 +02:00
d0be7524d3 Make some classes ICloneable; implement SettingsRepositoryViewModel. 2015-08-01 21:23:56 +02:00
5197c294b9 Merge branch 'release-2.0.0-alpha.3' into develop 2015-07-31 17:24:28 +02:00
118 changed files with 4830 additions and 448 deletions

View File

@ -1,3 +1,30 @@
Version 2.0.0-beta.1 (2015-08-13)
========================================================================
- FIX: Datenimport funktioniert jetzt auch mit Word-Text und nicht nur in den Tests.
- FIX: Mehrere Thesaurus-Fehler behoben.
- FIX: Stile werden jetzt gespeichert.
- NEU: Auf Werkseinstellungen zurücksetzen.
- NEU: Datumsangaben werden in eine Zeile "Laborwerte vom ..." eingebettet.
- NEU: Elemente können verschoben werden.
- NEU: Formatierung der Ausgabe mit Absatzvorlage.
- NEU: Parameter können im Thesaurus als "blacklisted" markiert werden und werden dann bei Verwendung einer Wildcard ("*") nicht berücksichtigt.
- NEU: Steuer-Elemente für Spalten.
- NEU: Stile können importiert und exportiert werden.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Version 2.0.0-alpha.5. (2015-08-04)
========================================================================
- FIX: Daniels Spezial löscht nicht mehr die Unterschriften.
- NEU: Eingebautes Demo-Dokument zum Ausprobieren.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Version 2.0.0-alpha.3 (2015-07-31)
========================================================================

View File

@ -52,6 +52,11 @@ folgende Teile aufgeteilt:
existieren verschiedene Klassen, die die Klassen des Labor-Modells
(`zaaReloaded2.LabModel`) umschließen und um entsprechende
Funktionalitäten erweitern.
- __Kontrolle der Formatierung:__ Der Namensraum
`zaaReloaded2.Controller` umfaßt Klassen, mit denen ein
`zaaReloaded2.Formatter.Formatter` gesteuert werden kann. Diese
Klassen spielen eine große Rolle bei den benutzerdefinierten
Anpassungen von Stilen.
## Parsen der Lauris-Ausgabe
@ -174,4 +179,49 @@ oder nicht-normalen Parametern oder immer mit ausgegeben werden:
Die Markierung besonderer Parameter erfolgt in der Textdatei, aus der
das `zaaReloaded2.Thesaurus.Parameters` generiert wird (s.o.).
## User Interface
Das User Interface wurde mit der Windows Presentation Foundation nach
dem [MVVM][]-Muster implementiert. Dabei wurde auf das Hilfs-Framework
[Bovender][bovender-framework] zurückgegriffen.
## Updates
Das Add-in sucht täglich nach einem Update; dabei wird die Datei
<http://zaa.nephrowiki.de/versioninfo.txt> heruntergeladen. Updates
werden automatisch im Hintergrund geladen und beim Schließen von Word
(bzw. der Zentralen Arztbriefablage) installiert und stehen dann beim
nächsten Starten der Anwendung zur Verfügung.
## Serialisierung
Um das Stil-Repositorium (`zaaReloaded2.Controller.SettingsRepository`)
in den Assembly-Properties speichern zu können und für den Im- und
Export von Stilen werden die in .NET eingebauten
Serialisierungs-Strukturen genutzt. Weil es mit der Verwendung eines
`XmlSerializer`s Probleme gab, weil der `XmlSerializer` nicht mit
Interface-Eigenschaften umgehen kann, wurde zunächst für alle Klassen,
die serialisiert werden müssen (`SettingsRepository`,
`zaaReloaded2.Controller.Settings` und die von
`zaaReloaded2.Controller.Elements.ElementBase` abgeleiteten Klassen) das
Interface `ISerializable` implementiert. Das hat aber auch nicht dazu
geführt, daß der `XmlSerializer` die Klassen serialisierte, so daß
jetzt der `SoapFormatter` verwendet wird. Der stört sich nicht an
Interface-Eigenschaften und produziert auch XML, wenngleich im etwas
komplizierten [SOAP][]-Format.
Um das `SettingsRepository` in den Assembly-Properties zu persistieren,
muß das serialisierte XML noch in einen Base64-kodierten String
umgewandelt werden, damit das SOAP-XML nicht mit dem XML der
Assembly-Properties ins Gehege kommt (siehe
`zaaReloaded2.Controller.SettingsRepository.Load()` und
`zaaReloaded2.Controller.SettingsRepository.Store()`).
[SOAP]: http://de.wikipedia.org/wiki/SOAP
[MVVM]: http://de.wikipedia.org/wiki/MVVM
[bovender-framework]: https://github.com/bovender/bovender
<!-- vim: set tw=72 sw=2 ts=2 sts=-1 : -->

View File

@ -61,7 +61,10 @@ namespace Tests.Controller.Elements
_formatter.Laboratory = lab;
_formatter.Settings.Elements.Add(new zaa.Items("Na, K, Cl"));
_formatter.Run();
Assert.AreEqual("Na 133, K 6 (5)\r", _document.Range().Text);
string expected = (
TimePointFormatter.DateAndTimeHeader(new DateTime(2015, 07, 13, 13, 31, 00)) +
"Na 133, K 6 (5)\r\r").Replace(Environment.NewLine, "\r");
Assert.AreEqual(expected, _document.Range().Text);
}
[Test]
@ -78,7 +81,10 @@ namespace Tests.Controller.Elements
_formatter.Laboratory = lab;
_formatter.Settings.Elements.Add(new zaa.Items("Klinische Chemie: Na, K, Cl"));
_formatter.Run();
Assert.AreEqual("Klinische Chemie: Na 133, K 6 (5)\r", _document.Range().Text);
string expected = (
TimePointFormatter.DateAndTimeHeader(new DateTime(2015, 07, 13, 13, 31, 00)) +
"Klinische Chemie: Na 133, K 6 (5)\r\r").Replace(Environment.NewLine, "\r");
Assert.AreEqual(expected, _document.Range().Text);
}
[Test]
@ -113,8 +119,10 @@ namespace Tests.Controller.Elements
_formatter.Laboratory = lab;
_formatter.Settings.Elements.Add(new zaa.Items("Klinische Chemie: Na, *"));
_formatter.Run();
Assert.AreEqual("Klinische Chemie: Na 133, Cl 110, K 6\r",
_document.Range().Text);
string expected = (
TimePointFormatter.DateAndTimeHeader(new DateTime(2015, 07, 13, 13, 31, 00)) +
"Klinische Chemie: Na 133, Cl 110, K 6\r\r").Replace(Environment.NewLine, "\r");
Assert.AreEqual(expected, _document.Range().Text);
}
[Test]
@ -133,8 +141,10 @@ namespace Tests.Controller.Elements
_formatter.Laboratory = lab;
_formatter.Settings.Elements.Add(new zaa.Items("Klinische Chemie: Na, SU-*"));
_formatter.Run();
Assert.AreEqual("Klinische Chemie: Na 133, SU-Protein 2,8\r",
_document.Range().Text);
string expected = (
TimePointFormatter.DateAndTimeHeader(new DateTime(2015, 07, 13, 13, 31, 00)) +
"Klinische Chemie: Na 133, SU-Protein 2,8\r\r").Replace(Environment.NewLine, "\r");
Assert.AreEqual(expected, _document.Range().Text);
}
[Test]
@ -153,8 +163,11 @@ namespace Tests.Controller.Elements
_formatter.Laboratory = lab;
_formatter.Settings.Elements.Add(new zaa.Items("Klinische Chemie: Na, SU-*, *"));
_formatter.Run();
Assert.AreEqual("Klinische Chemie: Na 133, SU-Protein 2,8, Cl 110, U-Na 99\r",
_document.Range().Text);
string expected = (
TimePointFormatter.DateAndTimeHeader(new DateTime(2015, 07, 13, 13, 31, 00)) +
"Klinische Chemie: Na 133, SU-Protein 2,8, Cl 110, U-Na 99\r\r")
.Replace(Environment.NewLine, "\r");
Assert.AreEqual(expected, _document.Range().Text);
}
}
}

View File

@ -27,7 +27,7 @@ namespace Tests.Controller
[TestFixture]
class SettingsRepositoryTest
{
SettingsRepository _savedSettings;
string _savedSettings;
[SetUp]
public void SetUp()
@ -50,33 +50,13 @@ namespace Tests.Controller
string testName = "test";
s.Name = testName;
sr.SettingsList.Add(s);
int expected = sr.SettingsList.Count;
int index = sr.SettingsList.IndexOf(s);
sr.Store();
sr = null;
sr = SettingsRepository.Load();
Assert.AreEqual(1, sr.SettingsList.Count);
Assert.AreEqual(testName, sr.SettingsList[0].Name);
}
[Test]
public void CreateDefaultSettings()
{
SettingsRepository sr = new SettingsRepository();
sr.SettingsList.Add(new Settings("test1", null));
sr.SettingsList.Add(new Settings("test2", null));
sr.SettingsList.Add(new Settings("test3", null));
sr.ResetDefault();
// Assert that there are now only the 2 default settings
Assert.AreEqual(2, sr.SettingsList.Count);
Assert.AreEqual(
zaaReloaded2.Properties.Settings.Default.SettingsNameWard,
sr.SettingsList[0].Name,
"Settings for ward expected as #1 (index 0) in list");
Assert.AreEqual(
zaaReloaded2.Properties.Settings.Default.SettingsNameClinic,
sr.SettingsList[1].Name,
"Settings for outpatient clinic expected as #2 (index 1) in list");
Assert.AreEqual(expected, sr.SettingsList.Count);
Assert.AreEqual(testName, sr.SettingsList[index].Name);
}
}
}

View File

@ -0,0 +1,54 @@
/* SettingsTest.cs
* part of zaaReloaded2
*
* Copyright 2015 Daniel Kraus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using zaaReloaded2.Controller;
using zaaReloaded2.Controller.Elements;
using System.IO;
namespace Tests.Controller
{
[TestFixture]
class SettingsTest
{
[Test]
public void CloneSettings()
{
SelectEachDay selectEachDay = new SelectEachDay();
Items items = new Items("some text");
Settings source = new Settings(
"hello world",
new List<ElementBase>() { selectEachDay, items });
source.ReferenceStyle = zaaReloaded2.Formatter.ReferenceStyle.IfSpecialOrAbnormal;
Settings clone = source.Clone() as Settings;
Assert.AreNotSame(source, clone);
Assert.AreEqual("Kopie von " + source.Name, clone.Name,
"Name");
Assert.AreNotSame(source.Elements, clone.Elements);
Assert.AreEqual(source.ReferenceStyle, clone.ReferenceStyle,
"ReferenceStyle");
Assert.AreEqual(
((Items)source.Elements[1]).Content,
((Items)clone.Elements[1]).Content,
"Items content");
}
}
}

View File

@ -1,7 +1,7 @@

04.07.2015 12:31:00:
Laborwerte vom 04.07.2015 12:31:00:
Klinische Chemie: Na 144 mM, K 4,3 mM
06.07.2015 10:28:00:
Laborwerte vom 06.07.2015 10:28:00:
Klinische Chemie: Na 138 mM, K 4,6 mM

View File

@ -1,7 +1,7 @@

04.07.2015:
Laborwerte vom 04.07.2015:
Klinische Chemie: Na 144 mM, K 4,3 mM
06.07.2015:
Laborwerte vom 06.07.2015:
Klinische Chemie: Na 138 mM, K 4,6 mM

View File

@ -1,4 +1,4 @@

04.07.2015:
Laborwerte vom 04.07.2015:
Klinische Chemie: Na 144 mM, K 4,3 mM

View File

@ -1,4 +1,4 @@

06.07.2015:
Laborwerte vom 06.07.2015:
Klinische Chemie: Na 138 mM, K 4,6 mM

View File

@ -99,6 +99,25 @@ namespace Tests.Formatter
_document.Range().Text);
}
[Test]
public void FormatSpecialItems()
{
ZaaImporter importer = new ZaaImporter();
importer.Import(
"Klinische Chemie: glomerul. Filtrationsr. CKD-EP: 36 ml/min /1,73qm; " +
"Sammelmenge (U): 12300 ml; "
);
Document document = new Document();
f.Formatter formatter = new f.Formatter(document);
formatter.Laboratory = importer.Laboratory;
formatter.Settings = new zaaReloaded2.Controller.Settings(
new List<ElementBase>() { new Items("*") } );
formatter.Run();
Assert.AreEqual(
"eGFR (CKD-EPI) 36 ml/min/1,73 m², SU-Volumen 12300 ml\r\r",
document.Range().Text);
}
string GetResourceText(string resource)
{
try

View File

@ -40,7 +40,7 @@ namespace Tests.Importer.ZaaImporter
[Test]
public void ParseInvalidLaurisTimePoints()
{
LaurisTimePoint tp = new LaurisTimePoint("Aerobe Kultur: Enterokokken ;  Wachstum: 10 ;");
LaurisTimePoint tp = new LaurisTimePoint("Mit freundlichen Grüßen");
Assert.IsFalse(tp.IsValidTimePoint,
"Bogus paragraph should be invalid LaurisTimePoint");

View File

@ -41,5 +41,15 @@ namespace Tests.Importer.ZaaImporter
// Only 6 distinct time points (see method documentation above).
Assert.AreEqual(6, importer.Laboratory.TimePoints.Count);
}
[Test]
public void ParseInvalidInput()
{
zaa.ZaaImporter importer = new zaa.ZaaImporter();
importer.Import("some arbitrary text\r\nthat does not represent\r\na valid lab");
Assert.IsFalse(importer.Success);
importer.Import("(03.03.1930 13:30:00)\r\nKlinische Chemie: Natrium 135 [135 - 145] mmol/l;");
Assert.IsTrue(importer.Success);
}
}
}

169
Tests/SerializationTest.cs Executable file
View File

@ -0,0 +1,169 @@
/* SelectFirstDayTest.cs
* part of zaaReloaded2
*
* Copyright 2015 Daniel Kraus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using zaaReloaded2.Controller.Elements;
using NUnit.Framework;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization.Formatters.Soap;
using zaaReloaded2.Controller;
namespace Tests.Controller
{
[TestFixture]
class SerializationTest
{
[Test]
public void SerializeControlElement()
{
SelectFirstDay element = new SelectFirstDay(
new List<FormatElementBase>()
{
new Items("hello"),
new Items("world")
}
);
MemoryStream stream = new MemoryStream();
// XmlSerializer does not work with interface properties...
// XmlSerializer serializer = new XmlSerializer(typeof(SelectFirstDay));
// BinaryFormatter serializer = new BinaryFormatter();
SoapFormatter serializer = new SoapFormatter();
serializer.Serialize(stream, element);
stream.Position = 0;
StreamReader sr = new StreamReader(stream);
Console.WriteLine(sr.ReadToEnd());
stream.Position = 0;
SelectFirstDay deserialized = serializer.Deserialize(stream) as SelectFirstDay;
Assert.IsNotNull(deserialized);
Assert.AreEqual(element.Children.Count, deserialized.Children.Count);
Assert.AreEqual(element.Children[0].Content, deserialized.Children[0].Content);
Assert.AreEqual(element.Children[1].Content, deserialized.Children[1].Content);
}
[Test]
public void SerializeFormatElement()
{
string testString = "Hello World";
CustomText element = new CustomText();
element.Content = testString;
MemoryStream stream = new MemoryStream();
SoapFormatter serializer = new SoapFormatter();
serializer.Serialize(stream, element);
stream.Position = 0;
CustomText deserialized = serializer.Deserialize(stream) as CustomText;
Assert.IsNotNull(deserialized);
Assert.AreEqual(element.Content, deserialized.Content);
}
[Test]
public void SerializeSettings()
{
Settings settings = CreateTestSettings1();
MemoryStream stream = new MemoryStream();
SoapFormatter serializer = new SoapFormatter();
serializer.Serialize(stream, settings);
stream.Position = 0;
Settings deserialized = serializer.Deserialize(stream) as Settings;
Assert.IsNotNull(deserialized);
Assert.AreEqual(settings.Name, deserialized.Name);
Assert.AreEqual(settings.ReferenceStyle, deserialized.ReferenceStyle);
Assert.AreEqual(settings.Elements.Count, deserialized.Elements.Count);
Assert.AreEqual(settings.Elements[0].GetType(), deserialized.Elements[0].GetType());
Assert.AreEqual(settings.Elements[1].GetType(), deserialized.Elements[1].GetType());
}
[Test]
public void SerializeSettingsRepository()
{
SettingsRepository repository = new SettingsRepository();
repository.SettingsList.Add(CreateTestSettings1());
repository.SettingsList.Add(CreateTestSettings2());
MemoryStream stream = new MemoryStream();
SoapFormatter serializer = new SoapFormatter();
serializer.Serialize(stream, repository);
stream.Position = 0;
SettingsRepository deserialized = serializer.Deserialize(stream) as SettingsRepository;
Assert.IsNotNull(deserialized);
Assert.AreEqual(repository.SettingsList.Count, deserialized.SettingsList.Count);
Assert.AreEqual(
repository.SettingsList[1].Elements.Count,
deserialized.SettingsList[1].Elements.Count
);
Assert.AreEqual(
repository.SettingsList[0].Name,
deserialized.SettingsList[0].Name
);
Assert.AreEqual(
repository.SettingsList[0].ReferenceStyle,
deserialized.SettingsList[0].ReferenceStyle
);
}
Settings CreateTestSettings1()
{
string testName = "test name...";
string testString = "Hello World";
SelectFirstDay controlElement = new SelectFirstDay(
new List<FormatElementBase>()
{
new Items("hello"),
new Items("world")
}
);
CustomText formatElement = new CustomText();
formatElement.Content = testString;
Settings settings = new Settings(testName, new List<ElementBase>()
{
controlElement,
formatElement
}
);
settings.ReferenceStyle = zaaReloaded2.Formatter.ReferenceStyle.IfSpecialItem;
return settings;
}
Settings CreateTestSettings2()
{
string testName = "another test name";
SelectFirstDay controlElement1 = new SelectFirstDay(
new List<FormatElementBase>()
{
new CustomText(),
}
);
SelectLastDay controlElement2 = new SelectLastDay(
new List<FormatElementBase>()
{
new Items("Items content"),
}
);
Settings settings = new Settings(testName, new List<ElementBase>()
{
controlElement1,
controlElement2
}
);
settings.ReferenceStyle = zaaReloaded2.Formatter.ReferenceStyle.IfSpecialOrAbnormal;
return settings;
}
}
}

View File

@ -58,11 +58,13 @@
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Runtime.Serialization.Formatters.Soap" />
<Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Expression.Blend.Sdk.1.0.2\lib\net40-client\System.Windows.Interactivity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xaml" />
<Reference Include="System.XML" />
<Reference Include="WindowsBase" />
</ItemGroup>
<Choose>
@ -78,7 +80,9 @@
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="SerializationTest.cs" />
<Compile Include="Controller\SettingsRepositoryTest.cs" />
<Compile Include="Controller\SettingsTest.cs" />
<Compile Include="Formatter\DocumentWriterTest.cs" />
<Compile Include="Thesaurus\ThesaurusTest.cs" />
<Compile Include="Controller\Elements\ItemsTest.cs" />
@ -91,7 +95,8 @@
<Compile Include="Thesaurus\TestThesaurus.cs" />
<Compile Include="Importer\ZaaImporter\TimePointTest.cs" />
<Compile Include="TestHelpers.cs" />
<Compile Include="ViewModels\SettingsRepositoryViewModel.cs" />
<Compile Include="ViewModels\ElementPickerViewModelTest.cs" />
<Compile Include="ViewModels\SettingsRepositoryViewModelTest.cs" />
<Compile Include="ViewModels\SettingsViewModelTest.cs" />
</ItemGroup>
<ItemGroup>

View File

@ -0,0 +1,54 @@
/* ElementPickerViewModelTest.cs
* part of zaaReloaded2
*
* Copyright 2015 Daniel Kraus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Bovender.Mvvm.ViewModels;
using zaaReloaded2.ViewModels;
namespace Tests.ViewModels
{
[TestFixture]
class ElementPickerViewModelTest
{
[Test]
public void ChooseElement()
{
ElementPickerViewModel vm = new ElementPickerViewModel(true);
ViewModelBase elementVM = vm.Categories.First().Children.First();
elementVM.IsSelected = true;
string expectedLabel = elementVM.DisplayString;
Assert.IsTrue(vm.ChooseElementCommand.CanExecute(null),
"Cannot execute ChooseElementCommand");
bool messageSent = false;
vm.ElementChosenMessage.Sent += (sender, args) =>
{
messageSent = true;
ViewModelBase messageContentVM = args.Content.ViewModel as ViewModelBase;
Assert.AreEqual(expectedLabel, messageContentVM.DisplayString);
};
vm.ChooseElementCommand.Execute(null);
Assert.IsTrue(messageSent, "No message was sent when element was chosen");
}
}
}

View File

@ -0,0 +1,72 @@
/* SettingsRepositoryViewModel.cs
* part of zaaReloaded2
*
* Copyright 2015 Daniel Kraus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using zaaReloaded2.Controller;
using zaaReloaded2.ViewModels;
namespace Tests.ViewModels
{
[TestFixture]
class SettingsRepositoryViewModelTest
{
SettingsRepositoryViewModel _vm;
const string TESTNAME = "hello world";
[SetUp]
public void SetUp()
{
SettingsRepository rep = new SettingsRepository();
rep.SettingsList.Add(new Settings(TESTNAME));
_vm = new SettingsRepositoryViewModel(rep);
}
[Test]
public void CanDeleteNonDefaultSettings()
{
_vm.SettingsList[_vm.SettingsList.Count - 1].IsSelected = true;
Assert.IsTrue(_vm.DeleteSettingsCommand.CanExecute(null));
}
[Test]
public void CannotDeleteDefaultSettings()
{
_vm.SettingsList[0].IsSelected = true;
Assert.IsFalse(_vm.DeleteSettingsCommand.CanExecute(null));
}
[Test]
public void CopySettings()
{
SettingsViewModel orig = _vm.SettingsList[0];
orig.IsSelected = true;
_vm.CopySettingsCommand.Execute(null);
SettingsViewModel copy = _vm.SettingsList[_vm.SettingsList.Count-1];
// Make sure we have a new object
Assert.AreNotSame(orig, copy);
Assert.AreNotSame(orig.RevealModelObject(), copy.RevealModelObject());
Assert.AreEqual(String.Format("Kopie von {0}", orig.Name), copy.Name);
Assert.IsTrue(copy.IsSelected);
}
}
}

View File

@ -22,6 +22,7 @@ using System.Text;
using NUnit.Framework;
using zaaReloaded2.ViewModels;
using zaaReloaded2.Controller;
using zaaReloaded2.Controller.Elements;
namespace Tests.ViewModels
{
@ -39,31 +40,149 @@ namespace Tests.ViewModels
[Test]
public void AddElement()
{
bool messageSent = false;
Settings model = _settingsVM.RevealModelObject() as Settings;
int oldViewModelElementCount = _settingsVM.Elements.Count;
int oldModelElementCount = model.Elements.Count;
_settingsVM.AddElementMessage.Sent += (sender, args) =>
{
messageSent = true;
ElementPickerViewModel picker = args.Content.ViewModel as ElementPickerViewModel;
Assert.IsNotNull(picker, "ViewModel in MessageContent is not an ElementPickerViewModel");
picker.Categories.First().Children.First().IsSelected = true;
picker.ChooseElementCommand.Execute(null);
};
_settingsVM.AddElementCommand.Execute(null);
Assert.IsTrue(messageSent, "Message was not sent");
Assert.AreEqual(oldViewModelElementCount + 1, _settingsVM.Elements.Count,
"Count of elements in ViewModel was not increased by 1");
Assert.AreEqual(oldModelElementCount + 1, model.Elements.Count,
"Count of elements in settings Model was not increased by 1");
}
[Test]
public void AddChildElement()
{
bool messageSent = false;
SelectEachDay model = new SelectEachDay();
ControlElementViewModel viewModel = new ControlElementViewModel(model);
_settingsVM.AddElementViewModel(viewModel);
viewModel.IsSelected = true;
int oldViewModelChildrenCount = viewModel.Elements.Count;
int oldModelChildrenCount = model.Children.Count;
_settingsVM.AddChildElementMessage.Sent += (sender, args) =>
{
messageSent = true;
ElementPickerViewModel picker = args.Content.ViewModel as ElementPickerViewModel;
Assert.IsNotNull(picker, "ViewModel in MessageContent is not an ElementPickerViewModel");
picker.Categories.First().Children.First().IsSelected = true;
Assert.IsTrue(picker.ChooseElementCommand.CanExecute(null),
"Cannot execute element picker's ChooseElementCommand.");
picker.ChooseElementCommand.Execute(null);
};
_settingsVM.AddChildElementCommand.Execute(null);
Assert.IsTrue(messageSent, "Message was not sent");
Assert.AreEqual(oldViewModelChildrenCount + 1, viewModel.Elements.Count,
"Count of children in ViewModel was not increased by 1");
Assert.AreEqual(oldModelChildrenCount + 1, model.Children.Count,
"Count of children in Model was not increased by 1");
}
[Test]
public void CannotAddChildElementToFormatElement()
{
ControlElementViewModel parent = new ControlElementViewModel(
new SelectFirstDay());
_settingsVM.AddElementViewModel(parent);
parent.IsSelected = true;
Assert.IsTrue(_settingsVM.AddChildElementCommand.CanExecute(null));
FormatElementViewModel child = new FormatElementViewModel(new Items());
_settingsVM.AddChildElementViewModel(parent, child);
parent.IsSelected = false;
child.IsSelected = true;
Assert.IsFalse(_settingsVM.AddChildElementCommand.CanExecute(null));
}
[Test]
public void DeleteElement()
{
Settings settings = new Settings();
settings.AddElement(new SelectFirstDay());
settings.AddElement(new SelectEachDay());
settings.AddElement(new SelectLastDay());
SettingsViewModel settingsVM = new SettingsViewModel(settings);
int oldCount = settingsVM.Elements.Count;
ElementViewModel elementVM = settingsVM.Elements.First();
ElementBase element = elementVM.RevealModelObject() as ElementBase;
Assert.IsTrue(settings.Elements.Contains(element),
"Settings object does not contain the model that the VM revealed?!");
elementVM.IsSelected = true;
Assert.IsTrue(settingsVM.DeleteElementCommand.CanExecute(null),
"DeleteElementCommand should be enabled.");
settingsVM.DeleteElementCommand.Execute(null);
Assert.AreEqual(oldCount - 1, settingsVM.Elements.Count);
Assert.IsFalse(settingsVM.Elements.Contains(elementVM),
"Elements collection still contains the deleted element view model.");
Assert.IsFalse(settings.Elements.Contains(element),
"Settings' Element collection still contains the element model.");
}
[Test]
public void DeleteChildElement()
{
Settings settings = new Settings();
settings.AddElement(new SelectFirstDay(new Items()));
settings.AddElement(new SelectEachDay());
settings.AddElement(new SelectLastDay());
SettingsViewModel settingsVM = new SettingsViewModel(settings);
ControlElementViewModel parent = ((ControlElementViewModel)settingsVM.Elements.First());
int oldCount = parent.Elements.Count;
ElementViewModel elementVM = ((ControlElementViewModel)settingsVM.Elements.First())
.Elements.First();
ElementBase element = elementVM.RevealModelObject() as ElementBase;
Assert.IsTrue(((ControlElementBase)settings.Elements[0]).Children.Contains(element),
"Settings object does not contain the model that the VM revealed?!");
elementVM.IsSelected = true;
Assert.IsTrue(settingsVM.DeleteElementCommand.CanExecute(null),
"DeleteElementCommand should be enabled.");
settingsVM.DeleteElementCommand.Execute(null);
Assert.AreEqual(oldCount - 1, parent.Elements.Count);
Assert.IsFalse(parent.Elements.Contains(elementVM),
"Elements collection still contains the deleted element view model.");
Assert.IsFalse(((ControlElementBase)settings.Elements[0]).Children.Contains(element),
"Settings' collection of FormatElement children still contains the element model.");
}
[Test]
public void CopyElement()
{
string testString = "this text should be duplicated";
_settingsVM.AddElementViewModel(
new ControlElementViewModel(new SelectEachDay(new Items(testString))));
int oldCount = _settingsVM.Elements.Count;
_settingsVM.Elements.First().IsSelected = true;
Assert.IsTrue(_settingsVM.CopyElementCommand.CanExecute(null),
"CopyElementCommand should be enabled.");
_settingsVM.CopyElementCommand.Execute(null);
Assert.AreEqual(oldCount + 1, _settingsVM.Elements.Count);
// Access the first element
ControlElementViewModel controlVM = _settingsVM.Elements.First() as ControlElementViewModel;
FormatElementViewModel formatVM = controlVM.Elements.First() as FormatElementViewModel;
Items items = formatVM.RevealModelObject() as Items;
Assert.IsNotNull(items,
"Child ViewModel of first ControlElementViewModel does not wrap Items object.");
Assert.AreEqual(testString, items.Content,
"First control element's child element has incorrect Content string.");
// Access the second element
controlVM = _settingsVM.Elements.Last() as ControlElementViewModel;
formatVM = controlVM.Elements.First() as FormatElementViewModel;
items = formatVM.RevealModelObject() as Items;
Assert.IsNotNull(items,
"Child ViewModel of last ControlElementViewModel does not wrap Items object.");
Assert.AreEqual(testString, items.Content,
"First control element's child element has incorrect Content string.");
}
}
}

BIN
gimp/d.xcf Normal file

Binary file not shown.

BIN
gimp/down.xcf Normal file

Binary file not shown.

BIN
gimp/duplicate.xcf Normal file

Binary file not shown.

BIN
gimp/exit.xcf Normal file

Binary file not shown.

BIN
gimp/export.xcf Normal file

Binary file not shown.

BIN
gimp/gear.xcf Normal file

Binary file not shown.

BIN
gimp/import.xcf Normal file

Binary file not shown.

BIN
gimp/minus.xcf Normal file

Binary file not shown.

BIN
gimp/pen.xcf Normal file

Binary file not shown.

BIN
gimp/plus-child.xcf Normal file

Binary file not shown.

BIN
gimp/plus.xcf Normal file

Binary file not shown.

BIN
gimp/reset.xcf Normal file

Binary file not shown.

BIN
gimp/up.xcf Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
www/img/elementpicker.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
www/img/nachher.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
www/img/ribbon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
www/img/stilauswahl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
www/img/stilbearbeiten.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
www/img/vorher.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

View File

@ -1,20 +1,178 @@
<html>
<head>
<title>zaaReloaded2 by Daniel Kraus</title>
<meta charset="utf-8">
<meta name="author" content="Daniel Kraus">
<style type="text/css"><!--
* {
font-family: Arial; font-size: 16px; line-height: 125%;
color: #333;
}
body { margin: 16px 24px; max-width: 800px; }
h1 { font-size: 150%; margin: 48px 0 24px 0; }
h2 { font-size: 120%; margin: 32px 0 16px 0; }
p { text-align: justify; }
img {
box-shadow: 2px 2px 8px #444;
}
.download {
width: 500px; margin: 16px auto;
padding: 8px; border: 1px solid #888;
box-shadow: 2px 2px 8px #444;
background-color: #eef;
}
.float-right {
float: right;
margin: 8px 0 8px 16px;
}
.center {
text-align: center;
}
.clear {
clear: both;
}
--></style>
</head>
<body>
<h1>zaaReloaded2</h1>
<p>
<p style="font-weight: bold;">
Erweiterung für Microsoft&reg; Word 2010-2013, das die <a
href="http://www.smi.ukw.de/sap-klinische-verfahren/archivsysteme/zentrale-arztbriefablage.html">
Zentrale Arztbriefablage (ZAA)</a> um Funktionen für das Formatieren
von Laborwerten erweitert.
</p>
<div class="download">
<h2 style="margin-top:0">Download</h2>
<p><a href="downloads/">zaa.nephrowiki.de/downloads</a></p>
</div>
<h2>Anleitung</h2>
<p class="center">
<img src="img/ribbon.png" alt="zaaReloaded2-Ribbon" />
</p>
<ol>
<li>Laborwerte auf üblichem Wege in einen Arztbrief einfügen
(alternativ kann der Befehl "Demo" ausgeführt werden, dann wird
ein Beispieldokument mit Laborwerten geöffnet).</li>
<li>Im zaaReloaded-Tab (s.o.) den linken Knopf "Formatieren"
klicken.</li>
<p class="center">
<img src="img/stilauswahl.png" alt="Stil auswählen" />
</p>
<li>
Beim ersten Mal erscheint eine Liste mit Stilen, aus der man den
gewünschten Stil auswählt (siehe Abbildung). Beim nächsten Mal,
wenn man auf diesen Knopf drückt, wird der zuletzt verwendete Stil
genommen.</li>
<li>Einen Moment warten... Voilà.</li>
</ol>
<h2 class="clear">Anpassen</h2>
<p>
Das Addin enthält einen Stil-Editor, mit dem die eingebauten Stile
bearbeitet und neue Stile entworfen werden können:
</p>
<p class="center">
<img src="img/stilbearbeiten.png" alt="Stil bearbeiten" />
</p>
<p class="clear">
<img src="img/elementpicker.png" alt="Elemente" class="float-right" />
Jeder Stil setzt sich aus sog. <i>Elementen</i> zusammen. Es gibt
<i>Steuerelemente</i>, die zum Beispiel für die Auswahl eines Tages
(erster Tag/letzter Tag) zuständig sind, und es gibt
<i>Ausgabeelemente</i>, die die eigentliche Formatierung und Ausgabe
der Laborwerte übernehmen.
</p>
<p>
Steuerelemente:
</p>
<ul>
<li>Ersten Tag auswählen</li>
<li>Letzten Tag auswählen</li>
<li>Jeden Tag nacheinander auswählen</li>
<li>Zwei Spalten einfügen/zur nächsten Spalte wechseln</li>
</ul>
<p>
Ausgabeelemente:
</p>
<ul>
<li>Laborparameter</li>
<li>Beliebiger Text</li>
</ul>
<p>
"Beliebiger Text" kann, wie der Name schon sagt, beliebigen Text
enthalten, der nicht weiter bearbeitet wird. Auf diese Weise kann
man z.B. Platzhalter für Urinsedimente ausgeben lassen, die dann
noch händisch vervollständigt werden.
</p>
<p>
"Laborparameter" enthalten eine durch Kommata getrennte Auflistung
von Parametern, die ausgegeben werden sollen. Jedes Element
"Laborparameter" kann optional einen Titel enthalten:
</p>
<p>
Beispiel:
</p>
<blockquote>
<p>
<img src="img/elementbearbeiten.png" alt="Element bearbeiten" />
</p>
<p>
Klinische Chemie: Na, K, Cl, (usw.)
</p>
</blockquote>
<p>
In diesem Fall ist "Klinische Chemie:" der optionale Titel.
</p>
<p>
Die Bezeichnungen der einzelnen Parameter sind fest einprogrammiert.
Teils decken sie sich mit den Bezeichnungen, wie sie in der
Zentralen Arztbriefablage erscheinen; teils sind sie aber auch
Surrogate (z.B. "eGFR (CKD-EPI)" anstatt "glomerul. Filtrationsr.
CKD-EP").
</p>
<p>
Die Platzhalter "SU-*", "U-*" und "*" geben die noch nicht
verwendeten Werte für Sammelurin, Spontanurin und alles weitere aus.
"*" sollte daher als letztes verwendet werden.
<p>
Die Liste der möglichen Parameternamen ist momentan fest
einprogrammiert und kann auch noch nicht angezeigt werden. Man kann
beim Entwickeln eines Stils aber probehalber den Platzhalter "*"
verwenden und sieht dann, welche Parameternamen noch verwendet
werden könnten.
</p>
<h2>Updates</h2>
<p>
Das Addin sucht täglich nach Updates und lädt und installiert diese
bei Bedarf im Hintergrund.
</p>
<h2>Weitere Informationen</h2>
<p><a href="doc/md_history.html">Versionsgeschichte</a></p>
<p><a href="doc/index.html">Quellcode-Dokumentation</a></p>
<hr />
<p>&copy; 2015 Daniel Kraus</p>
<p>&copy; 2015 <a href="http://www.bovender.de">Daniel Kraus</a></p>
</body>
<!-- vim: set tw=72 ai sts=2 ts=2 sw=2 : -->
</html>

View File

@ -1,4 +1,4 @@
2.0.0-alpha.3
http://zaa.nephrowiki.de/downloads/zaaReloaded-2.0.0-alpha.3.exe
c9bb1062acdf2d8181a3915e34d5cfe96d26934a publish/release/zaaReloaded-2.0.0-alpha.3.exe
2.0.0-beta.1
http://zaa.nephrowiki.de/downloads/zaaReloaded-2.0.0-beta.1.exe
4fe0f2bd8ba1c3852c02c6220bddf53b5fd98ef8 publish/release/zaaReloaded-2.0.0-beta.1.exe

View File

@ -1,4 +1,5 @@
/* ControlElementBase.cs
using System;
/* ControlElementBase.cs
* part of zaaReloaded2
*
* Copyright 2015 Daniel Kraus
@ -16,6 +17,8 @@
* limitations under the License.
*/
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
namespace zaaReloaded2.Controller.Elements
{
@ -23,23 +26,90 @@ namespace zaaReloaded2.Controller.Elements
/// Base class for control elements that control e.g. the working
/// set of time points in a Formatter object.
/// </summary>
public abstract class ControlElementBase : ElementBase
[Serializable]
public abstract class ControlElementBase : ElementBase, ISerializable
{
#region Properties
/// <summary>
/// Gets a list of child elements, all of which must be derived
/// from FormatElementBase.
/// </summary>
public IList<FormatElementBase> FormatElements { get; private set; }
public IList<FormatElementBase> Children { get; internal set; }
public ControlElementBase() { }
/// <summary>
/// Informs whether this control element can have child elements.
/// </summary>
public virtual bool CanHaveChildren { get { return true; } }
public ControlElementBase(IList<FormatElementBase> formatElements)
#endregion
#region Constructors
public ControlElementBase()
: this(new List<FormatElementBase>())
{ }
public ControlElementBase(IList<FormatElementBase> children)
{
FormatElements = formatElements;
Children = children;
}
public ControlElementBase(FormatElementBase formatElement)
: this(new List<FormatElementBase>() { formatElement })
public ControlElementBase(FormatElementBase children)
: this(new List<FormatElementBase>() { children })
{ }
#endregion
#region Serialization
/// <summary>
/// Deserialization constructor.
/// </summary>
protected ControlElementBase(SerializationInfo info, StreamingContext context)
{
int version = info.GetInt32("Version");
int childrenCount = info.GetInt32("ChildrenCount");
Children = new List<FormatElementBase>();
for (int i = 0; i < childrenCount; i++)
{
Type typeOfChild = info.GetValue(SerializedChildName(i, "Type"), typeof(Type)) as Type;
Children.Add(info.GetValue(SerializedChildName(i, "Object"), typeOfChild) as FormatElementBase);
}
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("Version", Properties.Settings.Default.SerializationVersion);
info.AddValue("ChildrenCount", Children.Count);
int i = 0;
foreach (FormatElementBase child in Children)
{
info.AddValue(SerializedChildName(i, "Type"), child.GetType());
info.AddValue(SerializedChildName(i, "Object"), child);
i++;
}
}
private string SerializedChildName(int index, string info)
{
return String.Format("Child{0}{1}", index, info);
}
#endregion
#region Protected methods
/// <summary>
/// Creates a clone of the Children list (for use in cloning
/// derived classes).
/// </summary>
/// <returns>Clone of the Children list.</returns>
protected IList<FormatElementBase> CloneChildren()
{
return Children.Select(child => child.Clone() as FormatElementBase).ToList();
}
#endregion
}
}

View File

@ -18,6 +18,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace zaaReloaded2.Controller.Elements
@ -25,16 +26,49 @@ namespace zaaReloaded2.Controller.Elements
/// <summary>
/// Controller element that writes arbitrary text to the document.
/// </summary>
class CustomText : FormatElementBase
[Serializable]
public class CustomText : FormatElementBase, ISerializable
{
public override string Label
{
get { return String.Format("\"{0}\"", Content); }
get
{
if (String.IsNullOrEmpty(Content))
{
return "Beliebiger Text";
}
else
{
return String.Format("\"{0}\"", Content);
}
}
}
public override void Run(Formatter.Formatter formatter)
{
formatter.WriteParagraph(Content);
}
protected override ElementBase CreateInstance()
{
CustomText clone = new CustomText();
clone.Content = Content;
return clone;
}
#region Constructors
public CustomText () { }
/// <summary>
/// Deserialization constructor.
/// </summary>
protected CustomText(SerializationInfo info, StreamingContext context)
{
int version = info.GetInt32("Version");
Content = info.GetString("Content");
}
#endregion
}
}

View File

@ -21,14 +21,14 @@ using System.Linq;
using System.Text;
using Microsoft.Office.Interop.Word;
using zaaReloaded2.LabModel;
using System.Runtime.Serialization;
namespace zaaReloaded2.Controller.Elements
{
/// <summary>
/// Base class for formatting elements.
/// </summary>
[Serializable]
public abstract class ElementBase
public abstract class ElementBase : ICloneable
{
/// <summary>
/// Returns the label for this formatting element.
@ -44,5 +44,16 @@ namespace zaaReloaded2.Controller.Elements
/// Element belongs to. The Formatter object provides access
/// to the current Word document etc.</param>
abstract public void Run(zaaReloaded2.Formatter.Formatter formatter);
public object Clone()
{
return CreateInstance();
}
/// <summary>
/// Creates a new instance that can be used for cloning.
/// </summary>
/// <returns>New instance of a derived class.</returns>
protected abstract ElementBase CreateInstance();
}
}

View File

@ -16,12 +16,14 @@
* limitations under the License.
*/
using System;
using System.Runtime.Serialization;
namespace zaaReloaded2.Controller.Elements
{
/// <summary>
/// Base class for elements that perform actual formatting.
/// </summary>
public abstract class FormatElementBase : ElementBase
public abstract class FormatElementBase : ElementBase, ISerializable
{
/// <summary>
/// Gets or sets the content of this format element.
@ -32,7 +34,6 @@ namespace zaaReloaded2.Controller.Elements
set
{
_content = value;
}
}
@ -42,5 +43,15 @@ namespace zaaReloaded2.Controller.Elements
protected virtual void OnContentChanged() {}
private string _content;
#region Serialization
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("Version", Properties.Settings.Default.SerializationVersion);
info.AddValue("Content", Content);
}
#endregion
}
}

View File

@ -23,6 +23,7 @@ using System.Diagnostics;
using Microsoft.Office.Interop.Word;
using zaaReloaded2.LabModel;
using zaaReloaded2.Formatter;
using System.Runtime.Serialization;
namespace zaaReloaded2.Controller.Elements
{
@ -31,13 +32,23 @@ namespace zaaReloaded2.Controller.Elements
/// to a Word document.
/// </summary>
[Serializable]
class Items : CustomText
public class Items : CustomText
{
#region ElementBase implementation
public override string Label
{
get { return Content; }
get
{
if (String.IsNullOrEmpty(Content))
{
return "Laborparameter";
}
else
{
return Content;
}
}
}
public override void Run(zaaReloaded2.Formatter.Formatter formatter)
@ -74,6 +85,13 @@ namespace zaaReloaded2.Controller.Elements
}
}
protected override ElementBase CreateInstance()
{
Items clone = new Items();
clone.Content = Content;
return clone;
}
#endregion
#region Constructors
@ -86,6 +104,13 @@ namespace zaaReloaded2.Controller.Elements
Content = content;
}
/// <summary>
/// Deserialization constructor.
/// </summary>
protected Items(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
#endregion
#region Private methods
@ -132,7 +157,6 @@ namespace zaaReloaded2.Controller.Elements
{
items.AddRange(CollectByName(formatter, itemName));
}
}
return items;
}
@ -148,9 +172,12 @@ namespace zaaReloaded2.Controller.Elements
foreach (TimePointFormatter tpf in formatter.WorkingTimePoints.Values)
{
List<ItemFormatter> newItems = tpf.ItemFormatters.Values
.Where(i => !i.HasBeenUsed && i.LabItem.QualifiedName.StartsWith(material))
.Where(i => !i.HasBeenUsed && !i.IsBlacklisted && i.LabItem.QualifiedName.StartsWith(material))
.ToList();
newItems.ForEach(i => i.HasBeenUsed = true);
// Include the material prefix only if this item was collected by a
// general wildcard ("*" rather than "SU-*" etc.).
newItems.ForEach(i => i.IncludeMaterial = String.IsNullOrEmpty(material));
items.AddRange(newItems);
}
return items;

View File

@ -0,0 +1,69 @@
/* NextColumn.cs
* part of zaaReloaded2
*
* Copyright 2015 Daniel Kraus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace zaaReloaded2.Controller.Elements
{
/// <summary>
/// Format element that causes a Formatter object to move the
/// insertion point to the next colum in a layout table.
/// </summary>
[Serializable]
public class NextColumn : ControlElementBase, ISerializable
{
public override string Label
{
get { return "Nächste Spalte"; }
}
public override bool CanHaveChildren
{
get
{
return false;
}
}
public override void Run(Formatter.Formatter formatter)
{
formatter.NextColumn();
}
protected override ElementBase CreateInstance()
{
return new NextColumn();
}
#region Constructors
public NextColumn() : base() { }
/// <summary>
/// Deserialization constructor.
/// </summary>
protected NextColumn(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
#endregion
}
}

View File

@ -18,15 +18,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace zaaReloaded2.Controller.Elements
{
class SelectEachDay : ControlElementBase
[Serializable]
public class SelectEachDay : ControlElementBase
{
public override string Label
{
get { return "Jeden Tag auswählen"; }
get { return "Jeder Tag"; }
}
public override void Run(Formatter.Formatter formatter)
@ -34,6 +36,13 @@ namespace zaaReloaded2.Controller.Elements
formatter.ProcessEachDay(this);
}
protected override ElementBase CreateInstance()
{
return new SelectEachDay(CloneChildren());
}
#region Constructors
public SelectEachDay() : base() { }
public SelectEachDay(FormatElementBase formatElement)
@ -43,5 +52,14 @@ namespace zaaReloaded2.Controller.Elements
public SelectEachDay(IList<FormatElementBase> formatElements)
: base(formatElements)
{ }
/// <summary>
/// Deserialization constructor.
/// </summary>
protected SelectEachDay(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
#endregion
}
}

View File

@ -18,6 +18,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace zaaReloaded2.Controller.Elements
@ -26,11 +27,12 @@ namespace zaaReloaded2.Controller.Elements
/// Selects the time points of the first day in a given Formatter
/// object.
/// </summary>
class SelectFirstDay : ControlElementBase
[Serializable]
public class SelectFirstDay : ControlElementBase, ISerializable
{
public override string Label
{
get { return "Ersten Tag auswählen"; }
get { return "Erster Tag"; }
}
public override void Run(Formatter.Formatter formatter)
@ -38,6 +40,13 @@ namespace zaaReloaded2.Controller.Elements
formatter.ProcessFirstDay(this);
}
protected override ElementBase CreateInstance()
{
return new SelectFirstDay(CloneChildren());
}
#region Constructors
public SelectFirstDay() : base() { }
public SelectFirstDay(FormatElementBase formatElement)
@ -47,5 +56,14 @@ namespace zaaReloaded2.Controller.Elements
public SelectFirstDay(IList<FormatElementBase> formatElements)
: base(formatElements)
{ }
/// <summary>
/// Deserialization constructor.
/// </summary>
protected SelectFirstDay(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
#endregion
}
}

View File

@ -19,6 +19,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace zaaReloaded2.Controller.Elements
@ -27,11 +28,12 @@ namespace zaaReloaded2.Controller.Elements
/// Selects the time points of the last day in a given Formatter
/// object.
/// </summary>
class SelectLastDay : ControlElementBase
[Serializable]
public class SelectLastDay : ControlElementBase, ISerializable
{
public override string Label
{
get { return "Letzten Tag auswählen"; }
get { return "Letzter Tag"; }
}
public override void Run(Formatter.Formatter formatter)
@ -39,6 +41,13 @@ namespace zaaReloaded2.Controller.Elements
formatter.ProcessLastDay(this);
}
protected override ElementBase CreateInstance()
{
return new SelectLastDay(CloneChildren());
}
#region Constructors
public SelectLastDay() : base() { }
public SelectLastDay(FormatElementBase formatElement)
@ -48,5 +57,14 @@ namespace zaaReloaded2.Controller.Elements
public SelectLastDay(IList<FormatElementBase> formatElements)
: base(formatElements)
{ }
/// <summary>
/// Deserialization constructor.
/// </summary>
protected SelectLastDay(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
#endregion
}
}

View File

@ -0,0 +1,69 @@
/* TwoColumns.cs
* part of zaaReloaded2
*
* Copyright 2015 Daniel Kraus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace zaaReloaded2.Controller.Elements
{
/// <summary>
/// Format element that causes a Formatter object to insert a table with
/// two columns and one row into the documents.
/// </summary>
[Serializable]
public class TwoColumns : ControlElementBase, ISerializable
{
public override string Label
{
get { return "Zwei Spalten einfügen"; }
}
public override bool CanHaveChildren
{
get
{
return false;
}
}
public override void Run(Formatter.Formatter formatter)
{
formatter.InsertTwoColumns();
}
protected override ElementBase CreateInstance()
{
return new TwoColumns();
}
#region Constructors
public TwoColumns() : base() { }
/// <summary>
/// Deserialization constructor.
/// </summary>
protected TwoColumns(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
#endregion
}
}

View File

@ -21,6 +21,10 @@ using System.Linq;
using System.Text;
using zaaReloaded2.Formatter;
using zaaReloaded2.Controller.Elements;
using System.IO;
using System.Text.RegularExpressions;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Soap;
namespace zaaReloaded2.Controller
{
@ -28,8 +32,43 @@ namespace zaaReloaded2.Controller
/// Holds settings related to controlling laboratory output.
/// </summary>
[Serializable]
public class Settings
public class Settings : ICloneable, ISerializable
{
#region Persistence
/// <summary>
/// Deserializes a Settings object from SOAP XML that is read from a file.
/// </summary>
/// <param name="fileName">File to read.</param>
/// <returns>Deserialized Settings object with new unique ID.</returns>
/// <exception cref="InvalidDataException">if the file does not contain
/// SOAP XML that can be deserialized to a Settings object.</exception>
public static Settings LoadFromFile(string fileName)
{
StreamReader reader = new StreamReader(fileName);
SoapFormatter formatter = new SoapFormatter();
Settings settings = formatter.Deserialize(reader.BaseStream) as Settings;
if (settings == null)
{
throw new InvalidDataException("Datei enthält keine Stil-Daten oder ist beschädigt.");
}
settings.Uid = Guid.NewGuid();
return settings;
}
/// <summary>
/// Serializes a Settings object to SOAP XML that is written to a file.
/// </summary>
/// <param name="fileName">File to write to.</param>
public void SaveToFile(string fileName)
{
StreamWriter writer = new StreamWriter(fileName);
SoapFormatter formatter = new SoapFormatter();
formatter.Serialize(writer.BaseStream, this);
}
#endregion
#region Properties
/// <summary>
@ -47,14 +86,23 @@ namespace zaaReloaded2.Controller
/// </summary>
public IList<ElementBase> Elements { get; private set; }
/// <summary>
/// Gets the unique ID of this Settings object. The unique
/// ID is not included in deep-copying (cloning).
/// </summary>
public Guid Uid { get; internal set; }
#endregion
#region Constructor
#region Constructors
public Settings()
{
Elements = new List<ElementBase>();
}
: this(string.Empty, null)
{ }
public Settings(string name)
: this(name, null)
{ }
/// <summary>
/// Creates a new Settings object with an initial
@ -63,9 +111,8 @@ namespace zaaReloaded2.Controller
/// <param name="initialElements">Set of ElementBase
/// object (or derived ones).</param>
public Settings(IList<ElementBase> initialElements)
{
Elements = initialElements;
}
: this(String.Empty, initialElements)
{ }
/// <summary>
/// Creates a new Settings object with an initial
@ -75,9 +122,48 @@ namespace zaaReloaded2.Controller
/// object (or derived ones).</param>
/// <param name="name">Name of these settings.</param>
public Settings(string name, IList<ElementBase> initialElements)
: this(initialElements)
{
Uid = Guid.NewGuid();
Name = name;
Elements = initialElements;
ReferenceStyle = Properties.Settings.Default.ReferenceStyle;
if (Elements == null)
{
Elements = new List<ElementBase>();
}
}
/// <summary>
/// Creates a new Settings object with an initial
/// set of elements, a name, and a unique ID.
/// </summary>
/// <param name="initialElements">Set of ElementBase
/// object (or derived ones).</param>
/// <param name="name">Name of these settings.</param>
/// <param name="Uid">Unique ID for this Settings object.</param>
public Settings(string name, IList<ElementBase> initialElements, Guid uid)
: this(name, initialElements)
{
Uid = uid;
}
/// <summary>
/// Deserialization constructor.
/// </summary>
protected Settings(SerializationInfo info, StreamingContext context)
{
int version = info.GetInt32("Version");
Uid = (Guid)info.GetValue("Uid", typeof(Guid));
Name = info.GetString("Name");
ReferenceStyle = (ReferenceStyle)info.GetValue("ReferenceStyle", typeof(ReferenceStyle));
int elementsCount = info.GetInt32("ElementsCount");
Elements = new List<ElementBase>();
for (int i = 0; i < elementsCount; i++)
{
Type type = info.GetValue(SerializationElementName(i, "Type"), typeof(Type)) as Type;
ElementBase element = info.GetValue(SerializationElementName(i, "Object"), type) as ElementBase;
Elements.Add(element);
}
}
#endregion
@ -94,5 +180,51 @@ namespace zaaReloaded2.Controller
}
#endregion
#region Implementation of ICloneable
public object Clone()
{
Settings clone = new Settings(
String.Format("Kopie von {0}", Name),
Elements.Select(e => e.Clone() as ElementBase).ToList()
);
clone.ReferenceStyle = ReferenceStyle;
return clone;
}
#endregion
#region Implementation of ISerializable
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("Version", Properties.Settings.Default.SerializationVersion);
info.AddValue("Uid", Uid);
info.AddValue("Name", Name);
info.AddValue("ReferenceStyle", ReferenceStyle);
info.AddValue("ElementsCount", Elements.Count);
int i = 0;
foreach (ElementBase e in Elements)
{
info.AddValue(SerializationElementName(i, "Type"), e.GetType());
info.AddValue(SerializationElementName(i, "Object"), e);
i++;
}
}
string SerializationElementName(int index, string info)
{
return String.Format("Element{0}{1}", index, info);
}
#endregion
#region Fields
// Defines header lines for the persistence file: "[My name]" and so on.
static readonly Regex _persistenceHeaderRegex = new Regex(@"^\[(?<name>.+?)]$");
#endregion
}
}

View File

@ -18,10 +18,15 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.Reflection;
using zaaReloaded2.Controller.Elements;
using System.Runtime.Serialization.Formatters.Soap;
using System.Web;
using System.Runtime.Serialization;
namespace zaaReloaded2.Controller
{
@ -35,96 +40,185 @@ namespace zaaReloaded2.Controller
/// different from zaaReloaded's Settings.
/// </remarks>
[Serializable]
public class SettingsRepository : ApplicationSettingsBase
public class SettingsRepository : ISerializable
{
#region Persistence
#region Properties persistence
/// <summary>
/// Loads the SettingsRepository instance that was persisted in
/// the assembly properties.
/// </summary>
/// <returns>SettingsRepository that was last stored in the
/// assembly properties, or a newly created SettingsRepository
/// if no previously stored exists.</returns>
/// <remarks>
/// The SettingsRepository is serialized using a SoapFormatter, which
/// creates SOAP XML. Since the assembly properties are stored as
/// XML as well, the serialized SettingsRepository is converted to
/// a base-64 string, which does not mess with the properties XML.
/// </remarks>
public static SettingsRepository Load()
{
return
zaaReloaded2.Properties.Settings.Default.SettingsRepository ??
new SettingsRepository();
string s = Properties.Settings.Default.SettingsRepository;
if (String.IsNullOrEmpty(s))
{
return new SettingsRepository();
}
else
{
MemoryStream stream = new MemoryStream();
string encoded = Properties.Settings.Default.SettingsRepository;
byte[] bytes = Convert.FromBase64String(encoded);
stream.Write(bytes, 0, bytes.Length);
stream.Position = 0;
SoapFormatter serializer = new SoapFormatter();
return serializer.Deserialize(stream) as SettingsRepository;
}
}
/// <summary>
/// Stores the SettingsRepository in the assembly properties.
/// </summary>
/// <remarks>
/// The SettingsRepository is serialized using a SoapFormatter, which
/// creates SOAP XML. Since the assembly properties are stored as
/// XML as well, the serialized SettingsRepository is converted to
/// a base-64 string, which does not mess with the properties XML.
/// </remarks>
public void Store()
{
zaaReloaded2.Properties.Settings.Default.SettingsRepository = this;
zaaReloaded2.Properties.Settings.Default.Save();
MemoryStream stream = new MemoryStream();
SoapFormatter serializer = new SoapFormatter();
serializer.Serialize(stream, this);
stream.Position = 0;
string encoded = Convert.ToBase64String(stream.ToArray());
Properties.Settings.Default.SettingsRepository = encoded;
Properties.Settings.Default.Save();
}
#endregion
#region Properties
[UserScopedSetting()]
[SettingsSerializeAs(SettingsSerializeAs.Xml)]
public IList<Settings> SettingsList { get; private set; }
public IList<Settings> SettingsList { get; protected set; }
#endregion
#region Constructor
#region Constructors
/// <summary>
/// Creates a new instance of a settings repository that will
/// contain a default set of settings.
/// </summary>
public SettingsRepository()
{
SettingsList = new List<Settings>();
CreateDefault();
}
#endregion
#region Serialization
protected SettingsRepository(SerializationInfo info, StreamingContext context)
{
int version = info.GetInt32("Version");
int settingsCount = info.GetInt32("SettingsCount");
SettingsList = new List<Settings>();
for (int i = 0; i < settingsCount; i++)
{
Type type = info.GetValue(SerializationSettingsName(i, "Type"), typeof(Type)) as Type;
Settings s = info.GetValue(SerializationSettingsName(i, "Object"), typeof(Settings)) as Settings;
SettingsList.Add(s);
}
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("Version", Properties.Settings.Default.SerializationVersion);
info.AddValue("SettingsCount", SettingsList.Count);
int i = 0;
foreach (Settings s in SettingsList)
{
info.AddValue(SerializationSettingsName(i, "Type"), s.GetType());
info.AddValue(SerializationSettingsName(i, "Object"), s);
i++;
}
}
string SerializationSettingsName(int index, string info)
{
return String.Format("Settings{0}{1}", index, info);
}
#endregion
#region Public methods
/// <summary>
/// Looks up a Settings object contained in this repository
/// by unique ID.
/// </summary>
/// <param name="uid">GUID to look for.</param>
/// <returns>Settings object with this GUID, or null if the
/// GUID was not found.</returns>
public Settings FindByGuid(Guid uid)
{
return SettingsList.FirstOrDefault(s => s.Uid == uid);
}
public static bool IsDefaultSettings(Settings settings)
{
return (settings.Name == Properties.Settings.Default.SettingsNameClinic + BUILTIN_LABEL ||
settings.Name == Properties.Settings.Default.SettingsNameWard + BUILTIN_LABEL);
}
#endregion
#region Private methods
/// <summary>
/// Resets the Settings contained in this SettingsRepository
/// to the default set of settings.
/// </summary>
public void ResetDefault()
private void CreateDefault()
{
SettingsList.Clear();
// Shortcut to assembly properties
zaaReloaded2.Properties.Settings def = zaaReloaded2.Properties.Settings.Default;
Assembly myAssembly = this.GetType().Assembly;
SoapFormatter deserializer = new SoapFormatter();
Stream stream = myAssembly.GetManifestResourceStream("zaaReloaded2.Defaults.ward.zaaReloaded");
Settings settings = deserializer.Deserialize(stream) as Settings;
settings.Name = Properties.Settings.Default.SettingsNameWard + BUILTIN_LABEL;
settings.Uid = Guid.Parse(DEFAULT_SETTINGS_1_UID);
SettingsList.Add(settings);
// TODO: May want to create deep copies of this list below
List<FormatElementBase> defaultItems = new List<FormatElementBase>()
{
new Items(def.DefaultItemsClinicalChem),
new Items(def.DefaultItemsInflammation),
new Items(def.DefaultItemsCardio),
new Items(def.DefaultItemsKidney),
new Items(def.DefaultItemsLiver),
new Items(def.DefaultItemsLipids),
new Items(def.DefaultItemsHematology),
new Items(def.DefaultItemsCoagulation),
new Items(def.DefaultItemsDrugs),
new Items(def.DefaultItemsCollectedUrine),
new Items(def.DefaultItemsSpotUrine),
new Items(def.DefaultItemsOther),
};
// Configure the settings for the ward
SettingsList.Add(
new Settings(
def.SettingsNameWard,
new List<ElementBase>()
{
new SelectFirstDay(defaultItems),
new SelectLastDay(defaultItems)
}
)
);
// Configure the settings for the outpatient clinic
SettingsList.Add(
new Settings(
def.SettingsNameClinic,
new List<ElementBase>()
{
new SelectEachDay(defaultItems),
}
)
);
stream = myAssembly.GetManifestResourceStream("zaaReloaded2.Defaults.clinic.zaaReloaded");
settings = deserializer.Deserialize(stream) as Settings;
settings.Name = Properties.Settings.Default.SettingsNameClinic + BUILTIN_LABEL;
settings.Uid = Guid.Parse(DEFAULT_SETTINGS_2_UID);
SettingsList.Add(settings);
}
#endregion
#region Constants
/// <summary>
/// Label that is appended to the default Settings' names.
/// </summary>
public const string BUILTIN_LABEL = " (eingebaut)";
/// <summary>
/// Constant GUID for the first default Settings.
/// </summary>
const string DEFAULT_SETTINGS_1_UID = "EA79DE6C-E999-44F1-9122-929A8AA404CB";
/// <summary>
/// Constant GUID for the second default Settings.
/// </summary>
const string DEFAULT_SETTINGS_2_UID = "783C63B5-A964-4368-B2D0-D4595DCCB952";
#endregion
}
}

View File

@ -0,0 +1,158 @@
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:clr="http://schemas.microsoft.com/soap/encoding/clr/1.0" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<a1:Settings id="ref-1" xmlns:a1="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Uid xsi:type="a2:Guid" xmlns:a2="http://schemas.microsoft.com/clr/ns/System">
<_a>-97947944</_a>
<_b>-28017</_b>
<_c>17434</_c>
<_d>191</_d>
<_e>72</_e>
<_f>82</_f>
<_g>56</_g>
<_h>48</_h>
<_i>158</_i>
<_j>105</_j>
<_k>95</_k>
</Uid>
<Name id="ref-3">NepA neu</Name>
<ReferenceStyle xsi:type="a3:ReferenceStyle" xmlns:a3="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Formatter/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">IfSpecialItem</ReferenceStyle>
<ElementsCount>1</ElementsCount>
<Element0Type href="#ref-4"/>
<Element0Object href="#ref-5"/>
</a1:Settings>
<a2:UnitySerializationHolder id="ref-4" xmlns:a2="http://schemas.microsoft.com/clr/ns/System">
<Data id="ref-6">zaaReloaded2.Controller.Elements.SelectEachDay</Data>
<UnityType>4</UnityType>
<AssemblyName id="ref-7">zaaReloaded2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6ec8d075a1ab1383</AssemblyName>
</a2:UnitySerializationHolder>
<a4:SelectEachDay id="ref-5" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<ChildrenCount>19</ChildrenCount>
<Child0Type href="#ref-8"/>
<Child0Object href="#ref-9"/>
<Child1Type href="#ref-8"/>
<Child1Object href="#ref-10"/>
<Child2Type href="#ref-8"/>
<Child2Object href="#ref-11"/>
<Child3Type href="#ref-8"/>
<Child3Object href="#ref-12"/>
<Child4Type href="#ref-8"/>
<Child4Object href="#ref-13"/>
<Child5Type href="#ref-8"/>
<Child5Object href="#ref-14"/>
<Child6Type href="#ref-8"/>
<Child6Object href="#ref-15"/>
<Child7Type href="#ref-8"/>
<Child7Object href="#ref-16"/>
<Child8Type href="#ref-8"/>
<Child8Object href="#ref-17"/>
<Child9Type href="#ref-8"/>
<Child9Object href="#ref-18"/>
<Child10Type href="#ref-8"/>
<Child10Object href="#ref-19"/>
<Child11Type href="#ref-8"/>
<Child11Object href="#ref-20"/>
<Child12Type href="#ref-8"/>
<Child12Object href="#ref-21"/>
<Child13Type href="#ref-8"/>
<Child13Object href="#ref-22"/>
<Child14Type href="#ref-8"/>
<Child14Object href="#ref-23"/>
<Child15Type href="#ref-24"/>
<Child15Object href="#ref-25"/>
<Child16Type href="#ref-24"/>
<Child16Object href="#ref-26"/>
<Child17Type href="#ref-24"/>
<Child17Object href="#ref-27"/>
<Child18Type href="#ref-8"/>
<Child18Object href="#ref-28"/>
</a4:SelectEachDay>
<a2:UnitySerializationHolder id="ref-8" xmlns:a2="http://schemas.microsoft.com/clr/ns/System">
<Data id="ref-29">zaaReloaded2.Controller.Elements.Items</Data>
<UnityType>4</UnityType>
<AssemblyName href="#ref-7"/>
</a2:UnitySerializationHolder>
<a4:Items id="ref-9" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-30">Klinische Chemie: Na, K, Cl, Mg, Ca, P, CaxP, Alb, Prot, Haptoglobin, LDH, Glukose, Harnsäure</Content>
</a4:Items>
<a4:Items id="ref-10" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-31">Entzündung/Immunsystem: CRP, Pct, C3c, C4, Anti-DNAse B, ASL</Content>
</a4:Items>
<a4:Items id="ref-11" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-32">Kardiale Marker: CK, CKMB, Trop, NTproBNP</Content>
</a4:Items>
<a4:Items id="ref-12" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-33">Niere: Krea, Hst, eGFR (CKD-EPI)</Content>
</a4:Items>
<a4:Items id="ref-13" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-34">Sammelurin: SU-Proteinurie, SU-Alb, SU-CrCl, SU-HstCl, SU-GFR, SU-Natrium, SU-Zeit, SU-Volumen</Content>
</a4:Items>
<a4:Items id="ref-14" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-35">Spot-Urin: U-*</Content>
</a4:Items>
<a4:Items id="ref-15" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-36">Leber: GOT, GGT, GPT, AP, Bilirubin, CHE</Content>
</a4:Items>
<a4:Items id="ref-16" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-37">Blutfette: TG, Chol, LDL, HDL, Lp(a)</Content>
</a4:Items>
<a4:Items id="ref-17" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-38">Hämatologie: Hb, Hkt, Reti, Leu, Thr, MCV, HbA1c, Retikulozyten, Fragmentozyten</Content>
</a4:Items>
<a4:Items id="ref-18" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-39">Gerinnung: Quick, INR, PTT, Fibrinogen, ATIII, Anti-Xa</Content>
</a4:Items>
<a4:Items id="ref-19" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-40">Diff.-BB: Ery, Neu, Lym, Mon, Baso, Eos</Content>
</a4:Items>
<a4:Items id="ref-20" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-41">Hormone: iPTH, TSH</Content>
</a4:Items>
<a4:Items id="ref-21" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-42">Medikamente: TAC, CSA, SIR, Vancomycin, Gentamicin, Tobramicin</Content>
</a4:Items>
<a4:Items id="ref-22" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-43">Eisenhaushalt: Eisen, Ferritin, Transferrin, Tf.-Sätt.</Content>
</a4:Items>
<a4:Items id="ref-23" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-44">BGA: pH, Std.-Bic., BE</Content>
</a4:Items>
<a2:UnitySerializationHolder id="ref-24" xmlns:a2="http://schemas.microsoft.com/clr/ns/System">
<Data id="ref-45">zaaReloaded2.Controller.Elements.CustomText</Data>
<UnityType>4</UnityType>
<AssemblyName href="#ref-7"/>
</a2:UnitySerializationHolder>
<a4:CustomText id="ref-25" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-46">Virologie (EDTA-Blut): CMV-PCR, BKV-PCR</Content>
</a4:CustomText>
<a4:CustomText id="ref-26" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-47">Nephrolog. Sediment: pH, Proteinurie, Ery /µl, Leu /µl, Plattenep. /µl, Bakt., Schleimfäden</Content>
</a4:CustomText>
<a4:CustomText id="ref-27" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-48">Autoantikörper: ANCA (IF), MPO-ANCA (ELISA), PR3-ANCA (ELISA), ANA (IF), AnDNA (ELISA), AnDNA (RIA)</Content>
</a4:CustomText>
<a4:Items id="ref-28" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-49">Hepatitis-Serologie: Anti-HBs, Anti-HBc</Content>
</a4:Items>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

View File

@ -0,0 +1,117 @@
# LAURIS-NAME "KANONISCHER NAME" MATERIAL "IMMER REFERENZBEREICH" "BLACKLIST"
# =========== ================== ======== ======================= ===========
"Übergangsepithelien (U)" Übergangsep. U
"a1-Microglobulin (SU)" a1-Microglobulin SU
"a1-Microglobulin (SU)/die" a1-Microglobulin SU
"aktuelles Bicarbonat" Bic BGA
"Albumin (PU)" Alb U
"Albumin (SU)" Alb SU
"Albumin (SU)/die" Alb SU
Albumin Alb S
Albumin/Creatinin (PU)" ACR U
"Alk. Phosphatase" AP S
Amylase Amylase S
"anorg. Phosphat" P S
"Bakterien (U)" Bakt U
Basenabweichung BE BGA
Basophile Baso E
"Bilirubin (U)" Bilirubin U
"C-reaktives Protein" CRP S
"Calcium (SU)" Ca SU
"Calcium (SU)/die" Ca SU
Calcium Ca S
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-Clearance (SU)/min" CrCl SU
"Cyclosporin-A vor Gabe" "CsA (C0)" S X
"Cystatin C (N Latex)" "Cystatin C" S X
Eisen Fe S
Eosinophile Eos E
"Erythrozyten (U)" Ery U
Erythrozyten Ery E
Ferritin Ferr S
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
"glomeruläre Filtrationsrate" GFR SU
"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
Hämatokrit Hkt E
Hämoglobin Hb E
Haptoglobin Haptoglobin S X
Harnsäure Harnsäure S
"Harnstoff (SU)" Hst SU
"Harnstoff (SU)/die" Hst/Tag SU
Harnstoff" Hst S
"Harnstoff-Clearance (SU)/min" HstCl SU
"HbA1c (NGSP)" HbA1c E
"HDL - Cholesterin" HDL S
"hyaline Zylinder (U)" "hyal. Zyl." U
"Kalium (SU)" K U
"Kalium (SU)/die" K SU
Kalium K S
"Ketonkörper (U)" KK U
"Lactat Dehydrogenase" LDH S
"LDL - Cholesterin" LDL S
"Leukozyten (U)" Leu U
Leukozyten Leu E
Lymphozyten Lym E
Magnesium Mg S X
"MCH (HbE)" MCH E
MCHC MCHC E
MCV MCV E
"Mittleres Plättchenvolumen" MPV E
Monozyten Mon E
"Natrium (SU)" Na SU
"Natrium (SU)/die" Na SU
Natrium Na S
Neutrophile Neu E
"Nitrit (U)" Nitrit U
NT-proBNP NT-proBNP S
"PCO2 (art.)" pCO2 BGA
"pH (U)" pH U
pH pH BGA
"Plattenepithelien (U)" Plattenep U
"PO2 (art.)" pO2 BGA
"Protein (U)" Protein U
"Sammelmenge (U)" Volumen SU
"Sammelzeit (U)" Zeit SU
"Sauerstoffsättigung (art.)" SO2 BGA
Sirolimus SIR S
"spezifisches Gewicht (U)" "spez. Gew." U
"Standard Bicarbonat" "Std.-Bic." BGA
"Tacrolimus (FK506)" TAC S
Thrombozyten Thr E
Transferrin Transferrin S
"Transferrinsättigung" Tf.-Sätt. S
"Triglyceride" TG S
"Troponin T (high sensitive)" hsTnT S
Unreife Granulozyten" Gran E
"Urobilinogen (U)" Urobilinogen U
"Niedermol. Heparin (Anti-Xa)" Anti-Xa Z
"Thromboplastinzeit n. Quick" Quick Z
PTT PTT Z
"Ratio int. norm." INR Z
"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
TSH TSH S
HAPTOGLOBIN Haptoglobin S
FRAGMENTOZYTEN Fragmentozyten E
"HBc-Antikörper (gesamt)" Anti-HBc S
HBs-Antikörper Anti-HBs S

View File

@ -2,6 +2,9 @@
# ============== ====================
# WICHTIG: Nur direkt austauschbare Einheiten verwenden,
# weil (bislang) keine Umrechnung der Werte vorgesehen ist!
"ml/min/ 1,73qm" "ml/min/1,73 m²"
"ml/min /1,73qm" "ml/min/1,73 m²"
ng/ml µg/l
mmol/l mM
n*1000/µl /nl
n*10E6/µl /fl
Bak/µl /µl

View File

@ -0,0 +1,208 @@
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:clr="http://schemas.microsoft.com/soap/encoding/clr/1.0" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<a1:Settings id="ref-1" xmlns:a1="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Uid xsi:type="a2:Guid" xmlns:a2="http://schemas.microsoft.com/clr/ns/System">
<_a>-1732917544</_a>
<_b>21822</_b>
<_c>16721</_c>
<_d>134</_d>
<_e>250</_e>
<_f>231</_f>
<_g>106</_g>
<_h>44</_h>
<_i>93</_i>
<_j>252</_j>
<_k>234</_k>
</Uid>
<Name id="ref-3">Station neu</Name>
<ReferenceStyle xsi:type="a3:ReferenceStyle" xmlns:a3="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Formatter/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">IfSpecialOrAbnormal</ReferenceStyle>
<ElementsCount>4</ElementsCount>
<Element0Type href="#ref-4"/>
<Element0Object href="#ref-5"/>
<Element1Type href="#ref-6"/>
<Element1Object href="#ref-7"/>
<Element2Type href="#ref-8"/>
<Element2Object href="#ref-9"/>
<Element3Type href="#ref-10"/>
<Element3Object href="#ref-11"/>
</a1:Settings>
<a2:UnitySerializationHolder id="ref-4" xmlns:a2="http://schemas.microsoft.com/clr/ns/System">
<Data id="ref-12">zaaReloaded2.Controller.Elements.TwoColumns</Data>
<UnityType>4</UnityType>
<AssemblyName id="ref-13">zaaReloaded2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6ec8d075a1ab1383</AssemblyName>
</a2:UnitySerializationHolder>
<a4:TwoColumns id="ref-5" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<ChildrenCount>0</ChildrenCount>
</a4:TwoColumns>
<a2:UnitySerializationHolder id="ref-6" xmlns:a2="http://schemas.microsoft.com/clr/ns/System">
<Data id="ref-14">zaaReloaded2.Controller.Elements.SelectFirstDay</Data>
<UnityType>4</UnityType>
<AssemblyName href="#ref-13"/>
</a2:UnitySerializationHolder>
<a4:SelectFirstDay id="ref-7" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<ChildrenCount>17</ChildrenCount>
<Child0Type href="#ref-15"/>
<Child0Object href="#ref-16"/>
<Child1Type href="#ref-15"/>
<Child1Object href="#ref-17"/>
<Child2Type href="#ref-15"/>
<Child2Object href="#ref-18"/>
<Child3Type href="#ref-15"/>
<Child3Object href="#ref-19"/>
<Child4Type href="#ref-15"/>
<Child4Object href="#ref-20"/>
<Child5Type href="#ref-15"/>
<Child5Object href="#ref-21"/>
<Child6Type href="#ref-15"/>
<Child6Object href="#ref-22"/>
<Child7Type href="#ref-15"/>
<Child7Object href="#ref-23"/>
<Child8Type href="#ref-15"/>
<Child8Object href="#ref-24"/>
<Child9Type href="#ref-15"/>
<Child9Object href="#ref-25"/>
<Child10Type href="#ref-15"/>
<Child10Object href="#ref-26"/>
<Child11Type href="#ref-15"/>
<Child11Object href="#ref-27"/>
<Child12Type href="#ref-15"/>
<Child12Object href="#ref-28"/>
<Child13Type href="#ref-15"/>
<Child13Object href="#ref-29"/>
<Child14Type href="#ref-15"/>
<Child14Object href="#ref-30"/>
<Child15Type href="#ref-15"/>
<Child15Object href="#ref-31"/>
<Child16Type href="#ref-15"/>
<Child16Object href="#ref-32"/>
</a4:SelectFirstDay>
<a2:UnitySerializationHolder id="ref-8" xmlns:a2="http://schemas.microsoft.com/clr/ns/System">
<Data id="ref-33">zaaReloaded2.Controller.Elements.NextColumn</Data>
<UnityType>4</UnityType>
<AssemblyName href="#ref-13"/>
</a2:UnitySerializationHolder>
<a4:NextColumn id="ref-9" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<ChildrenCount>0</ChildrenCount>
</a4:NextColumn>
<a2:UnitySerializationHolder id="ref-10" xmlns:a2="http://schemas.microsoft.com/clr/ns/System">
<Data id="ref-34">zaaReloaded2.Controller.Elements.SelectLastDay</Data>
<UnityType>4</UnityType>
<AssemblyName href="#ref-13"/>
</a2:UnitySerializationHolder>
<a4:SelectLastDay id="ref-11" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<ChildrenCount>17</ChildrenCount>
<Child0Type href="#ref-15"/>
<Child0Object href="#ref-16"/>
<Child1Type href="#ref-15"/>
<Child1Object href="#ref-17"/>
<Child2Type href="#ref-15"/>
<Child2Object href="#ref-18"/>
<Child3Type href="#ref-15"/>
<Child3Object href="#ref-19"/>
<Child4Type href="#ref-15"/>
<Child4Object href="#ref-20"/>
<Child5Type href="#ref-15"/>
<Child5Object href="#ref-21"/>
<Child6Type href="#ref-15"/>
<Child6Object href="#ref-22"/>
<Child7Type href="#ref-15"/>
<Child7Object href="#ref-23"/>
<Child8Type href="#ref-15"/>
<Child8Object href="#ref-24"/>
<Child9Type href="#ref-15"/>
<Child9Object href="#ref-25"/>
<Child10Type href="#ref-15"/>
<Child10Object href="#ref-26"/>
<Child11Type href="#ref-15"/>
<Child11Object href="#ref-27"/>
<Child12Type href="#ref-15"/>
<Child12Object href="#ref-28"/>
<Child13Type href="#ref-15"/>
<Child13Object href="#ref-29"/>
<Child14Type href="#ref-15"/>
<Child14Object href="#ref-30"/>
<Child15Type href="#ref-15"/>
<Child15Object href="#ref-31"/>
<Child16Type href="#ref-15"/>
<Child16Object href="#ref-32"/>
</a4:SelectLastDay>
<a2:UnitySerializationHolder id="ref-15" xmlns:a2="http://schemas.microsoft.com/clr/ns/System">
<Data id="ref-35">zaaReloaded2.Controller.Elements.Items</Data>
<UnityType>4</UnityType>
<AssemblyName href="#ref-13"/>
</a2:UnitySerializationHolder>
<a4:Items id="ref-16" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-36">Klinische Chemie: Na, K, Cl, Mg, Ca, P, CaxP, Alb, Prot, Haptoglobin, LDH, Glukose, Harnsäure</Content>
</a4:Items>
<a4:Items id="ref-17" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-37">Entzündung/Immunsystem: CRP, Pct, C3c, C4, Anti-DNAse B, ASL</Content>
</a4:Items>
<a4:Items id="ref-18" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-38">Kardiale Marker: CK, CKMB, Trop, NTproBNP</Content>
</a4:Items>
<a4:Items id="ref-19" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-39">Niere: Krea, Hst, eGFR (CKD-EPI)</Content>
</a4:Items>
<a4:Items id="ref-20" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-40">Sammelurin: SU-Proteinurie, SU-Alb, SU-CrCl, SU-HstCl, SU-GFR, SU-Natrium, SU-Zeit, SU-Volumen</Content>
</a4:Items>
<a4:Items id="ref-21" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-41">Spot-Urin: U-*</Content>
</a4:Items>
<a4:Items id="ref-22" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-42">Leber: GOT, GGT, GPT, AP, Bilirubin, CHE</Content>
</a4:Items>
<a4:Items id="ref-23" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-43">Blutfette: TG, Chol, LDL, HDL, Lp(a)</Content>
</a4:Items>
<a4:Items id="ref-24" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-44">Hämatologie: Hb, Hkt, Reti, Leu, Thr, MCV, HbA1c, Retikulozyten, Fragmentozyten</Content>
</a4:Items>
<a4:Items id="ref-25" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-45">Gerinnung: Quick, INR, PTT, Fibrinogen, ATIII, Anti-Xa</Content>
</a4:Items>
<a4:Items id="ref-26" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-46">Diff.-BB: Ery, Neu, Lym, Mon, Baso, Eos</Content>
</a4:Items>
<a4:Items id="ref-27" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-47">Hormone: iPTH, TSH</Content>
</a4:Items>
<a4:Items id="ref-28" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-48">Medikamente: TAC, CSA, SIR, Vancomycin, Gentamicin, Tobramicin</Content>
</a4:Items>
<a4:Items id="ref-29" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-49">Eisenhaushalt: Eisen, Ferritin, Transferrin, Tf.-Sätt.</Content>
</a4:Items>
<a4:Items id="ref-30" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-50">BGA: pH, Std.-Bic., BE</Content>
</a4:Items>
<a4:Items id="ref-31" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-51">Hepatitis-Serologie: Anti-HBs, Anti-HBc</Content>
</a4:Items>
<a4:Items id="ref-32" xmlns:a4="http://schemas.microsoft.com/clr/nsassem/zaaReloaded2.Controller.Elements/zaaReloaded2%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D6ec8d075a1ab1383">
<Version>1</Version>
<Content id="ref-52">Weitere Werte: *</Content>
</a4:Items>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

75
zaaReloaded2/Demo/Demo.cs Executable file
View File

@ -0,0 +1,75 @@
/* Demo.cs
* part of zaaReloaded2
*
* Copyright 2015 Daniel Kraus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Microsoft.Office.Interop.Word;
namespace zaaReloaded2.Demo
{
/// <summary>
/// Static class that serves to load an embedded Word document
/// into a temporary file and open that temporary file in Word.
/// </summary>
static class Demo
{
#region Public methods
/// <summary>
/// Opens a demo document. The document's Saved property is set to
/// false so that a user who wants to save changes will be prompted
/// for a file name.
/// </summary>
public static void OpenDemoDocument()
{
string tempFile = CreateTempFileFromResource();
Document demoDoc = Globals.ThisAddIn.Application.Documents
.Add(Template: tempFile);
File.Delete(tempFile);
}
#endregion
#region Private methods
/// <summary>
/// Copies the built-in demo file from a resource stream to a
/// temporary file and returns the path to that file.
/// </summary>
/// <returns>Path to the newly created temporary file.</returns>
static string CreateTempFileFromResource()
{
string resourceName = "zaaReloaded2.Demo.Demo.docx";
Stream resourceStream = typeof(Demo).Assembly
.GetManifestResourceStream(resourceName);
if (resourceStream == null)
{
throw new IOException("Unable to open stream " + resourceName);
}
string fileName = Path.GetTempFileName() + ".docx";
Stream tempStream = File.Create(fileName);
resourceStream.CopyTo(tempStream);
tempStream.Close();
return fileName;
}
#endregion
}
}

BIN
zaaReloaded2/Demo/Demo.docx Executable file

Binary file not shown.

View File

@ -25,7 +25,8 @@
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
xmlns:settings="clr-namespace:Bovender.Mvvm.Views.Settings;assembly=Bovender"
xmlns:converter="clr-namespace:Bovender.Mvvm.Converters;assembly=Bovender"
SizeToContent="Height" Width="700"
SizeToContent="Height" Width="700" ShowInTaskbar="False"
WindowStyle="ToolWindow" Topmost="True" ResizeMode="CanResizeWithGrip"
x:Name="exceptionDetailView"
Title="Technische Fehlerdetails"
settings:WindowState.Save="True"

View File

@ -27,6 +27,7 @@
xmlns:actions="clr-namespace:Bovender.Mvvm.Actions;assembly=Bovender"
xmlns:settings="clr-namespace:Bovender.Mvvm.Views.Settings;assembly=Bovender"
SizeToContent="WidthAndHeight" ResizeMode="CanResizeWithGrip"
WindowStyle="ToolWindow" ShowInTaskbar="False" Topmost="True"
WindowStartupLocation="CenterScreen"
Title="zaaReloaded2: Fehler!"
settings:WindowState.Save="True"

View File

@ -32,8 +32,7 @@ namespace zaaReloaded2.ExceptionHandler
{
get
{
// TODO: Get Word version
return "n/a";
return Globals.ThisAddIn.Application.Build;
}
}
@ -84,7 +83,7 @@ namespace zaaReloaded2.ExceptionHandler
protected override string DevPath()
{
return @"x:\Code\zaaReloaded2\";
return @"x:\Code\zaaReloaded2\zaaReloaded2\";
}
#endregion

View File

@ -20,6 +20,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Interop.Word;
using System.Text.RegularExpressions;
namespace zaaReloaded2.Formatter
{
@ -32,6 +33,7 @@ namespace zaaReloaded2.Formatter
{
FixWords(document);
FormatDiagnoses(selection);
FixSalutation(document);
}
static void FormatDiagnoses(Selection selection)
@ -59,6 +61,7 @@ namespace zaaReloaded2.Formatter
static void FixWords(Document document)
{
Find find = document.Range().Find;
find.Execute2007(FindText: "Körperlicher Untersuchungsbefund", ReplaceWith: "Körperl. Untersuchung", Replace: WdReplace.wdReplaceAll);
find.Execute2007(FindText: "Dr.D.Kraus", ReplaceWith: "Dr. D. Kraus", Replace: WdReplace.wdReplaceAll);
find.Execute2007(FindText: "Z. n.", ReplaceWith: "Z.n.", Replace: WdReplace.wdReplaceAll);
find.Execute2007(FindText: "Zust. n.", ReplaceWith: "Z.n.", Replace: WdReplace.wdReplaceAll);
@ -66,6 +69,23 @@ namespace zaaReloaded2.Formatter
find.Execute2007(FindText: "Assistent der Klinik", ReplaceWith: "Internist/Nephrologe", Replace: WdReplace.wdReplaceAll);
find.Execute2007(FindText: "Professor Dr.", ReplaceWith: "Prof. Dr.", Replace: WdReplace.wdReplaceAll);
find.Execute2007(FindText: "mmHg", ReplaceWith: "mm Hg", Replace: WdReplace.wdReplaceAll);
find.Execute2007(FindText: "RR ", ReplaceWith: "", Replace: WdReplace.wdReplaceAll);
find.Execute2007(FindText: "HF ", ReplaceWith: "", Replace: WdReplace.wdReplaceAll);
find.Execute2007(FindText: "TAC-Spiegel", ReplaceWith: "Tacrolimus-Talspiegel", Replace: WdReplace.wdReplaceAll);
find.Execute2007(FindText: "4-7", ReplaceWith: "4 bis 7", Replace: WdReplace.wdReplaceAll);
find.Execute2007(FindText: "5-8", ReplaceWith: "5 bis 8", Replace: WdReplace.wdReplaceAll);
find.Execute2007(FindText: "8-10", ReplaceWith: "8 bis 10", Replace: WdReplace.wdReplaceAll);
}
static void FixSalutation(Document document)
{
Regex sal = new Regex(@"^Mit.*?Grüßen");
Regex med = new Regex(@"^((Häusl|Empf).*?Medikat)|Therapieempf");
foreach (Paragraph p in document.Paragraphs)
{
if (sal.IsMatch(p.Range.Text)) p.Range.Text = "Mit freundlichen, kollegialen Grüßen,";
if (med.IsMatch(p.Range.Text)) p.Range.Text = "Aktuelle Medikation:";
}
}
}
}

View File

@ -53,6 +53,12 @@ namespace zaaReloaded2.Formatter
/// </summary>
public bool HasBufferedText { get { return _buffer.Length > 0; } }
/// <summary>
/// Gets or sets the desired paragraph style when flushing into
/// a Document.
/// </summary>
public string ParagraphStyle { get; set; }
#endregion
#region Constructors
@ -113,7 +119,14 @@ namespace zaaReloaded2.Formatter
if (Document != null)
{
Document.Range().Text = _buffer.ToString();
Selection s = Document.ActiveWindow.Selection;
s.ClearCharacterDirectFormatting();
s.ClearParagraphDirectFormatting();
if (!string.IsNullOrEmpty(ParagraphStyle))
{
s.set_Style(ParagraphStyle);
}
s.Range.Text = _buffer.ToString();
}
if (Parent != null)
{

View File

@ -64,6 +64,12 @@ namespace zaaReloaded2.Formatter
/// </summary>
public Dictionary<DateTime, TimePointFormatter> WorkingTimePoints { get; private set; }
/// <summary>
/// Is true if this Formatter object carries a Laboratory with
/// at least one time point.
/// </summary>
public bool CanRun { get { return Laboratory.TimePoints.Count > 0; } }
#endregion
#region Constructors
@ -113,6 +119,10 @@ namespace zaaReloaded2.Formatter
/// current position of the cursor).</param>
public void Run()
{
if (!CanRun) throw new InvalidOperationException("No laboratory data to format.");
CreateParagraphStyle();
_secondaryBuffer.ParagraphStyle = zaaReloaded2.Properties.Settings.Default.ParagraphStyleName;
int current = 0;
while (current < Settings.Elements.Count)
{
@ -195,7 +205,68 @@ namespace zaaReloaded2.Formatter
/// FormatElementBase children to process.</param>
public void ProcessAllTimePoints(ControlElementBase controlElement)
{
ProcessAllTimePoints(controlElement.FormatElements);
ProcessAllTimePoints(controlElement.Children);
}
/// <summary>
/// Inserts a table with two columns into the document.
/// </summary>
public void InsertTwoColumns()
{
_secondaryBuffer.Flush();
if (Document != null)
{
Range r = Document.ActiveWindow.Selection.Range;
_table = Document.Tables.Add(r, NumRows: 1, NumColumns: 2);
_table.AllowAutoFit = true;
_table.AutoFitBehavior(WdAutoFitBehavior.wdAutoFitWindow);
_table.PreferredWidthType = WdPreferredWidthType.wdPreferredWidthPercent;
_table.PreferredWidth = 100;
_table.Borders.Enable = 0;
}
}
/// <summary>
/// Moves the insertion point to the next column in a layout
/// table.
/// </summary>
public void NextColumn()
{
if (_table == null)
{
throw new InvalidOperationException(
"Kann nicht zur nächsten Spalte wechseln, da bislang keine Tabelle eingefügt wurde.");
}
_secondaryBuffer.Flush();
Document.ActiveWindow.Selection.MoveRight(WdUnits.wdCell);
}
/// <summary>
/// Creates a zaaReloaded2 paragraph style in the document.
/// </summary>
public void CreateParagraphStyle()
{
if (Document != null)
{
Style style;
// Don't see a better way to check for the existence of a particular
// paragraph style than by using a try...catch construction.
try
{
style = Document.Styles[Properties.Settings.Default.ParagraphStyleName];
}
catch
{
style = Document.Styles.Add(Properties.Settings.Default.ParagraphStyleName);
style.Font.Size = 10; // pt
style.Font.Bold = 0;
style.Font.Italic = 0;
style.Font.Underline = 0;
style.ParagraphFormat.LeftIndent = 36; // pt
style.ParagraphFormat.FirstLineIndent = -36; // pt
style.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphJustify;
}
}
}
#endregion
@ -259,7 +330,7 @@ namespace zaaReloaded2.Formatter
throw new ArgumentNullException("workingTimePoints");
WorkingTimePoints = workingTimePoints;
ProcessElements(controlElement.FormatElements);
ProcessElements(controlElement.Children);
if (_primaryBuffer.HasBufferedText)
{
_primaryBuffer.Prepend(
@ -286,6 +357,7 @@ namespace zaaReloaded2.Formatter
Laboratory _laboratory;
DocumentWriter _primaryBuffer;
DocumentWriter _secondaryBuffer;
Table _table;
#endregion
}

View File

@ -48,6 +48,23 @@ namespace zaaReloaded2.Formatter
/// </summary>
public bool HasBeenUsed { get; set; }
/// <summary>
/// Gets or sets a flag that tells the formatter to include or
/// not include the material indicator in the formatted output.
/// Default is true.
/// </summary>
/// <remarks>
/// For example, items that are selected with a wildcard may
/// contain the material info, while expressly chosen items
/// may not.
/// </remarks>
public bool IncludeMaterial { get; set; }
/// <summary>
/// Gets whether the Item is marked as blacklisted in the thesaurus.
/// </summary>
public bool IsBlacklisted { get { return LabItem.IsBlacklisted; } }
#endregion
#region Constructor
@ -58,6 +75,7 @@ namespace zaaReloaded2.Formatter
/// <param name="labItem">LabItem to wrap in this ItemFormatter.</param>
public ItemFormatter(LabItem labItem, ReferenceStyle referenceStyle)
{
IncludeMaterial = true;
LabItem = labItem;
ReferenceStyle = referenceStyle;
}
@ -133,11 +151,13 @@ namespace zaaReloaded2.Formatter
value = LabItem.Value;
}
string name = IncludeMaterial ? LabItem.QualifiedName : LabItem.Name;
// Insert the formatted text into the document.
formatter.Write(
String.Format(
"{0} {1}{2}{3}",
LabItem.QualifiedName,
name,
value,
unit,
reference

View File

@ -26,37 +26,36 @@ namespace zaaReloaded2.Formatter
/// <summary>
/// Describes the style of normal range references.
/// </summary>
[Serializable]
public enum ReferenceStyle
{
/// <summary>
/// Never write normal ranges
/// </summary>
[Description("Referenzbereich nie ausgeben")]
[Description("Niemals")]
Never,
/// <summary>
/// Write normal range if item is marked in dictionary
/// </summary>
[Description("Referenzbereich ausgeben, falls Parameter so markiert ist")]
[Description("Bei speziellen Parametern immer")]
IfSpecialItem,
/// <summary>
/// Write normal range if value is abnormal
/// </summary>
[Description("Referenzbereich ausgeben, falls Wert nicht normal ist")]
[Description("Bei pathologischem Wert")]
IfAbnormal,
/// <summary>
/// Write normal range if item is marked in dictionary, or if value is abnormal
/// </summary>
[Description("Referenzbereich ausgeben, falls Parameter so markiert ist oder falls Wert nicht normal ist")]
[Description("Bei pathologischem Wert oder speziellem Parameter")]
IfSpecialOrAbnormal,
/// <summary>
/// Always write normal range reference
/// </summary>
[Description("Referenzbereich immer ausgeben")]
[Description("Immer")]
Always
}
}

View File

@ -28,6 +28,55 @@ namespace zaaReloaded2.Formatter
/// </summary>
public class TimePointFormatter
{
#region Static methods
/// <summary>
/// Builds a header paragraph from a Date,
/// but only if the Date structure has a value.
/// </summary>
public static string DateHeader(DateTime date)
{
if (date != _nullTimeStamp.Date)
{
return FormatHeader(date.ToShortDateString());
}
else
{
return String.Empty;
}
}
/// <summary>
/// Builds a header paragraph from a DateTime structure,
/// but only if the DateTime structure has a value.
/// </summary>
public static string DateAndTimeHeader(DateTime dateTime)
{
if (dateTime != _nullTimeStamp)
{
return FormatHeader(dateTime.ToString());
}
else
{
return String.Empty;
}
}
#endregion
#region Private static methods
static string FormatHeader(string text)
{
return String.Format("{0}Laborwerte vom {1}:{2}",
Environment.NewLine,
text,
Environment.NewLine
);
}
#endregion
#region Properties
/// <summary>
@ -77,7 +126,7 @@ namespace zaaReloaded2.Formatter
/// <returns></returns>
public string GetDateHeader()
{
return FormatHeader(TimeStamp.ToShortDateString());
return DateHeader(TimeStamp);
}
@ -88,21 +137,14 @@ namespace zaaReloaded2.Formatter
/// <returns></returns>
public string GetDateAndTimeHeader()
{
return FormatHeader(TimeStamp.ToString());
return DateAndTimeHeader(TimeStamp);
}
#endregion
#region Private methods
#region Fields
string FormatHeader(string text)
{
return String.Format("{0}{1}:{2}",
Environment.NewLine,
text,
Environment.NewLine
);
}
static readonly DateTime _nullTimeStamp = new DateTime();
#endregion
}

BIN
zaaReloaded2/Icons/d.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1012 B

BIN
zaaReloaded2/Icons/down.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

BIN
zaaReloaded2/Icons/exit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 365 B

BIN
zaaReloaded2/Icons/gear.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

BIN
zaaReloaded2/Icons/pen.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B

BIN
zaaReloaded2/Icons/plus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 B

BIN
zaaReloaded2/Icons/up.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

View File

@ -30,6 +30,11 @@ namespace zaaReloaded2.Importer
/// </summary>
Laboratory Laboratory { get; set; }
/// <summary>
/// Indicates whether the import was successful.
/// </summary>
bool Success { get; }
/// <summary>
/// Imports laboratory data contained in a string.
/// </summary>

View File

@ -74,7 +74,9 @@ namespace zaaReloaded2.Importer.ZaaImporter
if (parameterDictionary != null)
{
Name = parameterDictionary.GetCanonicalName(OriginalName);
AlwaysPrintLimits = parameterDictionary.GetForceReferenceDisplay(Name);
AlwaysPrintLimits = parameterDictionary.GetForceReferenceDisplay(OriginalName);
IsBlacklisted = parameterDictionary.GetIsBlacklisted(OriginalName);
Material = parameterDictionary.GetMaterial(OriginalName, Material);
}
if (unitDictionary != null)
{
@ -164,10 +166,12 @@ namespace zaaReloaded2.Importer.ZaaImporter
}
/// <summary>
/// Analyses the Lauris name for a material abbreviation.
/// If the parameter does not refer to blood (serum, whole
/// blood, etc.), Lauris appends an abbreviation in parentheses
/// to the parameter name.
/// Parses the original Lauris name for a material abbreviation.
/// This may be misleading in certain cases, e.g. "Sammelmenge (U)"
/// appears to be spot urine ("U"), but is collected urine instead
/// ("SU"). Therefore, in the constructor that takes the thesaurus
/// parameters, the material is looked up in the Parameters thesaurus.
/// ("Sammelmenge (U)" is contained in the Parameters thesaurus.)
/// </summary>
/// <example>
/// Gesamt-Eiweiss (SU), Albumin (SU)/die, Gesamt-Eiweiss (PU)

View File

@ -32,6 +32,19 @@ namespace zaaReloaded2.Importer.ZaaImporter
/// </summary>
public class LaurisParagraph
{
#region Static methods
/// <summary>
/// Investigates a paragraph and determines whether it looks
/// like a Lauris laboratory items paragraph.
/// </summary>
public static bool ResemblesLaurisParagraph(string paragraph)
{
return _expectedFormat.IsMatch(paragraph);
}
#endregion
#region Public properties
/// <summary>
@ -122,7 +135,7 @@ namespace zaaReloaded2.Importer.ZaaImporter
#region Fields
static readonly Regex _expectedFormat = new Regex(@"(?<caption>[^:]+:\s*)?(?<items>[^:]+:\s*[^;]+;)*");
static readonly Regex _expectedFormat = new Regex(@"(?<caption>[^:]+:\s*)?(?<items>[^:]+:\s*[^;]+;)+");
Thesaurus.Parameters _parameterDictionary;
Thesaurus.Units _unitDictionary;

View File

@ -65,11 +65,15 @@ namespace zaaReloaded2.Importer.ZaaImporter
/// <summary>
/// Gets an array of paragraphs in this LaurisText.
/// </summary>
public string[] Paragraphs
public IList<String> Paragraphs
{
[DebuggerStepThrough]
get
{
if (_paragraphs == null)
{
_paragraphs = new List<String>();
}
return _paragraphs;
}
set
@ -83,7 +87,13 @@ namespace zaaReloaded2.Importer.ZaaImporter
/// Is true if the LaurisText has time stamp in the first
/// paragraph and <see cref="LabItem"/>s in the others.
/// </summary>
public bool IsValidTimePoint { get; private set; }
public bool IsValidTimePoint
{
get
{
return Items.Count > 0;
}
}
/// <summary>
/// Gets or sets the original Lauris text for this timepoint.
@ -101,7 +111,7 @@ namespace zaaReloaded2.Importer.ZaaImporter
{
Paragraphs = value.Split(
new string[] { Environment.NewLine },
StringSplitOptions.None);
StringSplitOptions.None).ToList();
}
}
}
@ -128,19 +138,41 @@ namespace zaaReloaded2.Importer.ZaaImporter
{ }
public LaurisTimePoint(
string[] paragraphs,
IList<String> paragraphs,
Parameters parameterDictionary,
Units unitDictionary)
: this(parameterDictionary, unitDictionary)
{
Paragraphs = paragraphs;
}
public LaurisTimePoint(IList<String> paragraphs)
: this(paragraphs, null, null)
{
}
public LaurisTimePoint(
Parameters parameterDictionary,
Units unitDictionary)
: this()
{
_parameterDictionary = parameterDictionary;
_unitDictionary = unitDictionary;
Paragraphs = paragraphs;
}
public LaurisTimePoint(string[] paragraphs)
: this(paragraphs, null, null)
#endregion
#region Public methods
/// <summary>
/// Adds a new paragraph to this time point by parsing
/// the paragraph for laboratory items.
/// </summary>
/// <param name="paragraph">Paragraph to add.</param>
public void AddParagraph(string paragraph)
{
Paragraphs.Add(paragraph);
ParseParagraph(paragraph);
}
#endregion
@ -151,59 +183,43 @@ namespace zaaReloaded2.Importer.ZaaImporter
/// Analyzes each Lauris paragraph in this time point, sets the date
/// and time, and collects LabItem data.
/// </summary>
/// <returns>True if the LaurisText has time stamp in the first paragraphs
/// and contains <see cref="LabItem"/>s in the others.</returns>
bool ParseParagraphs()
void ParseParagraphs()
{
if (Paragraphs.Length > 0)
if (Paragraphs != null)
{
if (!ParseTimeStamp()) return false;
LaurisParagraph lp;
if (IsValidTimePoint)
foreach (string paragraph in Paragraphs)
{
for (int i = 1; i < Paragraphs.Length; i++)
{
lp = new LaurisParagraph(
Paragraphs[i],
_parameterDictionary,
_unitDictionary);
if (lp.IsLaurisParagraph)
{
Items.Merge(lp.Items);
}
}
ParseParagraph(paragraph);
}
IsValidTimePoint = Items.Count > 0;
}
return true;
}
/// <summary>
/// Analyzes the date and time information that is expected to be
/// in the first paragraph.
/// </summary>
/// <returns>True if the LaurisText contains a time stamp in the
/// first paragraph.</returns>
bool ParseTimeStamp()
void ParseParagraph(string paragraph)
{
if (Paragraphs.Length == 0)
throw new InvalidOperationException("The time point has no paragraphs.");
Match m = _timeStampRegex.Match(Paragraphs[0]);
bool success = false;
if (m.Success)
if (_timeStampRegex.IsMatch(paragraph))
{
DateTime dt;
success = DateTime.TryParseExact(
m.Groups["datetime"].Value,
if (DateTime.TryParseExact(
_timeStampRegex.Match(paragraph).Groups["datetime"].Value,
"dd.MM.yyyy HH:mm",
CultureInfo.InvariantCulture,
DateTimeStyles.AllowWhiteSpaces,
out dt);
TimeStamp = dt;
out dt))
{
TimeStamp = dt;
}
}
else
{
LaurisParagraph lp = new LaurisParagraph(
paragraph,
_parameterDictionary,
_unitDictionary);
if (lp.IsLaurisParagraph)
{
Items.Merge(lp.Items);
}
}
IsValidTimePoint = success;
return success;
}
void AddItems(IItemDictionary items)
@ -221,7 +237,7 @@ namespace zaaReloaded2.Importer.ZaaImporter
/// </summary>
static readonly Regex _timeStampRegex = new Regex(
@"^\s*\(?\s*(?<datetime>\d\d\.\d\d\.\d\d\d\d\s+\d\d:\d\d)");
string[] _paragraphs;
IList<String> _paragraphs;
Parameters _parameterDictionary;
Units _unitDictionary;

View File

@ -52,6 +52,14 @@ namespace zaaReloaded2.Importer.ZaaImporter
}
}
public bool Success
{
get
{
return Laboratory.TimePoints.Count > 0;
}
}
/// <summary>
/// Splits the <paramref name="text"/> into individual time points
/// and creates <see cref="LaurisTimePoint"/> objects from them.
@ -59,45 +67,45 @@ namespace zaaReloaded2.Importer.ZaaImporter
/// <param name="text">ZAA-formatted Lauris output to import.</param>
public void Import(string text)
{
// Split the text into parargraphs. This implementation relies on the fact
// that the order or splitting strings in C#'s String.Split() method is
// important; see http://stackoverflow.com/a/8664639/270712
string[] paragraphs = text.Split(
new string[] { Environment.NewLine },
new string[] { "\r\n", "\n\r", "\r", "\n" },
StringSplitOptions.RemoveEmptyEntries);
int i = 0;
int start = 0;
int numParagraphs = paragraphs.Length;
LaurisTimePoint timePoint = null;
while (i < numParagraphs)
foreach (string paragraph in paragraphs)
{
// Search for the next occurrence of a time stamp line
while (i < numParagraphs
&& !LaurisTimePoint.IsTimeStampLine(paragraphs[i]))
// If the current paragraph looks like a Lauris time stamp,
// create a new time point.
if (LaurisTimePoint.IsTimeStampLine(paragraph))
{
i++;
}
// TODO: Find an alternative to returning in the middle of the method.
if (i >= numParagraphs) return;
if (LaurisTimePoint.IsTimeStampLine(paragraphs[i]))
{
// Remember the time stamp line's index
start = i;
// Seek the next time stamp line
while (i + 1 < numParagraphs
&& !LaurisTimePoint.IsTimeStampLine(paragraphs[i + 1]))
timePoint = new LaurisTimePoint(paragraph, _parameters, _units);
// Add the time point to the laboratory only if none
// with the same time stamp exists yet.
TimePoint existing = null;
if (Laboratory.TryGetTimePoint(timePoint.TimeStamp, ref existing))
{
i++;
timePoint = existing as LaurisTimePoint;
}
else
{
Laboratory.AddTimePoint(timePoint);
}
}
Laboratory.AddTimePoint(
new LaurisTimePoint(
paragraphs.Slice(start, i - start + 1),
_parameters,
_units
)
);
// If the current paragraph looks like a paragraph with
// laboratory items, add it to the current time point;
// if no time point exists yet, create one.
else if (LaurisParagraph.ResemblesLaurisParagraph(paragraph))
{
if (timePoint == null)
{
timePoint = new LaurisTimePoint(_parameters, _units);
Laboratory.AddTimePoint(timePoint);
}
timePoint.AddParagraph(paragraph);
}
}
}

View File

@ -205,6 +205,12 @@ namespace zaaReloaded2.LabModel
public Material Material { get; protected set; }
/// <summary>
/// Gets whether the LabItem is marked as blacklisted
/// in the thesaurus.
/// </summary>
public bool IsBlacklisted { get; protected set; }
#endregion
#region Constructors

View File

@ -66,6 +66,30 @@ namespace zaaReloaded2.LabModel
}
}
/// <summary>
/// Checks if the Laboratory contains a TimePoint with an identical
/// time stamp to the one being queried.
/// </summary>
/// <param name="timePoint">TimePoint whose time stamp to look for.</param>
/// <returns>True if a TimePoint with identical time stamp exists.</returns>
public bool HasTimePoint(TimePoint timePoint)
{
return TimePoints.ContainsKey(timePoint.TimeStamp);
}
/// <summary>
/// Looks for a TimePoint with a given timeStamp and returns
/// it as a reference parameter.
/// </summary>
/// <param name="timeStamp">Time stamp to look for.</param>
/// <param name="timePoint">Resulting TimePoint (if any).</param>
/// <returns>True if TimePoints contains a TimePoint with
/// the requested timeStamp.</returns>
public bool TryGetTimePoint(DateTime timeStamp, ref TimePoint timePoint)
{
return TimePoints.TryGetValue(timeStamp, out timePoint);
}
#endregion
}
}

View File

@ -9,9 +9,9 @@ using System.Security;
[assembly: AssemblyTitle("zaaReloaded2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyCompany("Daniel Kraus")]
[assembly: AssemblyProduct("zaaReloaded2")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
[assembly: AssemblyCopyright("Copyright © Daniel Kraus 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010061ecc0718277dee13e7dae2dad33787a981c9883ba80a659bebbdbec76563e201a7a3a6a5852e01bb5eb328d24d5889244b4626da9af9f93db663565441a3120e3985789e6f2a39289f4eed063725b84152cbef472d9dd2f7495f51dad6c91f4dc6fb7c72cb6bd9381335ac9878ec0a6369e880f35b8eca3063e16468d7704eb")]

View File

@ -25,9 +25,10 @@ namespace zaaReloaded2.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public global::zaaReloaded2.Controller.SettingsRepository SettingsRepository {
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string SettingsRepository {
get {
return ((global::zaaReloaded2.Controller.SettingsRepository)(this["SettingsRepository"]));
return ((string)(this["SettingsRepository"]));
}
set {
this["SettingsRepository"] = value;
@ -233,5 +234,74 @@ namespace zaaReloaded2.Properties {
return ((string)(this["DefaultItemsDrugs"]));
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("00000000-0000-0000-0000-000000000000")]
public global::System.Guid LastSettings {
get {
return ((global::System.Guid)(this["LastSettings"]));
}
set {
this["LastSettings"] = value;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("zaaReloaded2-Laborwerte")]
public string ParagraphStyleName {
get {
return ((string)(this["ParagraphStyleName"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("IfSpecialOrAbnormal")]
public global::zaaReloaded2.Formatter.ReferenceStyle ReferenceStyle {
get {
return ((global::zaaReloaded2.Formatter.ReferenceStyle)(this["ReferenceStyle"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Ausgabe-Elemente")]
public string FormatElementLabel {
get {
return ((string)(this["FormatElementLabel"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Steuerungs-Elemente")]
public string ControlElementLabel {
get {
return ((string)(this["ControlElementLabel"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("1")]
public int SerializationVersion {
get {
return ((int)(this["SerializationVersion"]));
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string ImportExportPath {
get {
return ((string)(this["ImportExportPath"]));
}
set {
this["ImportExportPath"] = value;
}
}
}
}

View File

@ -2,7 +2,7 @@
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="zaaReloaded2.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="SettingsRepository" Type="zaaReloaded2.Controller.SettingsRepository" Scope="User">
<Setting Name="SettingsRepository" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="AddinName" Type="System.String" Scope="Application">
@ -71,5 +71,26 @@
<Setting Name="DefaultItemsDrugs" Type="System.String" Scope="Application">
<Value Profile="(Default)">Medikamente: TAC, CSA, SIR, Vancomycin, Gentamicin, Tobramicin</Value>
</Setting>
<Setting Name="LastSettings" Type="System.Guid" Scope="User">
<Value Profile="(Default)">00000000-0000-0000-0000-000000000000</Value>
</Setting>
<Setting Name="ParagraphStyleName" Type="System.String" Scope="Application">
<Value Profile="(Default)">zaaReloaded2-Laborwerte</Value>
</Setting>
<Setting Name="ReferenceStyle" Type="zaaReloaded2.Formatter.ReferenceStyle" Scope="Application">
<Value Profile="(Default)">IfSpecialOrAbnormal</Value>
</Setting>
<Setting Name="FormatElementLabel" Type="System.String" Scope="Application">
<Value Profile="(Default)">Ausgabe-Elemente</Value>
</Setting>
<Setting Name="ControlElementLabel" Type="System.String" Scope="Application">
<Value Profile="(Default)">Steuerungs-Elemente</Value>
</Setting>
<Setting Name="SerializationVersion" Type="System.Int32" Scope="Application">
<Value Profile="(Default)">1</Value>
</Setting>
<Setting Name="ImportExportPath" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

View File

@ -26,6 +26,11 @@ using System.Windows;
using System.Drawing;
using System.Windows.Resources;
using Office = Microsoft.Office.Core;
using zaaReloaded2.Views;
using zaaReloaded2.ViewModels;
using zaaReloaded2.Importer.ZaaImporter;
using zaaReloaded2.Formatter;
using zaaReloaded2.Controller;
// TODO: Follow these steps to enable the Ribbon (XML) item:
@ -51,12 +56,14 @@ namespace zaaReloaded2
[ComVisible(true)]
public class Ribbon : Office.IRibbonExtensibility
{
private Office.IRibbonUI ribbon;
#region Constructor
public Ribbon()
{
}
#endregion
#region IRibbonExtensibility Members
public string GetCustomUI(string ribbonID)
@ -71,7 +78,8 @@ namespace zaaReloaded2
public void Ribbon_Load(Office.IRibbonUI ribbonUI)
{
this.ribbon = ribbonUI;
_ribbon = ribbonUI;
Globals.ThisAddIn.Application.WindowSelectionChange += Application_WindowSelectionChange;
}
/// <summary>
@ -86,6 +94,12 @@ namespace zaaReloaded2
{
switch (control.Id)
{
case "zrlFormat":
DoFormat();
break;
case "zrlSettings":
DoChooseSettings();
break;
case "zrlAbout":
ViewModels.AboutViewModel vm = new ViewModels.AboutViewModel();
vm.InjectInto<Views.AboutView>().ShowDialog();
@ -95,6 +109,9 @@ namespace zaaReloaded2
Globals.ThisAddIn.Application.ActiveDocument,
Globals.ThisAddIn.Application.Selection);
break;
case "zrlDemo":
Demo.Demo.OpenDemoDocument();
break;
default:
throw new InvalidOperationException("No operation defined for " + control.Id);
}
@ -135,6 +152,64 @@ namespace zaaReloaded2
}
}
public bool CanFormat(Office.IRibbonControl control)
{
return Globals.ThisAddIn.Application.Selection.Paragraphs.Count > 0;
}
#endregion
#region Private methods
void DoFormat()
{
if (CanFormat(null))
{
SettingsRepository repository = SettingsRepository.Load();
Guid lastSettingsUid = Properties.Settings.Default.LastSettings;
Settings lastSettings = repository.FindByGuid(lastSettingsUid);
if (lastSettings != null)
{
DoFormat(lastSettings);
}
else
{
DoChooseSettings();
}
}
}
void DoFormat(Settings settings)
{
ZaaImporter importer = new ZaaImporter();
importer.Import(Globals.ThisAddIn.Application.Selection.Text);
Formatter.Formatter formatter =new Formatter.Formatter(
Globals.ThisAddIn.Application.ActiveDocument);
formatter.Settings = settings;
formatter.Laboratory = importer.Laboratory;
formatter.Run();
}
void DoChooseSettings()
{
SettingsRepository repository = SettingsRepository.Load();
SettingsRepositoryViewModel vm = new SettingsRepositoryViewModel(repository);
vm.UseSettingsMessage.Sent += (sender, args) =>
{
SettingsViewModel settingsVM = args.Content.ViewModel as SettingsViewModel;
Settings settings = settingsVM.RevealModelObject() as Settings;
DoFormat(settings);
Properties.Settings.Default.LastSettings = settings.Uid;
Properties.Settings.Default.Save();
};
vm.InjectInto<SettingsRepositoryView>().ShowDialog();
}
public void Application_WindowSelectionChange(Microsoft.Office.Interop.Word.Selection Sel)
{
_ribbon.Invalidate();
}
#endregion
#region Helpers
@ -160,5 +235,11 @@ namespace zaaReloaded2
}
#endregion
#region Fields
private Office.IRibbonUI _ribbon;
#endregion
}
}

View File

@ -25,13 +25,17 @@
<tab id="zaaReloaded2" label="zaaReloaded2">
<group id="zrlFormatGroup" label="Formatieren">
<button id="zrlFormat" label="Formatieren" image="f.png" onAction="Ribbon_Click" size="large"
supertip="Formatiert den ausgewählten Bereich mit dem zuletzt verwendeten Stil." />
<button id="zrlChooseFormat" label="Stilauswahl" image="fff.png" onAction="Ribbon_Click" size="large"
supertip="Formatiert den ausgewählten Bereich mit dem zuletzt verwendeten Stil."
getEnabled="CanFormat" />
<button id="zrlSettings" label="Stilauswahl" image="fff.png" onAction="Ribbon_Click" size="large"
supertip="Zeigt eine Liste vorhandener Stile an. Stile können bearbeitet, hinzugefügt, gelöscht werden." />
<button id="zrlDaniel" label="Daniels Spezial" image="dk.png" onAction="Ribbon_Click" size="large"
getVisible="Daniel_GetVisible"/>
</group>
<group id="zrlInfoGroup" label="Info">
<button id="zrlDemo" label="Demo" image="d.png" onAction="Ribbon_Click" size="large"
screentip="Demo-Dokument öffnen"
supertip="Öffnet ein eingebautes Demo-Dokument, das zum Ausprobieren verwendet werden kann." />
<button id="zrlAbout" label="Über..." image="i.png" onAction="Ribbon_Click" size="large"
screentip="Über zaaReloaded"
supertip="Zeigt Informationen über das Add-in an." />

View File

@ -49,6 +49,13 @@
<Setter Property="Control.ToolTip" Value="{Binding Path=ToolTip, Mode=OneWay}" />
<Setter Property="IsEnabled" Value="{Binding Path=IsEnabled, Mode=OneWay}" />
</Style>
<Style TargetType="Image">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.3" />
</Trigger>
</Style.Triggers>
</Style>
<conv:EnumBooleanConverter x:Key="enumBoolConv" />
<conv:VisibilityBooleanConverter x:Key="visBoolConv" />
<conv:BooleanNegationConverter x:Key="boolNegConv" />

View File

@ -1,114 +0,0 @@
# LAURIS-NAME "KANONISCHER NAME" MATERIAL "IMMER REFERENZBEREICH"
# =========== ================== ======== =======================
"Übergangsepithelien (U)" Übergangsep. U
"a1-Microglobulin (SU)" a1-Microglobulin SU
"a1-Microglobulin (SU)/die" a1-Microglobulin SU
"aktuelles Bicarbonat" Bic BGA
"Albumin (PU)" Alb U
"Albumin (SU)" Alb SU
"Albumin (SU)/die" Alb SU
Albumin Alb S
Albumin/Creatinin (PU)" ACR U
"Alk. Phosphatase" AP S
Amylase Amylase S
anorg. Phosphat" Phosphat S
Bakterien (U)" Bakt U
Basenabweichung BE BGA
Basophile Baso E
Bilirubin (U)" Bilirubin U
C-reaktives Protein" CRP S
Calcium (SU)" Ca SU
Calcium (SU)/die" Ca SU
Calcium Ca S
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-Clearance (SU)/min" CrCl SU
Cyclosporin-A vor Gabe" "CsA (C0)" S X
Cystatin C (N Latex)" "Cystatin C" S X
Eisen Fe S
Eosinophile Eos E
Erythrozyten (U)" Ery U
Erythrozyten Ery E
Ferritin Ferr S
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
glomeruläre Filtrationsrate" GFR SU
glomerul. Filtrationsr. (MDRD)" "eGFR (MDRD)" S
glomerul. Filtrationsr. CKD-EP" "eGFR (CKD-EPI)" S
Glucose (U)" Glukose U
Glucose Glukose S
GOT (ASAT)" GOT S
GPT (ALAT)" GPT S
Hämatokrit Hkt E
Hämoglobin Hb E
Haptoglobin Haptoglobin S X
Harnsäure Harnsäure S
Harnstoff (SU)" Hst SU
Harnstoff (SU)/die" Hst/Tag SU
Harnstoff" Hst S
Harnstoff-Clearance (SU)/min" HstCl SU
HbA1c (NGSP)" HbA1c E
HDL - Cholesterin" HDL S
hyaline Zylinder (U)" "hyal. Zyl." U
Kalium (SU)" K U
Kalium (SU)/die" K SU
Kalium K S
Ketonkörper (U)" KK U
Lactat Dehydrogenase" LDH S
LDL - Cholesterin" LDL S
Leukozyten (U)" Leu U
Leukozyten Leu E
Lymphozyten Lym E
MCH (HbE) MCH E
MCHC MCHC E
MCV MCV E
Mittleres Plättchenvolumen MPV E
Monozyten Mon E
Natrium (SU)" Na SU
Natrium (SU)/die" Na SU
Natrium Na S
Neutrophile Neu E
Nitrit (U)" Nitrit U
NT-proBNP NT-proBNP S
PCO2 (art.)" pCO2 BGA
pH (U)" pH U
pH" pH BGA
Plattenepithelien (U)" Plattenep U
PO2 (art.)" pO2 BGA
Protein (U)" Protein U
Sammelmenge (U)" Volumen SU
Sammelzeit (U)" Zeit SU
Sauerstoffsättigung (art.)" SO2 BGA
Sirolimus SIR S
spezifisches Gewicht (U)" "spez. Gew." U
Standard Bicarbonat" "Std.-Bic." BGA
Tacrolimus (FK506)" TAC S
Thrombozyten Thr E
Transferrin Transferrin S
Transferrinsättigung" Tf.-Sätt. S
Triglyceride" TG S
Troponin T (high sensitive)" hsTnT S
Unreife Granulozyten" Gran E
Urobilinogen (U)" Urobilinogen U
Niedermol. Heparin (Anti-Xa)" Anti-Xa Z
Thromboplastinzeit n. Quick" Quick Z
PTT aPTT Z
Ratio int. norm." INR Z
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
TSH TSH S
HAPTOGLOBIN Haptoglobin S
FRAGMENTOZYTEN Fragmentozyten E

View File

@ -69,16 +69,23 @@ namespace zaaReloaded2.Thesaurus
/// <param name="laurisName">Lauris item name to look up.</param>
/// <returns><see cref="zaaReloaded2.LabModel.Material"/> enum; if no material is
/// found in the dictionary, the default material "S" (serum) is returned.</returns>
public Material GetMaterial(string laurisName)
public Material GetMaterial(string laurisName, Material def)
{
string textValue = LookUpValue(laurisName, 2);
try
if (String.IsNullOrEmpty(textValue))
{
return MaterialFactory.FromAbbreviation(textValue);
return def;
}
catch
else
{
return Material.B;
try
{
return MaterialFactory.FromAbbreviation(textValue);
}
catch
{
return Material.B;
}
}
}
@ -95,6 +102,18 @@ namespace zaaReloaded2.Thesaurus
return LookUpValue(laurisName, 3, false);
}
/// <summary>
/// Checks whether an item is marked as blacklisted in the
/// thesaurus.
/// </summary>
/// <param name="laurisName">Laboratory item to lok up;
/// this must be an original Lauris string.</param>
/// <returns>True if the item is marked as blacklisted,
/// false if not. Default is false.</returns>
public bool GetIsBlacklisted(string laurisName)
{
return LookUpValue(laurisName, 4, false);
}
#endregion
#region Overrides
@ -105,7 +124,7 @@ namespace zaaReloaded2.Thesaurus
protected override System.IO.Stream GetDefaultStream()
{
return Assembly.GetExecutingAssembly().GetManifestResourceStream(
"zaaReloaded2.Thesaurus.Defaults.parameters.txt");
"zaaReloaded2.Defaults.parameters.txt");
}
/// <summary>
@ -118,6 +137,5 @@ namespace zaaReloaded2.Thesaurus
}
#endregion
}
}

View File

@ -242,7 +242,7 @@ namespace zaaReloaded2.Thesaurus
#region Fields
private static readonly Regex _dashes = new Regex("-+");
private static readonly Regex _dashes = new Regex("^-+$");
#endregion
}

View File

@ -72,7 +72,7 @@ namespace zaaReloaded2.Thesaurus
protected override System.IO.Stream GetDefaultStream()
{
return Assembly.GetExecutingAssembly().GetManifestResourceStream(
"zaaReloaded2.Thesaurus.Defaults.units.txt");
"zaaReloaded2.Defaults.units.txt");
}
/// <summary>

View File

@ -119,6 +119,7 @@ namespace zaaReloaded2
ExceptionViewModel vm = new ExceptionViewModel(e.Exception);
vm.InjectInto<ExceptionView>().ShowDialog();
}
#endregion
#region Private fields

View File

@ -1,2 +1,2 @@
2.0.0-alpha.3
2.0.0.3
2.0.0-beta.1
2.0.0.6

View File

@ -0,0 +1,46 @@
/* CategoryViewModel.cs
* part of zaaReloaded2
*
* Copyright 2015 Daniel Kraus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Bovender.Mvvm.ViewModels;
namespace zaaReloaded2.ViewModels
{
/// <summary>
/// A simple view model that can be used to categorize items
/// in a tree view. It has a custom DisplayString and holds
/// a collection of child view model items.
/// </summary>
class CategoryViewModel : ViewModelBase
{
public IEnumerable<ViewModelBase> Children { get; private set; }
public CategoryViewModel(string name, IEnumerable<ViewModelBase> children)
{
DisplayString = name;
Children = children;
}
public override object RevealModelObject()
{
throw new NotImplementedException();
}
}
}

View File

@ -26,24 +26,106 @@ using System.Collections.ObjectModel;
namespace zaaReloaded2.ViewModels
{
class ControlElementViewModel : ElementViewModel
public class ControlElementViewModel : ElementViewModel
{
#region Properties
public ObservableCollection<ElementViewModel> Elements
/// <summary>
/// Gets a collection of child ElementViewModels.
/// </summary>
public ObservableCollection<ElementViewModel> Elements { get; protected set; }
/// <summary>
/// Gets information whether this control element view model can
/// have child elements;
/// </summary>
public virtual bool CanHaveChildren
{
get { return null; }
get
{
return ((ControlElementBase)Element).CanHaveChildren;
}
}
public override string ToolTip { get { return Element.Label; } }
#endregion
#region Constructors
public ControlElementViewModel() : base() { }
public ControlElementViewModel() : this(null) { }
public ControlElementViewModel(ControlElementBase controlElement)
: base(controlElement)
{ }
{
Elements = new ObservableCollection<ElementViewModel>();
if (controlElement != null)
{
foreach (FormatElementBase childElement in controlElement.Children)
{
FormatElementViewModel childVM = new FormatElementViewModel(childElement);
Elements.Add(childVM);
}
}
}
/// <summary>
/// Creates a new instance by copying the Elements property from another
/// ControlElementViewModel and the Children property from the other
/// view model's model.
/// </summary>
/// <param name="copyFrom">Other ControlElementViewModel to copy
/// from.</param>
public ControlElementViewModel(
ControlElementBase controlElement,
ControlElementViewModel copyFrom)
: this(controlElement)
{
Elements = copyFrom.Elements;
((ControlElementBase)Element).Children = controlElement.Children;
}
#endregion
#region Public methods
public void AddChildElement(FormatElementViewModel viewModel)
{
Elements.Add(viewModel);
viewModel.Parent = this;
ControlElementBase e = Element as ControlElementBase;
e.Children.Add(viewModel.RevealModelObject() as FormatElementBase);
}
public void RemoveChildElement(FormatElementViewModel viewModel)
{
if (!Elements.Contains(viewModel))
{
throw new InvalidOperationException(
"Cannot remove child view model that is not in the collection.");
}
Elements.Remove(viewModel);
((ControlElementBase)Element).Children
.Remove(viewModel.RevealModelObject() as FormatElementBase);
viewModel.Parent = null;
}
#endregion
#region Overrides
public override object Clone()
{
ControlElementViewModel clone = new ControlElementViewModel();
clone.Element = Element;
clone.Elements = new ObservableCollection<ElementViewModel>(
Elements.Select(evm => evm.Clone() as ElementViewModel));
foreach (FormatElementViewModel evm in clone.Elements)
{
evm.Parent = clone;
}
return clone;
}
#endregion
}

Some files were not shown because too many files have changed in this diff Show More