сделал карточку пациента

This commit is contained in:
Андрей Дувакин 2025-02-10 17:27:29 +05:00
parent 23123a3bce
commit 1101706f61
2 changed files with 35 additions and 4 deletions

View File

@ -0,0 +1,32 @@
import { Card } from "antd";
import PropTypes from "prop-types";
const PatientListCard = ({ patient }) => {
return (
<Card
hoverable={true}
title={`${patient.last_name} ${patient.first_name}`}
>
<p><strong>📅 Дата рождения:</strong> {patient.birthday}</p>
{patient.phone && <p><strong>📞 Телефон:</strong> {patient.phone}</p>}
{patient.email && <p><strong> Email:</strong> {patient.email}</p>}
{patient.diagnosis && <p><strong>🩺 Диагноз:</strong> {patient.diagnosis}</p>}
</Card>
);
};
PatientListCard.propTypes = {
patient: PropTypes.shape({
last_name: PropTypes.string.isRequired,
first_name: PropTypes.string.isRequired,
patronymic: PropTypes.string,
birthday: PropTypes.string.isRequired,
address: PropTypes.string,
email: PropTypes.string,
phone: PropTypes.string,
diagnosis: PropTypes.string,
correction: PropTypes.string,
}).isRequired,
};
export default PatientListCard;

View File

@ -3,6 +3,7 @@ import {Input, Select, List, Card, Button, FloatButton} from "antd";
import {PlusOutlined} from "@ant-design/icons"; import {PlusOutlined} from "@ant-design/icons";
import {useAuth} from "../AuthContext.jsx"; import {useAuth} from "../AuthContext.jsx";
import getAllPatients from "../api/GetAllPatients.jsx"; import getAllPatients from "../api/GetAllPatients.jsx";
import PatientListCard from "../components/PatientListCard.jsx";
const {Search} = Input; const {Search} = Input;
const {Option} = Select; const {Option} = Select;
@ -58,13 +59,11 @@ const PatientsPage = () => {
</div> </div>
<List <List
grid={{gutter: 16, column: 2}} grid={{gutter: 16, column: 1}}
dataSource={filteredPatients} dataSource={filteredPatients}
renderItem={(patient) => ( renderItem={(patient) => (
<List.Item> <List.Item>
<Card title={`${patient.last_name} ${patient.first_name}`}> <PatientListCard patient={patient}/>
Информация о пациенте
</Card>
</List.Item> </List.Item>
)} )}
/> />