Skip to content

Commit

Permalink
Daily Rounds: Remove support for copying from previous log update (#7752
Browse files Browse the repository at this point in the history
)

* remove support for copying from previous log update

* update cypress

* fix bug

* fix cypress

* Show events by default

* remove `current_health`

* fix rhythm and consciousness level no input value

* fix type issue

* Update src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx

---------

Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com>
  • Loading branch information
rithviknishad and nihal467 committed May 15, 2024
1 parent 245c811 commit ee15f65
Show file tree
Hide file tree
Showing 11 changed files with 244 additions and 323 deletions.
13 changes: 0 additions & 13 deletions cypress/e2e/patient_spec/patient_logupdate.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,6 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
cy.verifyNotification(
"Telemedicine Log Updates details created successfully",
);
// verify the copied previous value
cy.closeNotification();
patientLogupdate.clickLogupdate();
patientLogupdate.clickCopyPreviousValue();
patientLogupdate.selectPatientCategory(patientCategory);
cy.submitButton("Save");
cy.closeNotification();
cy.verifyContentPresence("#physical_examination_info", [
physicalExamination,
]);
cy.verifyContentPresence("#rhythm_detail", [patientRhythm]);
cy.submitButton("Continue");
cy.verifyNotification("Normal Log Updates details updated successfully");
});

it("Create a new log normal update for a domicilary care patient and edit it", () => {
Expand Down
4 changes: 0 additions & 4 deletions cypress/pageobject/Patient/PatientLogupdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,5 @@ class PatientLogupdate {
cy.get("#consultation_tab_nav").scrollIntoView();
cy.verifyAndClickElement("#consultation_tab_nav", "Vitals");
}

clickCopyPreviousValue() {
cy.get("#clone_last").click();
}
}
export default PatientLogupdate;
16 changes: 3 additions & 13 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,7 @@ export const CONSCIOUSNESS_LEVEL = [
id: "ONSET_OF_AGITATION_AND_CONFUSION",
text: "Onset of Agitation and Confusion",
},
{ id: "UNKNOWN", text: "Unknown" },
];
] as const;

export const LINES_CATHETER_CHOICES: Array<OptionsType> = [
{ id: 1, text: "CVP catheter " },
Expand Down Expand Up @@ -439,14 +438,6 @@ export const PATIENT_CATEGORIES: {

export const PATIENT_FILTER_CATEGORIES = PATIENT_CATEGORIES;

export const CURRENT_HEALTH_CHANGE = [
{ id: 0, text: "NO DATA", desc: "" },
{ id: 3, text: "STATUS QUO", desc: "No Change" },
{ id: 4, text: "BETTER", desc: "Better" },
{ id: 2, text: "WORSE", desc: "Worse" },
{ id: 1, text: "REQUIRES VENTILATOR", desc: "Requires Ventilator" },
];

export const SAMPLE_TEST_STATUS = [
{ id: 1, text: "REQUEST_SUBMITTED", desc: "Request Submitted" },
{ id: 2, text: "APPROVED", desc: "Approved for Sample Collection" },
Expand Down Expand Up @@ -753,11 +744,10 @@ export const CONSULTATION_TABS = [
{ text: "ABDM", desc: "ABDM Records" },
];

export const RHYTHM_CHOICES: Array<OptionsType> = [
{ id: 0, text: "UNKNOWN", desc: "Unknown" },
export const RHYTHM_CHOICES = [
{ id: 5, text: "REGULAR", desc: "Regular" },
{ id: 10, text: "IRREGULAR", desc: "Irregular" },
];
] as const;

export const LOCATION_BED_TYPES: Array<any> = [
{ id: "ISOLATION", name: "Isolation" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
const [ventilatorSocketUrl, setVentilatorSocketUrl] = useState<string>();
const [monitorBedData, setMonitorBedData] = useState<AssetBedModel>();
const [ventilatorBedData, setVentilatorBedData] = useState<AssetBedModel>();
const [showEvents, setShowEvents] = useState<boolean>(false);
const [showEvents, setShowEvents] = useState(false);

const vitals = useVitalsAspectRatioConfig({
default: undefined,
Expand Down
17 changes: 16 additions & 1 deletion src/Components/Form/FormFields/RadioFormField.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
import FormField from "./FormField";
import { FormFieldBaseProps, useFormFieldPropsResolver } from "./Utils";

type Props<T> = FormFieldBaseProps<string> & {
type Props<T> = FormFieldBaseProps<string | null> & {
options: T[];
optionDisplay: (option: T) => React.ReactNode;
optionValue: (option: T) => string;
containerClassName?: string;
unselectLabel?: string;
};

const RadioFormField = <T,>(props: Props<T>) => {
const field = useFormFieldPropsResolver(props);
return (
<FormField field={field}>
<div className={props.containerClassName || "flex gap-4 p-4"}>
{props.unselectLabel && (
<div className="flex items-center gap-2">
<input
className="h-4 w-4 rounded-full border-gray-600 text-primary-600 focus:ring-2 focus:ring-primary-500"
type="radio"
id="none"
name={props.name}
value={undefined}
checked={field.value == null}
onChange={() => field.handleChange(null)}
/>
<label htmlFor="none">{props.unselectLabel}</label>
</div>
)}
{props.options.map((option, idx) => {
const value = props.optionValue(option);
const optionId = `${props.name}-${idx}`;
Expand Down
25 changes: 6 additions & 19 deletions src/Components/Patient/DailyRoundListDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { lazy, useState } from "react";
import {
CONSCIOUSNESS_LEVEL,
CURRENT_HEALTH_CHANGE,
SYMPTOM_CHOICES,
} from "../../Common/constants";
import { CONSCIOUSNESS_LEVEL, SYMPTOM_CHOICES } from "../../Common/constants";
import { DailyRoundsModel } from "./models";
import Page from "../Common/components/Page";
import ButtonV2 from "../Common/components/ButtonV2";
Expand All @@ -12,7 +8,6 @@ import useQuery from "../../Utils/request/useQuery";
import routes from "../../Redux/api";
const Loading = lazy(() => import("../Common/Loading"));
const symptomChoices = [...SYMPTOM_CHOICES];
const currentHealthChoices = [...CURRENT_HEALTH_CHANGE];

export const DailyRoundListDetails = (props: any) => {
const { facilityId, patientId, consultationId, id } = props;
Expand All @@ -23,19 +18,11 @@ export const DailyRoundListDetails = (props: any) => {
pathParams: { consultationId, id },
onResponse: ({ res, data }) => {
if (res && data) {
const currentHealth = currentHealthChoices.find(
(i) => i.text === data.current_health,
);

const tdata: DailyRoundsModel = {
...data,
temperature: Number(data.temperature) ? data.temperature : "",
additional_symptoms_text: "",
medication_given: data.medication_given ?? [],

current_health: currentHealth
? currentHealth.desc
: data.current_health,
};
if (data.additional_symptoms?.length) {
const symptoms = data.additional_symptoms.map((symptom: number) => {
Expand Down Expand Up @@ -172,11 +159,11 @@ export const DailyRoundListDetails = (props: any) => {
<span className="font-semibold leading-relaxed">
Level Of Consciousness:{" "}
</span>
{dailyRoundListDetailsData.consciousness_level
? CONSCIOUSNESS_LEVEL.find(
(i) => i.id === dailyRoundListDetailsData.consciousness_level,
)?.text
: "-"}
{(dailyRoundListDetailsData.consciousness_level &&
CONSCIOUSNESS_LEVEL.find(
(i) => i.id === dailyRoundListDetailsData.consciousness_level,
)?.text) ||
"-"}
</div>
<div>
<span className="font-semibold leading-relaxed">
Expand Down

0 comments on commit ee15f65

Please sign in to comment.