Introduction

In Part 1, we explored the UI and Razor views.

In Part 2, we implemented Controllers and Services.

In this final part, we’ll cover:

Chat Integration

The Chat module allows staff and patients to communicate in real time. It’s implemented with JavaScript and Razor.

Chat Razor View – Views/Chat/Index.cshtml

<div id="chatBox" class="chat-window"></div>
<input id="chatInput" type="text" placeholder="Type a message..." />
<button onclick="sendMessage()">Send</button>

Chat Script – wwwroot/js/chat.js

function sendMessage() {
  const message = document.getElementById("chatInput").value;
  const chatBox = document.getElementById("chatBox");
  chatBox.innerHTML += `<p><strong>User:</strong> ${message}</p>`;
  document.getElementById("chatInput").value = "";
}

Styling – wwwroot/css/chat.css

.chat-window {
  border: 1px solid #ccc;
  height: 300px;
  overflow-y: scroll;
  padding: 10px;
}

.chat-window p {
  margin: 5px 0;
}

How It Works

Deployment Setup

The repository includes PowerShell scripts for automation. These scripts can:

Example PowerShell Snippet

# Initialize database
dotnet ef database update

# Publish project
dotnet publish -c Release -o ./publish

Enhancements for Production

To make HospitalManagement production-ready, consider the following improvements.

Authentication & Authorization

Real-Time Chat with SignalR

Database Improvements

UI/UX Enhancements

Logging & Monitoring

Conclusion (Part 3)

In this final part, we covered:

Together with Part 1 (UI + Razor) and Part 2 (Controllers + Services), this completes the HospitalManagement series.

You can explore the full implementation in the HospitalManagement GitHub repo

Summary

This part focused on integrating a basic chat module, automating deployment with PowerShell scripts, and identifying key enhancements required for a production-ready Hospital Management System. Combined with the UI, Razor views, Controllers, and Services covered in the previous parts, the series provides a complete foundation for building and extending an ASP.NET Core MVC-based hospital management application.