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 view treatment report and other minor fixes #36

Merged
merged 1 commit into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion components/ui/MedicationEffectsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const symbolName: Record<
name: "Enxaqueca",
},
"dizziness": {
icon: "Update",
icon: "Dizziness",
name: "Tontura",
},
"nausea": {
Expand Down
8 changes: 6 additions & 2 deletions components/ui/PatientNewTreatmentEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,14 @@ function PatientNewTreatmentEntry() {
);
const [availableDesiredEffects, setAvailableDesiredEffects] = useState<
AvailableEffects[]
>(["hunger", "sleep", "focus"]);
>(["hunger", "sleep", "focus" /*"relaxation", "disposition", "painRelief"*/]);
const [availableUndesiredEffects, setAvailableUndesiredEffects] = useState<
AvailableEffects[]
>(["dizziness", "nausea", "headache"]);
>([
"dizziness",
"nausea",
"headache", /*"anxiety", "confusion", "depression"*/
]);

return (
<PageWrap>
Expand Down
289 changes: 289 additions & 0 deletions components/ui/PatientTreatmentReport.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,289 @@
/**
* This component was made to control if user is logged in to access pages
*/
// import type { SectionProps } from "deco/types.ts";
// import { useUI } from "../../sdk/useUI.ts";
import { useEffect, useState } from "preact/hooks";
import { invoke } from "../../runtime.ts";
import PageWrap from "./PageWrap.tsx";
import Icon from "./Icon.tsx";
import { useUI } from "../../sdk/useUI.ts";
import type { DocListType } from "./MyDocs.tsx";
import Modal from "./Modal.tsx";
import { IS_BROWSER } from "$fresh/runtime.ts";
import type { Patient, Treatment } from "./PrescriberPatients.tsx";
import MedicationEffectsCard from "./MedicationEffectsCard.tsx";
import TreatmentCard from "./TreatmentCard.tsx";
import Chart from "deco-sites/ecannadeco/islands/FreshChart.tsx";
import { format } from "datetime";

export type Address = {
cep: string;
number: string;
complement: string;
addressType: string;
};

function PrescriberPatientTreatmentReport() {
const [isLoading, setIsLoading] = useState(false);
const [deleting, setDeleting] = useState(false);
const [isLoadingUsers, setIsLoadingUsers] = useState(false);
const [updating, setUpdating] = useState(false);
const [emailSearch, setEmailSearch] = useState("");
const [associationName, setAssociationName] = useState("");
const [associationCnpj, setAssociationCnpj] = useState("");
const [associationLogo, setAssociationLogo] = useState("");
const [createType, setCreateType] = useState<"user" | "association">(
"association",
);
const [limit, setLimit] = useState<number>();
const [hasNextPage, setHasNextPage] = useState<boolean>(false);
const [hasPrevPage, setHasPrevPage] = useState<boolean>(false);
const [page, setPage] = useState<number>();
const [totalPages, setTotalPages] = useState<number>();
const [treatment, setTreatment] = useState<Treatment>(
{
updated_at: "2024-05-14T14:29:09.024+00:00",
medication: [{
name: "CBD 3000mg - Abrapango",
dosage: "3 gotas 2x/ dia",
}, {
name: "THC 50mg - Abrapango",
dosage: "3 gotas 2x/ dia",
}],
entries: [{
created_at: "2024-05-14T14:29:09.024+00:00",
desiredEffects: [{
effect: {
name: "Fome",
},
intensity: 4,
}, {
effect: {
name: "Sono",
},
intensity: 3,
}],
undesiredEffects: [{
effect: {
name: "Dor de Cabeça",
},
intensity: 4,
}, {
effect: {
name: "Tontura",
},
intensity: 3,
}],
}],
current: true,
prescriber: {
name: "Dra. Endy Lacet",
registryType: "CRO",
registryUF: "DF",
registry: "0000000",
},
},
);

return (
<PageWrap>
{isLoading
? <span class="loading loading-spinner text-green-600"></span>
: (
<div class="flex flex-col gap-8 w-full">
<div class="flex justify-between">
<h3 class="text-2xl text-[#8b8b8b] text-center">
Relatório de Tratamento
</h3>
</div>
<div>
<div class="bg-white rounded-md shadow flex items-center justify-center gap-10 p-3">
<div class="flex gap-2 items-center">
<Icon id="Calendar" size={18} />
<span>09/05/2024</span>
</div>
<span>a</span>
<div class="flex gap-2 items-center">
<Icon id="Calendar" size={18} />
<span>09/05/2024</span>
</div>
</div>
</div>
<div>
<TreatmentCard treatment={treatment!} />
</div>
<div class="flex flex-col">
<h3 class="text-sm text-[#8b8b8b] mb-2">
Efeitos Desejados Relatados
</h3>
<div
class={`flex flex-col gap-6 p-3 bg-[#ffffff] rounded-md text-[10px] sm:text-xs md:text-sm shadow`}
>
<div class="flex gap-8">
<MedicationEffectsCard id="hunger" />
<MedicationEffectsCard id="sleep" />
<MedicationEffectsCard id="focus" />
</div>
<div class="collapse collapse-arrow border border-base-300 bg-base-200">
<input type="checkbox" />
<div class="collapse-title text-xl font-medium">
<span class="underline text-sm">Histórico dos efeitos</span>
</div>
<div class="collapse-content flex flex-col gap-[48px]">
<div>
<Chart
type="line"
options={{
scales: { y: { beginAtZero: true } },
}}
data={{
labels: [
"01/04",
"02/04",
"12/05",
`${format(new Date(), "dd/MM")}`,
],
datasets: [
{
label: "Fome - 09/05/2024 a 09/05/2024",
data: [4, 6, 8, 7],
borderColor: "#32b541",
borderWidth: 1,
},
],
}}
/>
</div>
<div>
<Chart
type="line"
options={{
scales: { y: { beginAtZero: true } },
}}
data={{
labels: [
"01/04",
"02/04",
"12/05",
`${format(new Date(), "dd/MM")}`,
],
datasets: [
{
label: "Sono - 09/05/2024 a 09/05/2024",
data: [5, 6, 4, 8],
borderColor: "#32b541",
borderWidth: 1,
},
],
}}
/>
</div>
<div>
<Chart
type="line"
options={{
scales: { y: { beginAtZero: true } },
}}
data={{
labels: [
"01/04",
"02/04",
"12/05",
`${format(new Date(), "dd/MM")}`,
],
datasets: [
{
label: "Foco - 09/05/2024 a 09/05/2024",
data: [4, 4, 2, 6],
borderColor: "#32b541",
borderWidth: 1,
},
],
}}
/>
</div>
</div>
</div>
</div>
</div>
<div class="flex flex-col">
<h3 class="text-sm text-[#8b8b8b] mb-2">
Efeitos Indesejados Relatados
</h3>
<div
class={`flex flex-col gap-6 p-3 bg-[#ffffff] rounded-md text-[10px] sm:text-xs md:text-sm shadow`}
>
<div class="flex gap-8">
<MedicationEffectsCard id="headache" />
<MedicationEffectsCard id="nausea" />
</div>
<div class="collapse collapse-arrow border border-base-300 bg-base-200">
<input type="checkbox" />
<div class="collapse-title text-xl font-medium">
<span class="underline text-sm">Histórico dos efeitos</span>
</div>
<div class="collapse-content flex flex-col gap-[48px]">
<div>
<Chart
type="line"
options={{
scales: { y: { beginAtZero: true } },
}}
data={{
labels: [
"01/04",
"02/04",
"12/05",
`${format(new Date(), "dd/MM")}`,
],
datasets: [
{
label: "Dor de Cabeça - 09/05/2024 a 09/05/2024",
data: [2, 6, 5, 4],
borderColor: "#d93939",
borderWidth: 1,
},
],
}}
/>
</div>
<div>
<Chart
type="line"
options={{
scales: { y: { beginAtZero: true } },
}}
data={{
labels: [
"01/04",
"02/04",
"12/05",
`${format(new Date(), "dd/MM")}`,
],
datasets: [
{
label: "Enjôo - 09/05/2024 a 09/05/2024",
data: [4, 2, 1, 3],
borderColor: "#d93939",
borderWidth: 1,
},
],
}}
/>
</div>
</div>
</div>
</div>
</div>
<button class="btn btn-primary text-white w-full" disabled>
<Icon id="Calendar" size={16} />
<span>Agendar Consulta (Breve)</span>
</button>
</div>
)}
</PageWrap>
);
}

export default PrescriberPatientTreatmentReport;
14 changes: 9 additions & 5 deletions components/ui/TreatmentCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,17 @@ const TreatmentCard = ({ treatment, hideLastFeedback }: Props) => {
</div>
{(treatment.patient || treatment.prescriber) && (
<div class="bg-secondary px-3 py-1 rounded-b-md text-white">
{treatment.prescriber
? (
{treatment.patient
? <span>Paciente: {treatment.patient!.name}</span>
: (
<span>
{`Prescritor: ${treatment.prescriber.name} | ${treatment.prescriber.registryType} ${treatment.prescriber.registry} - ${treatment.prescriber.registryUF}`}
{`Prescritor: ${treatment.prescriber!.name} | ${
treatment.prescriber!.registryType
} ${treatment.prescriber!.registry} - ${
treatment.prescriber!.registryUF
}`}
</span>
)
: <span>Paciente: {treatment.patient!.name}</span>}
)}
</div>
)}
</div>
Expand Down
2 changes: 2 additions & 0 deletions fresh.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import * as $NewTicketModal from "./islands/NewTicketModal.tsx";
import * as $Newsletter from "./islands/Newsletter.tsx";
import * as $OutOfStock from "./islands/OutOfStock.tsx";
import * as $PatientNewTreatmentEntry from "./islands/PatientNewTreatmentEntry.tsx";
import * as $PatientTreatmentReport from "./islands/PatientTreatmentReport.tsx";
import * as $PreSignupUsersModal from "./islands/PreSignupUsersModal.tsx";
import * as $PrescriberPatientTreatment from "./islands/PrescriberPatientTreatment.tsx";
import * as $PrescriberPatientTreatmentReport from "./islands/PrescriberPatientTreatmentReport.tsx";
Expand Down Expand Up @@ -102,6 +103,7 @@ const manifest = {
"./islands/Newsletter.tsx": $Newsletter,
"./islands/OutOfStock.tsx": $OutOfStock,
"./islands/PatientNewTreatmentEntry.tsx": $PatientNewTreatmentEntry,
"./islands/PatientTreatmentReport.tsx": $PatientTreatmentReport,
"./islands/PreSignupUsersModal.tsx": $PreSignupUsersModal,
"./islands/PrescriberPatientTreatment.tsx": $PrescriberPatientTreatment,
"./islands/PrescriberPatientTreatmentReport.tsx":
Expand Down
9 changes: 9 additions & 0 deletions islands/PatientTreatmentReport.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Component from "deco-sites/ecannadeco/components/ui/PatientTreatmentReport.tsx";
// import type { Props } from "../../components/ui/MyInfo.tsx";

function Island() {
return <Component />;
// return <Component {...props} />;
}

export default Island;
Loading
Loading