Generation of Inpatient Diagnosis Card - hmislk/hmis GitHub Wiki

Overview

A Diagnosis Card is a clinical document that summarizes all patient-related medical information recorded from admission to discharge. It includes all relevant medical information such as history, diagnoses, treatments, vital signs, clinical notes, and discharge medications

Note: This document includes only clinical data and does not include financial data such as invoices or final bills.

Background

This feature was originally requested by:

  • Roseth Hospital
  • Ruhuna Hospital

The goal is to provide a structured and complete clinical summary of a patient’s hospital stay.

Prerequisites for Generating a Diagnosis Card

To generate a Diagnosis Card, the following data must be recorded:

  • Admission-related Data

    • Data recorded when admitting a patient (BHT No: RHD/Normal/Ward 27)
  • Clinical Data of the patient

    • Patient history (Medical Conditions, Medications, Surgical Conditions, Allergies)
    • Clinical notes
    • Ward Medications
    • Discharge Medications
    • Diagnoses
    • Procedures

🧭 Step 1: Access Patient Admission

Navigate to: Inward → Search → Admission → Select an active (non-discharged) admission → Inpatient Dashboard (Bed Icon)

image1

Inpatient Dashboard

image (1)

🩺 Step 2: Add Clinical Data

  • All clinical data must be recorded before generating the Diagnosis Card.

1. Patient History

Path: Inpatient Dashboard → Clinical Data → Patient History

image (2)
  • This section records long-term and patient-specific medical information, not details specific to the current admission.

Example:

  • Fever (current issue) → ❌ Not recorded here
  • Hypertension → ✅ Recorded here

1(a). Demographic Data

image (3)
  • This tab includes the basic patient identification and personal details.

  • Types of Data

    1. Permanent Data
      • Rarely changes
      • Example: Date of Birth (DOB)
    2. Semi-Permanent Data
      • May change occasionally
      • Examples:
        • Name
        • Gender
        • Address

⚙️ Note: These fields can be configured via application settings based on hospital requirements.

1(b). Medical Conditions

image (4)
  • This tab includes long-term or chronic conditions of the patient.

  • Examples:

    • Hypertension (High Blood Pressure)
    • Diabetes Mellitus
    • Bronchial Asthma
    • Heart Disease
  • These belong to the Electronic Medical Records (EMR)

👉 See: How to Add Medical Conditions

1(c). Medications

image (8)
  • To records the long-term medications taken by the patient.

❗ Medications prescribed for the current admission are NOT included here.

Fields:

  • Medicine Name
  • Dose (e.g., 5 / 10 / 25 / 50)
  • Strength Unit (mg, tablet, etc.)
  • Frequency (once/twice/thrice)
  • Duration (1 week/ 2 weeks)

1(d). Surgical Conditions

image (9)
  • To record previous surgeries or procedures undergone by the patient.

👉 See: How to Add Surgical Conditions(Procedures)

1(e). Allergies

image (10)
  • To record any allergies that patient may have:

    • Drug allergies
    • Food allergies
    • Environmental allergies

2. Clinical Notes

Path: Inpatient Dashboard → Clinical Data → Clinical Notes

image (11)

🔐 Access Control

  • If it says, you don't have privileges:
    1. Assign required privileges to the user for the relevant department
    2. Logout and login again
image (12) image (13)
  • Clinical Notes capture doctor/consultant observations during patient visits.
  • Typically recorded:
    • Morning rounds
    • Evening visits (if applicable)

✅ These notes are essential for generating the Diagnosis Card.

Adding Clinical Notes

Screenshot 2026-03-30 172347
  • Click “+ New Clinical Assignment” and fill in:

    1. Complaints & History

    2. Vital Signs

      • Weight
      • Height
      • BMI -Temperature
      • Blood Pressure (BP) - Normal range: 80–120 mmHg
      • Pulse Rate (PR) - Normal range: 72–86 /min
      • SpO₂ (Oxygen Saturation)
        • Measures oxygen level in blood
        • Normal: 95–100%
        • Below 90%: Requires medical attention
      • Respiratory Rate (RR) - Normal range: 16–20 /min
    3. Diagnoses

    4. Procedures

    5. Plan of Action


3. Ward Medications

Path: Inpatient Dashboard → Clinical Data → Ward Medications

  • Records all medications administered during the hospital stay

4. Medicine Timeline

Path: Inpatient Dashboard → Clinical Data → Medicine Timeline

  • Displays chronological medication history
Screenshot 2026-03-30 172627

5. Discharge Medications

Path: Inpatient Dashboard → Clinical Data → Discharge Medications

  • To records medications prescribed at the time of discharge
image (14)

6. Diagnosis Card

Path: Inpatient Dashboard → Clinical Data → Diagnosis Card

  • Now let’s see how to generate the Diagnosis Card for the above patient with the added records.

🧾 Step 3: Create a Diagnosis Card Template

Navigate to: EMR (🩺Icon) → Settings → Documents → Add New Document Template

image (15)

Steps:

  • Enter template name
  • Select template type - InpatientDiagnosisCard/Prescription/Medical Certificate/etc.
  • Use placeholders listed under "Available Placeholders"
    • These will be dynamically replaced with actual data
  • Optionally:
    • Use AI tools to generate template content using placeholders
  • Paste into :Template Content" box
  • Click Save Template

🧾 Step 4: Generate Diagnosis Card

Navigate to: Inpatient Dashboard → Clinical Data → Diagnosis Card

image (16)

Steps:

  • Select template from drop-down
  • Click on "Generate"
  • Click "Edit" if changes are needed
  • Click "Save"

🤖 Step 5: Generate with AI

image (17)

Steps:

  • Click on “Generate with AI”
  • System auto-generates the Diagnosis Card using available data
  • Click on “Edit” if required to make changes on the generated content
  • Save the final version after modifications

📋 Built-in AI Instruction Templates

The template content box does not hold a visual layout — it holds AI instructions that tell the AI how to format the card. The system sends these instructions together with the patient's clinical data to the AI, which produces the final HTML card.

When no template is selected, the system uses a default general-purpose format. For specialised cards (e.g. surgery), create a template with the instructions below.


Surgery Diagnosis Card Template

Template Name: Surgery Diagnosis Card
Template Type: InpatientDiagnosisCard

Copy the following text exactly into the Template Content box when creating the template:

SURGERY DIAGNOSIS CARD — AI GENERATION INSTRUCTIONS

Use these instructions to generate a professional surgical diagnosis card in HTML format.

OUTPUT RULES:
- Output ONLY the HTML table markup. No markdown fencing, no explanations, no preamble.
- Use inline CSS styles on every element. Self-contained, suitable for printing on A4.
- Use a single <table> layout.
- OMIT any section entirely if it has no meaningful data — do NOT leave empty rows.
- NEVER fabricate, infer, or add any clinical data not explicitly provided.

HEADING:
- The main card title must be the surgery/procedure name (from SURGERIES / OPERATIONS), rendered in large bold text.
- Below the procedure name, show the institution name in bold.
- Do NOT use a generic title like “Diagnosis & Treatment Card”.

CARD STRUCTURE (in this exact order, omit any section with no data):
1. Header — Institution name (bold, centered), Procedure name as main title (large bold)
2. Patient row — Name, Age, Sex, BHT, DOA, DOD, Ward
3. Surgeon and Anaesthetist names (clearly labelled)
4. Pre-operative Diagnosis
5. Operation Performed — procedure name in <b>bold</b>
6. Operative Findings / Notes
7. Past Medical History — OMIT if “No significant past history”
8. Past Surgical History — extract from past medical history data if any surgical history mentioned; OMIT if none
9. Regular / Routine Medications — OMIT if none
10. Allergies — OMIT COMPLETELY if “No known allergies”
11. Post-operative Investigations — OMIT if none
12. Post-operative Ward Medications (Rx) — OMIT if none
13. Discharge Medications (DRx) — OMIT if none
14. Discharge Condition, Follow-Up Plan, Activity Instructions, Diet Instructions — each as a separate labelled row; OMIT any that are empty
15. Danger Signs — always include: “Return immediately if: Fever >38°C | Wound redness/swelling/discharge | Severe pain | Difficulty breathing | Bleeding”
16. Footer row — Discharge Date, Surgeon Signature

FORMATTING:
- Section header cells: background #1a3a5c, white text, bold, font-size 11px
- Allergies and Danger Signs header cells: background #c0392b, white text, bold
- Procedure/surgery names: always wrapped in <b>...</b>
- DOD showing “(still admitted)”: render in orange color
- Alternating light background (#eef3f9) on patient demographic rows
- Font: Arial, sans-serif, 12px base
- Table border: 2px solid #1a3a5c, border-collapse: collapse, width 100%

How to add this template

  1. Navigate to: EMR (🩺 icon) → Settings → Documents → Add New Document Template
  2. Enter Template Name: Surgery Diagnosis Card
  3. Select Template Type: InpatientDiagnosisCard
  4. Paste the text above into the Template Content box
  5. Click Save Template

Once saved, the template will appear in the Select Template dropdown on the Diagnosis Card page. When selected and Generate is clicked, the AI uses these instructions to produce a surgery-specific card with the procedure name as the heading, surgical team details, and all relevant sections.

⚠️ **GitHub.com Fallback** ⚠️