feat (generate-file) hopefully resume.html doesnt make any trouble

This commit is contained in:
dpurbosakti
2025-11-27 13:30:45 +07:00
parent 04add70ac5
commit abfbc568b0
4 changed files with 78 additions and 29 deletions
+65 -29
View File
@@ -438,35 +438,55 @@
<table style="page-break-inside: avoid !important;">
<tr>
<td>
<h4 class="section-title" style="margin-top: 3rem;">Obat yang diberikan</h4>
<table class="border-table" style="margin-top: 0.4rem;">
<thead>
<tr>
<th>
Terapi (Farmakologi & Non Farmakologi) Selama Perawatan
</th>
<th>
Terapi (Farmakologi & Non Farmakologi) Waktu Pulang
</th>
</tr>
</thead>
<tbody>
{{ $dataLen := len .Medications }}
{{ if gt $dataLen 0 }}
<!-- If we have data, show all of it -->
{{ range .Medications }}
<tr>
<td>
<h4 class="section-title" style="margin-top: 3rem;">Obat yang diberikan</i></h4>
<table class="border-table" style="margin-top: 0.4rem;">
<tr>
<th>
Terapi (Farmakologi & Non Farmakologi) Selawa Perawatan
</th>
<th>
Terapi (Farmakologi & Non Farmakologi) Selawa Pulang
</th>
</tr>
<tr>
<td>{{ .NIK }}</td>
<td>{{ .NIK }}</td>
</tr>
<tr>
<td>{{ .NIK }}</td>
<td>{{ .NIK }}</td>
</tr>
<tr>
<td>{{ .NIK }}</td>
<td>{{ .NIK }}</td>
</tr>
</table>
</td>
<td>{{ .DuringTreatment }}</td>
<td>{{ .AtDischarge }}</td>
</tr>
{{ end }}
</table>
<!-- If data is less than 2, fill remaining rows -->
{{ if eq $dataLen 1 }}
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
{{ end }}
{{ else }}
<!-- If no data, show 2 empty rows -->
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
{{ end }}
</tbody>
</table>
</td>
</tr>
</table>
@@ -501,7 +521,11 @@
<p class="description-label"><i>Blood Pressure</i></p>
</td>
<td class="data-colon">: </td>
{{ if and .BloodPressure (ne .BloodPressure "0/0") (ne .BloodPressure "") }}
<td>{{ .BloodPressure }} mmHg</td>
{{ else }}
<td></td>
{{ end }}
<td>
</tr>
@@ -512,7 +536,11 @@
</td>
</td>
<td class="data-colon">: </td>
<td>{{ .BodyTemperature }} C</td>
{{ if ne .BodyTemperature 0.0 }}
<td>{{ .BodyTemperature }} C</td>
{{ else }}
<td></td>
{{ end }}
<td>
</tr>
<tr>
@@ -521,7 +549,11 @@
<p class="description-label"><i>Pulse</i></p>
</td>
<td class="data-colon">: </td>
<td>{{ .HeartRate }} x/Menit</td>
{{ if ne .HeartRate 0.0 }}
<td>{{ .HeartRate }} x/Menit</td>
{{ else }}
<td></td>
{{ end }}
</td>
</tr>
</table>
@@ -535,7 +567,11 @@
</td>
</td>
<td class="data-colon">: </td>
<td>{{ .RespirationRate }}</td>
{{ if ne .RespirationRate 0.0 }}
<td>{{ .RespirationRate }} x/Menit</td>
{{ else }}
<td></td>
{{ end }}
</td>
</tr>
<tr>
@@ -90,6 +90,7 @@ type ValueDto struct {
Discharge DischargeCondition `json:"discharge"`
National NationalProgram `json:"national"`
Management Management `json:"management"`
Medication Medication `json:"medication"`
}
type Assessment struct {
@@ -170,3 +171,12 @@ type Management struct {
ConditionOnDischarge string `json:"conditionOnDischarge"` // e.g. "Stable"
DischargeMethod string `json:"dischargeMethod"` // e.g. "Discharged with Doctor's Approval"
}
type MedicationEntry struct {
DuringTreatment string `json:"duringTreatment"`
AtDischarge string `json:"atDischarge"`
}
type Medication struct {
Medications []MedicationEntry `json:"medications"`
}
@@ -330,6 +330,8 @@ func generateResumeTemplateData(resume er.Resume, event pl.Event, tx *gorm.DB) (
templateData.PainScale = rData.Discharge.PainScale
templateData.ConditionOnDischarge = rData.Management.ConditionOnDischarge
templateData.DischargeMethod = rData.Management.DischargeMethod
templateData.Medications = rData.Medication.Medications
templateData.Date = pu.GetTimeNow().Format("02-01-2006")
return &templateData, nil
}
@@ -65,6 +65,7 @@ type ResumePDF struct {
PainScale int
ConditionOnDischarge string
DischargeMethod string
Medications []er.MedicationEntry
// fasyankes
// date
// klinik