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

Encounter Locations view #10969

Open
wants to merge 27 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0b318c8
Add my locations page
bodhish Feb 19, 2025
5268a4a
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
amjithtitus09 Feb 28, 2025
48ed642
Encounter Locations View
amjithtitus09 Mar 3, 2025
30f9c06
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
amjithtitus09 Mar 3, 2025
4ec5a46
Update src/pages/Encounters/EncountersOverview.tsx
amjithtitus09 Mar 4, 2025
fa3665b
Update src/components/ui/sidebar/facility-nav.tsx
amjithtitus09 Mar 4, 2025
f210641
Update facility-nav.tsx
amjithtitus09 Mar 4, 2025
51176b9
Merge branch 'develop' into location-view-for-patients
amjithtitus09 Mar 4, 2025
217b7fc
Remove unused import
amjithtitus09 Mar 4, 2025
20a5c49
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
amjithtitus09 Mar 4, 2025
763db34
Responsiveness
amjithtitus09 Mar 4, 2025
df5be5e
Remove Locations tab
amjithtitus09 Mar 4, 2025
5b0954d
Added pagination, wired search to API
amjithtitus09 Mar 4, 2025
71806ca
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
amjithtitus09 Mar 4, 2025
181a949
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
amjithtitus09 Mar 5, 2025
c75a61a
Fix displaying not root locations
amjithtitus09 Mar 6, 2025
118eb1b
Merge branch 'develop' into location-view-for-patients
amjithtitus09 Mar 6, 2025
056cabf
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
amjithtitus09 Mar 6, 2025
4e69990
Group beds, fetch children on expand only
amjithtitus09 Mar 6, 2025
103ece6
Fix bed card height
amjithtitus09 Mar 6, 2025
b92e3e5
URL driven
amjithtitus09 Mar 6, 2025
0df532a
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
amjithtitus09 Mar 7, 2025
f4e5e14
Minor requested changes
amjithtitus09 Mar 7, 2025
86b4316
Merge branch 'develop' into location-view-for-patients
amjithtitus09 Mar 8, 2025
b913819
Merge branch 'develop' into location-view-for-patients
amjithtitus09 Mar 10, 2025
363efc2
Requested changes
amjithtitus09 Mar 10, 2025
58dfab4
Revert padding
amjithtitus09 Mar 10, 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
10 changes: 10 additions & 0 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@
"availabilities": "Availabilities",
"availability_status": "Availability Status",
"available": "Available",
"available_beds": "Available beds",
"available_features": "Available Features",
"available_in": "Available in",
"available_time_slots": "Available Time Slots",
Expand Down Expand Up @@ -953,6 +954,7 @@
"encounter_discharge_disposition__snf": "Skilled nursing facility",
"encounter_duration_confirmation": "The duration of this encounter would be",
"encounter_id": "Encounter ID",
"encounter_locations": "Encounter Locations",
"encounter_manage_organization_description": "Add or remove organizations from this encouter",
"encounter_marked_as_complete": "Encounter Completed",
"encounter_notes__all_discussions": "All Discussions",
Expand Down Expand Up @@ -1533,13 +1535,15 @@
"no_beds_available": "No beds available",
"no_changes": "No changes",
"no_changes_made": "No changes made",
"no_child_locations": "No Child Locations",
"no_child_locations_found": "No child locations found",
"no_comments_available": "No comments available",
"no_consultation_filed": "No consultation filed",
"no_consultation_updates": "No consultation updates",
"no_country_found": "No country found",
"no_data_found": "No data found",
"no_departments_teams_found": "No Departments or Teams found",
"no_description": "No Description",
"no_devices_available": "No devices available",
"no_devices_found": "No devices found",
"no_diagnoses_recorded": "No diagnoses recorded",
Expand All @@ -1559,6 +1563,7 @@
"no_linked_facilities": "No Linked Facilities",
"no_location": "No location assigned",
"no_location_description": "This device is not currently assigned to any location",
"no_locations": "No locations",
"no_locations_available": "No locations available",
"no_locations_found": "No locations found",
"no_log_update_delta": "No changes since previous log update",
Expand Down Expand Up @@ -1646,6 +1651,7 @@
"occupancy": "Occupancy",
"occupation": "Occupation",
"occupied": "Occupied",
"occupied_beds": "Occupied beds",
"occurrence": "Occurrence",
"old_password": "Current Password",
"on": "on",
Expand Down Expand Up @@ -1706,6 +1712,7 @@
"password_uppercase_validation": "Include at least <strong>one uppercase letter</strong> (A-Z).",
"passwords_match": "Passwords match.",
"patient": "Patient",
"patient encounters": "Patient Encounters",
"patient-notes": "Notes",
"patient__general-info": "General Info",
"patient__insurance-details": "Insurance Details",
Expand Down Expand Up @@ -1899,6 +1906,7 @@
"ration_card_category": "Ration Card Category",
"re_admission": "Re-Admission",
"readmission": "Re-admission",
"ready_for_admission": "Ready For Admission",
"reason": "Reason",
"reason_for_discontinuation": "Reason for discontinuation",
"reason_for_edit": "Reason for edit",
Expand Down Expand Up @@ -2094,6 +2102,7 @@
"search_for_symptoms_to_add": "Search for symptoms to add",
"search_icd11_placeholder": "Search for ICD-11 Diagnoses",
"search_investigation_placeholder": "Search Investigation & Groups",
"search_locations": "Search Locations",
"search_medication": "Search Medication",
"search_medications": "Search Medications",
"search_medicine": "Search Medicine",
Expand Down Expand Up @@ -2332,6 +2341,7 @@
"tomorrow": "Tomorrow",
"total_amount": "Total Amount",
"total_beds": "Total Beds",
"total_locations": "Total locations",
"total_patients": "Total Patients",
"total_slots": "Total Slots",
"total_staff": "Total Staff",
Expand Down
2 changes: 2 additions & 0 deletions src/Routers/AppRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { PlugConfigEdit } from "@/pages/Apps/PlugConfigEdit";
import { PlugConfigList } from "@/pages/Apps/PlugConfigList";
import UserDashboard from "@/pages/UserDashboard";

import LocationRoutes from "./routes/LocationRoutes";
import OrganizationRoutes from "./routes/OrganizationRoutes";
import AdminRoutes from "./routes/adminRoutes";

Expand All @@ -50,6 +51,7 @@ const Routes: AppRoutes = {
// ...AssetRoutes,
...ConsultationRoutes,
...FacilityRoutes,
...LocationRoutes,
...PatientRoutes,
...ResourceRoutes,
...ScheduleRoutes,
Expand Down
10 changes: 10 additions & 0 deletions src/Routers/routes/LocationRoutes.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { AppRoutes } from "@/Routers/AppRouter";
import LocationList from "@/pages/Facility/locations/LocationList";

const LocationRoutes: AppRoutes = {
"/facility/:facilityId/locations": ({ facilityId }) => (
<LocationList facilityId={facilityId} />
),
};

export default LocationRoutes;
9 changes: 7 additions & 2 deletions src/Routers/routes/PatientRoutes.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Redirect } from "raviger";

import {
facilityPatientTabs,
patientTabs,
Expand All @@ -7,15 +9,18 @@ import PatientIndex from "@/components/Patient/PatientIndex";
import PatientRegistration from "@/components/Patient/PatientRegistration";

import { AppRoutes } from "@/Routers/AppRouter";
import { EncounterList } from "@/pages/Encounters/EncounterList";
import EncountersOverview from "@/pages/Encounters/EncountersOverview";
import VerifyPatient from "@/pages/Patients/VerifyPatient";

const PatientRoutes: AppRoutes = {
"/facility/:facilityId/patients": ({ facilityId }) => (
<PatientIndex facilityId={facilityId} />
),
"/facility/:facilityId/encounters": ({ facilityId }) => (
<EncounterList facilityId={facilityId} />
<Redirect to={`/facility/${facilityId}/encounters/patients`} />
),
"/facility/:facilityId/encounters/:tab": ({ facilityId, tab }) => (
<EncountersOverview facilityId={facilityId} tab={tab} />
),
"/facility/:facilityId/patients/verify": ({ facilityId }) => (
<VerifyPatient facilityId={facilityId} />
Expand Down
120 changes: 120 additions & 0 deletions src/components/Encounter/EncounterInfoCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import { Separator } from "@radix-ui/react-separator";
import { format } from "date-fns";
import { Link } from "raviger";
import { useTranslation } from "react-i18next";

import { cn } from "@/lib/utils";

import CareIcon from "@/CAREUI/icons/CareIcon";

import { Badge } from "@/components/ui/badge";
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";

import { Encounter } from "@/types/emr/encounter";

export interface EncounterInfoCardProps {
encounter: Encounter;
facilityId: string;
hideBorder?: boolean;
}

const getStatusColor = (status: string) => {
switch (status) {
case "planned":
return "bg-blue-100 text-blue-800";
case "in_progress":
return "bg-yellow-100 text-yellow-800";
case "completed":
return "bg-green-100 text-green-800";
case "cancelled":
return "bg-red-100 text-red-800";
default:
return "bg-gray-100 text-gray-800";
}
};

const getPriorityColor = (priority: string) => {
switch (priority) {
case "stat":
return "bg-red-100 text-red-800";
case "urgent":
return "bg-orange-100 text-orange-800";
case "asap":
return "bg-yellow-100 text-yellow-800";
default:
return "bg-gray-100 text-gray-800";
}
};

export default function EncounterInfoCard(props: EncounterInfoCardProps) {
const { t } = useTranslation();

const { encounter, facilityId, hideBorder = false } = props;
return (
<Card
key={props.encounter.id}
className={cn(
"hover:shadow-lg transition-shadow group",
hideBorder && "border-none shadow-none",
)}
>
<CardHeader className="space-y-1 pb-2">
<div className="flex items-center justify-between">
<Link
href={`/facility/${facilityId}/patient/${encounter.patient.id}`}
className="hover:text-primary"
>
<CardTitle className="group-hover:text-primary transition-colors">
{encounter.patient.name}
{encounter.patient.death_datetime && (
<Badge variant="destructive" className="ml-2 py-0">
<h3 className="text-xs font-medium">{t("expired")}</h3>
</Badge>
)}
</CardTitle>
</Link>
</div>
<CardDescription className="flex items-center">
<CareIcon icon="l-clock" className="mr-2 h-4 w-4" />
{encounter.period.start &&
format(new Date(encounter.period.start), "PPp")}
</CardDescription>
</CardHeader>
<CardContent className="">
<div className="flex flex-col space-y-2">
<div className="flex flex-wrap items-center gap-2">
<Badge
className={getStatusColor(encounter.status)}
variant="outline"
>
{t(`encounter_status__${encounter.status}`)}
</Badge>
<Badge className="bg-gray-100 text-gray-800" variant="outline">
{t(`encounter_class__${encounter.encounter_class}`)}
</Badge>
<Badge
className={getPriorityColor(encounter.priority)}
variant="outline"
>
{t(`encounter_priority__${encounter.priority}`)}
</Badge>
</div>
<Separator className="my-2" />
<Link
href={`/facility/${facilityId}/patient/${encounter.patient.id}/encounter/${encounter.id}/updates`}
className="text-sm text-primary hover:underline text-right flex items-center justify-end group-hover:translate-x-1 transition-transform"
>
View Details
<CareIcon icon="l-arrow-right" className="ml-1 h-4 w-4" />
</Link>
</div>
</CardContent>
</Card>
);
}
6 changes: 5 additions & 1 deletion src/components/ui/sidebar/facility-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ function generateFacilityLinks(
url: `${baseUrl}/patients`,
icon: "d-patient",
},
{ name: t("encounters"), url: `${baseUrl}/encounters`, icon: "d-patient" },
{
name: t("encounters"),
url: `${baseUrl}/encounters`,
icon: "d-patient",
},
{
name: t("resource"),
url: `${baseUrl}/resource`,
Expand Down
Loading
Loading