Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treatment Summary UI Enhancement #10563

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
14bb055
added borders rm bg
AdityaJ2305 Feb 11, 2025
de537ef
Update src/components/Patient/TreatmentSummary.tsx
AdityaJ2305 Feb 11, 2025
c5f0919
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 11, 2025
879c27d
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 12, 2025
b237889
check for medication
AdityaJ2305 Feb 12, 2025
e1e2a51
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 12, 2025
c8a45cb
rm color of badges on print
AdityaJ2305 Feb 12, 2025
95e6c00
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 13, 2025
00e246c
border for ongoing medication table
AdityaJ2305 Feb 13, 2025
5628f13
rm badge color for ongoing medication
AdityaJ2305 Feb 13, 2025
f293a73
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 13, 2025
9a3336c
minor css change
AdityaJ2305 Feb 13, 2025
650eb1b
Merge branch 'treatment_summary_ui_enhancement' of https://github.com…
AdityaJ2305 Feb 13, 2025
8a0a587
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 13, 2025
964bbd3
added border for questionnaire response
AdityaJ2305 Feb 13, 2025
8456c68
Merge branch 'treatment_summary_ui_enhancement' of https://github.com…
AdityaJ2305 Feb 13, 2025
817d9dc
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 13, 2025
002ec2c
rm styling on questionnaire
AdityaJ2305 Feb 13, 2025
033d212
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 14, 2025
e114ebd
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,7 @@
"no_log_update_delta": "No changes since previous log update",
"no_log_updates": "No log updates found",
"no_medical_history_available": "No Medical History Available",
"no_medication_recorded": "No Medication Recorded",
"no_medications_found_for_this_encounter": "No medications found for this encounter.",
"no_medications_to_administer": "No medications to administer",
"no_notices_for_you": "No notices for you.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,23 @@ function StructuredResponseBadge({
);
}

function ResponseCard({ item }: { item: QuestionnaireResponse }) {
function ResponseCard({
item,
isPrintPreview,
}: {
item: QuestionnaireResponse;
isPrintPreview?: boolean;
}) {
const isStructured = !item.questionnaire;
const structuredType = Object.keys(item.structured_responses || {})[0];

return (
<Card className="flex flex-col py-3 px-4 transition-colors hover:bg-muted/50">
<Card
className={cn(
"flex flex-col py-3 px-4 transition-colors hover:bg-muted/50",
isPrintPreview && "shadow-none",
)}
>
<div className="flex items-start justify-between">
<div className="space-y-1">
<div className="flex items-center gap-2 text-xs text-gray-500">
Expand Down Expand Up @@ -327,7 +338,11 @@ export default function QuestionnaireResponsesList({
{questionnarieResponses?.results?.map(
(item: QuestionnaireResponse) => (
<li key={item.id} className="w-full">
<ResponseCard key={item.id} item={item} />
<ResponseCard
key={item.id}
item={item}
isPrintPreview={isPrintPreview}
/>
</li>
),
)}
Expand Down
8 changes: 8 additions & 0 deletions src/components/Medicine/MedicationsTable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from "@tanstack/react-query";
import { useTranslation } from "react-i18next";

import { CardContent } from "@/components/ui/card";
import { Skeleton } from "@/components/ui/skeleton";
import {
Table,
Expand Down Expand Up @@ -60,6 +61,13 @@ export const MedicationsTable = ({
</div>
);
}
if (!medications?.results.length) {
return (
<CardContent className="p-2">
<p className="text-gray-500">{t("no_medication_recorded")}</p>
</CardContent>
);
}
return (
<div className="border rounded-lg overflow-hidden">
<Table>
Expand Down
26 changes: 13 additions & 13 deletions src/components/Patient/MedicationStatementList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,13 @@ function MedicationRow({
<TableCell>
<Badge
variant="outline"
className={`whitespace-nowrap capitalize ${
MEDICATION_STATEMENT_STATUS_STYLES[statement.status]
}`}
className={
isPrintPreview
? ""
: `whitespace-nowrap capitalize ${
MEDICATION_STATEMENT_STATUS_STYLES[statement.status]
}`
}
>
{statement.status}
</Badge>
Expand Down Expand Up @@ -136,9 +140,9 @@ export function MedicationStatementList({

if (isLoading) {
return (
<Card className={cn("border-none rounded-sm", className)}>
<Card className={cn("rounded-sm", className, isPrintPreview && "p-3")}>
<CardHeader
className={cn("px-4 pt-4 pb-2", isPrintPreview && "px-0 py-2")}
className={cn("px-4 pt-4 pb-2", isPrintPreview && "px- py-2")}
>
<CardTitle>{t("ongoing_medications")}</CardTitle>
</CardHeader>
Expand All @@ -160,23 +164,19 @@ export function MedicationStatementList({

if (!filteredMedications?.length) {
return (
<Card className={cn("border-none rounded-sm", className)}>
<CardHeader
className={cn("px-4 pt-4 pb-2", isPrintPreview && "px-0 py-2")}
>
<Card className={cn("rounded-sm", className, isPrintPreview && "p-2")}>
<CardHeader className={cn("px-2 pt-4 pb-2")}>
<CardTitle>{t("ongoing_medications")}</CardTitle>
</CardHeader>
<CardContent
className={cn("px-2 pb-3 pt-2", isPrintPreview && "px-0 py-0")}
>
<CardContent className={cn("px-2 pb-3 pt-2")}>
<p className="text-gray-500">{t("no_ongoing_medications")}</p>
</CardContent>
</Card>
);
}

return (
<Card className={cn("border-none rounded-sm", className)}>
<Card className={cn("rounded-sm", className, isPrintPreview && "p-3")}>
<CardHeader
className={cn("px-4 pt-4 pb-2", isPrintPreview && "px-0 py-2")}
>
Expand Down
14 changes: 7 additions & 7 deletions src/components/Patient/TreatmentSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function TreatmentSummary({
<PrintPreview
title={`${t("treatment_summary")} - ${encounter.patient.name}`}
>
<div className="min-h-screen bg-white py-2 max-w-4xl mx-auto">
<div className="min-h-screen py-2 max-w-4xl mx-auto">
<div className="space-y-6">
{/* Header */}
<div className="flex justify-between items-start pb-2 border-b">
Expand Down Expand Up @@ -191,29 +191,29 @@ export default function TreatmentSummary({
<AllergyList
patientId={encounter.patient.id}
encounterId={encounterId}
className="border-none shadow-none"
className="border border-black shadow-none"
isPrintPreview={true}
/>

{/* Symptoms */}
<SymptomsList
patientId={encounter.patient.id}
encounterId={encounterId}
className="border-none shadow-none"
className="border border-black shadow-none"
isPrintPreview={true}
/>

{/* Diagnoses */}
<DiagnosisList
patientId={encounter.patient.id}
encounterId={encounterId}
className="border-none shadow-none"
className="border border-black shadow-none"
isPrintPreview={true}
/>

{/* Medications */}
<div className="border-none shadow-none space-y-2">
<p className="text-sm font-semibold text-gray-950">
<div className="border border-black shadow-none p-3">
<p className="text-sm font-semibold text-gray-950 m-1">
{t("medications")}
</p>
<MedicationsTable
Expand All @@ -226,7 +226,7 @@ export default function TreatmentSummary({
{/* Medication Statements */}
<MedicationStatementList
patientId={encounter.patient.id}
className="border-none shadow-none"
className="border border-black shadow-none"
isPrintPreview={true}
/>

Expand Down
34 changes: 24 additions & 10 deletions src/components/Patient/allergy/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export function AllergyList({
facilityId={facilityId}
patientId={patientId}
encounterId={encounterId}
className={className}
>
<CardContent className="px-2 pb-2">
<Skeleton className="h-[100px] w-full" />
Expand All @@ -118,6 +119,7 @@ export function AllergyList({
facilityId={facilityId}
patientId={patientId}
encounterId={encounterId}
className={className}
>
<CardContent className="px-2 pb-3 pt-2">
<p className="text-gray-500">{t("no_allergies_recorded")}</p>
Expand Down Expand Up @@ -148,29 +150,41 @@ export function AllergyList({
<TableCell>
<Badge
variant="outline"
className={`whitespace-nowrap ${
ALLERGY_CLINICAL_STATUS_STYLES[allergy.clinical_status]
}`}
className={
isPrintPreview
? ""
: `whitespace-nowrap ${ALLERGY_CLINICAL_STATUS_STYLES[allergy.clinical_status]}`
}
>
{t(allergy.clinical_status)}
</Badge>
</TableCell>
<TableCell>
<Badge
variant="outline"
className={`whitespace-nowrap ${
ALLERGY_CRITICALITY_STYLES[allergy.criticality]
}`}
className={
isPrintPreview
? ""
: `whitespace-nowrap ${
ALLERGY_CRITICALITY_STYLES[allergy.criticality]
}`
}
>
{t(allergy.criticality)}
</Badge>
</TableCell>
<TableCell>
<Badge
variant="outline"
className={`whitespace-nowrap capitalize ${
ALLERGY_VERIFICATION_STATUS_STYLES[allergy.verification_status]
}`}
className={
isPrintPreview
? ""
: `whitespace-nowrap capitalize ${
ALLERGY_VERIFICATION_STATUS_STYLES[
allergy.verification_status
]
}`
}
>
{t(allergy.verification_status)}
</Badge>
Expand Down Expand Up @@ -305,7 +319,7 @@ const AllergyListLayout = ({
isPrintPreview?: boolean;
}) => {
return (
<Card className={cn("border-none rounded-sm", className)}>
<Card className={cn("rounded-sm ", className, isPrintPreview && "p-2")}>
<CardHeader
className={cn(
"flex justify-between flex-row",
Expand Down
26 changes: 18 additions & 8 deletions src/components/Patient/diagnosis/DiagnosisTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,31 @@ export function DiagnosisTable({
<TableCell>
<Badge
variant="outline"
className={`whitespace-nowrap ${
DIAGNOSIS_CLINICAL_STATUS_STYLES[diagnosis.clinical_status]
}`}
className={
isPrintPreview
? ""
: `whitespace-nowrap ${
DIAGNOSIS_CLINICAL_STATUS_STYLES[
diagnosis.clinical_status
]
}`
}
>
{t(diagnosis.clinical_status)}
</Badge>
</TableCell>
<TableCell>
<Badge
variant="outline"
className={`whitespace-nowrap capitalize ${
DIAGNOSIS_VERIFICATION_STATUS_STYLES[
diagnosis.verification_status
]
}`}
className={
isPrintPreview
? ""
: `whitespace-nowrap capitalize ${
DIAGNOSIS_VERIFICATION_STATUS_STYLES[
diagnosis.verification_status
]
}`
}
>
{t(diagnosis.verification_status)}
</Badge>
Expand Down
4 changes: 3 additions & 1 deletion src/components/Patient/diagnosis/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function DiagnosisList({
facilityId={facilityId}
patientId={patientId}
encounterId={encounterId}
className={className}
>
<CardContent className="px-2 pb-2">
<Skeleton className="h-[100px] w-full" />
Expand All @@ -71,6 +72,7 @@ export function DiagnosisList({
facilityId={facilityId}
patientId={patientId}
encounterId={encounterId}
className={className}
>
<CardContent className="px-2 pb-3 pt-2">
<p className="text-gray-500">{t("no_diagnoses_recorded")}</p>
Expand Down Expand Up @@ -137,7 +139,7 @@ const DiagnosisListLayout = ({
isPrintPreview?: boolean;
}) => {
return (
<Card className={cn("border-none rounded-sm", className)}>
<Card className={cn("rounded-sm ", className, isPrintPreview && "p-2")}>
<CardHeader
className={cn(
"px-4 pt-4 pb-2 flex justify-between flex-row",
Expand Down
34 changes: 23 additions & 11 deletions src/components/Patient/symptoms/SymptomTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,31 +74,43 @@ export function SymptomTable({
<TableCell>
<Badge
variant="outline"
className={`whitespace-nowrap ${
SYMPTOM_SEVERITY_STYLES[symptom.severity]
}`}
className={
isPrintPreview
? ""
: `whitespace-nowrap ${
SYMPTOM_SEVERITY_STYLES[symptom.severity]
}`
}
>
{t(symptom.severity)}
</Badge>
</TableCell>
<TableCell>
<Badge
variant="outline"
className={`whitespace-nowrap ${
SYMPTOM_CLINICAL_STATUS_STYLES[symptom.clinical_status]
}`}
className={
isPrintPreview
? ""
: `whitespace-nowrap ${
SYMPTOM_CLINICAL_STATUS_STYLES[symptom.clinical_status]
}`
}
>
{t(symptom.clinical_status)}
</Badge>
</TableCell>
<TableCell>
<Badge
variant="outline"
className={`whitespace-nowrap capitalize ${
SYMPTOM_VERIFICATION_STATUS_STYLES[
symptom.verification_status
]
}`}
className={
isPrintPreview
? ""
: `whitespace-nowrap capitalize ${
SYMPTOM_VERIFICATION_STATUS_STYLES[
symptom.verification_status
]
}`
}
>
{t(symptom.verification_status)}
</Badge>
Expand Down
4 changes: 3 additions & 1 deletion src/components/Patient/symptoms/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function SymptomsList({
facilityId={facilityId}
patientId={patientId}
encounterId={encounterId}
className={className}
>
<CardContent className="px-2 pb-2">
<Skeleton className="h-[100px] w-full" />
Expand All @@ -70,6 +71,7 @@ export function SymptomsList({
facilityId={facilityId}
patientId={patientId}
encounterId={encounterId}
className={className}
>
<CardContent className="px-2 pb-3 pt-2">
<p className="text-gray-500">{t("no_symptoms_recorded")}</p>
Expand Down Expand Up @@ -135,7 +137,7 @@ const SymptomListLayout = ({
isPrintPreview?: boolean;
}) => {
return (
<Card className={cn("border-none rounded-sm", className)}>
<Card className={cn("rounded-sm ", className, isPrintPreview && "p-2")}>
<CardHeader
className={cn(
"flex justify-between flex-row",
Expand Down
Loading