summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/xml/macros/B.2.1.3.xml45
-rw-r--r--server/xml/templates/amd_kontrolunders.xml2
2 files changed, 43 insertions, 4 deletions
diff --git a/server/xml/macros/B.2.1.3.xml b/server/xml/macros/B.2.1.3.xml
index 3459538..fa2871a 100644
--- a/server/xml/macros/B.2.1.3.xml
+++ b/server/xml/macros/B.2.1.3.xml
@@ -31,9 +31,48 @@ ${current_eye_disease}</resume>
formatlanguage="lua"
format=
"
- return os.date('%e. %b %Y', tonumber(getValue('date')))
- .. ' - På ' .. getValue('eye')..' øje er der observeret '
- .. getValue('observeret') .. '. Symptomerne er opstået '
+ days = (os.time() - tonumber(getValue('date'))) / (60 * 60 * 24)
+ num = 0
+ identifier = ''
+ suffix = ''
+
+ if(num == 0 and math.floor(days/7) == 0)
+ then
+ num = days
+ identifier = 'dag'
+ suffix = 'e'
+ end
+
+ if(num == 0 and math.floor(days/31) == 0)
+ then
+ num = days / 7
+ identifier = 'uge'
+ suffix = 'r'
+ end
+
+ if(num == 0 and math.floor(days/365) == 0)
+ then
+ num = days / 31
+ identifier = 'måned'
+ suffix = 'er'
+ end
+
+ if(num == 0)
+ then
+ num = days / 365
+ identifier = 'år'
+ suffix = ''
+ end
+
+ num = math.floor(num * 2) / 2
+ if(num == 1)
+ then
+ suffix = ''
+ end
+
+ return 'På ' .. getValue('eye')..' øje har der været '
+ .. getValue('observeret') .. ' igennem ' .. num .. ' '
+ .. identifier .. suffix .. '. Symptomerne er opstået '
.. getValue('when') .. ' og er efterfølgende '
..getValue('then')
">
diff --git a/server/xml/templates/amd_kontrolunders.xml b/server/xml/templates/amd_kontrolunders.xml
index cadac75..906d66c 100644
--- a/server/xml/templates/amd_kontrolunders.xml
+++ b/server/xml/templates/amd_kontrolunders.xml
@@ -5,7 +5,7 @@
<macro header="Anamnese"/>
<macro name="B.1.1"/>
<macro name="B.1.2" compact="true"/>
- <macro name="B.2.1.2"/>
+ <macro name="B.2.1.3"/>
<!--
<macro name="B.1.3"/>
<macro name="B.2.1.1"/>