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

Patient Questionnaire: Org Access #10988

Merged
merged 7 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
3 changes: 0 additions & 3 deletions care.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@ const careConfig = {
resendOtpTimeout: env.REACT_APP_RESEND_OTP_TIMEOUT
? parseInt(env.REACT_APP_RESEND_OTP_TIMEOUT, 10)
: 30,



} as const;

export default careConfig;
10 changes: 8 additions & 2 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@
"active_location_cannot_be_in_future": "Active location cannot be in the future",
"active_prescriptions": "Active Prescriptions",
"add": "Add",
"add_another": "Add Another",
"add_another_session": "Add another session",
"add_as": "Add as",
"add_attachments": "Add Attachments",
Expand Down Expand Up @@ -1192,7 +1193,6 @@
"footer_body": "Open Healthcare Network is an open-source public utility designed by a multi-disciplinary team of innovators and volunteers. Open Healthcare Network CARE is a Digital Public Good recognised by the United Nations.",
"forget_password": "Forgot password?",
"forget_password_instruction": "Enter your username, and if it exists, we will send you a link to reset your password.",
"preview_form": "Preview form",
"forms": "Forms",
"frequency": "Frequency",
"from": "from",
Expand Down Expand Up @@ -1887,6 +1887,7 @@
"preset_updated": "Preset updated",
"prev_sessions": "Prev Sessions",
"preview": "Preview",
"preview_form": "Preview form",
"previous": "Previous",
"primary_ph_no": "Primary Ph No.",
"primary_phone_no": "Primary ph. no.",
Expand Down Expand Up @@ -1917,12 +1918,17 @@
"quantity_requested": "Quantity Requested",
"quantity_required": "Quantity Required",
"question": "Question",
"questionnaire_diagnosis_no_encounter": "Diagnosis cannot be recorded without an active encounter",
"questionnaire_error_loading": "Error loading questionnaire",
"questionnaire_medication_request_no_encounter": "Medication requests cannot be recorded without an active encounter",
"questionnaire_medication_statement_no_encounter": "Medication statements cannot be recorded without an active encounter",
"questionnaire_no_encounter": "Create an encounter first in order to update it",
"questionnaire_not_exist": "The questionnaire you tried to access does not exist.",
"questionnaire_one": "Questionnaire",
"questionnaire_other": "Questionnaires",
"questionnaire_submission_failed": "Failed to submit questionnaire",
"questionnaire_submitted_successfully": "Questionnaire submitted successfully",
"questionnaire_symptom_no_encounter": "Symptoms cannot be recorded without an active encounter",
"quick_access": "Quick Access",
"quick_actions": "Quick Actions",
"quick_actions_description": "Schedule an appointment or create a new encounter",
Expand Down Expand Up @@ -2015,7 +2021,7 @@
"rescheduled": "Rescheduled",
"rescheduling": "Rescheduling...",
"resend_otp": "Resend OTP",
"resend_otp_timer":"Resend OTP in {{time}} seconds",
"resend_otp_timer": "Resend OTP in {{time}} seconds",
"reserved": "Reserved",
"reset": "Reset",
"reset_password": "Reset Password",
Expand Down
5 changes: 5 additions & 0 deletions src/Routers/routes/ConsultationRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const consultationRoutes: AppRoutes = {
facilityId={facilityId}
encounterId={encounterId}
patientId={patientId}
subjectType="encounter"
/>
),
"/facility/:facilityId/patient/:patientId/encounter/:encounterId/questionnaire/:slug":
Expand All @@ -38,6 +39,7 @@ const consultationRoutes: AppRoutes = {
encounterId={encounterId}
questionnaireSlug={slug}
patientId={patientId}
subjectType="encounter"
/>
),
"/facility/:facilityId/patient/:patientId/encounter/:encounterId/questionnaire_response/:id":
Expand Down Expand Up @@ -87,6 +89,9 @@ const consultationRoutes: AppRoutes = {
subjectType="patient"
/>
),
"/patient/:patientId/questionnaire": ({ patientId }) => (
<EncounterQuestionnaire patientId={patientId} subjectType="patient" />
),
};

export default consultationRoutes;
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { useQuery } from "@tanstack/react-query";
import { t } from "i18next";
import { useQueryParams } from "raviger";
import { Link, useQueryParams } from "raviger";
import { Trans, useTranslation } from "react-i18next";

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

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

import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { Separator } from "@/components/ui/separator";

Expand All @@ -25,6 +28,7 @@ import { QuestionnaireResponse } from "@/types/questionnaire/questionnaireRespon
interface Props {
encounter?: Encounter;
patientId: string;
facilityId?: string;
isPrintPreview?: boolean;
onlyUnstructured?: boolean;
}
Expand Down Expand Up @@ -293,8 +297,8 @@ function ResponseCard({
}

export default function QuestionnaireResponsesList({
encounter,
patientId,
facilityId,
isPrintPreview = false,
onlyUnstructured,
}: Props) {
Expand All @@ -310,8 +314,8 @@ export default function QuestionnaireResponsesList({
limit: RESULTS_PER_PAGE_LIMIT,
offset: ((qParams.page ?? 1) - 1) * RESULTS_PER_PAGE_LIMIT,
}),
encounter: encounter?.id,
only_unstructured: onlyUnstructured,
subject_type: "patient",
},
maxPages: isPrintPreview ? undefined : 1,
pageSize: isPrintPreview ? 100 : RESULTS_PER_PAGE_LIMIT,
Expand All @@ -321,6 +325,23 @@ export default function QuestionnaireResponsesList({
return (
<div className="mt-4 gap-4">
<div className="max-w-full">
<div className="flex justify-between items-center mb-4">
<div className="mr-4 text-xl font-bold text-secondary-900">
{t("updates")}
</div>
<Button asChild variant="outline_primary">
<Link
href={
facilityId
? `/facility/${facilityId}/patient/${patientId}/questionnaire`
: `/patient/${patientId}/questionnaire`
}
>
<CareIcon icon="l-plus" className="mr-2" />
{t("add_patient_updates")}
</Link>
</Button>
</div>
{isLoading ? (
<div className="grid gap-5">
<CardListSkeleton count={RESULTS_PER_PAGE_LIMIT} />
Expand Down
10 changes: 7 additions & 3 deletions src/components/Patient/EncounterQuestionnaire.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import query from "@/Utils/request/query";
import { formatDateTime } from "@/Utils/utils";

interface Props {
facilityId: string;
facilityId?: string;
patientId: string;
encounterId?: string;
questionnaireSlug?: string;
Expand All @@ -34,7 +34,7 @@ export default function EncounterQuestionnaire({
queryKey: ["encounter", encounterId],
queryFn: query(routes.encounter.get, {
pathParams: { id: encounterId ?? "" },
queryParams: { facility: facilityId },
queryParams: { facility: facilityId! },
}),
enabled: !!encounterId,
});
Expand Down Expand Up @@ -72,10 +72,14 @@ export default function EncounterQuestionnaire({
encounterId={encounterId}
questionnaireSlug={questionnaireSlug}
onSubmit={() => {
if (encounterId) {
if (encounterId && facilityId) {
navigate(
`/facility/${facilityId}/patient/${patientId}/encounter/${encounterId}/updates`,
);
} else if (facilityId) {
navigate(
`/facility/${facilityId}/patient/${patientId}/updates`,
);
} else {
navigate(`/patient/${patientId}/updates`);
}
Expand Down
3 changes: 1 addition & 2 deletions src/components/Patient/PatientDetailsTab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import QuestionnaireResponsesList from "@/components/Facility/ConsultationDetail
import EncounterHistory from "@/components/Patient/PatientDetailsTab//EncounterHistory";
import { HealthProfileSummary } from "@/components/Patient/PatientDetailsTab//HealthProfileSummary";
import { Demography } from "@/components/Patient/PatientDetailsTab/Demography";
import { Updates } from "@/components/Patient/PatientDetailsTab/patientUpdates";

import { Patient } from "@/types/emr/newPatient";

Expand Down Expand Up @@ -32,7 +31,7 @@ export const patientTabs = [
},
{
route: "updates",
component: Updates,
component: QuestionnaireResponsesList,
},
{
route: "resource_requests",
Expand Down
126 changes: 0 additions & 126 deletions src/components/Patient/PatientDetailsTab/patientUpdates.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/Questionnaire/QuestionRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ interface QuestionRendererProps {
disabled?: boolean;
activeGroupId?: string;
encounterId?: string;
facilityId: string;
facilityId?: string;
patientId: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface QuestionGroupProps {
clearError: (questionId: string) => void;
disabled?: boolean;
activeGroupId?: string;
facilityId: string;
facilityId?: string;
patientId: string;
}

Expand Down
Loading
Loading