Explorar o código

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

Conflicts:
	svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/CapacityAssessmentRecordService.java
yeshijie %!s(int64=4) %!d(string=hai) anos
pai
achega
f197cc35da

+ 1 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/CapacityAssessmentRecordDao.java

@ -10,5 +10,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
public interface CapacityAssessmentRecordDao extends PagingAndSortingRepository<CapacityAssessmentRecordDO, String>,
        JpaSpecificationExecutor<CapacityAssessmentRecordDO> {
    CapacityAssessmentRecordDO findByPatient(String patient);
}

+ 3 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/ServicePackageRecordDao.java

@ -4,11 +4,13 @@ import com.yihu.jw.entity.base.servicePackage.ServicePackageRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by yeshijie on 2021/2/25.
 */
public interface ServicePackageRecordDao extends PagingAndSortingRepository<ServicePackageRecordDO, String>, JpaSpecificationExecutor<ServicePackageRecordDO> {
    List<ServicePackageRecordDO> findBySignId(String signId);
}

+ 9 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/CapacityAssessmentRecordService.java

@ -76,6 +76,15 @@ public class CapacityAssessmentRecordService extends BaseJpaService<CapacityAsse
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    /**
     * 按id查找评估明细
     * @param id
     * @return
     */
    public CapacityAssessmentRecordDO findAssessmentByPatientId(String patient)  {
        return capacityAssessmentRecordDao.findByPatient(patient);
    }
    /**
     * 按id查找评估明细
     * @param id

+ 21 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageService.java

@ -12,6 +12,7 @@ import com.yihu.jw.entity.base.servicePackage.ServicePackageItemDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageRecordDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.entity.care.archive.ArchiveDO;
import com.yihu.jw.entity.care.sign.CapacityAssessmentRecordDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.service.BasePatientMedicardCardService;
import com.yihu.jw.restmodel.web.PageEnvelop;
@ -29,6 +30,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
/**
 *
@ -44,7 +46,8 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
    private ServicePackageDao servicePackageDao;
    @Autowired
    private ServicePackageItemDao servicePackageItemDao;
    @Autowired
    private CapacityAssessmentRecordService capacityAssessmentRecordService;
    @Autowired
    private ServicePackageSignRecordDao servicePackageSignRecordDao;
    @Autowired
@ -265,8 +268,10 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
    @Transactional(rollbackFor = Exception.class)
    public ServicePackageSignRecordDO servicePackageSign(String jsonData,String doctorId,String patientId) throws Exception{
        ServicePackageSignRecordDO signRecordDO = objectMapper.readValue(jsonData, ServicePackageSignRecordDO.class);
        signRecordDO.setPatient(patientId);
        List<ServicePackageRecordDO> recordDOList = signRecordDO.getRecordDOList();
        String signId = signRecordDO.getId();
        List<String> idList = new ArrayList<>();
        if(StringUtil.isEmpty(signId)){
            List<ServicePackageSignRecordDO> signRecordDOs = servicePackageSignRecordDao.findByStatusAndPatient(1,signRecordDO.getPatient());
            if(signRecordDOs.size()==0){
@ -283,19 +288,32 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
                signId = signRecordDO.getId();
                //建档状态修改
                ArchiveDO archiveDO = archiveDao.findByPatientAndDoctorCode(signRecordDO.getPatient(),doctorId);
                ArchiveDO archiveDO = archiveDao.findByPatientAndDoctorCode(patientId,doctorId);
                if(archiveDO!=null){
                    archiveDO.setSignStatus(1);
                    archiveDao.save(archiveDO);
                }
            }else{
                signId = signRecordDOs.get(0).getId();
                List<ServicePackageRecordDO> existList = servicePackageRecordDao.findBySignId(signId);
                idList = existList.stream().map(ServicePackageRecordDO::getServicePackageId).collect(Collectors.toList());
            }
        }
        for (ServicePackageRecordDO recordDO:recordDOList){
        Iterator<ServicePackageRecordDO> iterator = recordDOList.iterator();
        while (iterator.hasNext()) {
            ServicePackageRecordDO recordDO = iterator.next();
            recordDO.setPatient(patientId);
            recordDO.setSignId(signId);
            if (idList.contains(recordDO.getServicePackageId())) {
                iterator.remove();//使用迭代器的删除方法删除
            }
        }
        if(recordDOList.size()>0){
            CapacityAssessmentRecordDO capacityAssessmentRecordDO = capacityAssessmentRecordService.findAssessmentByPatientId(patientId);
            capacityAssessmentRecordDO.setServicePackageStatus(1);
            capacityAssessmentRecordService.save(capacityAssessmentRecordDO);
        }
        servicePackageRecordDao.save(recordDOList);
        return signRecordDO;