60 lines
2.0 KiB
C++
60 lines
2.0 KiB
C++
#ifndef PATIENT_SERVICE_H
|
||
#define PATIENT_SERVICE_H
|
||
|
||
#include <functional>
|
||
#include <string>
|
||
|
||
#include "core/his_context.h"
|
||
|
||
namespace core {
|
||
|
||
// Patient CRUD + admission/discharge status sync.
|
||
class PatientService {
|
||
public:
|
||
explicit PatientService(HisContext& ctx);
|
||
|
||
size_t patientCount() const;
|
||
const Patient* findPatient(const std::string& patientId) const;
|
||
Patient* findPatient(const std::string& patientId);
|
||
bool addPatient(const Patient& p);
|
||
bool updatePatient(const std::string& patientId,
|
||
const std::string& name,
|
||
int age,
|
||
const std::string& gender,
|
||
const std::string& contact,
|
||
PatientStatus status = PatientStatus::Outpatient);
|
||
bool removePatient(const std::string& patientId, std::string& outError);
|
||
void for_eachPatient(
|
||
const std::function<void(const std::string&, const Patient&)>& visitor) const;
|
||
void findByName(
|
||
const std::string& keyword,
|
||
const std::function<void(const std::string&, const Patient&)>& visitor) const;
|
||
void findByPatientId(
|
||
const std::string& keyword,
|
||
const std::function<void(const std::string&, const Patient&)>& visitor) const;
|
||
|
||
// 通过手机号模糊搜索患者
|
||
void findByContact(
|
||
const std::string& keyword,
|
||
const std::function<void(const std::string&, const Patient&)>& visitor) const;
|
||
|
||
bool admitPatient(const std::string& wardId,
|
||
const std::string& patientId,
|
||
std::string& outBedId);
|
||
|
||
// 创建新患者(自动生成UUID)
|
||
Patient createPatient(const std::string& name, int age, const std::string& gender,
|
||
const std::string& contact, PatientStatus status = PatientStatus::Outpatient);
|
||
|
||
bool releaseBed(const std::string& wardId, const std::string& bedId);
|
||
|
||
bool releasePatient(const std::string& wardId, const std::string& patientId);
|
||
|
||
private:
|
||
HisContext& ctx_;
|
||
};
|
||
|
||
} // namespace core
|
||
|
||
#endif
|