package com.ann.demo.service.impl;

import com.ann.demo.entity.filing.MessageSubordinate;
import com.ann.demo.repository.MessageSubordinateRepository;
import com.ann.demo.service.MessageSubordinateService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
 * @Description
 * @Date 2019/7/9 16:43
 * @Created by  ljx
 */
@Service
public class MessageSubordinateServiceImpl implements MessageSubordinateService {

    static final Logger logger = LoggerFactory.getLogger(MessageSubordinateServiceImpl.class);

    @Autowired
    MessageSubordinateRepository subordinateRepository;

    @Override
    public void save(MessageSubordinate messageSubordinate) throws Exception{
        subordinateRepository.save(messageSubordinate);
    }

    @Override
    public boolean countByPatientMainAndContentJson(String patientMainStr, String contentJson) throws Exception {
        if (patientMainStr != null && contentJson != null) {
            if (subordinateRepository.countByPatientMainAndContentJson(patientMainStr, contentJson) > 0)
                return false;
            return true;
        }
        return false;
    }

}
