66 lines
2.1 KiB
C++
66 lines
2.1 KiB
C++
#ifndef DEPARTMENT_SERVICE_H
|
||
#define DEPARTMENT_SERVICE_H
|
||
|
||
#include <functional>
|
||
#include <string>
|
||
#include <vector>
|
||
|
||
#include "core/his_context.h"
|
||
#include "models/doctor.h"
|
||
#include "models/medicine.h"
|
||
|
||
namespace core {
|
||
|
||
class DepartmentService {
|
||
public:
|
||
explicit DepartmentService(HisContext& ctx);
|
||
|
||
size_t departmentCount() const;
|
||
|
||
const Department* findDepartment(const std::string& departmentId) const;
|
||
Department* findDepartment(const std::string& departmentId);
|
||
|
||
void for_eachDepartment(
|
||
const std::function<void(const std::string&, const Department&)>& visitor) const;
|
||
|
||
// 搜索科室:支持名称、描述
|
||
void searchDepartments(
|
||
const std::string& keyword,
|
||
const std::function<void(const std::string&, const Department&)>& visitor) const;
|
||
|
||
bool addDepartment(const Department& d);
|
||
bool removeDepartment(const std::string& departmentId);
|
||
bool updateDepartment(const std::string& departmentId, const Department& d);
|
||
|
||
// 创建新科室(自动生成UUID)
|
||
Department createDepartment(const std::string& name, const std::string& description = "");
|
||
|
||
// 新增:获取指定科室的所有医生(动态查询)
|
||
std::vector<Doctor> getDoctorsByDepartment(const std::string& departmentId) const;
|
||
|
||
// 新增:获取指定科室的所有药品(动态查询)
|
||
std::vector<Medicine> getMedicinesByDepartment(const std::string& departmentId) const;
|
||
|
||
// 新增:获取科室名称
|
||
std::string getDepartmentName(const std::string& departmentId) const;
|
||
|
||
// 新增:检查是否可以删除科室(如果科室下有医生或药品则不能删除)
|
||
bool canDeleteDepartment(const std::string& departmentId) const;
|
||
|
||
// 新增:获取科室下的医生数量
|
||
size_t getDoctorCountInDepartment(const std::string& departmentId) const;
|
||
|
||
// 新增:获取科室下的药品数量
|
||
size_t getMedicineCountInDepartment(const std::string& departmentId) const;
|
||
|
||
// 新增:获取科室下的检查项目数量
|
||
size_t getCheckCountInDepartment(const std::string& departmentId) const;
|
||
|
||
private:
|
||
HisContext& ctx_;
|
||
};
|
||
|
||
} // namespace core
|
||
|
||
#endif
|