|
|
@@ -0,0 +1,106 @@
|
|
|
+package tr.cn.module.phototherapy.common.service.impl;
|
|
|
+
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import cn.tr.core.exception.ServiceException;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import tr.cn.module.phototherapy.common.repository.BusClinicRepository;
|
|
|
+import tr.cn.module.phototherapy.common.po.BusClinicPO;
|
|
|
+import tr.cn.module.phototherapy.common.dto.BusClinicDTO;
|
|
|
+import tr.cn.module.phototherapy.common.dto.BusClinicQueryDTO;
|
|
|
+import java.util.*;
|
|
|
+import tr.cn.module.phototherapy.common.service.IBusClinicService;
|
|
|
+import tr.cn.module.phototherapy.common.mapper.BusClinicMapper;
|
|
|
+import jakarta.annotation.Resource;
|
|
|
+import cn.tr.core.exception.TRExcCode;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 临床表Service接口实现类
|
|
|
+ *
|
|
|
+ * @author CodeGenerator
|
|
|
+ * @date 2026-01-12
|
|
|
+ **/
|
|
|
+@Service
|
|
|
+public class BusClinicServiceImpl implements IBusClinicService {
|
|
|
+ @Resource
|
|
|
+ private BusClinicRepository baseRepository;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据条件查询临床表
|
|
|
+ * @param query 查询参数
|
|
|
+ * @author CodeGenerator
|
|
|
+ * @date 2026-01-12
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<BusClinicDTO> selectBusClinicList(BusClinicQueryDTO query){
|
|
|
+ return BusClinicMapper.INSTANCE.convertDtoList(
|
|
|
+ baseRepository.selectList(new LambdaQueryWrapper<BusClinicPO>()
|
|
|
+ .eq(ObjectUtil.isNotNull(query.getId()), BusClinicPO::getId, query.getId())
|
|
|
+ .eq(ObjectUtil.isNotNull(query.getPatientId()), BusClinicPO::getPatientId, query.getPatientId())
|
|
|
+ .eq(ObjectUtil.isNotNull(query.getUserId()), BusClinicPO::getUserId, query.getUserId())
|
|
|
+ .eq(ObjectUtil.isNotNull(query.getLastTreatmentTime()), BusClinicPO::getLastTreatmentTime, query.getLastTreatmentTime())
|
|
|
+ .eq(ObjectUtil.isNotNull(query.getTherapyPlanId()), BusClinicPO::getTherapyPlanId, query.getTherapyPlanId())
|
|
|
+ .like(ObjectUtil.isNotNull(query.getPatientName()), BusClinicPO::getPatientName, query.getPatientName())
|
|
|
+ .eq(ObjectUtil.isNotNull(query.getPatentAge()), BusClinicPO::getPatentAge, query.getPatentAge())
|
|
|
+ .eq(ObjectUtil.isNotNull(query.getPatientGender()), BusClinicPO::getPatientGender, query.getPatientGender())
|
|
|
+ .like(ObjectUtil.isNotNull(query.getPatentPhone()), BusClinicPO::getPatentPhone, query.getPatentPhone())
|
|
|
+ .like(ObjectUtil.isNotNull(query.getPatientAddress()), BusClinicPO::getPatientAddress, query.getPatientAddress())
|
|
|
+ .eq(ObjectUtil.isNotNull(query.getDeviceId()), BusClinicPO::getDeviceId, query.getDeviceId())
|
|
|
+ .eq(ObjectUtil.isNotNull(query.getTherapyId()), BusClinicPO::getTherapyId, query.getTherapyId())
|
|
|
+ )
|
|
|
+ );
|
|
|
+ };
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据id查询临床表
|
|
|
+ * @param id 主键id
|
|
|
+ * @author CodeGenerator
|
|
|
+ * @date 2026-01-12
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public BusClinicDTO selectBusClinicById(String id){
|
|
|
+ return BusClinicMapper.INSTANCE.convertDto(baseRepository.selectById(id));
|
|
|
+ };
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑临床表
|
|
|
+ * @param source 编辑实体类
|
|
|
+ * @author CodeGenerator
|
|
|
+ * @date 2026-01-12
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @Override
|
|
|
+ public boolean updateBusClinicById(BusClinicDTO source){
|
|
|
+ return baseRepository.updateById(BusClinicMapper.INSTANCE.convertPO(source))!=0;
|
|
|
+ };
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增临床表
|
|
|
+ * @param source 新增实体类
|
|
|
+ * @author CodeGenerator
|
|
|
+ * @date 2026-01-12
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public boolean insertBusClinic(BusClinicDTO source){
|
|
|
+ return baseRepository.insert(BusClinicMapper.INSTANCE.convertPO(source))!=0;
|
|
|
+ };
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除临床表详情
|
|
|
+ * @param ids 删除主键集合
|
|
|
+ * @author CodeGenerator
|
|
|
+ * @date 2026-01-12
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public int removeBusClinicByIds(Collection<String> ids){
|
|
|
+ if(CollectionUtil.isEmpty(ids)){
|
|
|
+ throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001,"请选择要删除的数据");
|
|
|
+ }
|
|
|
+ return baseRepository.deleteByIds(ids);
|
|
|
+ };
|
|
|
+}
|