package com.emoon.chat.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.emoon.chat.domain.MedicalRecDo;
import com.emoon.chat.mapper.MedicalRecMapper;
import com.emoon.chat.service.IMedicalRecService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.utils.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author destiny
 * @description:
 * @date 2025/10/14 23:43
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class MedicalRecServiceImpl implements IMedicalRecService {

    private final MedicalRecMapper medicalRecMapper;

    @Override
    public List<MedicalRecDo> queryList(MedicalRecDo medicalRecDo) {
        return medicalRecMapper.selectList(new LambdaQueryWrapper<MedicalRecDo>()
            .eq(medicalRecDo.getId() != null, MedicalRecDo::getId, medicalRecDo.getId())
            .eq(StringUtils.isNotBlank(medicalRecDo.getMrId()), MedicalRecDo::getMrId, medicalRecDo.getMrId())
            .eq(StringUtils.isNotBlank(medicalRecDo.getPatVisitInfoId()), MedicalRecDo::getPatVisitInfoId, medicalRecDo.getPatVisitInfoId())
            .eq(StringUtils.isNotBlank(medicalRecDo.getTypeName()), MedicalRecDo::getTypeName, medicalRecDo.getTypeName())
            .eq(StringUtils.isNotBlank(medicalRecDo.getDeptId()), MedicalRecDo::getDeptId, medicalRecDo.getDeptId())
            .eq(StringUtils.isNotBlank(medicalRecDo.getDeptName()), MedicalRecDo::getDeptName, medicalRecDo.getDeptName())
            .eq(StringUtils.isNotBlank(medicalRecDo.getStatus()), MedicalRecDo::getStatus, medicalRecDo.getStatus())
            .eq(StringUtils.isNotBlank(medicalRecDo.getCreator()), MedicalRecDo::getCreator, medicalRecDo.getCreator())
            .eq(StringUtils.isNotBlank(medicalRecDo.getEditor()), MedicalRecDo::getEditor, medicalRecDo.getEditor())
            .eq(StringUtils.isNotBlank(medicalRecDo.getEditTime()), MedicalRecDo::getEditTime, medicalRecDo.getEditTime())
            .eq(StringUtils.isNotBlank(medicalRecDo.getCmpltr()), MedicalRecDo::getCmpltr, medicalRecDo.getCmpltr())
            .eq(StringUtils.isNotBlank(medicalRecDo.getCmpltTime()), MedicalRecDo::getCmpltTime, medicalRecDo.getCmpltTime())
            .eq(StringUtils.isNotBlank(medicalRecDo.getSno()), MedicalRecDo::getSno, medicalRecDo.getSno())
            .eq(StringUtils.isNotBlank(medicalRecDo.getContent()), MedicalRecDo::getContent, medicalRecDo.getContent())
            .eq(medicalRecDo.getDataStatus() != null, MedicalRecDo::getDataStatus, medicalRecDo.getDataStatus())
        );
    }

}
