zqy
4 天以前 f84d029d497949af28c6780a52bec9020c642311
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult;
@@ -39,7 +40,7 @@
 */
@Service
@Slf4j
public class ZfDoctorServiceImpl extends ServiceImpl<ZfDoctorMapper, ZfDoctor> implements ZfDoctorService {
public class ZfDoctorServiceImpl extends ServiceImpl<ZfDoctorMapper, ZfDoctor> implements ZfDoctorService,ModuleSearchable {
    @Resource
    ZInfoUserService zInfoUserService;
@@ -101,7 +102,11 @@
        //加上父母家族id
        idList.add(fatherFaId);
        idList.add(motherFaId);
        List<Long> fms = zInfoUserService.findByUaidToFaid(myself.getUaid()).stream().map(ZInfoUser::getFamilyId).collect(Collectors.toList());
        if(!fms.isEmpty())
        {
            idList.addAll(fms);
        }
//        String familyIds = listFamilyIds();
//        String secondFamilyAuthority = listSecondFamilyIds()
        LambdaQueryWrapper<ZfDoctor> lqw = buildCondition(zfDoctor, idList);
@@ -156,7 +161,7 @@
    public List<ZfDoctor> markOwnData(Long familyId,Long fatherFamilyId, Long motherFamilyId, List<ZfDoctor> beanRecords) {
        return beanRecords.stream().peek(
                bean -> {
                    if (bean.getFamilyId() == familyId||(fatherFamilyId!=0L && fatherFamilyId==familyId)||(motherFamilyId!=0L && motherFamilyId==familyId)) {
                    if (Objects.equals(bean.getFamilyId(), familyId) ||(fatherFamilyId!=0L && fatherFamilyId.equals(familyId))||(motherFamilyId!=0L && motherFamilyId.equals(familyId))) {
                        bean.setOwnData(1);
                    } else {
                        bean.setOwnData(0);
@@ -461,6 +466,29 @@
                .like(StringUtils.isNotEmpty(zfDoctor.getWmedical()), ZfDoctor::getWmedical, zfDoctor.getWmedical())
                .like(StringUtils.isNotEmpty(zfDoctor.getCmedical()), ZfDoctor::getCmedical, zfDoctor.getCmedical())
                .like(StringUtils.isNotEmpty(zfDoctor.getRemark()), ZfDoctor::getRemark, zfDoctor.getRemark());
//        lqw.like(StringUtils.isNotEmpty(zfDoctor.getCompanion()),ZfDoctor::getCompanion,zfDoctor.getCompanion());
        if (CollectionUtils.isNotEmpty(zfDoctor.getCompanionList())) {
            List<String> companionList = zfDoctor.getCompanionList();
            // 清理和去重
            companionList = companionList.stream()
                .map(String::trim)
                .filter(s -> !s.isEmpty())
                .distinct()
                .collect(Collectors.toList());
            if (!companionList.isEmpty()) {
                // 确保所有参与人都在companion字段中
                for (String companion : companionList) {
                    lqw.apply("FIND_IN_SET({0}, REPLACE(REPLACE(companion, ' ', ''), ',', ',')) > 0",
                        companion);
                }
            }
        }
        lqw.between(zfDoctor.getHappenStartTime() != null && zfDoctor.getHappenEndTime() != null, ZfDoctor::getCreateTime, zfDoctor.getHappenStartTime(), zfDoctor.getHappenEndTime());
        if (StringUtils.isNotEmpty(zfDoctor.getPrescription())) {
            lqw.and(wrapper -> {
                wrapper.like(StringUtils.isNotEmpty(zfDoctor.getPrescription()), ZfDoctor::getWmedical, zfDoctor.getPrescription())
@@ -469,6 +497,23 @@
            });
        }
        return lqw;
    }
    @Override
    public String getModuleCode() {
        return "2043";
    }
    @Override
    public List<?> search(String companion, Date happenStartTime, Date happenEndTime) {
        ZfDoctor zfDoctor = new ZfDoctor();
        String[] split = companion.split(",");
        List<String> list = Arrays.asList(split);
        zfDoctor.setCompanionList(list);        zfDoctor.setHappenStartTime(happenStartTime);
        zfDoctor.setHappenEndTime(happenEndTime);
        return selectByCondition(zfDoctor);
    }
//    public LambdaQueryWrapper<ZfDoctor> buildCondition2(List<Long> ids) {
@@ -512,4 +557,4 @@
//    }
}
}