ソースを参照

Merge branch 'dev' of yeshijie/wlyy2.0 into dev

叶仕杰 4 年 前
コミット
e0f2613b4e

+ 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);
}

+ 13 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java

@ -362,6 +362,19 @@ public class SignEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "getArchiveTopNum")
    @ApiOperation(value = "档案管理-获取签约/未签约总数")
    public ObjEnvelop getArchiveTopNum(
            @ApiParam(name = "doctorId", value = "医生id", required = true)
            @RequestParam String doctorId) {
        try{
            return ObjEnvelop.getSuccess("查询成功",archiveService.getArchiveTopNum(doctorId));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "archiveList")
    @ApiOperation(value = "获取档案分页")
    public PageEnvelop<List<Map<String,Object>>> archiveList (

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

@ -1,5 +1,6 @@
package com.yihu.jw.care.service.sign;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.apply.PatientBedApplyDao;
import com.yihu.jw.care.dao.sign.ArchiveDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
@ -58,6 +59,23 @@ public class ArchiveService extends BaseJpaService<ArchiveDO, ArchiveDao> {
        return jdbcTemplate.queryForObject(sql,Integer.class);
    }
    public JSONObject getArchiveTopNum(String doctorId){
        JSONObject json = new JSONObject();
        json.put("signTotal",0);
        json.put("unSignTotal",0);
        String sql = " SELECT COUNT(*) num,CAST(sign_status as char) sign_status  from wlyy_archive WHERE doctor_code =  '"+doctorId+"'GROUP BY sign_status";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        for (Map<String,Object> map:list){
            if("1".equals(String.valueOf(map.get("sign_status")))){
                json.put("signTotal",map.get("num"));
            }
            if("0".equals(String.valueOf(map.get("sign_status")))){
                json.put("unSignTotal",map.get("num"));
            }
        }
        return json;
    }
    public PageEnvelop<List<Map<String,Object>>> archiveList(String doctorId, int page, int size,Integer signStatus,String name){
        String sql = "SELECT a.create_time,p.idcard,p.mobile,p.name,p.sex,p.id ";
        String countSql = "SELECT count(*) ";

+ 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;