Files
HIS-GUI/include/core/ward_service.h
2026-04-05 20:11:43 +08:00

56 lines
1.5 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#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