Skip to content

Commit

Permalink
use existing types of patient notes model
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhavik-ag committed Sep 5, 2023
1 parent dbfab12 commit bac0f87
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 72 deletions.
78 changes: 7 additions & 71 deletions src/Components/Facility/PatientNoteCard.tsx
Original file line number Diff line number Diff line change
@@ -1,76 +1,10 @@
import { relativeDate, formatDateTime, classNames } from "../../Utils/utils";
import { USER_TYPES_MAP } from "../../Common/constants";
import { PatientNotesModel } from "./models";

export interface NoteType {
note: string;
facility: Facility;
created_by_object: CreatedByObject;
user_type: string;
created_date: string;
}

export interface Facility {
id: string;
name: string;
local_body: number;
district: number;
state: number;
ward_object: WardObject;
local_body_object: LocalBodyObject;
district_object: DistrictObject;
state_object: StateObject;
facility_type: FacilityType;
read_cover_image_url: any;
features: any[];
patient_count: number;
bed_count: number;
}

export interface WardObject {
id: number;
name: string;
number: number;
local_body: number;
}

export interface LocalBodyObject {
id: number;
name: string;
body_type: number;
localbody_code: string;
district: number;
}

export interface DistrictObject {
id: number;
name: string;
state: number;
}

export interface StateObject {
id: number;
name: string;
}

export interface FacilityType {
id: number;
name: string;
}

export interface CreatedByObject {
id: number;
first_name: string;
username: string;
email: string;
last_name: string;
user_type: string;
last_login: string;
}

const PatientNoteCard = ({ note }: { note: NoteType }) => {
const PatientNoteCard = ({ note }: { note: PatientNotesModel }) => {
return (
<div
key={note.id}
className={classNames(
"mt-4 flex w-full flex-col rounded-lg border border-gray-300 bg-white p-3 text-gray-800",
note.user_type === "RemoteSpecialist" && "border-primary-400"
Expand All @@ -81,9 +15,11 @@ const PatientNoteCard = ({ note }: { note: NoteType }) => {
{note.created_by_object?.first_name || "Unknown"}{" "}
{note.created_by_object?.last_name}
</span>
<span className="pl-2 text-sm text-gray-700">
{`(${USER_TYPES_MAP[note.user_type]})`}
</span>
{note.user_type && (
<span className="pl-2 text-sm text-gray-700">
{`(${USER_TYPES_MAP[note.user_type]})`}
</span>
)}
</div>
<span className="whitespace-pre-wrap break-words">{note.note}</span>
<div className="mt-3 text-end text-xs text-gray-500">
Expand Down
1 change: 0 additions & 1 deletion src/Components/Facility/PatientNotesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const PatientNotesList = (props: PatientNotesProps) => {
}
setIsLoading(false);
}
console.log(res);
},
[props.patientId, dispatch]
);
Expand Down
41 changes: 41 additions & 0 deletions src/Components/Facility/models.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,44 @@ export type ICD11DiagnosisModel = {
label: string;
parentId: string | null;
};

// Patient Notes Model
export interface BaseFacilityModel {
id: string;
name: string;
local_body: number;
district: number;
state: number;
ward_object: WardModel;
local_body_object?: LocalBodyModel;
district_object?: DistrictModel;
state_object?: StateModel;
facility_type: FacilityType;
read_cover_image_url: any;
features: any[];
patient_count: number;
bed_count: number;
}

export interface FacilityType {
id: number;
name: string;
}

export interface BaseUserModel {
id: number;
first_name: string;
username: string;
email: string;
last_name: string;
user_type: string;
last_login: string;
}

export interface PatientNotesModel {
note: string;
facility: BaseFacilityModel;
created_by_object: BaseUserModel;
user_type?: string;
created_date: string;
}

0 comments on commit bac0f87

Please sign in to comment.