package cn.hnthyy.thmz.service.impl.his;

import cn.hnthyy.thmz.entity.his.PatientMiSfz;
import cn.hnthyy.thmz.mapper.his.PatientMiSfzMapper;
import cn.hnthyy.thmz.service.his.PatientMiSfzService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class PatientMiSfzServiceImpl implements PatientMiSfzService {
    @SuppressWarnings("all")
    @Autowired
    private PatientMiSfzMapper patientMiSfzMapper;

    @Override
    public PatientMiSfz queryPatientMiSfzByPatientId(String patientId) {
        return patientMiSfzMapper.selectPatientMiSfzByPatientId(patientId);
    }

    @Override
    @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
    public int savePatientMiSfz(PatientMiSfz patientMiSfz) {
        patientMiSfzMapper.deletePatientMiSfzByPatientId(patientMiSfz.getPatientId());
        return  patientMiSfzMapper.insertPatientMiSfz(patientMiSfz);
    }
}
