<html>

<head>
    <meta charset="UTF-8" />
    <title>General Consent</title>
    <style>
        body {
            padding: 2rem 3rem;
        }

        table {
            width: 100%;
            border-collapse: collapse
        }

        td {
            vertical-align: top;
        }

        .border-table,
        .border-table td,
        .border-table th {
            border: 1px solid black;
        }

        .section-title {
            margin-top: 1rem;
            margin-bottom: 0rem;
        }

        .data-label {
            width: 9rem;
        }

        .data-colon {
            width: 15px; padding-left: 10px;
        }

        .description-label {
            font-size: 0.7rem;
            margin: 0;
        }
        
    </style>
</head>

<body style="font-family: Arial, sans-serif; line-height: 1.4">
    <table style="width: 100%; border-collapse: collapse">
        <tr>
            <td style="text-align: center">
                <img src="logo-1.png" alt="logo" style="height: 70px" />
            </td>
            <td style="text-align: center">
                <div style="font-size: 14px; font-weight: bold">
                    PEMERINTAH PROVINSI JAWA TIMUR
                </div>
                <div style="font-size: 14px; font-weight: bold">
                    RUMAH SAKIT UMUM DAERAH Dr. SAIFUL ANWAR
                </div>
                <div style="font-size: 13px">
                    TERAKREDITASI KARS VERSI 2012 TINGKAT PARIPURNA
                </div>
                <div style="margin-top: 8px">
                    Jl. Jaksa Agung Suprapto No. 2 MALANG 65111
                </div>
                <div>Telp. (0341) 362101, Fax. (0341) 362110</div>
                <div>Email: rsu-drsaifulanwar@jatimprov.go.id</div>
                <div>Website: www.rsudsaifulanwar.jatimprov.go.id</div>
            </td>
            <td style="text-align: center">
                <img src="logo-rssa.png" alt="logo" style="height: 70px" />
            </td>
        </tr>
    </table>

    <hr style="margin: 20px 0" />
    
    <div style="
        text-align: center;
        font-weight: bold;
        font-size: 1rem;
      ">
        IDENTITAS PASIEN
    </div>


    <table style="
        width: 100%;
        margin-top: 20px;
        border-collapse: collapse;
      ">
        <tr>
            <td style="width: 10rem;">
                No. RM
            </td>
            <td class="data-colon">: </td>
            <td>{{ .MedicalRecord }}</td>
            <td style="width: 7rem;">
                Ruang/Klinik
            </td>
            <td class="data-colon">: </td>
            <td>{{ .Unit }}</td>
        </tr>
        <tr>
            <td>
                NIK
            </td>
            <td class="data-colon">: </td>
            <td>{{ .NIK }}</td>
            <td>
                Kelas
            </td>
            <td class="data-colon">: </td>
            <td>{{ .Class }}</td>
        </tr>
        <tr>
            <td>
                Nama
            </td>
            <td class="data-colon">: </td>
            <td>{{ .Name }}</td>
            <td>
                DPJP
            </td>
            <td class="data-colon">: </td>
            <td>{{ .Doctor_Name }}</td>
        </tr>

    </tr>
        <td style="padding: 5px 0"></td>
        </tr>

        <tr>
            <td>
                Tempat/Tanggal Lahir
            </td>
            <td class="data-colon">: </td>
            <td>{{ .BirthPlaceDate }}</td>
        </tr>
        <tr>
            <td>
                Jenis Kelamin
            </td>
            <td class="data-colon">: </td>
            <td>{{ .Gender }}</td>
        </tr>
        <tr>
            <td>
                No. Telepon
            </td>
            <td class="data-colon">: </td>
            <td>{{ .Phone }}</td>
        </tr>
    </table>

    <hr style="margin: 20px 0" />
    <h1 style="
        text-align: center;
        font-weight: bold;
        font-size: 1rem;
        margin: 0;
      ">
        RESUME MEDIS
    </h1>
    <p style="
        font-size: 0.7rem;
        margin: 0;
        text-align: center;
      "><i>Medical Discharge Summary</i></p>


    <p style="
        font-size: 0.7rem;
        margin-top: 1rem;
      "><i>(Diisi oleh Dokter Penanggung Jawab Pelayanan)</i></p>
    <table>
        <tr>
            <td class="data-label">
                Tanggal Masuk
            </td>
            <td class="data-colon">: </td>
            <td>{{ .StartedAt }}</td>
        </tr>
        <tr>
            <td class="data-label">
                Tanggal Keluar
            </td>
            <td class="data-colon">: </td>
            <td>{{ .FinishedAt }}</td>
        </tr>
        <tr>
            <td class="data-label">
                Diagnosis Masuk
            </td>
            <td class="data-colon">: </td>
            <td>{{ .DiagnosisIn }}</td>
        </tr>
        <tr>
            <td class="data-label">
                Diagnosis Keluar
            </td>
            <td class="data-colon">: </td>
            <td>{{ .DiagnosisOut }}</td>
        </tr>
    </table>

 <table class="border-table" style="margin-top: 0.7rem; page-break-inside: avoid !important;">
    <thead>
        <tr>
            <th style="width: 1rem;">
                No
            </th>
            <th>
                Diagnosa
            </th>
            <th>
                Dasar Diagnosa
            </th>
            <th>
                Kode ICD-10
            </th>
        </tr>
    </thead>
    <tbody>
        {{ $dataLen := len .Diagnosis }}
        {{ if gt $dataLen 0 }}
            <!-- If we have data, show all of it -->
            {{ range $index, $diagnosis := .Diagnosis }}
            <tr>
                <td>{{ if eq $index 0 }}1{{ else if eq $index 1 }}2{{ else if eq $index 2 }}3{{ else if eq $index 3 }}4{{ else if eq $index 4 }}5{{ else }}{{ $index }}{{ end }}</td>
                <td>{{ $diagnosis.DiagnosisName }}</td>
                <td>{{ $diagnosis.Basis }}</td>
                <td>{{ $diagnosis.ICD10 }}</td>
            </tr>
            {{ end }}
            
            <!-- If data is less than 2, fill remaining rows -->
            {{ if eq $dataLen 1 }}
            <tr>
                <td>2</td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
            {{ end }}
        {{ else }}
            <!-- If no data, show 2 empty rows -->
            <tr>
                <td>1</td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
            <tr>
                <td>2</td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
        {{ end }}
    </tbody>
</table>







    <h4 class="section-title">Kajian Awal Medis</i></h4>
    <p style="
        font-size: 0.7rem;
        margin-top: 0rem;
        margin-bottom: 0.4rem;
    "><i>(Diisi oleh Dokter Penanggung Jawab Pelayanan)</i></p>

    <table>
        <tr>
            <td class="data-label">
                Keluhan Utama
            </td>
            <td class="data-colon">: </td>
            <td>{{ .MainComplaint }}</td>
        </tr>
        <tr>
            <td class="data-label">
                Riwayat Penyakit
            </td>
            <td class="data-colon">: </td>
            <td>{{ .MedicalHistory }}</td>
        </tr>
        <tr>
            <td class="data-label">
                Pemeriksaan Fisik & Keadaan Umum
            </td>
            <td class="data-colon">: </td>
            <td>{{ .PhysicalExamination }}</td>
        </tr>
    </table>

    <h4 class="section-title">Pemeriksaan Penunjang</i></h4>
    <table>
        <tr>
            <td class="data-label">
                Pemeriksaan
            </td>
            <td class="data-colon">: </td>
            <td>{{ .SupportingExamination }}</td>
        </tr>
    </table>

    <table style="page-break-inside: avoid !important;"></table>
        <tr>
            <td>
                <h4 class="section-title">Tindakan Medis</i></h4>
               <table class="border-table" style="margin-top: 0.4rem;">
    <thead>
        <tr>
            <th style="width: 1rem;">
                No
            </th>
            <th>
                Tindakan
            </th>
            <th>
                Dasar Tindakan
            </th>
            <th>
                Kode ICD 9-CM
            </th>
        </tr>
    </thead>
    <tbody>
        {{ $dataLen := len .MedicalActions }}
        {{ if gt $dataLen 0 }}
            <!-- If we have data, show all of it -->
            {{ range $index, $action := .MedicalActions }}
            <tr>
                <td>{{ if eq $index 0 }}1{{ else if eq $index 1 }}2{{ else if eq $index 2 }}3{{ else if eq $index 3 }}4{{ else if eq $index 4 }}5{{ else }}{{ $index }}{{ end }}</td>
                <td>{{ $action.Action }}</td>
                <td>{{ $action.Basis }}</td>
                <td>{{ $action.ICD9 }}</td>
            </tr>
            {{ end }}
            
            <!-- If data is less than 2, fill remaining rows -->
            {{ if eq $dataLen 1 }}
            <tr>
                <td>2</td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
            {{ end }}
        {{ else }}
            <!-- If no data, show 2 empty rows -->
            <tr>
                <td>1</td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
            <tr>
                <td>2</td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
        {{ end }}
    </tbody>
</table>
   

    <table style="margin: 0.7rem 0;">
        <tr>
            <td class="data-label">
                Tindakan Medis
            </td>
            <td class="data-colon">: </td>
            <td>{{ .MedicalAction }}</td>
        </tr>
    </table>




    <table style="page-break-inside: avoid !important;">
        <tr>
            <td>
                <h4 class="section-title">Konsultasi</i></h4>
                        </table>
                    <table class="border-table" style="margin-top: 0.4rem;">
                    <thead>
                        <tr>
                        <th style="width: 1rem;">No</th>
                        <th>Konsultasi</th>
                        <th>Jawaban Konsultasi</th>
                        </tr>
                    </thead>
                    <tbody>
                        {{ $dataLen := len .Consultations }}
                        {{ if gt $dataLen 0 }}
                        <!-- If we have data, show all of it -->
                        {{ range $index, $consultation := .Consultations }}
                        <tr>
                            <td>{{ if eq $index 0 }}1{{ else if eq $index 1 }}2{{ else if eq $index 2 }}3{{ else if eq $index 3 }}4{{ else if eq $index 4 }}5{{ else }}{{ $index }}{{ end }}</td>
                            <td>{{ $consultation.Consultation }}</td>
                            <td>{{ $consultation.ConsultationAnswer }}</td>
                        </tr>
                        {{ end }}
                        
                        <!-- If data is less than 2, fill remaining rows -->
                        {{ if eq $dataLen 1 }}
                        <tr><td>2</td><td></td><td></td></tr>
                        {{ end }}
                        {{ else }}
                        <!-- If no data, show 2 empty rows -->
                        <tr><td>1</td><td></td><td></td></tr>
                        <tr><td>2</td><td></td><td></td></tr>
                        {{ end }}
                    </tbody>
                    </table>
            </td>
        </tr>

    <h4 class="section-title">Terapi</i></h4>
    <table>
        <tr>
            <td class="data-label">
                Alergi
            </td>
            <td class="data-colon">: </td>
            <td>
                {{ .Allergy}}
            </td>
        </tr>
    </table>


    <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>{{ .DuringTreatment }}</td>
            <td>{{ .AtDischarge }}</td>
        </tr>
        {{ end }}
        
        <!-- 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>
    






    <h4 class="section-title">Kondisi saat Pulang</i></h4>
    <table>
        <tr>
            <td class="data-label">Kesadaran</td>
            <td class="data-colon">: </td>
            <td>{{ .ConsciousnessLevel }}</td>
        </tr>
        <tr>
            <td class="data-label">
                Tanda Vital
                <p class="description-label"><i>Vital sign</i></p>
            </td>
            <td class="data-colon">:</td>
        </tr>
    <tr>
        <td colspan="3">
        <table>
            <tr>

                <td style="width: 50%;"> 
            <table cellspacing="0" cellpadding="0">
                <tr>
                    <td>
                        <td class="data-label" style="text-align: right;"> Tekanan Darah
                            <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>
                <tr>
                    <td>
                    <td class="data-label" style="text-align: right;">Suhu
                        <p class="description-label"><i>Temperatur</i></p>
                        </td>
                    </td>
                    <td class="data-colon">: </td>
                    {{ if ne .BodyTemperature 0.0 }}
                        <td>{{ .BodyTemperature }} C</td>
                        {{ else }}
                            <td></td>
                        {{ end }}
                    <td>
                </tr>
                <tr>
                    <td>
                    <td class="data-label" style="text-align: right;">Nadi
                        <p class="description-label"><i>Pulse</i></p>
                    </td>
                    <td class="data-colon">: </td>
                    {{ if ne .HeartRate 0.0 }}
                        <td>{{ .HeartRate }} x/Menit</td>
                        {{ else }}
                            <td></td>
                        {{ end }}
                    </td>
                </tr>
            </table>
                </td>
                <td>
                    <table cellspacing="0" cellpadding="0">
                <tr>
                    <td>
                    <td class="data-label" style="text-align: right;">Frekuensi Nafas
                        <p class="description-label"><i>Respiratory rate</i></p>
                        </td>
                    </td>
                    <td class="data-colon">: </td>
                    {{ if ne .RespirationRate 0.0 }}
                        <td>{{ .RespirationRate }} x/Menit</td>
                        {{ else }}
                            <td></td>
                        {{ end }}
                    </td>
                </tr>
                <tr>
                    <td>
                    <td class="data-label" style="text-align: right;">Skala Nyeri
                        <p class="description-label"><i>Pain Scale</i></p>
                        </td>
                    </td>
                    <td class="data-colon">: </td>
                    <td>{{ .PainScale }}</td>
                </tr>
            </table>
                </td>
            </tr>
        </table>
            
        </td>
    </tr>

    <tr>
        <td class="data-label">Keadaan Keluar</td>
        <td class="data-colon">: </td>
        <td>{{ .ConditionOnDischarge }}</td>
    </tr>
    <tr>
        <td class="data-label">Cara Keluar
            <p class="description-label"><i>Patient discharge of hospital</i></p>
        </td>
        <td class="data-colon">:</td>
        <td>{{ .DischargeMethod }}</td>
    </tr>
</table>






    <table style="                  
                margin-top: 1rem;
                ">
        <tr>
            <td>
                <h4 class="description-label">INSTRUKSI UNTUK TINDAK LANJUT</h4>
                <p class="description-label"><i>Follow up Consultation to</i></p>
            </td>
            <td class="">
                <h4 class="description-label">Kontrol Ke</h4>
                <p class="description-label"><i>Follow up Consultation to</i></p>
            </td>
            <td class="">
                <table>
                    <tr>
                        <td style="width: 4rem;">Fasyankes</td>
                        <td class="data-colon">: </td>
                        <td>{{ .NIK }}</td>
                    </tr>
                    <tr>
                        <td>Tanggal</td>
                        <td>: </td>
                        <td>{{ .NIK }}</td>
                    </tr>
                    <tr>
                        <td>Klinik</td>
                        <td>: </td>
                        <td>{{ .NIK }}</td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr><td style="height: 1rem;"></td></tr>
        <tr>
            <td class="">
                <h4 class="description-label">Dalam keadaan darurat dapat menghubungi</h4>
                <p class="description-label"><i>In case of emergencycontact</i></p>
            </td>
            <td class="">
                <h4 class="description-label">IGD</h4>
                <p class="description-label"><i>(Accident & Emergency Instalation)</i></p>
            </td>
            <td class="">
                <table>
                    <tr>
                        <td style="width: 4rem;">Telepon
                            <p class="description-label"><i>Phone</i></p>
                        </td>
                        <td class="data-colon">: </td>
                        <td>(0341) 362101</td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr><td style="height: 1rem;"></td></tr>
        <tr>
            <td class="">
                <h4 class="description-label">EDUKASI & RENCANA TINDAK LANJUT</h4>
                <p class="description-label"><i>Follow up plan (if necessary)</i></p>
            </td>
            <td class="">
                <h4 class="description-label"></h4>
                <p class="description-label"><i>(bila diperlukan)</i></p>
            </td>
        </tr>
    </table>





    <table style="margin-top: 3rem;">
        <tr>
            <td></td>
            <td style="width: 15rem;">
                Malang, {{ .Date }}<br>
                Dokter Penanggung Jawab Pelayanan
            </td>
        </tr>
        <tr><td style="height: 7rem;"></td></tr>
        <tr>
            <td></td>
            <td style="width: 15rem;">
                ({{ .Doctor_Name }})
            </td>
        </tr>
    </table>

    <div style="height: 3rem;"></div>
        <hr style="margin: 20px 0" />
        <p>*) Data dapat berubah setelah pasien pulang sesuai prosedur</p>
    
</body>

</html>