Skip to content

Commit

Permalink
Merge pull request #337 from noharm-ai/develop
Browse files Browse the repository at this point in the history
v3.1.17
  • Loading branch information
marceloarocha authored Jul 10, 2024
2 parents b552228 + d31000a commit c8ba80f
Show file tree
Hide file tree
Showing 54 changed files with 2,128 additions and 364 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "noharm-app",
"version": "3.1.16",
"version": "3.1.17",
"private": true,
"dependencies": {
"@ckeditor/ckeditor5-build-classic": "^35.0.1",
Expand Down
33 changes: 33 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,39 @@
</noscript>
<!-- End Google Tag Manager (noscript) -->

<script>
(function (n, i, v, r, s, c, u, x, z) {
x = window.AwsRumClient = { q: [], n: n, i: i, v: v, r: r, c: c, u: u };
window[n] = function (c, p) {
x.q.push({ c: c, p: p });
};
z = document.createElement("script");
z.async = true;
z.src = s;
document.head.insertBefore(
z,
document.getElementsByTagName("script")[0]
);
})(
"cwr",
"76733ed1-1445-4f80-8e41-2f824a752c39",
"1.0.0",
"sa-east-1",
"https://client.rum.us-east-1.amazonaws.com/1.18.0/cwr.js",
{
sessionSampleRate: 1,
identityPoolId: "sa-east-1:45bad581-042d-4680-91e2-972f4074372d",
endpoint: "https://dataplane.rum.sa-east-1.amazonaws.com",
telemetries: ["errors"],
allowCookies: true,
enableXRay: false,
sessionAttributes: {
applicationVersion: "%REACT_APP_VERSION%",
},
}
);
</script>

<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="update-browser" style="display: none"></div>
<button id="update-browser-close" style="display: none">Fechar</button>
Expand Down
96 changes: 96 additions & 0 deletions src/components/DrugAlertLevelTag.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import React from "react";
import { useTranslation } from "react-i18next";

import Tooltip from "components/Tooltip";
import Badge from "components/Badge";
import Tag from "components/Tag";

export default function DrugAlertLevelTag({
levels,
count,
showDescription = false,
allergy = false,
onClick = () => {},
}) {
const { t } = useTranslation();

const getAlertStyle = () => {
const defaultColor = {
background: "#7ebe9a",
borderColor: "#7ebe9a",
color: "#fff",
};

if (!levels.length) {
return defaultColor;
}

if (levels.indexOf("high") !== -1) {
return {
background: "#f44336",
borderColor: "#f44336",
color: "#fff",
};
}

if (levels.indexOf("medium") !== -1) {
return {
background: "#f57f17",
borderColor: "#f57f17",
color: "#fff",
};
}

if (levels.indexOf("low") !== -1) {
return {
background: "#ffc107",
borderColor: "#ffc107",
color: "#fff",
};
}
};

const getAlertDescription = () => {
if (!levels.length) {
return "-";
}

if (levels.indexOf("high") !== -1) {
return "Alto";
}

if (levels.indexOf("medium") !== -1) {
return "Médio";
}

if (levels.indexOf("low") !== -1) {
return "Baixo";
}
};

return (
<Tooltip
title={
allergy
? t("prescriptionDrugTags.alertsAllergy")
: t("prescriptionDrugTags.alerts")
}
>
<Badge dot count={allergy ? 1 : 0}>
<Tag
style={{
...getAlertStyle(),
cursor: "pointer",
marginRight: 0,
width: showDescription ? "auto" : "30px",
textAlign: "center",
padding: showDescription ? "0 5px" : 0,
}}
onClick={() => onClick()}
>
{showDescription ? getAlertDescription() : count}
</Tag>
</Badge>
</Tooltip>
);
}
4 changes: 2 additions & 2 deletions src/components/Forms/ClinicalNotes/util/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,11 @@ export const alertsTemplate = (prescription) => {

let alerts = [];
list.forEach((i) => {
if (i.alerts && i.alerts.length) {
if (i.alertsComplete && i.alertsComplete.length) {
const tpl = `
Medicamento: ${i.drug}
Alertas:
-- ${i.alerts.join("\r\n -- ")}
-- ${i.alertsComplete.map((a) => a.text).join("\r\n -- ")}
`;
alerts = [...alerts, tpl];
}
Expand Down
3 changes: 3 additions & 0 deletions src/components/Layout/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ const Me = ({

const ErrorFallback = ({ error, resetErrorBoundary }) => {
console.error(error);
if (window.cwr) {
window.cwr("recordError", error);
}
return (
<div style={{ maxWidth: "500px" }}>
<Alert
Expand Down
56 changes: 31 additions & 25 deletions src/components/Prioritization/Filter/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -624,43 +624,49 @@ export default function Filter({
allowClear
>
<Select.Option key={"allergy"} value={"allergy"}>
{t("alerts.alergy")}
{t("drugAlertType.allergy")}
</Select.Option>

<Select.Option key={"maxDose"} value={"maxDose"}>
{t("alerts.max_dose")}
{t("drugAlertType.maxDose")}
</Select.Option>

<Select.Option key={"dup"} value={"dup"}>
{t("alerts.duplicate")}
<Select.Option key={"dm"} value={"dm"}>
{t("drugAlertType.dm")}
</Select.Option>

<Select.Option key={"exams"} value={"exams"}>
{t("alerts.exam")}
<Select.Option key={"dt"} value={"dt"}>
{t("drugAlertType.dt")}
</Select.Option>

<Select.Option key={"inc"} value={"inc"}>
{t("alerts.y")}
<Select.Option key={"liver"} value={"liver"}>
{t("drugAlertType.liver")}
</Select.Option>

<Select.Option key={"isl"} value={"isl"}>
{t("alerts.isl")}
<Select.Option key={"iy"} value={"iy"}>
{t("drugAlertType.iy")}
</Select.Option>

<Select.Option key={"int"} value={"int"}>
{t("alerts.interaction")}
<Select.Option key={"it"} value={"it"}>
{t("drugAlertType.it")}
</Select.Option>

<Select.Option key={"tube"} value={"tube"}>
{t("alerts.tube")}
<Select.Option key={"ira"} value={"ira"}>
{t("drugAlertType.ira")}
</Select.Option>
<Select.Option key={"sl"} value={"sl"}>
{t("drugAlertType.sl")}
</Select.Option>

<Select.Option key={"elderly"} value={"elderly"}>
{t("alerts.elderly")}
{t("drugAlertType.elderly")}
</Select.Option>
<Select.Option key={"kidney"} value={"kidney"}>
{t("drugAlertType.kidney")}
</Select.Option>
<Select.Option key={"platelets"} value={"platelets"}>
{t("drugAlertType.platelets")}
</Select.Option>
<Select.Option key={"rx"} value={"rx"}>
{t("drugAlertType.rx")}
</Select.Option>
<Select.Option key={"tube"} value={"tube"}>
{t("drugAlertType.tube")}
</Select.Option>

<Select.Option key={"maxTime"} value={"maxTime"}>
{t("alerts.time")}
{t("drugAlertType.maxTime")}
</Select.Option>
</Select>
</Col>
Expand Down
3 changes: 2 additions & 1 deletion src/components/Prioritization/Util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ export const filterList = (list, filter) => {
newList = newList.filter(
(i) =>
i.namePatient.toLowerCase().includes(filter.searchKey) ||
`${i.admissionNumber}`.includes(filter.searchKey)
`${i.admissionNumber}`.includes(filter.searchKey) ||
`${i.idPatient}`.includes(filter.searchKey)
);
}

Expand Down
45 changes: 45 additions & 0 deletions src/components/References/Relation/columns.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,51 @@ const columns = (security) => [
</Tag>
),
},
{
title: "Nível",
render: (entry, record) => {
switch (record.level) {
case "low":
return (
<Tag
style={{
background: "#ffc107",
borderColor: "#ffc107",
color: "#fff",
}}
>
Baixo
</Tag>
);
case "medium":
return (
<Tag
style={{
background: "#f57f17",
borderColor: "#f57f17",
color: "#fff",
}}
>
Médio
</Tag>
);
case "high":
return (
<Tag
style={{
background: "#f44336",
borderColor: "#f44336",
color: "#fff",
}}
>
Alto
</Tag>
);
default:
return record.level;
}
},
},
{
title: "Ações",
key: "operations",
Expand Down
27 changes: 27 additions & 0 deletions src/components/References/Relation/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,33 @@ export default function Relation({
/>
</Col>
</Row>
{relation.item.editable && (
<Row type="flex" gutter={24} css="padding: 7px 0">
<Col span={8}>
<Heading as="p" size="14px">
Nível:
</Heading>
</Col>
<Col span={24 - 8}>
<Select
optionFilterProp="children"
showSearch
onChange={(value) => update({ level: value })}
value={relation.item.level}
>
<Select.Option key={"low"} value={"low"}>
Baixo
</Select.Option>
<Select.Option key={"medium"} value={"medium"}>
Médio
</Select.Option>
<Select.Option key={"high"} value={"high"}>
Alto
</Select.Option>
</Select>
</Col>
</Row>
)}
{relation.item.editable && (
<Row type="flex" gutter={24} css="padding: 7px 0">
<Col span={24}>
Expand Down
Loading

0 comments on commit c8ba80f

Please sign in to comment.