HMS
    • Features
    • Public API
      • change_password
        POST
      • get_my_info
        GET
      • Login
        POST
      • Register Patient
        POST
      • Get Doctor List
        GET
      • Get Ward List
        GET
      • Get Team List
        GET
      • Get Team Info
        GET
    • Patient
      • patient/book
        POST
      • patient query appointments
        GET
      • patient edit appointments
        POST
      • patient cancel appointments
        DELETE
      • patient get current ward
        GET
    • Receptionist
      • receptionist query appointments
        GET
      • receptionist process_appointment
        POST
      • receptionist check in
        POST
    • Doctor
      • doctor query appointments
        GET
      • doctor treat
        POST
      • Get Patient Info
        GET
      • Get Patient List
        GET
    • Admin
      • Admin transfer ward
        POST
      • Admin patient discharge
        POST
      • Admin Create ward
        POST
      • Admin Edit ward
        POST
      • Admin Delete ward
        DELETE
      • Admin Create doctor team
        POST
      • Admin Delete doctor team
        DELETE
      • Admin Set Doctor Resigned
        POST
      • Admin Register User
        POST
      • Admin Edit Team Info
        POST
      • Admin Edit Doctor Info
        POST
      • Admin Edit Patient Info
        POST
      • Admin Reset User Password
        POST
      • Admin Reset User Password From Role ID
        POST
      • Admin Get Patient List
        GET
    • Info Output
      • Get Patients in ward
      • Get Team Patients
      • Get Treatment Records

    Features

    Features#

    1.
    Patient Management
    Admission & Discharge: Record a patient’s admission and discharge information.
    Ward Transfer: Handle transfers between wards, including verifying the patient’s identity and the target ward’s type and availability.
    2.
    Doctor & Team Management
    Doctor Records: The system must store doctor / consultant details and track which doctors have treated which patients.
    Team Management: Keep a record of the patients assigned to each team, including the team code and the responsible doctor’s name.
    3.
    Lists & Reports
    Patients in a Ward: Show each patient’s name and age for a ward selected by an administrator.
    Patients by Team: For a selected team, list all patients under its care and the name of the ward each patient is in.
    4.
    Data Recording & Removal
    Treatment Records: Log every treatment a patient receives, including the treating doctor.
    Discharge Handling: When a patient is discharged, remove all information related to that patient from this system—except for medical records, which are handled by another system.
    After a ward transfer, the patient’s previous wards are not stored.

    Database Design#

    Users (users)#

    ColumnTypeDescription
    idINTEGER PKUnique user ID
    usernameTEXTUsername
    password_hashTEXTPassword hash
    roleINTEGERUser role (patient / doctor)
    patient_idINTEGER FK → patients(id)Patient ID (if the user is a patient)
    doctor_idINTEGER FK → doctors(id)Doctor ID (if the user is a doctor)

    Credentials (credentials)#

    ColumnTypeDescription
    tokenTEXT PKLogin token
    expire_atDATETIMEExpiration time
    roleINTEGERUser role (patient / doctor)
    patient_idINTEGER FK → patients(id)Patient ID (if the user is a patient)
    doctor_idINTEGER FK → doctors(id)Doctor ID (if the user is a doctor)

    Wards (wards)#

    ColumnTypeDescription
    idINTEGER PKWard ID
    nameTEXTWard name
    typeTEXTWard type (e.g., Internal Medicine, ICU)
    total_capacityINTEGERTotal number of beds
    current_occupancyINTEGERNumber of occupied beds

    Doctors (doctors)#

    ColumnTypeDescription
    idINTEGER PKDoctor ID
    nameTEXTName
    titleTEXTHonorific / title
    birth_dateDATEDate of birth
    genderTEXTGender
    phoneTEXTPhone
    emailTEXTEmail
    gradeINTEGERGrade / seniority

    Teams (teams)#

    ColumnTypeDescription
    idINTEGER PKTeam ID
    departmentTEXTDepartment
    consultant_idINTEGER FK → doctors(id)Consultant (lead doctor) ID
    is_admin_teamBOOLEANWhether this is an admin team

    Doctor–Team Link (doctor_team_roles)#

    ColumnTypeDescription
    doctor_idINTEGER FK → doctors(id)Doctor ID
    team_idINTEGER FK → teams(id)Team ID

    Patients (patients)#

    ColumnTypeDescription
    idINTEGER PKPatient ID
    nameTEXTName
    titleTEXTHonorific
    birth_dateDATEDate of birth
    genderTEXTGender
    phoneTEXTPhone
    emailTEXTEmail
    postcodeTEXTPostcode
    addressTEXTAddress

    Admissions (admissions)#

    ColumnTypeDescription
    idINTEGER PKAdmission ID
    appointment_idINTEGER FK → appointments(id)Related appointment ID
    patient_idINTEGER FK → patients(id)Patient ID
    ward_idINTEGER FK → wards(id)Current ward ID
    team_idINTEGER FK → teams(id)Care team ID
    consultant_idINTEGER FK → doctors(id)Lead consultant ID
    admitted_atDATETIMEAdmission time
    discharged_atDATETIMEDischarge time (nullable)

    Treatments (treatments)#

    ColumnTypeDescription
    idINTEGER PKRecord ID
    appointment_idINTEGER FK → appointments(id)Related appointment
    doctor_idINTEGER FK → doctors(id)Treating doctor ID
    patient_idINTEGER FK → patients(id)Patient ID
    treated_atDATETIMETreatment time
    treat_infoTEXTTreatment details

    Appointments (appointments)#

    ColumnTypeDescription
    idINTEGER PKAppointment ID
    patient_idINTEGER FK → patients(id)Patient ID
    categoryTEXTCategory (exam / admission / follow-up, etc.)
    appointment_timeDATETIMEScheduled time
    descriptionTEXTPatient description
    approvedBOOLEANApproved or not
    feedbackTEXT (NULLABLE)Feedback notes
    assigned_teamINTEGER FK → teams(id) (NULLABLE)Assigned team
    dischargedBOOLEANWhether the patient has been discharged

    Seed Data#

    Administrator and receptionist team
    Administrator account

    API Endpoints#

    General#

    EndpointDescription
    /loginLog in
    /register_patientPatient self-registration
    /get_my_infoRetrieve own user information
    /change_passwordChange password
    /get_doctor_listGet list of doctors
    /get_ward_listGet list of wards
    /get_team_listGet list of medical teams
    /get_team_infoGet members of a specific medical team

    Patient#

    EndpointDescription
    /patient/bookCreate an appointment
    /patient/appointmentsView own appointments
    /patient/edit_appointmentEdit an appointment
    /patient/cancel_appointmentCancel an appointment
    /patient/get_my_wardGet the ward currently assigned

    Receptionist (identified by teams.department)#

    EndpointDescription
    /receptionist/appointmentsView all appointments
    /receptionist/process_appointmentAssign an appointment
    /receptionist/check_inHandle patient check-in

    Doctor#

    EndpointDescription
    /doctor/appointmentsView all appointments for the doctor’s team
    /doctor/treatSubmit a treatment record

    Administrator#

    EndpointDescription
    /admin/transfer_wardTransfer a patient to another ward
    /admin/patient_dischargeDischarge a patient
    /admin/create_wardCreate a ward
    /admin/edit_wardEdit ward information
    /admin/delete_wardDelete a ward
    /admin/create_doctor_teamCreate a doctor team
    /admin/delete_doctor_teamDelete a doctor team
    /admin/registerManually register a doctor / receptionist
    /admin/edit_team_infoEdit medical team members
    /admin/edit_doctor_infoEdit doctor information
    /admin/edit_patient_infoEdit patient information
    /admin/set_resign_doctorMark doctor as resigned / reinstated
    /admin/reset_user_passwordReset a user’s password
    /admin/get_patient_listGet list of patients

    Data Output#

    EndpointDescription
    /data/ward_patientsList patients currently in a ward
    /data/team_patientsList all patients under a team and the ward they are in
    /data/treatment_doctorsAll doctors who have treated a patient (via treatment records) Unused
    Modified at 2025-04-23 22:13:15
    Next
    change_password
    Built with