Medikamentenseite Button und Sidebar erstellt.
This commit is contained in:
parent
87fc63b3b0
commit
bc7dfc0210
@ -252,7 +252,7 @@ function showPatientMedications(req, res) {
|
|||||||
|
|
||||||
res.render("patient_medications", {
|
res.render("patient_medications", {
|
||||||
title: "Medikamente",
|
title: "Medikamente",
|
||||||
sidebarPartial: "partials/patient-sidebar",
|
sidebarPartial: "partials/patient-doctor-sidebar",
|
||||||
active: "patient_medications",
|
active: "patient_medications",
|
||||||
|
|
||||||
patient: patients[0],
|
patient: patients[0],
|
||||||
@ -391,7 +391,7 @@ function showPatientOverview(req, res) {
|
|||||||
|
|
||||||
res.render("patient_overview", {
|
res.render("patient_overview", {
|
||||||
title: "Patient Übersicht",
|
title: "Patient Übersicht",
|
||||||
sidebarPartial: "partials/patient-sidebar",
|
sidebarPartial: "partials/patient-doctor-sidebar",
|
||||||
active: "patient_overview",
|
active: "patient_overview",
|
||||||
|
|
||||||
patient,
|
patient,
|
||||||
|
|||||||
@ -258,3 +258,30 @@ a.waiting-slot {
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* =========================================================
|
||||||
|
✅ Patientendaten maximal so breit wie die maximalen Daten sind
|
||||||
|
========================================================= */
|
||||||
|
.patient-data-box {
|
||||||
|
max-width: 900px; /* ✅ maximale Breite (kannst du ändern) */
|
||||||
|
width: 100%;
|
||||||
|
margin: 0 auto; /* ✅ zentriert */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ✅ Button im Wartezimmer-Monitor soll aussehen wie ein Link-Block */
|
||||||
|
.waiting-btn {
|
||||||
|
width: 100%;
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
padding: 10px; /* genau wie waiting-slot vorher */
|
||||||
|
margin: 0;
|
||||||
|
|
||||||
|
text-align: center;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ✅ Entfernt Focus-Rahmen (falls Browser blau umrandet) */
|
||||||
|
.waiting-btn:focus {
|
||||||
|
outline: none;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|||||||
@ -61,7 +61,7 @@ router.get("/waiting-room", requireLogin, showWaitingRoom);
|
|||||||
|
|
||||||
router.post("/waiting-room/:id", requireLogin, moveToWaitingRoom);
|
router.post("/waiting-room/:id", requireLogin, moveToWaitingRoom);
|
||||||
router.post(
|
router.post(
|
||||||
"/move-to-waiting-room/:id",
|
"/:id/back-to-waiting-room",
|
||||||
requireLogin,
|
requireLogin,
|
||||||
movePatientToWaitingRoom,
|
movePatientToWaitingRoom,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -31,15 +31,17 @@
|
|||||||
|
|
||||||
<% waitingPatients.forEach(p => { %>
|
<% waitingPatients.forEach(p => { %>
|
||||||
|
|
||||||
<% if (user.role === 'arzt' || user.role === 'mitarbeiter') { %>
|
<% if (user.role === 'arzt') { %>
|
||||||
<a href="/patients/<%= p.id %>/overview" class="waiting-slot occupied clickable">
|
<form method="POST" action="/patients/<%= p.id %>/call" style="width:100%; margin:0;">
|
||||||
|
<button type="submit" class="waiting-slot occupied clickable waiting-btn">
|
||||||
<div class="patient-text">
|
<div class="patient-text">
|
||||||
<div class="name"><%= p.firstname %> <%= p.lastname %></div>
|
<div class="name"><%= p.firstname %> <%= p.lastname %></div>
|
||||||
<div class="birthdate">
|
<div class="birthdate">
|
||||||
<%= new Date(p.birthdate).toLocaleDateString("de-DE") %>
|
<%= new Date(p.birthdate).toLocaleDateString("de-DE") %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</button>
|
||||||
|
</form>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<div class="waiting-slot occupied">
|
<div class="waiting-slot occupied">
|
||||||
<div class="patient-text">
|
<div class="patient-text">
|
||||||
|
|||||||
@ -34,13 +34,6 @@
|
|||||||
|
|
||||||
<!-- rechts -->
|
<!-- rechts -->
|
||||||
<div class="page-header-right">
|
<div class="page-header-right">
|
||||||
|
|
||||||
<% if (!hideDashboard) { %>
|
|
||||||
<a href="/dashboard" class="btn btn-outline-light btn-sm">
|
|
||||||
⬅️ Dashboard
|
|
||||||
</a>
|
|
||||||
<% } %>
|
|
||||||
|
|
||||||
<span id="datetime" class="page-header-datetime"></span>
|
<span id="datetime" class="page-header-datetime"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
67
views/partials/patient-doctor-sidebar.ejs
Normal file
67
views/partials/patient-doctor-sidebar.ejs
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<%
|
||||||
|
const pid = patient?.id || null;
|
||||||
|
|
||||||
|
// ✅ Wenn wir in der Medikamentenseite sind → nur Zurück anzeigen
|
||||||
|
const onlyBack = active === "patient_medications";
|
||||||
|
%>
|
||||||
|
|
||||||
|
<div class="sidebar">
|
||||||
|
|
||||||
|
<!-- ✅ Logo -->
|
||||||
|
<div style="margin-bottom: 30px; display: flex; flex-direction: column; gap: 10px;">
|
||||||
|
<div style="padding: 20px; text-align: center">
|
||||||
|
<div class="logo" style="margin: 0">🩺 Praxis System</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ✅ Zurück (immer sichtbar) -->
|
||||||
|
<a href="<%= pid ? '/patients/' + pid + '/overview' : '/dashboard' %>" class="nav-item">
|
||||||
|
<i class="bi bi-arrow-left-circle"></i> Zurück
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<% if (!onlyBack && pid) { %>
|
||||||
|
|
||||||
|
<div style="margin: 10px 0; border-top: 1px solid rgba(255, 255, 255, 0.12)"></div>
|
||||||
|
|
||||||
|
<!-- ✅ Medikamentenverwaltung -->
|
||||||
|
<a
|
||||||
|
href="/patients/<%= pid %>/medications?returnTo=overview"
|
||||||
|
class="nav-item <%= active === 'patient_medications' ? 'active' : '' %>"
|
||||||
|
>
|
||||||
|
<i class="bi bi-capsule"></i> Medikamentenverwaltung
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- ✅ Patient bearbeiten -->
|
||||||
|
<a
|
||||||
|
href="/patients/edit/<%= pid %>?returnTo=overview"
|
||||||
|
class="nav-item <%= active === 'patient_edit' ? 'active' : '' %>"
|
||||||
|
>
|
||||||
|
<i class="bi bi-pencil-square"></i> Patient bearbeiten
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- ✅ Ins Wartezimmer -->
|
||||||
|
<form method="POST" action="/patients/<%= pid %>/back-to-waiting-room">
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="nav-item"
|
||||||
|
style="width:100%; border:none; background:transparent; text-align:left;"
|
||||||
|
>
|
||||||
|
<i class="bi bi-door-open"></i> Ins Wartezimmer
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<!-- ✅ Entlassen -->
|
||||||
|
<form method="POST" action="/patients/<%= pid %>/discharge">
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="nav-item"
|
||||||
|
style="width:100%; border:none; background:transparent; text-align:left;"
|
||||||
|
onclick="return confirm('Patient wirklich entlassen?')"
|
||||||
|
>
|
||||||
|
<i class="bi bi-check2-circle"></i> Entlassen
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
</div>
|
||||||
@ -1,124 +1,148 @@
|
|||||||
<!DOCTYPE html>
|
<%- include("partials/page-header", {
|
||||||
<html lang="de">
|
user,
|
||||||
<head>
|
title: "💊 Medikation",
|
||||||
<meta charset="UTF-8">
|
subtitle: patient.firstname + " " + patient.lastname,
|
||||||
<title>Medikation – <%= patient.firstname %> <%= patient.lastname %></title>
|
showUserName: true,
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
showDashboardButton: false
|
||||||
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
}) %>
|
||||||
</head>
|
|
||||||
<body class="bg-light">
|
|
||||||
|
|
||||||
<%
|
<div class="content">
|
||||||
/* =========================
|
|
||||||
HILFSFUNKTION
|
|
||||||
========================== */
|
|
||||||
function formatDate(d) {
|
|
||||||
return d ? new Date(d).toLocaleDateString("de-DE") : "-";
|
|
||||||
}
|
|
||||||
%>
|
|
||||||
|
|
||||||
<nav class="navbar navbar-dark bg-dark px-3">
|
|
||||||
<span class="navbar-brand">
|
|
||||||
💊 Medikation – <%= patient.firstname %> <%= patient.lastname %>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<a href="<%= returnTo === 'overview'
|
|
||||||
? `/patients/${patient.id}/overview`
|
|
||||||
: '/patients' %>"
|
|
||||||
class="btn btn-outline-light btn-sm">
|
|
||||||
Zurück
|
|
||||||
</a>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="container mt-4">
|
|
||||||
<%- include("partials/flash") %>
|
<%- include("partials/flash") %>
|
||||||
<!-- =========================
|
|
||||||
FORMULAR (NUR ADMIN)
|
|
||||||
========================== -->
|
|
||||||
<% if (user && user.role === 'arzt') { %>
|
|
||||||
|
|
||||||
<div class="card shadow mb-4">
|
<div class="container-fluid">
|
||||||
|
|
||||||
<% } else { %>
|
<!-- ✅ Patient Info -->
|
||||||
|
<div class="card shadow-sm mb-3 patient-box">
|
||||||
<div class="alert alert-info">
|
<div class="card-body">
|
||||||
ℹ️ Nur Administratoren dürfen Medikamente eintragen.
|
<h5 class="mb-1">
|
||||||
|
<%= patient.firstname %> <%= patient.lastname %>
|
||||||
|
</h5>
|
||||||
|
<div class="text-muted small">
|
||||||
|
Geboren am:
|
||||||
|
<%= new Date(patient.birthdate).toLocaleDateString("de-DE") %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row g-3">
|
||||||
|
|
||||||
|
<!-- ✅ Medikament hinzufügen -->
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="card shadow-sm h-100">
|
||||||
|
<div class="card-header fw-semibold">
|
||||||
|
➕ Medikament zuweisen
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
<form method="POST" action="/patients/<%= patient.id %>/medications/assign">
|
||||||
|
|
||||||
|
<div class="mb-2">
|
||||||
|
<label class="form-label">Medikament auswählen</label>
|
||||||
|
<select name="medication_variant_id" class="form-select" required>
|
||||||
|
<option value="">-- auswählen --</option>
|
||||||
|
<% meds.forEach(m => { %>
|
||||||
|
<option value="<%= m.id %>">
|
||||||
|
<%= m.medication %> | <%= m.form %> | <%= m.dosage %>
|
||||||
|
<% if (m.package) { %>
|
||||||
|
| <%= m.package %>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
</option>
|
||||||
|
<% }) %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- =========================
|
<div class="mb-2">
|
||||||
AKTUELLE MEDIKATION
|
<label class="form-label">Dosierungsanweisung</label>
|
||||||
========================== -->
|
<input
|
||||||
|
type="text"
|
||||||
|
class="form-control"
|
||||||
|
name="dosage_instruction"
|
||||||
|
placeholder="z.B. 1-0-1"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h4>Aktuelle Medikation</h4>
|
<div class="row g-2 mb-2">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label">Startdatum</label>
|
||||||
|
<input type="date" class="form-control" name="start_date" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<table class="table table-bordered table-sm mt-3">
|
<div class="col-md-6">
|
||||||
<thead class="table-light">
|
<label class="form-label">Enddatum</label>
|
||||||
|
<input type="date" class="form-control" name="end_date" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="btn btn-primary">
|
||||||
|
✅ Speichern
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<a href="/patients/<%= patient.id %>/overview" class="btn btn-outline-secondary">
|
||||||
|
⬅️ Zur Übersicht
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ✅ Aktuelle Medikation -->
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="card shadow-sm h-100">
|
||||||
|
<div class="card-header fw-semibold">
|
||||||
|
📋 Aktuelle Medikation
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
<% if (!currentMeds || currentMeds.length === 0) { %>
|
||||||
|
<div class="text-muted">
|
||||||
|
Keine Medikation vorhanden.
|
||||||
|
</div>
|
||||||
|
<% } else { %>
|
||||||
|
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-sm table-striped align-middle">
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Medikament</th>
|
<th>Medikament</th>
|
||||||
|
<th>Form</th>
|
||||||
<th>Dosierung</th>
|
<th>Dosierung</th>
|
||||||
<th>Packung</th>
|
|
||||||
<th>Anweisung</th>
|
<th>Anweisung</th>
|
||||||
<th>Zeitraum</th>
|
<th>Von</th>
|
||||||
<% if (user && user.role === 'arzt') { %>
|
<th>Bis</th>
|
||||||
<th>Aktionen</th>
|
|
||||||
<% } %>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<% currentMeds.forEach(cm => { %>
|
||||||
<% if (!currentMeds || currentMeds.length === 0) { %>
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="6" class="text-center text-muted">
|
<td><%= cm.medication %></td>
|
||||||
Keine Medikation vorhanden
|
<td><%= cm.form %></td>
|
||||||
</td>
|
<td><%= cm.dosage %></td>
|
||||||
</tr>
|
<td><%= cm.dosage_instruction || "-" %></td>
|
||||||
|
|
||||||
<% } else { %>
|
|
||||||
|
|
||||||
<% currentMeds.forEach(m => { %>
|
|
||||||
<tr>
|
|
||||||
<td><%= m.medication %> (<%= m.form %>)</td>
|
|
||||||
<td><%= m.dosage %></td>
|
|
||||||
<td><%= m.package %></td>
|
|
||||||
<td><%= m.dosage_instruction || "-" %></td>
|
|
||||||
<td>
|
<td>
|
||||||
<%= formatDate(m.start_date) %> –
|
<%= cm.start_date ? new Date(cm.start_date).toLocaleDateString("de-DE") : "-" %>
|
||||||
<%= m.end_date ? formatDate(m.end_date) : "laufend" %>
|
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
<% if (user && user.role === 'arzt') { %>
|
<%= cm.end_date ? new Date(cm.end_date).toLocaleDateString("de-DE") : "-" %>
|
||||||
<td class="d-flex gap-1">
|
|
||||||
|
|
||||||
<form method="POST"
|
|
||||||
action="/patient-medications/end/<%= m.id %>?returnTo=<%= returnTo || '' %>">
|
|
||||||
<button class="btn btn-sm btn-warning">
|
|
||||||
⏹ Beenden
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<form method="POST"
|
|
||||||
action="/patient-medications/delete/<%= m.id %>?returnTo=<%= returnTo || '' %>"
|
|
||||||
onsubmit="return confirm('Medikation wirklich löschen?')">
|
|
||||||
<button class="btn btn-sm btn-danger">
|
|
||||||
🗑️ Löschen
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<% } %>
|
|
||||||
</tr>
|
</tr>
|
||||||
<% }) %>
|
<% }) %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
</tbody>
|
</div>
|
||||||
</table>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
<%- include("partials/flash") %>
|
<%- include("partials/flash") %>
|
||||||
|
|
||||||
<!-- ✅ PATIENTENDATEN -->
|
<!-- ✅ PATIENTENDATEN -->
|
||||||
<div class="card shadow mb-4">
|
<div class="card shadow-sm mb-3 patient-data-box">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h4>Patientendaten</h4>
|
<h4>Patientendaten</h4>
|
||||||
|
|
||||||
@ -49,34 +49,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- ✅ AKTIONEN -->
|
|
||||||
<div class="d-flex gap-2 mb-4 flex-wrap">
|
|
||||||
|
|
||||||
<a
|
|
||||||
href="/patients/<%= patient.id %>/medications?returnTo=overview"
|
|
||||||
class="btn btn-primary"
|
|
||||||
>
|
|
||||||
💊 Medikation verwalten
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a
|
|
||||||
href="/patients/edit/<%= patient.id %>?returnTo=overview"
|
|
||||||
class="btn btn-outline-info"
|
|
||||||
>
|
|
||||||
✏️ Patient bearbeiten
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<form method="POST" action="/patients/<%= patient.id %>/discharge">
|
|
||||||
<button
|
|
||||||
class="btn btn-danger"
|
|
||||||
onclick="return confirm('Patient wirklich entlassen?')"
|
|
||||||
>
|
|
||||||
✅ Entlassen
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- ✅ UNTERER BEREICH -->
|
<!-- ✅ UNTERER BEREICH -->
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
|
|
||||||
@ -130,7 +102,7 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5>💊 Rezept erstellen</h5>
|
<h5>💊 Rezept erstellen</h5>
|
||||||
|
|
||||||
<form method="POST" action="/patients/<%= patient.id %>/medications/assign">
|
<form method="POST" action="/patients/<%= patient.id %>/medications">
|
||||||
<select name="medication_variant_id" class="form-select mb-2" required>
|
<select name="medication_variant_id" class="form-select mb-2" required>
|
||||||
<option value="">Bitte auswählen…</option>
|
<option value="">Bitte auswählen…</option>
|
||||||
<% medicationVariants.forEach(mv => { %>
|
<% medicationVariants.forEach(mv => { %>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user