INSERT INTO `treatment_plans` (`id`, `patient_id`, `doctor_id`, `symptoms`, `symptom_analysis`, `doctor_input`, `test_results`, `treatment_plan`, `prescription`, `created_by`, `updated_by`, `created_at`, `updated_at`, `hospital_id`) VALUES
(19, 53, '44', 'Headace', '**Patient Analysis**\n\n**Patient Information:**  \n- Name: Mr Patient  \n- Age: 13 years  \n- Gender: Male  \n- Medical History: Not specified (non-contributory)\n\n**Current Symptom:**  \n- Headache\n\n---\n\n### 1. Potential Differential Diagnoses\n\nGiven the limited information (isolated headache in a 13-year-old male), the following are common and important causes to consider:\n\n- **Primary Headache Disorders:**\n  - Migraine (with or without aura)\n  - Tension-type headache\n  - Cluster headache (less common in this age group)\n\n- **Secondary Headache Causes:**\n  - Viral or bacterial infection (e.g., sinusitis, upper respiratory tract infection, meningitis)\n  - Medication overuse headache\n  - Head trauma/concussion\n  - Vision problems (e.g., refractive errors)\n  - Dehydration\n  - Intracranial pathology (e.g., tumor, hydrocephalus, idiopathic intracranial hypertension)\n  - Hypertension\n\n---\n\n### 2. Recommended Diagnostic Tests\n\n**Initial evaluation should be guided by clinical history and physical examination.**  \nIf red flags or concerning features are present, consider:\n\n- **Basic Investigations:**\n  - Vital signs (including blood pressure)\n  - Neurological examination\n  - Fundoscopic examination (for papilledema)\n  - Visual acuity assessment\n\n- **If indicated by history/exam:**\n  - CBC, CRP/ESR (if infection or inflammation suspected)\n  - Urinalysis (if systemic symptoms)\n  - Brain imaging (CT/MRI) if red flags present (see below)\n  - Lumbar puncture (if meningitis or increased intracranial pressure suspected)\n\n---\n\n### 3. Urgency Level\n\n- **Low to Medium** (based on current information)\n  - **If no red flags** or abnormal findings on history/exam, outpatient evaluation is appropriate.\n  - **If red flags present** (see below), urgency increases to **High**—immediate evaluation required.\n\n---\n\n### 4. Key Observations and Clinical Notes\n\n- **History is critical:** Onset, duration, character, location, associated symptoms (nausea, vomiting, visual changes, photophobia, phonophobia, fever, neck stiffness, recent trauma, etc.).\n- **Physical exam:** Complete neurological and general examination.\n- **Family history:** Migraine or other headache disorders.\n- **Medication and substance use:** Caffeine, over-the-counter medications, recent changes.\n- **Psychosocial factors:** Stress, sleep patterns, school performance.\n\n---\n\n### 5. Red Flags to Watch For\n\nImmediate evaluation is warranted if any of the following are present:\n\n- Sudden, severe (\"thunderclap\") headache\n- Headache with fever, neck stiffness, photophobia (meningitis/encephalitis)\n- Headache with altered mental status, seizures, or focal neurological deficits\n- Headache that wakes the patient from sleep or is worse in the morning\n- Headache with vomiting (especially projectile)\n- Recent head trauma\n- Visual changes (blurred vision, double vision, vision loss)\n- Papilledema on exam\n- Immunocompromised status or known malignancy\n\n---\n\n### 6. Confidence Level\n\n- **Low**\n  - Due to the extremely limited clinical information provided (only \"headache\" as a symptom and no relevant medical history), the confidence in this analysis is low. A thorough clinical history and examination are essential for accurate diagnosis and management.\n\n---\n\n**Summary:**  \nThe differential for headache in a 13-year-old is broad, ranging from benign primary headache disorders to serious secondary causes. Careful assessment for red flags is crucial. If any concerning features are present, urgent evaluation is required. Otherwise, outpatient workup and management may be appropriate. Further history and examination findings are needed for a definitive assessment.\n\n**Recommendation:**  \nAdvise prompt in-person evaluation by a healthcare professional for a detailed history, examination, and appropriate investigations.', NULL, NULL, NULL, NULL, 992, NULL, '2025-09-08 04:24:01', NULL, 98),
(20, 53, '44', 'headace', '**Patient Analysis**\n\n**Patient Information:**  \n- Name: Mr Patient  \n- Age: 13 years  \n- Gender: Male  \n- Medical History: Not specified (entry \"dfgdfg\" appears to be a placeholder)\n\n**Current Symptom:**  \n- Headache\n\n---\n\n### 1. Potential Differential Diagnoses\n\nGiven the limited information (isolated headache in a 13-year-old male), consider the following common and serious causes:\n\n**Common Causes:**\n- Tension-type headache\n- Migraine (with or without aura)\n- Sinusitis\n- Viral illness (e.g., upper respiratory tract infection)\n- Eyestrain (refractive error)\n\n**Less Common but Serious Causes:**\n- Meningitis/encephalitis\n- Intracranial mass or space-occupying lesion\n- Idiopathic intracranial hypertension\n- Head trauma/concussion\n- Hypertension\n- Medication overuse headache\n\n---\n\n### 2. Recommended Diagnostic Tests\n\n**Initial Evaluation:**\n- Detailed history and physical examination (including neurological exam)\n- Assessment for associated symptoms: fever, photophobia, neck stiffness, nausea/vomiting, visual changes, recent trauma, altered mental status\n\n**Further Workup (if indicated by history/exam):**\n- Fundoscopic examination (for papilledema)\n- Blood pressure measurement\n- CBC, CRP/ESR (if infection or inflammation suspected)\n- Sinus imaging (if sinusitis suspected)\n- Brain imaging (CT/MRI) if red flags present (see below)\n- Lumbar puncture (if meningitis/encephalitis suspected)\n\n---\n\n### 3. Urgency Level\n\n**Medium**  \n- Isolated headache in a 13-year-old is often benign, but further assessment is required to rule out serious causes.\n- Urgency increases to **High** if any red flags (see below) are present.\n\n---\n\n### 4. Key Observations and Clinical Notes\n\n- Age and gender are typical for primary headache disorders (migraine, tension-type).\n- No associated symptoms or relevant medical history provided.\n- No mention of trauma, fever, neurological deficits, or other systemic symptoms.\n- Lack of detail limits the ability to narrow the differential diagnosis.\n\n---\n\n### 5. Red Flags to Watch For\n\nIf any of the following are present, escalate urgency and consider immediate referral or emergency evaluation:\n\n- Sudden-onset \"worst headache of life\"\n- Headache with fever, neck stiffness, photophobia (meningitis signs)\n- Altered mental status, seizures, focal neurological deficits\n- Papilledema or visual changes\n- Headache worsened by Valsalva, lying down, or in the morning\n- Recent head trauma\n- Persistent vomiting\n- Immunosuppression or known malignancy\n\n---\n\n### 6. Confidence Level\n\n**Low to Medium**  \n- Confidence is limited by lack of detailed history, physical findings, and associated symptoms.\n- Additional information is required for a more precise assessment.\n\n---\n\n**Summary:**  \nThis is a 13-year-old male with an isolated complaint of headache. The most likely causes are benign (tension-type or migraine), but serious etiologies must be considered and ruled out, especially if red flags are present. A thorough history and physical examination are essential. If any red flags are identified, urgent evaluation is warranted.\n\n**Recommendation:**  \nAdvise prompt clinical evaluation by a healthcare professional to obtain a detailed history and perform a physical and neurological examination. Immediate attention is required if any red flags develop.', NULL, NULL, NULL, NULL, 992, NULL, '2025-09-08 04:27:26', NULL, 98),
(21, 53, '44', 'headache', '**Patient Analysis**\n\n**Patient Information:**  \n- Name: Mr Patient  \n- Age: 13 years  \n- Gender: Male  \n- Medical History: Not specified (text \"dfgdfg\" appears to be a placeholder)\n\n**Current Symptom:**  \n- Headache\n\n---\n\n### 1. Potential Differential Diagnoses\n\nGiven the limited information (isolated headache in a 13-year-old male), the following differential diagnoses should be considered:\n\n- **Primary Headache Disorders:**\n  - Migraine (with or without aura)\n  - Tension-type headache\n  - Cluster headache (less common in this age group)\n\n- **Secondary Headache Causes:**\n  - Viral or bacterial infection (e.g., sinusitis, upper respiratory tract infection, meningitis)\n  - Medication overuse headache\n  - Head trauma/concussion (if recent trauma)\n  - Vision problems (e.g., refractive errors)\n  - Intracranial pathology (e.g., tumor, hydrocephalus, idiopathic intracranial hypertension)\n  - Dehydration\n  - Sleep disorders\n\n---\n\n### 2. Recommended Diagnostic Tests\n\n**Initial Assessment:**\n- Thorough history and physical examination (including neurological exam)\n- Headache diary (onset, duration, associated symptoms, triggers)\n\n**If Red Flags or Abnormal Findings:**\n- Neuroimaging (MRI preferred, CT if urgent)\n- Lumbar puncture (if meningitis or subarachnoid hemorrhage suspected)\n- Blood tests (CBC, CRP/ESR if infection or inflammation suspected)\n- Sinus imaging (if sinusitis suspected)\n- Vision assessment (if visual symptoms present)\n\n---\n\n### 3. Urgency Level\n\n**Medium**\n\n- Most headaches in this age group are benign, but careful assessment for red flags is essential.\n- If any red flags (see below) are present, urgency increases to **High**.\n\n---\n\n### 4. Key Observations and Clinical Notes\n\n- Isolated headache in a 13-year-old male is most commonly due to primary headache disorders.\n- Absence of associated symptoms (fever, vomiting, altered consciousness, visual changes, neck stiffness) in the provided information.\n- No medical history provided; relevant past history (e.g., trauma, chronic illness) is unknown.\n- Further history is crucial: onset, duration, character, location, associated symptoms, family history, medication use, recent infections, trauma.\n\n---\n\n### 5. Red Flags to Watch For\n\n- Sudden onset (\"thunderclap\" headache)\n- Severe, worsening, or persistent headache\n- Headache with fever, neck stiffness, photophobia, or altered mental status (meningitis/encephalitis)\n- Focal neurological deficits (weakness, vision changes, seizures)\n- Headache waking from sleep or worse in the morning (raised intracranial pressure)\n- Recent head trauma\n- Vomiting (especially projectile)\n- Immunosuppression or known malignancy\n\n---\n\n### 6. Confidence Level\n\n**Confidence Level:** 60%\n\n*Reasoning:*  \nAnalysis is limited by lack of detailed history, physical findings, and medical background. The most likely causes are benign, but serious secondary causes cannot be excluded without further information.\n\n---\n\n**Recommendation:**  \nA comprehensive clinical evaluation by a healthcare professional is essential to obtain a detailed history, perform a physical and neurological examination, and determine the need for further investigations. Immediate medical attention is warranted if any red flags are present.', NULL, NULL, NULL, NULL, 992, NULL, '2025-09-08 04:29:30', NULL, 98),
(22, 53, '44', 'headache', '**Patient Information:**  \n- Name: Mr Patient  \n- Age: 13 years  \n- Gender: Male  \n- Medical History: Not specified (entry \"dfgdfg\" not interpretable)\n\n**Current Symptom:**  \n- Headache\n\n---\n\n### 1. Potential Differential Diagnoses\n\nGiven the limited information (isolated headache in a 13-year-old male), consider the following common and serious causes:\n\n- **Primary Headache Disorders:**\n  - Migraine (with or without aura)\n  - Tension-type headache\n  - Cluster headache (less common in this age group)\n- **Secondary Headache Causes:**\n  - Viral or bacterial infection (e.g., sinusitis, upper respiratory tract infection, meningitis)\n  - Medication overuse headache\n  - Vision problems (refractive errors)\n  - Trauma (concussion, subdural hematoma)\n  - Intracranial mass or space-occupying lesion (rare but serious)\n  - Hypertension\n  - Dehydration\n  - Sleep disturbances\n\n---\n\n### 2. Recommended Diagnostic Tests\n\n**Initial Evaluation:**\n- Detailed history and physical examination (including neurological exam)\n- Assessment for recent trauma, fever, photophobia, neck stiffness, vomiting, visual changes, or focal neurological deficits\n\n**Further Investigations (if indicated by history/exam):**\n- **Neuroimaging (CT/MRI):** If red flags or abnormal neurological findings are present\n- **Lumbar puncture:** If meningitis or subarachnoid hemorrhage is suspected\n- **Laboratory tests:** CBC, CRP, ESR if infection or inflammation suspected\n- **Vision assessment:** If visual symptoms or eye strain suspected\n\n---\n\n### 3. Urgency Level\n\n**Medium**  \n- Isolated headache in a 13-year-old is common and often benign, but further assessment is needed to rule out serious causes.\n- **Urgency increases to High** if any red flags (see below) are present.\n\n---\n\n### 4. Key Observations and Clinical Notes\n\n- The symptom is non-specific; further history is crucial (onset, duration, character, associated symptoms, triggers, family history, medication use, recent infections, trauma).\n- Physical and neurological examination findings are essential to guide further workup.\n- Consider psychosocial factors (school stress, sleep hygiene).\n\n---\n\n### 5. Red Flags to Watch For\n\n- Sudden, severe (\"thunderclap\") headache\n- Headache with fever, neck stiffness, photophobia (meningitis)\n- Altered mental status, confusion, seizures\n- Focal neurological deficits (weakness, vision loss, ataxia)\n- Headache worsened by Valsalva, lying down, or in the morning (raised intracranial pressure)\n- Recent head trauma\n- Persistent vomiting\n- Immunosuppression or known malignancy\n\n---\n\n### 6. Confidence Level\n\n**Confidence Level:** 70%  \n- Confidence is limited by the lack of detailed history, physical examination, and medical background.  \n- Further information is required for a more precise assessment.\n\n---\n\n**Note:**  \nThis analysis is for informational purposes only. A thorough clinical evaluation by a healthcare professional is essential for accurate diagnosis and management. If any red flags are present, seek urgent medical attention.', NULL, NULL, NULL, NULL, 992, NULL, '2025-09-08 04:30:21', NULL, 98),
(23, 53, '44', 'Heaadace', '**Patient Information:**  \nName: Mr Patient  \nAge: 13 years  \nGender: Male  \nMedical History: Not specified (text appears non-informative)\n\n**Current Symptoms:**  \nHeadache\n\n---\n\n### 1. Potential Differential Diagnoses\n\nGiven the limited information (isolated headache in a 13-year-old male), consider the following common and serious causes:\n\n- **Primary Headache Disorders:**\n  - Migraine (with or without aura)\n  - Tension-type headache\n  - Cluster headache (less common in this age group)\n\n- **Secondary Headache Causes:**\n  - Viral or bacterial infection (e.g., sinusitis, upper respiratory tract infection, meningitis)\n  - Medication overuse headache\n  - Trauma (concussion, subdural hematoma)\n  - Vision problems (refractive errors, eye strain)\n  - Intracranial mass or increased intracranial pressure (rare but serious)\n  - Hypertension\n  - Dehydration\n\n---\n\n### 2. Recommended Diagnostic Tests\n\n**Initial Evaluation:**\n- Detailed history and physical examination (including neurological assessment)\n- Vital signs (temperature, blood pressure, heart rate)\n- Fundoscopic examination (to assess for papilledema)\n\n**Further Investigations (if indicated by history/exam):**\n- CBC, CRP/ESR (if infection or inflammation suspected)\n- Lumbar puncture (if meningitis or subarachnoid hemorrhage suspected)\n- CT/MRI brain (if red flags or abnormal neurological findings)\n- Sinus imaging (if sinusitis suspected)\n- Vision assessment (if visual symptoms)\n\n---\n\n### 3. Urgency Level\n\n**Low to Medium**  \n- If headache is mild, non-progressive, and not associated with red flag symptoms, urgency is **Low**.\n- If any red flags (see below) are present, urgency increases to **High**.\n\n---\n\n### 4. Key Observations and Clinical Notes\n\n- Isolated headache in an adolescent is most commonly benign (migraine or tension-type).\n- Lack of associated symptoms (fever, neck stiffness, vomiting, visual changes, altered mental status) in the provided information.\n- No history of trauma, recent illness, or medication use documented.\n- Medical history is unclear; further clarification needed.\n\n---\n\n### 5. Red Flags to Watch For\n\n- Sudden onset \"worst headache of life\"\n- Headache with fever, neck stiffness, photophobia (meningitis/encephalitis)\n- Altered mental status, confusion, seizures\n- Focal neurological deficits (weakness, vision loss, ataxia)\n- Papilledema (suggests increased intracranial pressure)\n- Headache waking from sleep or worse in the morning\n- Recent head trauma\n- Immunosuppression or known malignancy\n\n---\n\n### 6. Confidence Level\n\n**Confidence Level:** 60%  \n*Rationale: The analysis is based on a single symptom (\"headache\") with no detailed history, physical findings, or context. Confidence would increase with more comprehensive clinical information.*\n\n---\n\n**Note:**  \nThis analysis is not a substitute for a thorough clinical evaluation. Please ensure the patient is reviewed by a healthcare professional for a complete assessment and appropriate management.', NULL, NULL, NULL, NULL, 992, NULL, '2025-09-08 04:39:46', NULL, 98),
(24, 53, '44', 'Headace', '**Patient Analysis**\n\n**Patient Information:**  \n- Name: Mr Patient  \n- Age: 13 years  \n- Gender: Male  \n- Medical History: Not specified (text appears non-informative)\n\n**Current Symptom:**  \n- Headache\n\n---\n\n### 1. Potential Differential Diagnoses\n\nGiven the limited information (isolated headache in a 13-year-old male), possible causes include:\n\n- **Primary Headache Disorders:**\n  - Migraine (with or without aura)\n  - Tension-type headache\n  - Cluster headache (less common in this age group)\n\n- **Secondary Headache Causes:**\n  - Viral or bacterial infection (e.g., sinusitis, upper respiratory tract infection, meningitis)\n  - Medication overuse or withdrawal\n  - Dehydration\n  - Vision problems (refractive errors)\n  - Trauma (concussion, subdural hematoma)\n  - Intracranial pathology (tumor, hydrocephalus, idiopathic intracranial hypertension)\n  - Hypertension\n  - Dental or temporomandibular joint (TMJ) issues\n\n---\n\n### 2. Recommended Diagnostic Tests\n\n**Initial Evaluation:**\n- Detailed history and physical/neurological examination\n\n**Further Investigations (if indicated by history/exam):**\n- CBC, CRP/ESR (if infection or inflammation suspected)\n- Urinalysis (if systemic symptoms)\n- Imaging (CT/MRI brain) if red flags present (see below)\n- Lumbar puncture (if meningitis or subarachnoid hemorrhage suspected)\n- Ophthalmologic evaluation (if visual symptoms or papilledema suspected)\n- Blood pressure measurement\n\n---\n\n### 3. Urgency Level\n\n**Medium**  \n- Headache in a 13-year-old is common and often benign, but further assessment is needed to rule out serious causes, especially if red flags are present.\n\n---\n\n### 4. Key Observations and Clinical Notes\n\n- Isolated headache in an adolescent is most commonly due to primary headache disorders.\n- Lack of associated symptoms (fever, neck stiffness, vomiting, visual changes, altered consciousness) in the provided information.\n- No trauma or chronic medical conditions reported.\n- Incomplete medical history; further details needed for comprehensive assessment.\n\n---\n\n### 5. Red Flags to Watch For\n\nImmediate evaluation is warranted if any of the following are present:\n- Sudden, severe (\"thunderclap\") headache\n- Headache with fever, neck stiffness, photophobia (meningitis/encephalitis)\n- Altered mental status, seizures, focal neurological deficits\n- Papilledema or visual changes\n- Headache worse with Valsalva, lying down, or in the morning (raised intracranial pressure)\n- Recent head trauma\n- Persistent vomiting\n- Immunosuppression or known malignancy\n\n---\n\n### 6. Confidence Level\n\n**Confidence Level:** 60%  \n- Confidence is limited by the lack of detailed history, associated symptoms, and physical findings. Further information is essential for a more accurate assessment.\n\n---\n\n**Note:**  \nThis analysis is based on the limited information provided. A thorough clinical evaluation by a healthcare professional is essential for accurate diagnosis and management. If any red flag symptoms develop, seek immediate medical attention.', NULL, NULL, NULL, NULL, 992, NULL, '2025-09-08 04:50:24', NULL, 98),
(25, 53, '44', 'Headache', '**Patient Information:**  \nName: Mr Patient  \nAge: 13 years  \nGender: Male  \nMedical History: Not specified (notation \"dfgdfg\" is non-informative)\n\n**Current Symptom:**  \nHeadache\n\n---\n\n### 1. Potential Differential Diagnoses\n\nIn a 13-year-old male presenting with headache, differentials include:\n\n- **Primary Headaches:**\n  - Migraine (with or without aura)\n  - Tension-type headache\n  - Cluster headache (less common at this age)\n\n- **Secondary Headaches:**\n  - Viral or bacterial infection (e.g., sinusitis, upper respiratory tract infection, meningitis/encephalitis)\n  - Medication overuse or withdrawal\n  - Head trauma (concussion, subdural/epidural hematoma)\n  - Vision problems (refractive errors)\n  - Intracranial mass lesion (tumor, abscess, hydrocephalus)\n  - Hypertension\n  - Idiopathic intracranial hypertension\n\n---\n\n### 2. Recommended Diagnostic Tests\n\nThe choice of tests depends on further history and physical findings. Initial recommendations:\n\n- **History & Physical Exam:** Detailed neurological and general physical examination\n- **Basic Investigations:**\n  - Vital signs (including blood pressure)\n  - Fundoscopy (to assess for papilledema)\n  - Visual acuity testing\n- **If red flags or abnormal findings:**\n  - Neuroimaging (CT/MRI brain)\n  - Lumbar puncture (if meningitis, encephalitis, or subarachnoid hemorrhage suspected)\n  - Laboratory tests (CBC, CRP, ESR, electrolytes)\n\n---\n\n### 3. Urgency Level\n\n- **Medium** (based on isolated headache and lack of red flag symptoms in the provided information)\n- **High** if any red flags are present (see below)\n\n---\n\n### 4. Key Observations and Clinical Notes\n\n- The symptom is non-specific: further history is essential (onset, duration, quality, associated symptoms, triggers, family history, medication use, trauma, recent infections).\n- No mention of fever, neck stiffness, vomiting, visual changes, or altered consciousness.\n- No prior medical history provided.\n- Headaches in this age group are often benign but secondary causes must be ruled out, especially with new, severe, or progressive symptoms.\n\n---\n\n### 5. Red Flags to Watch For\n\n- Sudden, severe (“thunderclap”) headache\n- Headache with fever, neck stiffness, photophobia (concern for meningitis/encephalitis)\n- Altered mental status, confusion, or seizures\n- Focal neurological deficits (weakness, numbness, vision loss)\n- Papilledema or signs of increased intracranial pressure (vomiting, worse lying down)\n- Headache waking patient from sleep\n- Recent head trauma\n- Immunocompromised state or known malignancy\n\n---\n\n### 6. Confidence Level\n\n**Confidence Level:** 70%  \n*Rationale: The analysis is based on a single, non-specific symptom with insufficient clinical context or history. Confidence would increase with a more detailed history and examination findings.*\n\n---\n\n**Note:**  \nThis analysis is intended to guide further assessment and is not a substitute for direct clinical evaluation. Prompt review by a healthcare professional is recommended to obtain a thorough history, perform an examination, and determine appropriate management.', NULL, NULL, NULL, NULL, 992, NULL, '2025-09-08 04:51:38', NULL, 98),
(26, 53, '44', 'headache', '**Patient Information:**  \nName: Mr Patient  \nAge: 13 years  \nGender: Male  \nMedical History: Not specified (text \"dfgdfg\" is not interpretable)\n\n**Current Symptom:**  \nHeadache\n\n---\n\n### 1. Potential Differential Diagnoses\n\nGiven the limited information (isolated headache in a 13-year-old male), consider the following common and serious causes:\n\n- **Primary Headache Disorders:**\n  - Tension-type headache\n  - Migraine (with or without aura)\n  - Cluster headache (less common in this age group)\n\n- **Secondary Headache Causes:**\n  - Viral or bacterial infection (e.g., sinusitis, upper respiratory tract infection, meningitis)\n  - Medication overuse or withdrawal\n  - Vision problems (e.g., refractive errors)\n  - Trauma (recent head injury)\n  - Intracranial pathology (e.g., tumor, hydrocephalus, idiopathic intracranial hypertension)\n  - Hypertension\n  - Dehydration\n\n---\n\n### 2. Recommended Diagnostic Tests\n\n**Initial Evaluation:**\n- Detailed history and physical examination (including neurological exam)\n- Assessment for associated symptoms: fever, neck stiffness, photophobia, vomiting, visual changes, altered mental status, recent trauma\n\n**If Red Flags or Abnormal Findings:**\n- Neuroimaging (CT or MRI brain)\n- Lumbar puncture (if meningitis or subarachnoid hemorrhage suspected)\n- Blood tests (CBC, inflammatory markers if infection suspected)\n- Ophthalmologic evaluation (if visual symptoms or papilledema suspected)\n\n---\n\n### 3. Urgency Level\n\n**Medium**  \n- Most headaches in this age group are benign, but a careful assessment for red flags is essential.\n- If any red flags are present (see below), urgency escalates to **High**.\n\n---\n\n### 4. Key Observations and Clinical Notes\n\n- Isolated headache in a 13-year-old is most commonly due to primary headache disorders or benign causes.\n- Lack of additional symptoms (fever, vomiting, altered consciousness) in the provided data lowers suspicion for acute life-threatening causes, but absence of evidence is not evidence of absence.\n- Medical history is not provided; relevant history (e.g., recent trauma, family history of migraine, medication use, prior similar episodes) is crucial for further narrowing the differential.\n\n---\n\n### 5. Red Flags to Watch For\n\n- Sudden, severe (\"thunderclap\") headache\n- Headache with fever, neck stiffness, photophobia (meningitis/encephalitis)\n- Headache with vomiting, especially early morning or projectile\n- Altered mental status, confusion, seizures\n- Focal neurological deficits (weakness, vision loss, ataxia)\n- Papilledema (suggestive of increased intracranial pressure)\n- Recent head trauma\n- Immunosuppression or underlying malignancy\n\n---\n\n### 6. Confidence Level\n\n**Confidence Level:** 60%  \n- Confidence is moderate due to the limited clinical information provided. A more detailed history and examination are essential for a more accurate assessment.\n\n---\n\n**Note:**  \nThis analysis is based on the information provided. A thorough clinical evaluation by a healthcare professional is necessary for accurate diagnosis and management. If any red flag symptoms develop, seek immediate medical attention.', NULL, NULL, NULL, NULL, 992, NULL, '2025-09-08 04:57:05', NULL, 98),
(27, 53, '44', 'Headache', '**Patient Information:**  \nName: Mr Patient  \nAge: 13 years  \nGender: Male  \nMedical History: Not specified (text appears non-informative)\n\n**Current Symptom:**  \nHeadache\n\n---\n\n### 1. Potential Differential Diagnoses\n\nGiven the limited information (isolated headache in a 13-year-old male), consider the following common and serious causes:\n\n- **Primary Headache Disorders:**\n  - Migraine (with or without aura)\n  - Tension-type headache\n  - Cluster headache (less common in this age group)\n\n- **Secondary Headache Causes:**\n  - Viral or bacterial infection (e.g., sinusitis, upper respiratory infection, meningitis)\n  - Medication overuse or withdrawal\n  - Dehydration\n  - Vision problems (refractive errors)\n  - Trauma (concussion, subdural hematoma)\n  - Intracranial mass or increased intracranial pressure (rare but serious)\n  - Hypertension\n  - Dental issues (e.g., temporomandibular joint dysfunction)\n  - Sleep disorders\n\n---\n\n### 2. Recommended Diagnostic Tests\n\n**Initial evaluation should be guided by history and physical examination.**  \nIf the headache is new, severe, or associated with concerning features, consider:\n\n- **Basic Workup:**\n  - Full neurological examination\n  - Vital signs (including blood pressure)\n  - Fundoscopic examination (for papilledema)\n  - Sinus examination\n\n- **Further Testing (if indicated by red flags or abnormal exam):**\n  - CBC, CRP/ESR (if infection or inflammation suspected)\n  - CT or MRI brain (if signs of increased intracranial pressure, focal neurological deficit, or trauma)\n  - Lumbar puncture (if meningitis or subarachnoid hemorrhage suspected)\n  - Vision assessment (if visual symptoms present)\n\n---\n\n### 3. Urgency Level\n\n**Medium**  \n- Most pediatric headaches are benign, but the urgency increases if red flags are present (see below).\n- If any red flags are present, escalate to **High** urgency.\n\n---\n\n### 4. Key Observations and Clinical Notes\n\n- Isolated headache in a 13-year-old is most commonly due to benign causes (migraine, tension-type).\n- Lack of additional symptoms (fever, neck stiffness, vomiting, altered mental status, visual changes, trauma) makes serious causes less likely, but absence of information does not rule them out.\n- Detailed history (onset, duration, character, associated symptoms, triggers, family history, medication use) and physical exam are essential for further risk stratification.\n\n---\n\n### 5. Red Flags to Watch For\n\n- Sudden, severe (\"thunderclap\") headache\n- Headache with fever, neck stiffness, photophobia (meningitis)\n- Altered mental status, confusion, or seizures\n- Focal neurological deficits (weakness, vision loss, ataxia)\n- Papilledema or signs of increased intracranial pressure (worse with lying down, vomiting)\n- Headache waking from sleep or worse in the morning\n- Recent head trauma\n- Immunosuppression or known malignancy\n- Persistent vomiting\n\n---\n\n### 6. Confidence Level\n\n**Confidence Level:** 70%  \n- Confidence is moderate due to the very limited clinical information provided. A thorough history and physical examination are required for a more definitive assessment.\n\n---\n\n**Note:**  \nThis analysis is based on the information provided. A face-to-face evaluation by a healthcare professional is essential for accurate diagnosis and management. If any red flags are present, seek urgent medical attention.', NULL, NULL, NULL, NULL, 992, NULL, '2025-09-08 05:18:57', NULL, 98),
(28, 53, '44', 'headache', '**Patient Information:**  \nName: Mr Patient  \nAge: 13 years  \nGender: Male  \nMedical History: Not specified (text \"dfgdfg\" is non-informative)\n\n**Presenting Symptom:**  \nHeadache\n\n---\n\n### 1. Potential Differential Diagnoses\n\nIn a 13-year-old male with headache and no further history provided, consider the following common and serious causes:\n\n- **Primary Headache Disorders:**\n  - Migraine (with or without aura)\n  - Tension-type headache\n  - Cluster headache (less common in this age group)\n\n- **Secondary Headache Causes:**\n  - Viral or bacterial infection (e.g., sinusitis, upper respiratory tract infection, meningitis)\n  - Medication overuse headache\n  - Head trauma/concussion\n  - Vision problems (refractive errors, eye strain)\n  - Dehydration\n  - Sleep disturbances\n  - Intracranial pathology (e.g., mass lesion, hydrocephalus, idiopathic intracranial hypertension)\n  - Hypertension\n  - Dental issues (e.g., temporomandibular joint dysfunction)\n\n---\n\n### 2. Recommended Diagnostic Tests\n\n**Initial Evaluation:**\n- **History and Physical Examination:**  \n  - Detailed headache history (onset, duration, location, quality, associated symptoms, triggers, relieving factors, family history)\n  - Neurological examination\n  - Vital signs (including blood pressure)\n\n**Further Investigations (if indicated by history/exam):**\n- **Laboratory Tests:**  \n  - CBC, CRP/ESR (if infection or inflammation suspected)\n- **Imaging:**  \n  - Brain MRI or CT (if red flags present or abnormal neurological findings)\n- **Other:**  \n  - Ophthalmologic evaluation (if visual symptoms or papilledema suspected)\n  - Lumbar puncture (if meningitis or raised intracranial pressure suspected)\n\n---\n\n### 3. Urgency Level\n\n**Medium**  \n- Most pediatric headaches are benign, but a thorough assessment is needed to rule out serious causes.\n- Urgency increases to **High** if any red flags (see below) are present.\n\n---\n\n### 4. Key Observations and Clinical Notes\n\n- **Age-appropriate causes:** Migraine and tension-type headaches are common in adolescents.\n- **Lack of detailed history:** Unable to assess chronicity, associated symptoms (e.g., fever, vomiting, photophobia, neck stiffness), or precipitating factors.\n- **No medical history provided:** Unknown risk factors or comorbidities.\n- **No mention of trauma or systemic symptoms.**\n- **No neurological findings provided.**\n\n---\n\n### 5. Red Flags to Watch For\n\nImmediate evaluation is warranted if any of the following are present:\n\n- Sudden, severe (\"worst ever\") headache\n- Headache with fever, neck stiffness, photophobia (meningitis/encephalitis)\n- Altered mental status, seizures, or focal neurological deficits\n- Papilledema or visual changes\n- Headache worse with Valsalva, lying down, or in the morning (raised intracranial pressure)\n- Recent head trauma\n- Persistent vomiting\n- Immunosuppression or known malignancy\n- Age <6 years with new severe headache\n\n---\n\n**Summary:**  \nA 13-year-old male with headache requires a detailed history and physical exam to guide further workup. Most headaches in this age group are benign, but red flags must be excluded. If any concerning features are present, urgent neuroimaging and specialist referral are indicated.\n\n**Recommendation:**  \nConsult a healthcare professional for a comprehensive evaluation. If any red flags develop, seek immediate medical attention.', NULL, NULL, NULL, NULL, 992, NULL, '2025-09-08 05:32:18', NULL, 98),
(29, 53, '44', 'headache', '**Patient Information:**  \nName: Mr Patient  \nAge: 13 years  \nGender: Male  \nMedical History: Not specified (entry \"dfgdfg\" appears non-informative)\n\n**Presenting Symptom:**  \nHeadache\n\n---\n\n### 1. Potential Differential Diagnoses\n\nIn a 13-year-old male presenting with headache, consider the following common and serious causes:\n\n**Primary Headache Disorders:**\n- Migraine (with or without aura)\n- Tension-type headache\n- Cluster headache (less common in this age group)\n\n**Secondary Headache Causes:**\n- Viral or bacterial infection (e.g., sinusitis, upper respiratory tract infection, meningitis)\n- Medication overuse headache\n- Head trauma/concussion\n- Vision problems (refractive errors)\n- Dental issues (e.g., temporomandibular joint dysfunction)\n- Intracranial pathology (e.g., tumor, hydrocephalus, idiopathic intracranial hypertension)\n- Hypertension\n- Dehydration\n\n---\n\n### 2. Recommended Diagnostic Tests\n\n**Initial Evaluation:**\n- Comprehensive history and physical examination, including neurological assessment\n- Vital signs (including blood pressure)\n- Fundoscopic examination (to assess for papilledema)\n\n**Further Investigations (if indicated by history/exam):**\n- CBC, CRP/ESR (if infection or inflammation suspected)\n- Lumbar puncture (if meningitis or subarachnoid hemorrhage suspected)\n- Neuroimaging (CT/MRI brain) if:\n  - Abnormal neurological findings\n  - Sudden onset (\"thunderclap\" headache)\n  - Signs of raised intracranial pressure\n  - Headache awakens patient from sleep or is worse in the morning\n  - New onset severe headache\n- Sinus imaging (if sinusitis suspected)\n- Vision assessment (if visual symptoms present)\n\n---\n\n### 3. Urgency Level\n\n**Medium** (based on current information)\n\n- **Low** if headache is mild, intermittent, with no red flags, and normal exam.\n- **High** if any red flags (see below) are present.\n\n---\n\n### 4. Key Observations and Clinical Notes\n\n- **History:** Onset, duration, location, character, severity, associated symptoms (nausea, vomiting, photophobia, phonophobia, visual changes, neck stiffness, fever, recent trauma, focal neurological deficits, recent illness).\n- **Family history:** Migraine or other headache disorders.\n- **Medication history:** Recent changes, over-the-counter or prescription drugs.\n- **Social history:** School stress, screen time, sleep patterns.\n- **Physical exam:** General appearance, vital signs, neurological exam, fundoscopic exam, sinus tenderness, neck stiffness.\n\n---\n\n### 5. Red Flags to Watch For\n\n- Sudden, severe (\"worst ever\") headache\n- Headache with fever, neck stiffness, photophobia (meningitis)\n- Altered mental status, confusion, seizures\n- Focal neurological deficits (weakness, vision loss, ataxia)\n- Papilledema (signs of raised intracranial pressure)\n- Headache that awakens from sleep or is worse in the morning\n- Recent head trauma\n- Persistent vomiting\n- Immunosuppression or known malignancy\n\n---\n\n**Clinical Note:**  \nGiven the limited information, a thorough history and physical examination are essential to guide further workup. If any red flags are present, urgent evaluation is warranted. Otherwise, outpatient management and monitoring may be appropriate.\n\n**Recommendation:**  \nAdvise prompt evaluation by a healthcare professional to further characterize the headache and rule out serious causes.', NULL, NULL, NULL, NULL, 992, NULL, '2025-09-08 05:33:27', NULL, 98),
(30, 53, '44', 'Headache', '**Patient Analysis: Headache in a 13-year-old Male**\n\n---\n\n**1. Potential Differential Diagnoses**\n\n- **Primary Headache Disorders**\n  - Migraine (with or without aura)\n  - Tension-type headache\n  - Cluster headache (less common in this age group)\n\n- **Secondary Headache Causes**\n  - Sinusitis\n  - Viral or bacterial infection (e.g., upper respiratory tract infection, meningitis)\n  - Medication overuse headache\n  - Refractive error (vision problems)\n  - Trauma (recent head injury)\n  - Intracranial pathology (tumor, hydrocephalus, hemorrhage)\n  - Hypertension\n  - Dental issues (e.g., temporomandibular joint dysfunction)\n  - Dehydration\n\n---\n\n**2. Recommended Diagnostic Tests**\n\n*Initial evaluation should be guided by history and physical examination. Consider the following:*\n\n- **Basic Workup**\n  - Detailed history and neurological examination\n  - Vital signs (including blood pressure)\n  - Fundoscopic examination (for papilledema)\n  - Sinus examination\n\n- **Further Investigations (if indicated by red flags or abnormal findings)**\n  - Neuroimaging (MRI or CT brain) if suspicion of intracranial pathology\n  - Lumbar puncture (if signs of meningitis or subarachnoid hemorrhage)\n  - CBC, CRP/ESR (if infection or inflammation suspected)\n  - Vision assessment (if visual symptoms present)\n\n---\n\n**3. Urgency Level**\n\n- **Medium** (based on current information)\n  - *If only headache is present without red flags or abnormal findings, outpatient evaluation is appropriate.*\n  - *If any red flags are present (see below), urgency increases to High.*\n\n---\n\n**4. Key Observations and Clinical Notes**\n\n- Age and gender: 13-year-old male\n- Symptom: Headache (no further details provided)\n- No past medical history of note (medical history entry appears non-specific)\n- No associated symptoms provided (e.g., fever, neck stiffness, vomiting, visual changes, trauma)\n- No mention of recent illness, trauma, or medication use\n\n*Clinical notes:*\n- A thorough history is essential (onset, duration, location, character, associated symptoms, triggers, family history of migraine, impact on daily activities).\n- Physical and neurological examination is critical to rule out secondary causes.\n\n---\n\n**5. Red Flags to Watch For**\n\n- Sudden, severe (\"thunderclap\") headache\n- Headache with fever, neck stiffness, photophobia (meningitis/encephalitis)\n- Altered mental status, confusion, seizures\n- Focal neurological deficits (weakness, vision loss, ataxia)\n- Papilledema (suggests increased intracranial pressure)\n- Headache worsening with Valsalva, lying down, or in the morning\n- Recent head trauma\n- New onset headache in a patient with cancer or immunosuppression\n- Persistent vomiting\n- Headache that awakens from sleep\n\n---\n\n**Summary:**  \nMr Patient, a 13-year-old male, presents with headache. The differential is broad and includes primary and secondary causes. The urgency is medium unless red flags are present. A detailed history and examination are essential to guide further workup. Immediate attention is warranted if any red flags develop.\n\n**Recommendation:**  \nAdvise prompt evaluation by a healthcare professional for further assessment and management.', 'sinus', '', 'Certainly. Based on the information provided—including the clinical input of \"sinus\"—the most likely diagnosis is **acute sinusitis** (rhinosinusitis) as the cause of headache in this 13-year-old male. Below is a comprehensive, evidence-based treatment plan:\n\n---\n\n### 1. Primary Diagnosis\n\n**Acute Sinusitis (Acute Rhinosinusitis)**\n\n---\n\n### 2. Treatment Goals\n\n- Relieve headache and sinus symptoms\n- Eradicate infection (if bacterial)\n- Prevent complications (e.g., orbital or intracranial spread)\n- Restore normal sinus function\n- Minimize unnecessary antibiotic use\n\n---\n\n### 3. Medication Recommendations\n\n#### a. **First-line: Symptomatic Management**\n- **Analgesics/Antipyretics:**  \n  - *Acetaminophen* 10–15 mg/kg/dose every 4–6 hours as needed (max 75 mg/kg/day)\n  - *Ibuprofen* 5–10 mg/kg/dose every 6–8 hours as needed (max 40 mg/kg/day)\n\n- **Nasal Saline Irrigation:**  \n  - Isotonic saline nasal spray or irrigation 2–3 times daily\n\n- **Intranasal Corticosteroids** (if significant nasal congestion or allergic rhinitis):  \n  - *Fluticasone nasal spray* 1–2 sprays per nostril once daily\n\n#### b. **Antibiotics**  \n*Indicated only if:*\n- Symptoms persist >10 days without improvement\n- Severe symptoms (fever ≥39°C, purulent nasal discharge, facial pain) for ≥3 consecutive days\n- Worsening symptoms after initial improvement (\"double sickening\")\n\n**First-line antibiotic:**\n- *Amoxicillin-clavulanate* 45 mg/kg/day (amoxicillin component) divided every 12 hours for 10 days  \n  - If non-severe penicillin allergy: *Cefdinir* 14 mg/kg/day in 1–2 doses for 10 days  \n  - If severe allergy: *Levofloxacin* 10–20 mg/kg/day once daily for 10 days\n\n**Note:** Do not use macrolides due to resistance.\n\n---\n\n### 4. Non-Pharmacological Interventions\n\n- Encourage adequate hydration\n- Warm compresses over sinuses for pain relief\n- Rest\n- Avoid exposure to irritants (smoke, strong odors)\n- Humidified air (cool mist humidifier in bedroom)\n\n---\n\n### 5. Follow-up Schedule\n\n- **Routine:** Reassess in 48–72 hours if symptoms worsen or fail to improve\n- **Earlier:** Immediate evaluation if red flag symptoms develop (see below)\n- **After antibiotics:** Re-evaluate at end of course if not fully resolved\n\n---\n\n### 6. Monitoring Parameters\n\n- Symptom resolution (headache, nasal congestion, discharge, facial pain)\n- Temperature (fever resolution)\n- Adverse effects of medications (GI upset, rash, allergic reaction)\n- Signs of complications (see below)\n\n---\n\n### 7. Patient Education Points\n\n- Most sinus infections are viral and resolve without antibiotics\n- Use antibiotics only as prescribed; complete the full course if started\n- Proper technique for nasal saline irrigation\n- Recognize and report red flag symptoms promptly\n- Avoid overuse of decongestants (risk of rebound congestion)\n- Maintain good hand hygiene to prevent spread of infection\n\n---\n\n### 8. Potential Complications to Watch For\n\n- **Orbital complications:** Periorbital swelling, erythema, visual changes, ophthalmoplegia\n- **Intracranial complications:** Severe headache, altered mental status, persistent vomiting, neck stiffness, seizures\n- **Chronic sinusitis:** Symptoms >12 weeks\n- **Antibiotic adverse reactions:** Rash, diarrhea, anaphylaxis\n\n---\n\n**Summary:**  \nMr Patient likely has acute sinusitis. Begin with symptomatic management; reserve antibiotics for persistent, severe, or worsening symptoms. Educate on red flags and ensure close follow-up. Consult ENT or refer to hospital if complications or red flags arise.\n\n**Always recommend consultation with a healthcare professional for confirmation of diagnosis and ongoing management.**', 'Medications:\n1. Acetaminophen 325 mg - 1 tablet by mouth every 4–6 hours as needed for pain or fever - Maximum 5 doses in 24 hours\n2. Isotonic saline nasal spray - 2 sprays per nostril - 2 to 3 times daily - For 10 days\n3. Fluticasone nasal spray 50 mcg - 1 spray per nostril - Once daily - For 10 days\n\nInstructions:\n- Take acetaminophen with or without food as needed for headache or fever. Do not exceed the maximum daily dose.\n- Use saline nasal spray to help clear nasal congestion.\n- Use fluticasone nasal spray at the same time each day. Shake well before use.\n- Drink plenty of fluids and get adequate rest.\n- Apply a warm compress over the sinuses for pain relief.\n\nPrecautions:\n- Do not use over-the-counter decongestant nasal sprays for more than 3 days to avoid rebound congestion.\n- Seek medical attention if symptoms worsen, do not improve after 10 days, or if you develop severe headache, swelling around the eyes, vision changes, persistent vomiting, neck stiffness, or rash.', 992, 992, '2025-09-08 05:37:00', '2025-09-08 05:38:35', 98);
INSERT INTO `treatment_plans` (`id`, `patient_id`, `doctor_id`, `symptoms`, `symptom_analysis`, `doctor_input`, `test_results`, `treatment_plan`, `prescription`, `created_by`, `updated_by`, `created_at`, `updated_at`, `hospital_id`) VALUES
(31, 53, '44', 'headache', '**Patient Information:**  \nName: Mr Patient  \nAge: 13 years  \nGender: Male  \nMedical History: Not specified (text appears non-informative)\n\n**Presenting Symptom:**  \nHeadache\n\n---\n\n### 1. Potential Differential Diagnoses\n\nIn a 13-year-old male presenting with headache, consider the following common and serious causes:\n\n- **Primary Headache Disorders:**\n  - Migraine (with or without aura)\n  - Tension-type headache\n  - Cluster headache (less common in this age group)\n\n- **Secondary Headache Causes:**\n  - Viral or bacterial infection (e.g., sinusitis, upper respiratory tract infection, meningitis)\n  - Medication overuse or withdrawal\n  - Refractive error (vision problems)\n  - Trauma (concussion, subdural/epidural hematoma)\n  - Intracranial mass or space-occupying lesion (rare, but important to consider)\n  - Hypertension\n  - Dental or temporomandibular joint (TMJ) issues\n  - Dehydration\n\n---\n\n### 2. Recommended Diagnostic Tests\n\n**Initial Evaluation:**\n- **Thorough history and physical examination** (including neurological exam)\n- **Vital signs** (including blood pressure, temperature)\n\n**Further investigations based on clinical suspicion:**\n- **CBC, CRP/ESR** (if infection or inflammation suspected)\n- **Urinalysis** (if systemic symptoms)\n- **Ophthalmologic evaluation** (if visual symptoms)\n- **Neuroimaging (CT/MRI brain):**\n  - If red flags present (see below)\n  - Abnormal neurological findings\n  - Sudden onset (\"thunderclap\" headache)\n  - Headache worsened by Valsalva or position\n- **Lumbar puncture:** If meningitis or subarachnoid hemorrhage suspected and imaging is negative\n\n---\n\n### 3. Urgency Level\n\n**Medium**  \n- Most pediatric headaches are benign, but a careful assessment is required to rule out serious causes.\n- If any red flags are present (see below), urgency increases to **High**.\n\n---\n\n### 4. Key Observations and Clinical Notes\n\n- **History:** Onset, duration, frequency, location, quality, severity, associated symptoms (nausea, vomiting, photophobia, phonophobia, visual changes, fever, neck stiffness, recent trauma, altered mental status)\n- **Family history:** Migraines or neurological disorders\n- **Medication use:** Recent changes, overuse\n- **Social history:** School stress, sleep patterns, screen time, caffeine use\n- **Physical exam:** Full neurological exam, fundoscopic exam (for papilledema), assessment for meningeal signs, sinus tenderness\n\n---\n\n### 5. Red Flags to Watch For\n\n- Sudden, severe (\"worst ever\") headache\n- Headache with fever, neck stiffness, photophobia (meningitis/encephalitis)\n- Altered mental status, confusion, seizures\n- Focal neurological deficits (weakness, vision loss, ataxia)\n- Papilledema (suggests increased intracranial pressure)\n- Headache worsened by lying down, coughing, or Valsalva\n- Recent head trauma\n- Persistent vomiting\n- Headache awakening from sleep or present on awakening\n- Immunosuppression or known malignancy\n\n---\n\n**Summary:**  \nA 13-year-old male with headache requires a thorough history and physical exam to distinguish between primary and secondary causes. Most headaches in this age group are benign, but red flags must be actively sought. If any are present, urgent evaluation and neuroimaging are warranted. Otherwise, outpatient workup and symptomatic management may be appropriate.\n\n**Recommendation:**  \nFurther clinical details are needed. Please consult a healthcare professional for a comprehensive evaluation.', 'migrane', '', 'Certainly. Here is a comprehensive, structured treatment plan for a 13-year-old male diagnosed with **migraine**:\n\n---\n\n## 1. Primary Diagnosis\n\n**Migraine headache** (pediatric/adolescent onset)\n\n---\n\n## 2. Treatment Goals\n\n- Rapid relief of acute migraine attacks\n- Minimize headache frequency, severity, and duration\n- Prevent migraine-related disability (school absence, activity limitation)\n- Reduce reliance on acute medications and prevent medication overuse\n- Identify and manage triggers\n- Monitor for and prevent complications\n\n---\n\n## 3. Medication Recommendations\n\n### a. **Acute (Abortive) Treatment**\n\n**First-line:**\n- **Acetaminophen**: 15 mg/kg/dose PO, max 1000 mg/dose, every 4–6 hours as needed (max 75 mg/kg/day or 4000 mg/day)\n- **Ibuprofen**: 10 mg/kg/dose PO, max 600 mg/dose, every 6–8 hours as needed (max 40 mg/kg/day or 2400 mg/day)\n\n**If inadequate response and diagnosis confirmed:**\n- **Triptans** (approved for pediatric use; age restrictions apply):\n    - **Sumatriptan nasal spray**: 5–20 mg (start with 10 mg), may repeat once after 2 hours if needed (max 40 mg/24h)\n    - **Rizatriptan**: 5 mg PO (for ages 6–17 years, weight-based), may repeat once after 2 hours (max 10 mg/24h)\n\n**Note:** Avoid opioid and barbiturate-containing medications.\n\n### b. **Preventive (Prophylactic) Treatment**\n\nConsider if:\n- ≥4 disabling headaches/month\n- Significant impact on quality of life\n- Poor response to acute therapy\n\n**Options:**\n- **Propranolol**: 10–20 mg PO BID, titrate as needed (max 2–4 mg/kg/day)\n- **Amitriptyline**: 0.25–1 mg/kg PO at bedtime\n- **Topiramate**: 25 mg PO at bedtime, titrate up to 100 mg/day as tolerated\n\n**Selection based on comorbidities, side effect profile, and patient/family preference.**\n\n---\n\n## 4. Non-Pharmacological Interventions\n\n- **Lifestyle modifications:**\n    - Regular sleep schedule\n    - Hydration (adequate fluid intake)\n    - Regular meals, avoid skipping meals\n    - Limit caffeine and screen time\n    - Regular physical activity\n- **Trigger identification and avoidance:** Keep a headache diary\n- **Stress management:** Relaxation techniques, cognitive-behavioral therapy (CBT) if indicated\n- **Biofeedback** (if available)\n- **Education** on early recognition and management of symptoms\n\n---\n\n## 5. Follow-up Schedule\n\n- **Initial follow-up:** 2–4 weeks after starting treatment or sooner if symptoms worsen\n- **Subsequent follow-ups:** Every 3 months if stable, or as clinically indicated\n- **Headache diary review** at each visit\n\n---\n\n## 6. Monitoring Parameters\n\n- **Headache frequency, severity, and duration** (headache diary)\n- **Medication use:** Frequency and response to abortive therapy\n- **Side effects** of medications (e.g., drowsiness, weight changes, mood changes)\n- **Impact on daily activities** (school attendance, participation in activities)\n- **Vital signs** (especially if on beta-blockers)\n- **Growth parameters** (height, weight, BMI)\n\n---\n\n## 7. Patient Education Points\n\n- **Nature of migraine:** Not dangerous, but can be disabling\n- **Importance of early treatment:** Take medication at onset of headache for best effect\n- **Avoid medication overuse:** Limit acute medications to ≤2–3 days/week to prevent rebound headaches\n- **Lifestyle factors:** Emphasize regular routines and trigger avoidance\n- **When to seek urgent care:** If headache is sudden/severe, associated with fever, neck stiffness, confusion, weakness, vision loss, or persistent vomiting\n\n---\n\n## 8. Potential Complications to Watch For\n\n- **Medication overuse headache** (rebound headache)\n- **Adverse effects** of medications (GI upset, sedation, mood changes, weight gain/loss, cognitive effects)\n- **Progression to chronic migraine**\n- **Psychosocial impact:** School absenteeism, anxiety, depression\n- **Development of new or atypical symptoms** (may indicate secondary cause)\n\n---\n\n**Note:**  \nThis plan should be individualized based on the patient’s full history, comorbidities, and response to therapy. All medication dosages should be confirmed and adjusted as appropriate for age and weight. **Consultation with a pediatric neurologist** is recommended for refractory or complex cases.\n\n**Always advise close follow-up and re-evaluation if symptoms change or do not improve.**', NULL, 992, 992, '2025-09-08 05:54:33', '2025-09-08 05:55:43', 98),
(32, 53, '44', 'RIght hand arm muscle pain ', '**Patient Information:**  \nName: Mr Patient  \nAge: 13 years  \nGender: Male  \nMedical History: Not specified (text appears as placeholder)\n\n**Presenting Complaint:**  \nRight hand/arm muscle pain\n\n---\n\n### 1. Potential Differential Diagnoses\n\n- **Muscle strain or overuse injury** (most common in adolescents, especially if involved in sports or physical activity)\n- **Minor trauma or contusion** (history of recent injury, fall, or impact)\n- **Tendinitis or tenosynovitis**\n- **Nerve compression or entrapment** (e.g., carpal tunnel syndrome, though less common at this age)\n- **Infection** (cellulitis, abscess, or myositis—especially if associated with redness, swelling, or fever)\n- **Referred pain** (from cervical radiculopathy or shoulder pathology)\n- **Juvenile idiopathic arthritis** (if associated with joint swelling, morning stiffness)\n- **Compartment syndrome** (rare, but critical to rule out if severe pain, swelling, or neurovascular compromise)\n- **Bone pathology** (e.g., fracture, osteomyelitis, bone tumor—less likely but important to consider)\n\n---\n\n### 2. Recommended Diagnostic Tests\n\n- **Detailed physical examination** (inspection, palpation, range of motion, neurovascular assessment)\n- **Plain X-ray** of the right hand/arm (if trauma suspected or to rule out fracture)\n- **Ultrasound** (if soft tissue injury, abscess, or tenosynovitis suspected)\n- **CBC, ESR, CRP** (if infection or inflammatory process suspected)\n- **MRI** (if persistent, unexplained pain or suspicion of deep tissue involvement)\n- **Nerve conduction studies** (if neuropathic symptoms present)\n\n---\n\n### 3. Urgency Level\n\n- **Low to Medium**  \n  - If pain is mild, no trauma, no systemic symptoms, and no neurovascular compromise.\n- **High**  \n  - If any red flags (see below) are present.\n\n---\n\n### 4. Key Observations and Clinical Notes\n\n- **History:** Onset, duration, character, and location of pain; history of trauma or overuse; associated symptoms (swelling, redness, fever, numbness, weakness).\n- **Examination:** Look for swelling, erythema, warmth, deformity, tenderness, range of motion, and neurovascular status (capillary refill, pulses, sensation, motor function).\n- **Functional impact:** Ability to use the hand/arm, impact on daily activities.\n- **Systemic symptoms:** Fever, malaise, weight loss.\n\n---\n\n### 5. Red Flags to Watch For\n\n- **Severe, unrelenting pain** (especially out of proportion to exam)\n- **Rapidly increasing swelling or tightness** (suggestive of compartment syndrome)\n- **Neurovascular compromise** (numbness, tingling, weakness, pallor, absent pulses)\n- **Signs of infection** (fever, erythema, warmth, fluctuance)\n- **History of significant trauma**\n- **Systemic symptoms** (fever, weight loss, night sweats)\n- **Inability to move fingers/hand or loss of function**\n\n---\n\n**Summary:**  \nRight hand/arm muscle pain in a 13-year-old male is most commonly due to minor trauma or overuse, but a thorough history and examination are essential to rule out more serious causes. Immediate attention is required if any red flags are present. Further workup should be guided by clinical findings.\n\n**Recommendation:**  \nAdvise prompt clinical evaluation to determine the underlying cause and initiate appropriate management.', 'not sure', '', 'Certainly. Below is a comprehensive, structured treatment plan for a 13-year-old male presenting with right hand/arm muscle pain, based on the information provided. This plan assumes no red flags or systemic symptoms are present and that the most likely diagnosis is a **muscle strain or overuse injury**. If further history or examination suggests another etiology, the plan should be adjusted accordingly.\n\n---\n\n## 1. Primary Diagnosis\n\n**Muscle strain or overuse injury** of the right hand/arm  \n*(If new information arises—such as trauma, infection, or neurological symptoms—reassess and update diagnosis.)*\n\n---\n\n## 2. Treatment Goals\n\n- Relieve pain and restore function\n- Prevent further injury\n- Identify and address any underlying or serious pathology\n- Educate patient and family on injury prevention and warning signs\n\n---\n\n## 3. Medication Recommendations\n\n**First-line (if no contraindications):**\n- **Acetaminophen (Paracetamol):**  \n  - Dose: 10–15 mg/kg per dose every 4–6 hours as needed (maximum 75 mg/kg/day, not to exceed 3,000 mg/day)\n- **OR Ibuprofen:**  \n  - Dose: 5–10 mg/kg per dose every 6–8 hours as needed (maximum 40 mg/kg/day, not to exceed 2,400 mg/day)\n- **Duration:** Use for 3–5 days or until pain resolves. Taper as symptoms improve.\n\n**Note:**  \n- Avoid NSAIDs if there is suspicion of fracture, renal impairment, or GI issues.\n- Do not use both acetaminophen and ibuprofen simultaneously unless specifically indicated.\n\n---\n\n## 4. Non-Pharmacological Interventions\n\n- **Rest:** Limit activities that exacerbate pain for 48–72 hours.\n- **Ice:** Apply ice packs to the affected area for 15–20 minutes every 2–3 hours for the first 48 hours.\n- **Compression:** Use an elastic bandage if mild swelling is present (ensure no neurovascular compromise).\n- **Elevation:** Keep the arm elevated above heart level to reduce swelling.\n- **Gentle stretching and range-of-motion exercises:** Begin as pain allows to prevent stiffness.\n- **Physical therapy referral:** If pain persists beyond 1–2 weeks or if there is functional limitation.\n\n---\n\n## 5. Follow-up Schedule\n\n- **Initial follow-up:** 3–5 days to reassess pain, function, and check for any new symptoms.\n- **Further follow-up:** 1–2 weeks if symptoms persist or worsen.\n- **Immediate review:** If any red flags develop (see below).\n\n---\n\n## 6. Monitoring Parameters\n\n- Pain severity and functional status\n- Swelling, redness, or warmth\n- Neurovascular status (sensation, movement, capillary refill)\n- Signs of infection (fever, local erythema, fluctuance)\n- Ability to perform daily activities\n\n---\n\n## 7. Patient Education Points\n\n- Importance of rest and gradual return to activity\n- Proper use of medications (dose, frequency, duration)\n- How to apply ice and compression safely\n- Warning signs that require urgent medical attention:\n  - Severe or worsening pain\n  - Numbness, tingling, or weakness\n  - Inability to move fingers/hand\n  - Swelling, redness, or warmth\n  - Fever or systemic symptoms\n- Avoiding reinjury: warm-up before activities, use proper technique, avoid overuse\n\n---\n\n## 8. Potential Complications to Watch For\n\n- **Compartment syndrome:** Severe pain, swelling, neurovascular compromise (medical emergency)\n- **Infection:** Increasing redness, warmth, swelling, fever\n- **Nerve injury:** Persistent numbness, tingling, or weakness\n- **Chronic pain or loss of function:** If not improving as expected\n- **Missed fracture or underlying pathology:** If pain persists or worsens despite treatment\n\n---\n\n**If any red flags or concerning features develop, or if the diagnosis is uncertain, escalate care and consider further diagnostic workup (imaging, labs, specialist referral).**\n\n---\n\n**Note:**  \nThis plan is for general guidance and should be tailored to the individual patient based on clinical findings and response to initial management. Always consult with a healthcare professional for definitive diagnosis and treatment.', 'Medications:\n1. Ibuprofen 200 mg (tablet or liquid, as appropriate) - Take 1 tablet (or 5–10 mg/kg per dose) by mouth every 6–8 hours as needed for pain - For up to 5 days\n\nInstructions:\n- Take with food to reduce stomach upset.\n- Do not exceed 40 mg/kg per day or 2,400 mg per day (whichever is lower).\n- Use the lowest effective dose for the shortest duration needed.\n- Rest the affected arm and avoid activities that cause pain for 48–72 hours.\n- Apply ice to the painful area for 15–20 minutes every 2–3 hours for the first 48 hours.\n- Elevate the arm above heart level to reduce swelling.\n\nPrecautions:\n- Do not use if you have a history of stomach ulcers, kidney problems, or allergy to ibuprofen.\n- Stop medication and seek medical attention if you develop severe pain, swelling, redness, numbness, tingling, weakness, fever, or if symptoms worsen or do not improve after 5 days.', 992, 992, '2025-09-08 06:10:28', '2025-09-08 06:12:38', 98),
(33, 53, '44', 'Server lower abdomen pain', '**Patient Analysis**\n\n**Patient Information:**  \n- Name: Mr Patient  \n- Age: 13 years  \n- Gender: Male  \n- Medical History: Not specified (text appears as \"dfgdfg\")\n\n**Current Symptom:**  \n- Severe lower abdominal pain\n\n---\n\n### 1. Potential Differential Diagnoses\n\nFor a 13-year-old male with severe lower abdominal pain, consider the following:\n\n- **Acute Appendicitis**  \n  (Most common surgical emergency in this age group; pain often starts periumbilically and migrates to the right lower quadrant)\n- **Testicular Torsion**  \n  (Can present as lower abdominal pain, especially if referred pain; must be ruled out urgently)\n- **Gastroenteritis**  \n  (Usually associated with vomiting/diarrhea)\n- **Constipation/Fecal Impaction**\n- **Urinary Tract Infection (UTI) or Cystitis**\n- **Mesenteric Adenitis**  \n  (Common in children/adolescents, often mimics appendicitis)\n- **Intussusception**  \n  (More common in younger children, but possible)\n- **Inguinal Hernia (incarcerated/strangulated)**\n- **Meckel’s Diverticulitis**\n- **Inflammatory Bowel Disease (IBD)**\n- **Henoch-Schönlein Purpura (HSP)**\n- **Trauma**\n\n---\n\n### 2. Recommended Diagnostic Tests\n\n- **Physical Examination:**  \n  - Abdominal exam (tenderness, rebound, guarding, masses, bowel sounds)\n  - Genital exam (testicular tenderness, swelling, cremasteric reflex)\n- **Laboratory Tests:**  \n  - CBC (leukocytosis)\n  - CRP/ESR (inflammation)\n  - Urinalysis (UTI, hematuria)\n  - Electrolytes, renal function\n- **Imaging:**  \n  - Abdominal ultrasound (appendicitis, intussusception, hernia, testicular torsion)\n  - Scrotal ultrasound with Doppler (if testicular torsion suspected)\n  - Abdominal X-ray (if obstruction/constipation suspected)\n- **Other:**  \n  - Stool studies (if diarrhea present)\n\n---\n\n### 3. Urgency Level\n\n**High**  \n- Severe lower abdominal pain in a 13-year-old male is a potentially surgical emergency.  \n- Immediate evaluation is warranted to rule out appendicitis, testicular torsion, or other acute abdominal conditions.\n\n---\n\n### 4. Key Observations and Clinical Notes\n\n- **Pain characteristics:** Onset, duration, location, migration, severity, associated symptoms (nausea, vomiting, fever, urinary symptoms, constipation/diarrhea)\n- **Associated symptoms:** Vomiting, fever, dysuria, hematuria, scrotal pain/swelling, rash, recent trauma\n- **Past medical/surgical history:** Not provided\n- **Vital signs:** Not provided (tachycardia, hypotension, fever are important)\n- **Physical findings:** Not provided (abdominal tenderness, peritonism, testicular findings)\n\n---\n\n### 5. Red Flags to Watch For\n\n- **Signs of peritonitis:** Rebound tenderness, guarding, rigidity\n- **Hemodynamic instability:** Tachycardia, hypotension, pallor\n- **Testicular pain/swelling:** Absent cremasteric reflex, high-riding testis (testicular torsion)\n- **Persistent vomiting**\n- **Bloody stools or urine**\n- **Severe, worsening, or sudden-onset pain**\n- **Inability to pass urine or stool**\n- **Signs of sepsis:** Fever, altered mental status\n\n---\n\n**Summary:**  \nSevere lower abdominal pain in a 13-year-old male is a high-urgency presentation. Immediate evaluation is required to rule out surgical emergencies such as appendicitis and testicular torsion. Prompt physical examination, laboratory workup, and imaging are recommended. Monitor for red flags and consult pediatric surgery/urology as indicated.\n\n**Note:** This analysis is for informational purposes only. Immediate clinical assessment by a healthcare professional is essential.', NULL, NULL, NULL, NULL, 992, NULL, '2025-09-08 12:29:08', NULL, 98);

-- --------------------------------------------------------

--
-- Table structure for table `usage_logs`
--

CREATE TABLE `usage_logs` (
  `id` int(11) NOT NULL,
  `inventory_item_id` int(11) NOT NULL,
  `department_id` int(11) DEFAULT NULL,
  `used_by_type` enum('doctor','nurse','patient','department','other') NOT NULL,
  `used_by_id` int(11) DEFAULT NULL,
  `patient_id` int(11) DEFAULT NULL,
  `doctor_id` int(11) DEFAULT NULL,
  `quantity_used` int(11) NOT NULL,
  `unit_cost` decimal(10,2) DEFAULT 0.00,
  `total_cost` decimal(15,2) DEFAULT 0.00,
  `usage_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `purpose` varchar(255) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `batch_number` varchar(100) DEFAULT NULL,
  `expiry_date` date DEFAULT NULL,
  `hospital_id` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `created_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `usage_logs`
--

INSERT INTO `usage_logs` (`id`, `inventory_item_id`, `department_id`, `used_by_type`, `used_by_id`, `patient_id`, `doctor_id`, `quantity_used`, `unit_cost`, `total_cost`, `usage_date`, `purpose`, `notes`, `batch_number`, `expiry_date`, `hospital_id`, `created_at`, `created_by`) VALUES
(1, 3, 0, 'nurse', 0, 0, 0, 30, 12.00, 360.00, '2025-08-08 00:38:00', 'sdfsfsdf', 'sdfsdfs', '', '0000-00-00', 98, '2025-08-08 00:38:56', 992),
(2, 2, 0, 'department', 0, 0, 0, 50, 12.00, 600.00, '2025-08-08 00:38:00', 'dfgdfgdfgd', 'fdgdgdfg', '', '0000-00-00', 98, '2025-08-08 00:39:25', 992),
(3, 1, 0, 'doctor', 0, 0, 44, 20, 10.00, 200.00, '2025-08-08 00:39:00', 'dfgfdgfdg', 'dfgfdgdg', '', '0000-00-00', 98, '2025-08-08 00:39:50', 992),
(4, 2, 0, 'nurse', 0, 0, 0, 50, 12.00, 600.00, '2025-09-03 14:40:00', 'Treatment', '', '', '0000-00-00', 98, '2025-09-03 14:41:01', 992);

--
-- Triggers `usage_logs`
--
DELIMITER $$
CREATE TRIGGER `tr_update_stock_on_usage` AFTER INSERT ON `usage_logs` FOR EACH ROW BEGIN
    DECLARE prev_stock INT;
    
    SELECT current_stock INTO prev_stock FROM inventory_items WHERE id = NEW.inventory_item_id;
    
    UPDATE inventory_items 
    SET current_stock = current_stock - NEW.quantity_used,
        updated_at = CURRENT_TIMESTAMP
    WHERE id = NEW.inventory_item_id;
    
    INSERT INTO stock_transactions (
        inventory_item_id, transaction_type, reference_type, reference_id, 
        quantity, unit_cost, total_cost, previous_stock, new_stock, 
        expiry_date, batch_number, hospital_id, created_by
    ) VALUES (
        NEW.inventory_item_id, 'usage', 'usage_log', NEW.id,
        -NEW.quantity_used, NEW.unit_cost, NEW.total_cost,
        prev_stock, prev_stock - NEW.quantity_used,
        NEW.expiry_date, NEW.batch_number,
        NEW.hospital_id, NEW.created_by
    );
END
$$
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` int(11) UNSIGNED NOT NULL,
  `ip_address` varchar(15) NOT NULL,
  `username` varchar(100) NOT NULL,
  `password` varchar(255) NOT NULL,
  `salt` varchar(255) DEFAULT NULL,
  `email` varchar(100) NOT NULL,
  `activation_code` varchar(40) DEFAULT NULL,
  `forgotten_password_code` varchar(40) DEFAULT NULL,
  `forgotten_password_time` int(11) UNSIGNED DEFAULT NULL,
  `remember_code` varchar(40) DEFAULT NULL,
  `created_on` int(11) UNSIGNED NOT NULL,
  `last_login` int(11) UNSIGNED DEFAULT NULL,
  `active` tinyint(1) UNSIGNED DEFAULT NULL,
  `first_name` varchar(50) DEFAULT NULL,
  `last_name` varchar(50) DEFAULT NULL,
  `company` varchar(100) DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `hospital_ion_id` varchar(100) DEFAULT NULL,
  `img_url` varchar(1000) DEFAULT NULL,
  `sidebar` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `ip_address`, `username`, `password`, `salt`, `email`, `activation_code`, `forgotten_password_code`, `forgotten_password_time`, `remember_code`, `created_on`, `last_login`, `active`, `first_name`, `last_name`, `company`, `phone`, `hospital_ion_id`, `img_url`, `sidebar`) VALUES
(1, '127.0.0.1', 'Super Admin', '$2y$08$7.GvR4bJco0I41DMIlz7W.ZITEKIegyT5u8dq8O49ivRMqR4pllUa', '', 'superadmin@hms.com', '', 'eX0.Bq6nP57EuXX4hJkPHO973e7a4c25f1849d3a', 1511432365, 'zCeJpcj78CKqJ4sVxVbxcO', 1268889823, 1756109699, 1, 'Admin', 'istrator', 'ADMIN', '0', NULL, NULL, '1'),
(992, '103.231.162.67', 'Hospital Admin', '$2y$08$s6rD5svVL5NRympXc.90l.oD4plJMIQHcpHnudtyi16Igh/KoLRI2', NULL, 'admin@hms.com', NULL, NULL, NULL, NULL, 1640871501, 1757313741, 1, NULL, NULL, NULL, NULL, NULL, 'uploads/userIcon.png', '1'),
(996, '103.231.162.67', 'Mr. Pharmacist', '$2y$08$JGEE1UKZeSN7FK6FuTE1reXgVih.i3Py5xosfLhAK/UIT3CkjaXyK', NULL, 'pharmacist@hms.com', NULL, NULL, NULL, NULL, 1640872306, 1731305559, 1, NULL, NULL, NULL, NULL, '992', NULL, '1'),
(997, '103.231.162.67', 'Mr. Laboratorist', '$2y$08$O4W9KfNQ0JKuh99pYZ.jau3C1JQjd8EqG4NPwXggI/9EqobywDCY.', NULL, 'laboratorist@hms.com', NULL, NULL, NULL, NULL, 1640872353, 1741462557, 1, NULL, NULL, NULL, NULL, '992', NULL, '1'),
(999, '103.231.162.67', 'Mr. Receptionist', '$2y$08$sV9w5r1M.eMwMwxrtXonvOGy7w43z2HpQg8NGhRTsHW.5EJ85cbIG', NULL, 'receptionist@hms.com', NULL, NULL, NULL, NULL, 1640872489, 1736862380, 1, NULL, NULL, NULL, NULL, '992', NULL, '1'),
(1037, '103.231.162.57', 'Mrs Nurse', '$2y$08$C6PSBOX7nBvbiVexQBxjguVkex.b/WVMzCFDEECBoecnUvj7qAwDi', NULL, 'nurse@hms.com', NULL, NULL, NULL, NULL, 1654758336, 1736862020, 1, NULL, NULL, NULL, NULL, '992', NULL, '1'),
(1065, '103.220.205.33', 'caSoft', '$2y$08$7gyVj4b5836qHiJdysQ6bOxN.qplvFGGvOH4T2y2Z0eZ6RXqX4Kg.', NULL, 'admin@example.commm', NULL, NULL, NULL, NULL, 1681107777, NULL, 1, NULL, NULL, NULL, NULL, '1064', NULL, NULL),
(1067, '103.220.205.33', 'Mr Accountant', '$2y$08$S2ZT0Afx5XCOT4NQt7rEl.aKIkvZ4FClR42l8XSRC02KdClm.7K8C', NULL, 'accountant@hms.com', NULL, NULL, NULL, NULL, 1684289908, 1731305844, 1, NULL, NULL, NULL, NULL, '992', NULL, '1'),
(1070, '110.76.128.101', 'Demo Doctor', '$2y$08$2Qv9zmzHYIfJOb2LJsfQMuwHp3GlPQgshwBeptZ21Os2o08HLVqUq', NULL, 'doctor1@hms.com', NULL, NULL, NULL, NULL, 1700468397, 1700468420, 1, NULL, NULL, NULL, NULL, '1069', NULL, NULL),
(1113, '110.76.128.101', ' Rizvi Mahmud', '$2y$08$Zt4I9GCnzKA9U/Lkz0fbdOXpxCJl/7YvIYBZFcYDBQHz32M9UWJqC', NULL, 'rizvi@example.com', NULL, NULL, NULL, NULL, 1728287982, NULL, 1, NULL, NULL, NULL, NULL, '1112', NULL, NULL),
(1114, '110.76.128.101', 'Dr Rahmatullah', '$2y$08$cDPvjSRd/094Ss1.Esi4NuAx7/Qr.jU/cLpr/.DL6x.k1TT5rvPQW', NULL, 'rahmatullah@example.com', NULL, NULL, NULL, NULL, 1728287982, NULL, 1, NULL, NULL, NULL, NULL, '1112', NULL, NULL),
(1131, '103.77.63.65', 'Mr Doctor', '$2y$08$F0OCioJeQcTvu0IEJKdcmuRKz/GKRBRsarPDU/clDbGpZnm6sEohe', NULL, 'doctor@hms.com', NULL, NULL, NULL, NULL, 1735375563, 1757304029, 1, NULL, NULL, NULL, NULL, '992', NULL, '1'),
(1141, '110.76.128.101', 'Mr Patient', '$2y$08$fsU45XWqyDREnAIsZqNJo.AjStevnDTpKl9jl3g5RFOqjxBvW/R3G', NULL, 'patient@hms.com', NULL, NULL, NULL, NULL, 1736862254, 1756798084, 1, NULL, NULL, NULL, NULL, '992', NULL, '1');

-- --------------------------------------------------------

--
-- Table structure for table `users_groups`
--

CREATE TABLE `users_groups` (
  `id` int(11) UNSIGNED NOT NULL,
  `user_id` int(11) UNSIGNED NOT NULL,
  `group_id` mediumint(8) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

--
-- Dumping data for table `users_groups`
--

INSERT INTO `users_groups` (`id`, `user_id`, `group_id`) VALUES
(1, 1, 1),
(879, 877, 5),
(880, 878, 4),
(881, 879, 6),
(882, 880, 7),
(883, 881, 8),
(884, 882, 3),
(885, 883, 10),
(889, 887, 5),
(890, 888, 4),
(999, 992, 11),
(1001, 994, 4),
(1002, 995, 6),
(1003, 996, 7),
(1004, 997, 8),
(1005, 998, 3),
(1006, 999, 10),
(1008, 1001, 5),
(1010, 1003, 5),
(1011, 1004, 4),
(1012, 1005, 4),
(1013, 1006, 11),
(1015, 1008, 4),
(1016, 1009, 4),
(1017, 1010, 4),
(1018, 1011, 3),
(1019, 1012, 6),
(1020, 1013, 10),
(1021, 1014, 7),
(1022, 1015, 8),
(1023, 1016, 5),
(1024, 1017, 5),
(1025, 1018, 5),
(1026, 1019, 5),
(1027, 1020, 4),
(1028, 1021, 5),
(1029, 1022, 5),
(1030, 1023, 5),
(1031, 1024, 11),
(1032, 1025, 11),
(1033, 1026, 4),
(1034, 1027, 4),
(1035, 1028, 4),
(1036, 1029, 4),
(1037, 1030, 5),
(1038, 1031, 4),
(1039, 1032, 4),
(1040, 1033, 4),
(1041, 1034, 4),
(1042, 1035, 4),
(1043, 1036, 6),
(1044, 1037, 6),
(1045, 1038, 5),
(1046, 1039, 4),
(1047, 1040, 6),
(1048, 1041, 4),
(1049, 1042, 5),
(1050, 1043, 4),
(1051, 1044, 5),
(1052, 1045, 6),
(1053, 1046, 8),
(1054, 1047, 4),
(1055, 1048, 11),
(1056, 1049, 11),
(1057, 1050, 11),
(1058, 1051, 11),
(1059, 1052, 11),
(1060, 1053, 11),
(1061, 1054, 11),
(1062, 1055, 11),
(1063, 1056, 11),
(1064, 1057, 11),
(1065, 1058, 5),
(1066, 1059, 6),
(1067, 1060, 7),
(1068, 1061, 8),
(1069, 1062, 3),
(1070, 1063, 10),
(1071, 1064, 11),
(1072, 1065, 5),
(1073, 1066, 5),
(1074, 1067, 3),
(1075, 1068, 5),
(1076, 1069, 11),
(1077, 1070, 4),
(1078, 1071, 1),
(1079, 1072, 11),
(1080, 1073, 6),
(1081, 1074, 4),
(1082, 1075, 4),
(1083, 1076, 4),
(1084, 1077, 4),
(1085, 1078, 4),
(1086, 1079, 4),
(1087, 1080, 4),
(1088, 1081, 4),
(1089, 1082, 4),
(1090, 1083, 4),
(1091, 1084, 4),
(1092, 1085, 4),
(1093, 1086, 4),
(1094, 1087, 11),
(1095, 1088, 11),
(1096, 1089, 11),
(1097, 1090, 5),
(1098, 1091, 5),
(1099, 1092, 4),
(1100, 1093, 5),
(1101, 1094, 5),
(1102, 1095, 5),
(1103, 1096, 5),
(1104, 1097, 11),
(1105, 1098, 11),
(1106, 1099, 11),
(1107, 1100, 11),
(1108, 1101, 11),
(1109, 1102, 11),
(1110, 1103, 11),
(1111, 1104, 11),
(1112, 1105, 11),
(1113, 1106, 11),
(1114, 1107, 11),
(1115, 1108, 11),
(1116, 1109, 11),
(1117, 1110, 3),
(1118, 1111, 11),
(1119, 1112, 11),
(1120, 1113, 5),
(1121, 1114, 4),
(1122, 1115, 11),
(1123, 1116, 5),
(1124, 1117, 4),
(1125, 1118, 5),
(1126, 1119, 5),
(1127, 1120, 5),
(1128, 1121, 5),
(1129, 1122, 5),
(1130, 1123, 5),
(1131, 1124, 5),
(1132, 1125, 5),
(1133, 1126, 5),
(1134, 1127, 11),
(1135, 1128, 5),
(1136, 1129, 5),
(1137, 1130, 5),
(1138, 1131, 4),
(1139, 1132, 5),
(1140, 1133, 5),
(1141, 1134, 5),
(1142, 1135, 5),
(1143, 1136, 5),
(1144, 1137, 4),
(1145, 1138, 4),
(1146, 1139, 4),
(1147, 1140, 4),
(1148, 1141, 5),
(1149, 1142, 11),
(1150, 1143, 11),
(1151, 1144, 11),
(1152, 1145, 4),
(1153, 1146, 11);

-- --------------------------------------------------------

--
-- Table structure for table `vendor_quotations`
--

CREATE TABLE `vendor_quotations` (
  `id` int(11) NOT NULL,
  `quotation_number` varchar(50) NOT NULL,
  `supplier_id` int(11) NOT NULL,
  `quotation_date` date NOT NULL,
  `validity_date` date DEFAULT NULL,
  `status` enum('draft','sent','received','accepted','rejected','expired') DEFAULT 'draft',
  `total_amount` decimal(15,2) DEFAULT 0.00,
  `tax_amount` decimal(15,2) DEFAULT 0.00,
  `discount_amount` decimal(15,2) DEFAULT 0.00,
  `grand_total` decimal(15,2) DEFAULT 0.00,
  `terms_conditions` text DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `hospital_id` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `created_by` int(11) DEFAULT NULL,
  `updated_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `vendor_quotation_items`
--

CREATE TABLE `vendor_quotation_items` (
  `id` int(11) NOT NULL,
  `quotation_id` int(11) NOT NULL,
  `inventory_item_id` int(11) NOT NULL,
  `quantity` int(11) NOT NULL,
  `unit_price` decimal(10,2) NOT NULL,
  `total_price` decimal(15,2) NOT NULL,
  `delivery_time` varchar(100) DEFAULT NULL,
  `specifications` text DEFAULT NULL,
  `notes` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `vital_signs`
--

CREATE TABLE `vital_signs` (
  `id` int(100) NOT NULL,
  `patient_id` varchar(1000) DEFAULT NULL,
  `bmi_height` varchar(1000) DEFAULT NULL,
  `bmi_weight` varchar(1000) DEFAULT NULL,
  `respiratory_rate` varchar(1000) DEFAULT NULL,
  `oxygen_saturation` varchar(1000) DEFAULT NULL,
  `temperature` varchar(1000) DEFAULT NULL,
  `diastolic_blood_pressure` varchar(1000) DEFAULT NULL,
  `systolic_blood_pressure` varchar(1000) DEFAULT NULL,
  `add_date_time` varchar(1000) DEFAULT NULL,
  `heart_rate` varchar(1000) DEFAULT NULL,
  `hospital_id` varchar(1000) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

--
-- Dumping data for table `vital_signs`
--

INSERT INTO `vital_signs` (`id`, `patient_id`, `bmi_height`, `bmi_weight`, `respiratory_rate`, `oxygen_saturation`, `temperature`, `diastolic_blood_pressure`, `systolic_blood_pressure`, `add_date_time`, `heart_rate`, `hospital_id`) VALUES
(13, '11', '1.01', '1.02', '2', '1', '2', '4', '2', '18-05-2024 20:41:16', '2', '98'),
(14, '44', '1.04', '1.05', '5', '5', '5', '5', '6', '03-11-2024 16:33:15', '5', '98'),
(16, '47', '432', '324', '234', '324', '234', '234', '234', '08-11-2024 17:50:48', '324', '98'),
(17, '47', '234', '24', '24', '234', '43', '24', '42', '08-11-2024 17:52:41', '34', '98'),
(18, '53', '175.26', '68', '16', '96', '37', '90', '130', '07-09-2025 11:07:23', '78', '98');

-- --------------------------------------------------------

--
-- Table structure for table `website_settings`
--

CREATE TABLE `website_settings` (
  `id` int(100) NOT NULL,
  `title` varchar(100) DEFAULT NULL,
  `logo` varchar(100) DEFAULT NULL,
  `address` varchar(500) DEFAULT NULL,
  `phone` varchar(100) DEFAULT NULL,
  `emergency` varchar(100) DEFAULT NULL,
  `support` varchar(100) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `currency` varchar(100) DEFAULT NULL,
  `block_1_text_under_title` varchar(500) DEFAULT NULL,
  `service_block__text_under_title` varchar(500) DEFAULT NULL,
  `doctor_block__text_under_title` varchar(500) DEFAULT NULL,
  `facebook_id` varchar(100) DEFAULT NULL,
  `twitter_id` varchar(100) DEFAULT NULL,
  `google_id` varchar(100) DEFAULT NULL,
  `youtube_id` varchar(100) DEFAULT NULL,
  `skype_id` varchar(100) DEFAULT NULL,
  `x` varchar(100) DEFAULT NULL,
  `twitter_username` varchar(100) DEFAULT NULL,
  `block_img_url` varchar(200) DEFAULT NULL,
  `comment_1` varchar(500) DEFAULT NULL,
  `comment_2` varchar(500) DEFAULT NULL,
  `verified_1` varchar(200) DEFAULT NULL,
  `verified_2` varchar(200) DEFAULT NULL,
  `comment_logo_1` varchar(100) DEFAULT NULL,
  `comment_logo_2` varchar(100) DEFAULT NULL,
  `partner_header_title` varchar(300) DEFAULT NULL,
  `partner_header_description` varchar(500) DEFAULT NULL,
  `section_title_1` varchar(200) DEFAULT NULL,
  `section_title_2` varchar(200) DEFAULT NULL,
  `section_title_3` varchar(200) DEFAULT NULL,
  `section_description_1` varchar(500) DEFAULT NULL,
  `section_description_2` varchar(500) DEFAULT NULL,
  `section_description_3` varchar(500) DEFAULT NULL,
  `section_1_text_1` varchar(500) DEFAULT NULL,
  `section_2_text_1` varchar(500) DEFAULT NULL,
  `section_3_text_1` varchar(500) DEFAULT NULL,
  `section_1_text_2` varchar(500) DEFAULT NULL,
  `section_2_text_2` varchar(500) DEFAULT NULL,
  `section_3_text_2` varchar(500) DEFAULT NULL,
  `section_1_text_3` varchar(500) DEFAULT NULL,
  `section_2_text_3` varchar(500) DEFAULT NULL,
  `section_3_text_3` varchar(500) DEFAULT NULL,
  `partner_image_1` varchar(200) DEFAULT NULL,
  `partner_image_2` varchar(200) DEFAULT NULL,
  `partner_image_3` varchar(200) DEFAULT NULL,
  `market_title` varchar(200) DEFAULT NULL,
  `market_description` varchar(500) DEFAULT NULL,
  `market_button_link` varchar(200) DEFAULT NULL,
  `market_image` varchar(200) DEFAULT NULL,
  `market_commentator_name` varchar(200) DEFAULT NULL,
  `market_commentator_designation` varchar(200) DEFAULT NULL,
  `market_comment` varchar(500) DEFAULT NULL,
  `commentator_profile_image` varchar(200) DEFAULT NULL,
  `commentator_logo_1` varchar(200) DEFAULT NULL,
  `commentator_logo_2` varchar(200) DEFAULT NULL,
  `commentator_logo_3` varchar(200) DEFAULT NULL,
  `team_title` varchar(200) DEFAULT NULL,
  `team_description` varchar(500) DEFAULT NULL,
  `team_button_link` varchar(200) DEFAULT NULL,
  `team_commentator_name` varchar(200) DEFAULT NULL,
  `team_commentator_designation` varchar(200) DEFAULT NULL,
  `team_comment` varchar(500) DEFAULT NULL,
  `team_verified` varchar(200) DEFAULT NULL,
  `team_review_logo` varchar(200) DEFAULT NULL,
  `team_commentator_image` varchar(200) DEFAULT NULL,
  `registration_block_text` varchar(1000) DEFAULT NULL,
  `contact_us` varchar(1000) DEFAULT NULL,
  `contact_us_email` varchar(100) DEFAULT NULL,
  `chat_js` varchar(1000) DEFAULT NULL,
  `google_translation_switch_in_frontend` varchar(100) DEFAULT NULL,
  `language` varchar(100) DEFAULT NULL,
  `question1` text DEFAULT NULL,
  `question2` text DEFAULT NULL,
  `question3` text DEFAULT NULL,
  `question4` text DEFAULT NULL,
  `question5` text DEFAULT NULL,
  `question6` text DEFAULT NULL,
  `question7` text DEFAULT NULL,
  `question8` text DEFAULT NULL,
  `question9` text DEFAULT NULL,
  `answer1` text DEFAULT NULL,
  `answer2` text DEFAULT NULL,
  `answer3` text DEFAULT NULL,
  `answer4` text DEFAULT NULL,
  `answer5` text DEFAULT NULL,
  `answer6` text DEFAULT NULL,
  `answer7` text DEFAULT NULL,
  `answer8` text DEFAULT NULL,
  `answer9` text DEFAULT NULL,
  `tawk_to_status` varchar(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

--
-- Dumping data for table `website_settings`
--

INSERT INTO `website_settings` (`id`, `title`, `logo`, `address`, `phone`, `emergency`, `support`, `email`, `currency`, `block_1_text_under_title`, `service_block__text_under_title`, `doctor_block__text_under_title`, `facebook_id`, `twitter_id`, `google_id`, `youtube_id`, `skype_id`, `x`, `twitter_username`, `block_img_url`, `comment_1`, `comment_2`, `verified_1`, `verified_2`, `comment_logo_1`, `comment_logo_2`, `partner_header_title`, `partner_header_description`, `section_title_1`, `section_title_2`, `section_title_3`, `section_description_1`, `section_description_2`, `section_description_3`, `section_1_text_1`, `section_2_text_1`, `section_3_text_1`, `section_1_text_2`, `section_2_text_2`, `section_3_text_2`, `section_1_text_3`, `section_2_text_3`, `section_3_text_3`, `partner_image_1`, `partner_image_2`, `partner_image_3`, `market_title`, `market_description`, `market_button_link`, `market_image`, `market_commentator_name`, `market_commentator_designation`, `market_comment`, `commentator_profile_image`, `commentator_logo_1`, `commentator_logo_2`, `commentator_logo_3`, `team_title`, `team_description`, `team_button_link`, `team_commentator_name`, `team_commentator_designation`, `team_comment`, `team_verified`, `team_review_logo`, `team_commentator_image`, `registration_block_text`, `contact_us`, `contact_us_email`, `chat_js`, `google_translation_switch_in_frontend`, `language`, `question1`, `question2`, `question3`, `question4`, `question5`, `question6`, `question7`, `question8`, `question9`, `answer1`, `answer2`, `answer3`, `answer4`, `answer5`, `answer6`, `answer7`, `answer8`, `answer9`, `tawk_to_status`) VALUES
(1, 'Hospital Saas', 'uploads/66b9a2ee3f71ae0484e26a7bNew_Project_(1).png', 'Boropool, Rajbari-770001', '556165156131', '+01234567891', '+01234567891', 'zzenofast@gmail.com', '$', NULL, 'Lets see what our recent customer says.', NULL, 'https://www.facebook.com/rizvi.plabon/', 'https://www.twitter.com/casoft/', 'https://www.google.com/casoft/', 'https://www.youtube.com/casoft/', 'https://www.skype.com/casoft/', NULL, 'codearistos/', 'uploads/customer.svg', NULL, NULL, NULL, NULL, 'uploads/8th-illus.png', 'uploads/module-1.jpg', 'Streamlined Hospital Management', 'Empower your practice with our comprehensive hospital SaaS solution—where technology meets  dental expertise.', 'Empower Hospital Practice', 'Automate with Excellence', 'Unmatched Support', 'Maximize clinic efficiency with our customizable hospital               management SaaS. Streamline operations, enhance care, and propel               growth.', 'Elevate your hospital services with our comprehensive automation               tools. Tailored for clinics big and small.', 'Immediate assistance and extensive resources at your fingertips,               ensuring your clinic', 'If you have an active software license, then you will have access to software support. This really is totally open-source software.', 'Accumulative solutions', 'Organize your hospital', 'Flawless Functionality for Hospital Excellence', 'We are providing all the essential professional services of a firm. For example, inventory management system, purchase order management system, supplier report, and cash-flow management system.', 'Customization Facilities', 'Experience unparalleled reliability with our hospital SaaS. We ensure seamless operation, allowing you to focus on patient care without technical distractions.', 'Streamline Your Practice Management', 'This software is 100% customizable. We are prepared to customize predicates on your own business requirements.', 'uploads/module-2.jpg', 'uploads/module-3.jpg', 'uploads/RD-solicita-facilidad-para-adquisicion.jpg', NULL, NULL, NULL, 'uploads/RD-solicita-facilidad-para-adquisicion1.jpg', NULL, NULL, NULL, 'uploads/photo-1503023345310-bd7c1de61c7d1.jpg', 'uploads/astana.jpg', 'uploads/innnn.jpg', 'uploads/unbounce.jpg', 'Why Choose Our Product?', 'We are providing the most perfect service for you, and our priority is the customer', 'How long do I get support?', 'Engineered for performance', 'Our platform', NULL, NULL, 'uploads/15548217993981.jpg', 'uploads/png-transparent-junior-chamber-international-jci-malaysia-secretariat-organization-united-states-junior-chamber-business-business-blue-text-trademark.png', NULL, 'Contact With Us', NULL, 'Tawk Chat Embed Link', 'yes', NULL, 'Responsive Website', 'Android Apps', 'Admin Panel', 'Administrative Module', 'https://codearistos.net/dev/hmz/frontend', 'Doctor Module', 'https://codearistos.net/dev/hmz/frontend', 'Accountants Module', 'https://codearistos.net/dev/hmz/frontend', 'We have arranged a fully responsive SEO optimized dynamic website. This website ensures your online presence & people will be able to make an online appointment through the website.', 'In today', 'With this software, you can get a superpower administrative module that can provide you an ultimate system of management. In this software, you can create 8 kinds of accounts like doctors, nurses, pharmacists, accountant, laboratorian, receptionist, representative, case managers by using the admin panel, and also can specify their responsibilities separately. As well as, this software has a separate dashboard for each account.', 'We have designed the administrative module for a hospital owner or the person who is accountable to operate the entire hospital smoothly. Using this module, you can manage the entire system easily and efficiently. Because this module includes every important feature like doctors portal, patient portal, appointment scheduling, prescription management, human resource management, bed management, employee, accounts, software settings, role assigning, etc.', 'https://codearistos.net/dev/hmz/frontend', 'A doctor is the most important person to ensure the health condition of any patient. For this purpose, this software has a doctor module. Using this module, doctors can access all important functions that belong to them. As a result, they can maintain patient portals, appointment scheduling & maintaining, prescription making, and any other things that are related to hospital activities.', 'https://codearistos.net/dev/hmz/frontend', 'Accountants are responsible to control monetary flow, profit-and- loss calculation. Patients are considered the main factor of this software. Moreover, they are the key earning source of this system. So this module allows access to the patient portal. Besides, the Accountant module also has the access account creation option, like debit or credit account based on expense and earning, employee name, and billing. With this software, you can get a complete clinic management system that helps to understand both technical or non-technical people.', 'https://codearistos.net/dev/hmz/frontend', 'no');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `accountant`
--
ALTER TABLE `accountant`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `advice`
--
ALTER TABLE `advice`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `ai_image_analyses`
--
ALTER TABLE `ai_image_analyses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `patient_id` (`patient_id`),
  ADD KEY `doctor_id` (`doctor_id`),
  ADD KEY `hospital_id` (`hospital_id`),
  ADD KEY `created_by` (`created_by`),
  ADD KEY `updated_by` (`updated_by`),
  ADD KEY `image_type` (`image_type`),
  ADD KEY `created_at` (`created_at`);

--
-- Indexes for table `ai_patient_overviews`
--
ALTER TABLE `ai_patient_overviews`
  ADD PRIMARY KEY (`id`),
  ADD KEY `patient_id` (`patient_id`),
  ADD KEY `doctor_id` (`doctor_id`),
  ADD KEY `hospital_id` (`hospital_id`),
  ADD KEY `created_by` (`created_by`),
  ADD KEY `updated_by` (`updated_by`),
  ADD KEY `created_at` (`created_at`);

--
-- Indexes for table `alloted_bed`
--
ALTER TABLE `alloted_bed`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `appointment`
--
ALTER TABLE `appointment`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `attendance`
--
ALTER TABLE `attendance`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `autoemailshortcode`
--
ALTER TABLE `autoemailshortcode`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `autoemailtemplate`
--
ALTER TABLE `autoemailtemplate`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `autosmsshortcode`
--
ALTER TABLE `autosmsshortcode`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `autosmstemplate`
--
ALTER TABLE `autosmstemplate`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `bankb`
--
ALTER TABLE `bankb`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `bed`
--
ALTER TABLE `bed`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `bed_category`
--
ALTER TABLE `bed_category`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `bed_checkout`
--
ALTER TABLE `bed_checkout`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `bed_diagnostic`
--
ALTER TABLE `bed_diagnostic`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `bed_medicine`
--
ALTER TABLE `bed_medicine`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `bed_service`
--
ALTER TABLE `bed_service`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `blood_group`
--
ALTER TABLE `blood_group`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `category`
--
ALTER TABLE `category`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `chat`
--
ALTER TABLE `chat`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `daily_progress`
--
ALTER TABLE `daily_progress`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `department`
--
ALTER TABLE `department`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `diagnosis`
--
ALTER TABLE `diagnosis`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `diagnostic_report`
--
ALTER TABLE `diagnostic_report`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `doctor`
--
ALTER TABLE `doctor`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `doctor_visit`
--
ALTER TABLE `doctor_visit`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `donor`
--
ALTER TABLE `donor`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `draft_payment`
--
ALTER TABLE `draft_payment`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `email`
--
ALTER TABLE `email`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `email_settings`
--
ALTER TABLE `email_settings`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `emergency`
--
ALTER TABLE `emergency`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `expense`
--
ALTER TABLE `expense`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `expense_category`
--
ALTER TABLE `expense_category`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `facilitie`
--
ALTER TABLE `facilitie`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `faq`
--
ALTER TABLE `faq`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `featured`
--
ALTER TABLE `featured`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `file`
--
ALTER TABLE `file`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `folder`
--
ALTER TABLE `folder`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `gallery`
--
ALTER TABLE `gallery`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `google_captcha`
--
ALTER TABLE `google_captcha`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `gpt_memory`
--
ALTER TABLE `gpt_memory`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `grid`
--
ALTER TABLE `grid`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `groups`
--
ALTER TABLE `groups`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `holidays`
--
ALTER TABLE `holidays`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `hospital`
--
ALTER TABLE `hospital`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `hospital_deposit`
--
ALTER TABLE `hospital_deposit`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `hospital_payment`
--
ALTER TABLE `hospital_payment`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `insurance_company`
--
ALTER TABLE `insurance_company`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `inventory_categories`
--
ALTER TABLE `inventory_categories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_hospital_id` (`hospital_id`),
  ADD KEY `idx_parent_id` (`parent_id`),
  ADD KEY `idx_status` (`status`);

--
-- Indexes for table `inventory_items`
--
ALTER TABLE `inventory_items`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_item_code_hospital` (`item_code`,`hospital_id`),
  ADD KEY `idx_hospital_id` (`hospital_id`),
  ADD KEY `idx_category` (`category`),
  ADD KEY `idx_status` (`status`),
  ADD KEY `idx_current_stock` (`current_stock`),
  ADD KEY `idx_reorder_level` (`reorder_level`),
  ADD KEY `idx_name` (`name`),
  ADD KEY `idx_barcode` (`barcode`),
  ADD KEY `idx_inventory_items_code_hospital` (`item_code`,`hospital_id`);

--
-- Indexes for table `lab`
--
ALTER TABLE `lab`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `laboratorist`
--
ALTER TABLE `laboratorist`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `lab_category`
--
ALTER TABLE `lab_category`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `language`
--
ALTER TABLE `language`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `leaves`
--
ALTER TABLE `leaves`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `leave_type`
--
ALTER TABLE `leave_type`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `login_attempts`
--
ALTER TABLE `login_attempts`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `logs`
--
ALTER TABLE `logs`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `macro`
--
ALTER TABLE `macro`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `manualemailshortcode`
--
ALTER TABLE `manualemailshortcode`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `manualsmsshortcode`
--
ALTER TABLE `manualsmsshortcode`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `manual_email_template`
--
ALTER TABLE `manual_email_template`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `manual_sms_template`
--
ALTER TABLE `manual_sms_template`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `medical_history`
--
ALTER TABLE `medical_history`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `medicine`
--
ALTER TABLE `medicine`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `medicine_batches`
--
ALTER TABLE `medicine_batches`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_batch_medicine_hospital` (`batch_number`,`medicine_id`,`hospital_id`),
  ADD KEY `idx_medicine_id` (`medicine_id`),
  ADD KEY `idx_supplier_id` (`supplier_id`),
  ADD KEY `idx_purchase_item_id` (`purchase_item_id`),
  ADD KEY `idx_hospital_id` (`hospital_id`),
  ADD KEY `idx_expiry_date` (`expiry_date`),
  ADD KEY `idx_status` (`status`),
  ADD KEY `idx_current_stock` (`current_stock`),
  ADD KEY `idx_medicine_batches_expiry_hospital` (`expiry_date`,`hospital_id`);

--
-- Indexes for table `medicine_category`
--
ALTER TABLE `medicine_category`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `medicine_purchases`
--
ALTER TABLE `medicine_purchases`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_po_hospital` (`purchase_order_no`,`hospital_id`),
  ADD KEY `idx_supplier_id` (`supplier_id`),
  ADD KEY `idx_hospital_id` (`hospital_id`),
  ADD KEY `idx_purchase_date` (`purchase_date`),
  ADD KEY `idx_purchase_status` (`purchase_status`),
  ADD KEY `idx_payment_status` (`payment_status`),
  ADD KEY `idx_medicine_purchases_po_hospital` (`purchase_order_no`,`hospital_id`);

--
-- Indexes for table `medicine_purchase_items`
--
ALTER TABLE `medicine_purchase_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_purchase_id` (`purchase_id`),
  ADD KEY `idx_medicine_id` (`medicine_id`),
  ADD KEY `idx_batch_number` (`batch_number`),
  ADD KEY `idx_expiry_date` (`expiry_date`);

--
-- Indexes for table `medicine_purchase_payments`
--
ALTER TABLE `medicine_purchase_payments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_purchase_id` (`purchase_id`),
  ADD KEY `idx_hospital_id` (`hospital_id`),
  ADD KEY `idx_payment_date` (`payment_date`),
  ADD KEY `idx_status` (`status`);

--
-- Indexes for table `medicine_stock_movements`
--
ALTER TABLE `medicine_stock_movements`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_medicine_id` (`medicine_id`),
  ADD KEY `idx_batch_id` (`batch_id`),
  ADD KEY `idx_hospital_id` (`hospital_id`),
  ADD KEY `idx_movement_type` (`movement_type`),
  ADD KEY `idx_movement_date` (`movement_date`),
  ADD KEY `idx_reference` (`reference_type`,`reference_id`),
  ADD KEY `idx_medicine_stock_movements_date_hospital` (`movement_date`,`hospital_id`);

--
-- Indexes for table `medicine_suppliers`
--
ALTER TABLE `medicine_suppliers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_hospital_id` (`hospital_id`),
  ADD KEY `idx_status` (`status`),
  ADD KEY `idx_name` (`name`),
  ADD KEY `idx_medicine_suppliers_name_hospital` (`name`,`hospital_id`);

--
-- Indexes for table `meeting`
--
ALTER TABLE `meeting`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `meeting_settings`
--
ALTER TABLE `meeting_settings`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `module`
--
ALTER TABLE `module`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `notice`
--
ALTER TABLE `notice`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `nurse`
--
ALTER TABLE `nurse`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `odontogram`
--
ALTER TABLE `odontogram`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `ot_payment`
--
ALTER TABLE `ot_payment`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `package`
--
ALTER TABLE `package`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `patient`
--
ALTER TABLE `patient`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `patient_deposit`
--
ALTER TABLE `patient_deposit`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `patient_material`
--
ALTER TABLE `patient_material`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `payment`
--
ALTER TABLE `payment`
  ADD PRIMARY KEY (`id`),
  ADD KEY `hospital_id` (`hospital_id`),
  ADD KEY `id` (`id`),
  ADD KEY `hospital_id_2` (`hospital_id`);

--
-- Indexes for table `paymentGateway`
--
ALTER TABLE `paymentGateway`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `payment_category`
--
ALTER TABLE `payment_category`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `payroll`
--
ALTER TABLE `payroll`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `pharmacist`
--
ALTER TABLE `pharmacist`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `pharmacy_expense`
--
ALTER TABLE `pharmacy_expense`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `pharmacy_expense_category`
--
ALTER TABLE `pharmacy_expense_category`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `pharmacy_payment`
--
ALTER TABLE `pharmacy_payment`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `pharmacy_payment_category`
--
ALTER TABLE `pharmacy_payment_category`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `prescription`
--
ALTER TABLE `prescription`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `pservice`
--
ALTER TABLE `pservice`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `purchase_orders`
--
ALTER TABLE `purchase_orders`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_po_number_hospital` (`po_number`,`hospital_id`),
  ADD KEY `idx_supplier_id` (`supplier_id`),
  ADD KEY `idx_hospital_id` (`hospital_id`),
  ADD KEY `idx_status` (`status`),
  ADD KEY `idx_order_date` (`order_date`),
  ADD KEY `idx_purchase_orders_number_hospital` (`po_number`,`hospital_id`);

--
-- Indexes for table `purchase_order_items`
--
ALTER TABLE `purchase_order_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_purchase_order_id` (`purchase_order_id`),
  ADD KEY `idx_inventory_item_id` (`inventory_item_id`);

--
-- Indexes for table `receptionist`
--
ALTER TABLE `receptionist`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `report`
--
ALTER TABLE `report`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `request`
--
ALTER TABLE `request`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `review`
--
ALTER TABLE `review`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `salary`
--
ALTER TABLE `salary`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `service`
--
ALTER TABLE `service`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `settings`
--
ALTER TABLE `settings`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `site_featured`
--
ALTER TABLE `site_featured`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `site_gallery`
--
ALTER TABLE `site_gallery`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `site_grid`
--
ALTER TABLE `site_grid`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `site_map`
--
ALTER TABLE `site_map`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `site_review`
--
ALTER TABLE `site_review`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `site_service`
--
ALTER TABLE `site_service`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `site_settings`
--
ALTER TABLE `site_settings`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `site_slide`
--
ALTER TABLE `site_slide`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `slide`
--
ALTER TABLE `slide`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `sms`
--
ALTER TABLE `sms`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `sms_settings`
--
ALTER TABLE `sms_settings`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `stock_transactions`
--
ALTER TABLE `stock_transactions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_inventory_item_id` (`inventory_item_id`),
  ADD KEY `idx_transaction_type` (`transaction_type`),
  ADD KEY `idx_hospital_id` (`hospital_id`),
  ADD KEY `idx_transaction_date` (`transaction_date`),
  ADD KEY `idx_reference` (`reference_type`,`reference_id`),
  ADD KEY `idx_stock_transactions_date_hospital` (`transaction_date`,`hospital_id`);

--
-- Indexes for table `superadmin`
--
ALTER TABLE `superadmin`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `suppliers`
--
ALTER TABLE `suppliers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_hospital_id` (`hospital_id`),
  ADD KEY `idx_status` (`status`),
  ADD KEY `idx_name` (`name`),
  ADD KEY `idx_suppliers_name_hospital` (`name`,`hospital_id`);

--
-- Indexes for table `symptom`
--
ALTER TABLE `symptom`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `template`
--
ALTER TABLE `template`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `testpkz`
--
ALTER TABLE `testpkz`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `time_schedule`
--
ALTER TABLE `time_schedule`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `time_slot`
--
ALTER TABLE `time_slot`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `transaction_logs`
--
ALTER TABLE `transaction_logs`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `treatment`
--
ALTER TABLE `treatment`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `treatment_plans`
--
ALTER TABLE `treatment_plans`
  ADD PRIMARY KEY (`id`),
  ADD KEY `patient_id` (`patient_id`),
  ADD KEY `created_by` (`created_by`),
  ADD KEY `updated_by` (`updated_by`),
  ADD KEY `hospital_id` (`hospital_id`);

--
-- Indexes for table `usage_logs`
--
ALTER TABLE `usage_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_inventory_item_id` (`inventory_item_id`),
  ADD KEY `idx_hospital_id` (`hospital_id`),
  ADD KEY `idx_usage_date` (`usage_date`),
  ADD KEY `idx_used_by` (`used_by_type`,`used_by_id`),
  ADD KEY `idx_patient_id` (`patient_id`),
  ADD KEY `idx_doctor_id` (`doctor_id`),
  ADD KEY `idx_department_id` (`department_id`),
  ADD KEY `idx_usage_logs_date_hospital` (`usage_date`,`hospital_id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `users_groups`
--
ALTER TABLE `users_groups`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uc_users_groups` (`user_id`,`group_id`),
  ADD KEY `fk_users_groups_users1_idx` (`user_id`),
  ADD KEY `fk_users_groups_groups1_idx` (`group_id`);

--
-- Indexes for table `vendor_quotations`
--
ALTER TABLE `vendor_quotations`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_quotation_number_hospital` (`quotation_number`,`hospital_id`),
  ADD KEY `idx_supplier_id` (`supplier_id`),
  ADD KEY `idx_hospital_id` (`hospital_id`),
  ADD KEY `idx_status` (`status`),
  ADD KEY `idx_quotation_date` (`quotation_date`);

--
-- Indexes for table `vendor_quotation_items`
--
ALTER TABLE `vendor_quotation_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_quotation_id` (`quotation_id`),
  ADD KEY `idx_inventory_item_id` (`inventory_item_id`);

--
-- Indexes for table `vital_signs`
--
ALTER TABLE `vital_signs`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `website_settings`
--
ALTER TABLE `website_settings`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `accountant`
--
ALTER TABLE `accountant`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `advice`
--
ALTER TABLE `advice`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT for table `ai_image_analyses`
--
ALTER TABLE `ai_image_analyses`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=67;

--
-- AUTO_INCREMENT for table `ai_patient_overviews`
--
ALTER TABLE `ai_patient_overviews`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;

--
-- AUTO_INCREMENT for table `alloted_bed`
--
ALTER TABLE `alloted_bed`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=95;

--
-- AUTO_INCREMENT for table `appointment`
--
ALTER TABLE `appointment`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=449;

--
-- AUTO_INCREMENT for table `attendance`
--
ALTER TABLE `attendance`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=162;

--
-- AUTO_INCREMENT for table `autoemailshortcode`
--
ALTER TABLE `autoemailshortcode`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=74;

--
-- AUTO_INCREMENT for table `autoemailtemplate`
--
ALTER TABLE `autoemailtemplate`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1656;

--
-- AUTO_INCREMENT for table `autosmsshortcode`
--
ALTER TABLE `autosmsshortcode`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=70;

--
-- AUTO_INCREMENT for table `autosmstemplate`
--
ALTER TABLE `autosmstemplate`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=973;

--
-- AUTO_INCREMENT for table `bankb`
--
ALTER TABLE `bankb`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=745;

--
-- AUTO_INCREMENT for table `bed`
--
ALTER TABLE `bed`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `bed_category`
--
ALTER TABLE `bed_category`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `bed_checkout`
--
ALTER TABLE `bed_checkout`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25;

--
-- AUTO_INCREMENT for table `bed_diagnostic`
--
ALTER TABLE `bed_diagnostic`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=105;

--
-- AUTO_INCREMENT for table `bed_medicine`
--
ALTER TABLE `bed_medicine`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=159;

--
-- AUTO_INCREMENT for table `bed_service`
--
ALTER TABLE `bed_service`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=92;

--
-- AUTO_INCREMENT for table `blood_group`
--
ALTER TABLE `blood_group`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `category`
--
ALTER TABLE `category`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `chat`
--
ALTER TABLE `chat`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `daily_progress`
--
ALTER TABLE `daily_progress`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;

--
-- AUTO_INCREMENT for table `department`
--
ALTER TABLE `department`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31;

--
-- AUTO_INCREMENT for table `diagnosis`
--
ALTER TABLE `diagnosis`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;

--
-- AUTO_INCREMENT for table `diagnostic_report`
--
ALTER TABLE `diagnostic_report`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `doctor`
--
ALTER TABLE `doctor`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=50;

--
-- AUTO_INCREMENT for table `doctor_visit`
--
ALTER TABLE `doctor_visit`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20;

--
-- AUTO_INCREMENT for table `donor`
--
ALTER TABLE `donor`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `draft_payment`
--
ALTER TABLE `draft_payment`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24;

--
-- AUTO_INCREMENT for table `email`
--
ALTER TABLE `email`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;

--
-- AUTO_INCREMENT for table `email_settings`
--
ALTER TABLE `email_settings`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=360;

--
-- AUTO_INCREMENT for table `emergency`
--
ALTER TABLE `emergency`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `expense`
--
ALTER TABLE `expense`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=43;

--
-- AUTO_INCREMENT for table `expense_category`
--
ALTER TABLE `expense_category`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `facilitie`
--
ALTER TABLE `facilitie`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;

--
-- AUTO_INCREMENT for table `faq`
--
ALTER TABLE `faq`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `featured`
--
ALTER TABLE `featured`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `file`
--
ALTER TABLE `file`
  MODIFY `id` int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `folder`
--
ALTER TABLE `folder`
  MODIFY `id` int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=110;

--
-- AUTO_INCREMENT for table `gallery`
--
ALTER TABLE `gallery`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `google_captcha`
--
ALTER TABLE `google_captcha`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `gpt_memory`
--
ALTER TABLE `gpt_memory`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `grid`
--
ALTER TABLE `grid`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `groups`
--
ALTER TABLE `groups`
  MODIFY `id` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `holidays`
--
ALTER TABLE `holidays`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `hospital`
--
ALTER TABLE `hospital`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=140;

--
-- AUTO_INCREMENT for table `hospital_deposit`
--
ALTER TABLE `hospital_deposit`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=115;

--
-- AUTO_INCREMENT for table `hospital_payment`
--
ALTER TABLE `hospital_payment`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=94;

--
-- AUTO_INCREMENT for table `insurance_company`
--
ALTER TABLE `insurance_company`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `inventory_categories`
--
ALTER TABLE `inventory_categories`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;

--
-- AUTO_INCREMENT for table `inventory_items`
--
ALTER TABLE `inventory_items`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `lab`
--
ALTER TABLE `lab`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=904;

--
-- AUTO_INCREMENT for table `laboratorist`
--
ALTER TABLE `laboratorist`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `lab_category`
--
ALTER TABLE `lab_category`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=128;

--
-- AUTO_INCREMENT for table `language`
--
ALTER TABLE `language`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT for table `leaves`
--
ALTER TABLE `leaves`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `leave_type`
--
ALTER TABLE `leave_type`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `login_attempts`
--
ALTER TABLE `login_attempts`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=258;

--
-- AUTO_INCREMENT for table `logs`
--
ALTER TABLE `logs`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2142;

--
-- AUTO_INCREMENT for table `macro`
--
ALTER TABLE `macro`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;

--
-- AUTO_INCREMENT for table `manualemailshortcode`
--
ALTER TABLE `manualemailshortcode`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `manualsmsshortcode`
--
ALTER TABLE `manualsmsshortcode`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `manual_email_template`
--
ALTER TABLE `manual_email_template`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;

--
-- AUTO_INCREMENT for table `manual_sms_template`
--
ALTER TABLE `manual_sms_template`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `medical_history`
--
ALTER TABLE `medical_history`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=151;

--
-- AUTO_INCREMENT for table `medicine`
--
ALTER TABLE `medicine`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=36;

--
-- AUTO_INCREMENT for table `medicine_batches`
--
ALTER TABLE `medicine_batches`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `medicine_category`
--
ALTER TABLE `medicine_category`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `medicine_purchases`
--
ALTER TABLE `medicine_purchases`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `medicine_purchase_items`
--
ALTER TABLE `medicine_purchase_items`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `medicine_purchase_payments`
--
ALTER TABLE `medicine_purchase_payments`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `medicine_stock_movements`
--
ALTER TABLE `medicine_stock_movements`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;

--
-- AUTO_INCREMENT for table `medicine_suppliers`
--
ALTER TABLE `medicine_suppliers`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `meeting`
--
ALTER TABLE `meeting`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;

--
-- AUTO_INCREMENT for table `meeting_settings`
--
ALTER TABLE `meeting_settings`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `module`
--
ALTER TABLE `module`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `notice`
--
ALTER TABLE `notice`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `nurse`
--
ALTER TABLE `nurse`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `odontogram`
--
ALTER TABLE `odontogram`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=26;

--
-- AUTO_INCREMENT for table `ot_payment`
--
ALTER TABLE `ot_payment`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `package`
--
ALTER TABLE `package`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `patient`
--
ALTER TABLE `patient`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=54;

--
-- AUTO_INCREMENT for table `patient_deposit`
--
ALTER TABLE `patient_deposit`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=409;

--
-- AUTO_INCREMENT for table `patient_material`
--
ALTER TABLE `patient_material`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=50;

--
-- AUTO_INCREMENT for table `payment`
--
ALTER TABLE `payment`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=666;

--
-- AUTO_INCREMENT for table `paymentGateway`
--
ALTER TABLE `paymentGateway`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=595;

--
-- AUTO_INCREMENT for table `payment_category`
--
ALTER TABLE `payment_category`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=87;

--
-- AUTO_INCREMENT for table `payroll`
--
ALTER TABLE `payroll`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=105;

--
-- AUTO_INCREMENT for table `pharmacist`
--
ALTER TABLE `pharmacist`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `pharmacy_expense`
--
ALTER TABLE `pharmacy_expense`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `pharmacy_expense_category`
--
ALTER TABLE `pharmacy_expense_category`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `pharmacy_payment`
--
ALTER TABLE `pharmacy_payment`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;

--
-- AUTO_INCREMENT for table `pharmacy_payment_category`
--
ALTER TABLE `pharmacy_payment_category`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `prescription`
--
ALTER TABLE `prescription`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=46;

--
-- AUTO_INCREMENT for table `pservice`
--
ALTER TABLE `pservice`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;

--
-- AUTO_INCREMENT for table `purchase_orders`
--
ALTER TABLE `purchase_orders`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `purchase_order_items`
--
ALTER TABLE `purchase_order_items`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `receptionist`
--
ALTER TABLE `receptionist`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `report`
--
ALTER TABLE `report`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `request`
--
ALTER TABLE `request`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `review`
--
ALTER TABLE `review`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `salary`
--
ALTER TABLE `salary`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `service`
--
ALTER TABLE `service`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `settings`
--
ALTER TABLE `settings`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=155;

--
-- AUTO_INCREMENT for table `site_featured`
--
ALTER TABLE `site_featured`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `site_gallery`
--
ALTER TABLE `site_gallery`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `site_grid`
--
ALTER TABLE `site_grid`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `site_map`
--
ALTER TABLE `site_map`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=140;

--
-- AUTO_INCREMENT for table `site_review`
--
ALTER TABLE `site_review`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `site_service`
--
ALTER TABLE `site_service`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `site_settings`
--
ALTER TABLE `site_settings`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `site_slide`
--
ALTER TABLE `site_slide`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;

--
-- AUTO_INCREMENT for table `slide`
--
ALTER TABLE `slide`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `sms`
--
ALTER TABLE `sms`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `sms_settings`
--
ALTER TABLE `sms_settings`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=561;

--
-- AUTO_INCREMENT for table `stock_transactions`
--
ALTER TABLE `stock_transactions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `superadmin`
--
ALTER TABLE `superadmin`
  MODIFY `id` int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;

--
-- AUTO_INCREMENT for table `suppliers`
--
ALTER TABLE `suppliers`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `symptom`
--
ALTER TABLE `symptom`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=62;

--
-- AUTO_INCREMENT for table `template`
--
ALTER TABLE `template`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=32;

--
-- AUTO_INCREMENT for table `testpkz`
--
ALTER TABLE `testpkz`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `time_schedule`
--
ALTER TABLE `time_schedule`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=46;

--
-- AUTO_INCREMENT for table `time_slot`
--
ALTER TABLE `time_slot`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=850;

--
-- AUTO_INCREMENT for table `transaction_logs`
--
ALTER TABLE `transaction_logs`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=630;

--
-- AUTO_INCREMENT for table `treatment`
--
ALTER TABLE `treatment`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;

--
-- AUTO_INCREMENT for table `treatment_plans`
--
ALTER TABLE `treatment_plans`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34;

--
-- AUTO_INCREMENT for table `usage_logs`
--
ALTER TABLE `usage_logs`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1147;

--
-- AUTO_INCREMENT for table `users_groups`
--
ALTER TABLE `users_groups`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1154;

--
-- AUTO_INCREMENT for table `vendor_quotations`
--
ALTER TABLE `vendor_quotations`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `vendor_quotation_items`
--
ALTER TABLE `vendor_quotation_items`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `vital_signs`
--
ALTER TABLE `vital_signs`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;

--
-- AUTO_INCREMENT for table `website_settings`
--
ALTER TABLE `website_settings`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

-- --------------------------------------------------------

--
-- Structure for view `low_stock_items`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`democa`@`localhost` SQL SECURITY DEFINER VIEW `low_stock_items`  AS SELECT `i`.`id` AS `id`, `i`.`item_code` AS `item_code`, `i`.`name` AS `name`, `i`.`category` AS `category`, `i`.`current_stock` AS `current_stock`, `i`.`reorder_level` AS `reorder_level`, `i`.`minimum_stock` AS `minimum_stock`, `i`.`unit_cost` AS `unit_cost`, `i`.`hospital_id` AS `hospital_id`, `i`.`reorder_level`- `i`.`current_stock` AS `shortage_quantity` FROM `inventory_items` AS `i` WHERE `i`.`current_stock` <= `i`.`reorder_level` AND `i`.`status` = 'active' ;

-- --------------------------------------------------------

--
-- Structure for view `medicine_expiring_soon`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`democa`@`localhost` SQL SECURITY DEFINER VIEW `medicine_expiring_soon`  AS SELECT `m`.`id` AS `medicine_id`, `m`.`name` AS `medicine_name`, `m`.`generic` AS `generic`, `mb`.`id` AS `batch_id`, `mb`.`batch_number` AS `batch_number`, `mb`.`expiry_date` AS `expiry_date`, `mb`.`current_stock` AS `current_stock`, to_days(`mb`.`expiry_date`) - to_days(curdate()) AS `days_to_expiry`, `mb`.`unit_cost`* `mb`.`current_stock` AS `value_at_risk`, `m`.`hospital_id` AS `hospital_id`, `ms`.`name` AS `supplier_name` FROM ((`medicine` `m` join `medicine_batches` `mb` on(`m`.`id` = `mb`.`medicine_id`)) left join `medicine_suppliers` `ms` on(`mb`.`supplier_id` = `ms`.`id`)) WHERE `mb`.`current_stock` > 0 AND to_days(`mb`.`expiry_date`) - to_days(curdate()) <= 90 AND to_days(`mb`.`expiry_date`) - to_days(curdate()) >= 0 ORDER BY to_days(`mb`.`expiry_date`) - to_days(curdate()) ASC ;

-- --------------------------------------------------------

--
-- Structure for view `medicine_low_stock`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`democa`@`localhost` SQL SECURITY DEFINER VIEW `medicine_low_stock`  AS SELECT `m`.`id` AS `id`, `m`.`name` AS `name`, `m`.`generic` AS `generic`, `m`.`category` AS `category`, `m`.`quantity` AS `current_total_stock`, coalesce(sum(`mb`.`current_stock`),0) AS `total_batch_stock`, count(`mb`.`id`) AS `total_batches`, `m`.`hospital_id` AS `hospital_id` FROM (`medicine` `m` left join `medicine_batches` `mb` on(`m`.`id` = `mb`.`medicine_id` and `mb`.`current_stock` > 0)) GROUP BY `m`.`id` HAVING `current_total_stock` <= 10 ;

-- --------------------------------------------------------

--
-- Structure for view `medicine_stock_with_batches`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`democa`@`localhost` SQL SECURITY DEFINER VIEW `medicine_stock_with_batches`  AS SELECT `m`.`id` AS `medicine_id`, `m`.`name` AS `medicine_name`, `m`.`generic` AS `generic`, `m`.`category` AS `category`, `m`.`company` AS `company`, coalesce(`mb`.`id`,0) AS `batch_id`, coalesce(`mb`.`batch_number`,'No Batch') AS `batch_number`, `mb`.`expiry_date` AS `expiry_date`, `mb`.`manufacturing_date` AS `manufacturing_date`, coalesce(`mb`.`current_stock`,0) AS `batch_stock`, coalesce(`mb`.`unit_cost`,0) AS `batch_cost`, coalesce(`mb`.`selling_price`,0) AS `batch_selling_price`, coalesce(`mb`.`mrp`,0) AS `batch_mrp`, coalesce(`mb`.`status`,'unknown') AS `batch_status`, CASE WHEN `mb`.`expiry_date` is null THEN NULL ELSE to_days(`mb`.`expiry_date`) - to_days(curdate()) END AS `days_to_expiry`, CASE WHEN `mb`.`expiry_date` is null THEN 'no_expiry' WHEN to_days(`mb`.`expiry_date`) - to_days(curdate()) <= 0 THEN 'expired' WHEN to_days(`mb`.`expiry_date`) - to_days(curdate()) <= 30 THEN 'expiring_soon' ELSE 'good' END AS `expiry_status`, `m`.`hospital_id` AS `hospital_id` FROM (`medicine` `m` left join `medicine_batches` `mb` on(`m`.`id` = `mb`.`medicine_id`)) WHERE `mb`.`current_stock` > 0 OR `mb`.`id` is null ;

-- --------------------------------------------------------

--
-- Structure for view `monthly_usage_summary`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`democa`@`localhost` SQL SECURITY DEFINER VIEW `monthly_usage_summary`  AS SELECT `i`.`id` AS `inventory_item_id`, `i`.`name` AS `item_name`, `i`.`category` AS `category`, year(`ul`.`usage_date`) AS `usage_year`, month(`ul`.`usage_date`) AS `usage_month`, sum(`ul`.`quantity_used`) AS `total_quantity_used`, sum(`ul`.`total_cost`) AS `total_cost`, avg(`ul`.`quantity_used`) AS `avg_daily_usage`, `ul`.`hospital_id` AS `hospital_id` FROM (`usage_logs` `ul` join `inventory_items` `i` on(`ul`.`inventory_item_id` = `i`.`id`)) GROUP BY `i`.`id`, year(`ul`.`usage_date`), month(`ul`.`usage_date`), `ul`.`hospital_id` ;

-- --------------------------------------------------------

--
-- Structure for view `purchase_order_summary`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`democa`@`localhost` SQL SECURITY DEFINER VIEW `purchase_order_summary`  AS SELECT `po`.`id` AS `id`, `po`.`po_number` AS `po_number`, `s`.`name` AS `supplier_name`, `po`.`order_date` AS `order_date`, `po`.`expected_delivery_date` AS `expected_delivery_date`, `po`.`status` AS `status`, `po`.`grand_total` AS `grand_total`, count(`poi`.`id`) AS `total_items`, sum(`poi`.`quantity_ordered`) AS `total_quantity_ordered`, sum(`poi`.`quantity_received`) AS `total_quantity_received`, `po`.`hospital_id` AS `hospital_id` FROM ((`purchase_orders` `po` left join `suppliers` `s` on(`po`.`supplier_id` = `s`.`id`)) left join `purchase_order_items` `poi` on(`po`.`id` = `poi`.`purchase_order_id`)) GROUP BY `po`.`id` ;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `inventory_categories`
--
ALTER TABLE `inventory_categories`
  ADD CONSTRAINT `inventory_categories_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `inventory_categories` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `medicine_batches`
--
ALTER TABLE `medicine_batches`
  ADD CONSTRAINT `fk_batches_purchase_item` FOREIGN KEY (`purchase_item_id`) REFERENCES `medicine_purchase_items` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_batches_supplier` FOREIGN KEY (`supplier_id`) REFERENCES `medicine_suppliers` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `medicine_purchases`
--
ALTER TABLE `medicine_purchases`
  ADD CONSTRAINT `fk_purchases_supplier` FOREIGN KEY (`supplier_id`) REFERENCES `medicine_suppliers` (`id`),
  ADD CONSTRAINT `medicine_purchases_ibfk_1` FOREIGN KEY (`supplier_id`) REFERENCES `medicine_suppliers` (`id`);

--
-- Constraints for table `medicine_purchase_items`
--
ALTER TABLE `medicine_purchase_items`
  ADD CONSTRAINT `fk_purchase_items_purchase` FOREIGN KEY (`purchase_id`) REFERENCES `medicine_purchases` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `medicine_purchase_payments`
--
ALTER TABLE `medicine_purchase_payments`
  ADD CONSTRAINT `fk_purchase_payments_purchase` FOREIGN KEY (`purchase_id`) REFERENCES `medicine_purchases` (`id`);

--
-- Constraints for table `medicine_stock_movements`
--
ALTER TABLE `medicine_stock_movements`
  ADD CONSTRAINT `fk_stock_movements_batch` FOREIGN KEY (`batch_id`) REFERENCES `medicine_batches` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `purchase_orders`
--
ALTER TABLE `purchase_orders`
  ADD CONSTRAINT `purchase_orders_ibfk_1` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`);

--
-- Constraints for table `purchase_order_items`
--
ALTER TABLE `purchase_order_items`
  ADD CONSTRAINT `purchase_order_items_ibfk_1` FOREIGN KEY (`purchase_order_id`) REFERENCES `purchase_orders` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `purchase_order_items_ibfk_2` FOREIGN KEY (`inventory_item_id`) REFERENCES `inventory_items` (`id`);

--
-- Constraints for table `stock_transactions`
--
ALTER TABLE `stock_transactions`
  ADD CONSTRAINT `stock_transactions_ibfk_1` FOREIGN KEY (`inventory_item_id`) REFERENCES `inventory_items` (`id`);

--
-- Constraints for table `usage_logs`
--
ALTER TABLE `usage_logs`
  ADD CONSTRAINT `usage_logs_ibfk_1` FOREIGN KEY (`inventory_item_id`) REFERENCES `inventory_items` (`id`);

--
-- Constraints for table `vendor_quotations`
--
ALTER TABLE `vendor_quotations`
  ADD CONSTRAINT `vendor_quotations_ibfk_1` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`);

--
-- Constraints for table `vendor_quotation_items`
--
ALTER TABLE `vendor_quotation_items`
  ADD CONSTRAINT `vendor_quotation_items_ibfk_1` FOREIGN KEY (`quotation_id`) REFERENCES `vendor_quotations` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `vendor_quotation_items_ibfk_2` FOREIGN KEY (`inventory_item_id`) REFERENCES `inventory_items` (`id`);
COMMIT;

