56 lines
1.5 KiB
C++
56 lines
1.5 KiB
C++
#ifndef WARD_SERVICE_H
|
||
#define WARD_SERVICE_H
|
||
|
||
#include <functional>
|
||
#include <string>
|
||
#include <vector>
|
||
|
||
#include "core/his_context.h"
|
||
#include "utils/file_manager.h"
|
||
|
||
namespace core {
|
||
|
||
// Ward persistence + CRUD over in-memory ward list.
|
||
class WardService {
|
||
public:
|
||
explicit WardService(HisContext& ctx);
|
||
|
||
size_t wardCount() const;
|
||
|
||
const Ward* findWard(const std::string& wardId) const;
|
||
|
||
Ward* findWard(const std::string& wardId);
|
||
|
||
void for_eachWard(
|
||
const std::function<void(const std::string&, const Ward&)>& visitor) const;
|
||
|
||
bool addWard(const Ward& w);
|
||
|
||
// 创建新病房(自动生成UUID)
|
||
Ward createWard(const std::string& departmentId, WardType type, int maxBeds);
|
||
|
||
bool removeWard(const std::string& wardId);
|
||
|
||
bool addBed(const std::string& wardId, const std::string& bedId);
|
||
|
||
// 释放床位(将床位状态置 Free),属于病房状态操作层
|
||
bool releaseBed(const std::string& wardId, const std::string& bedId);
|
||
|
||
// 释放指定患者占用床位(根据 patientId 查找床位并释放)
|
||
bool releasePatient(const std::string& wardId, const std::string& patientId);
|
||
|
||
// 删除床位:属于设施管理层(仅可在空闲床位上操作)
|
||
bool removeBed(const std::string& wardId, const std::string& bedId);
|
||
|
||
bool loadFromFile(const std::string& path, std::string& outError);
|
||
|
||
bool saveToFile(const std::string& path, std::string& outError, int indent = 2) const;
|
||
|
||
private:
|
||
HisContext& ctx_;
|
||
};
|
||
|
||
} // namespace core
|
||
|
||
#endif
|