Ver código fonte

代码修改

liubing 4 anos atrás
pai
commit
da6d98669e

+ 7 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/PatientEndpoint.java

@ -1,5 +1,6 @@
package com.yihu.jw.care.endpoint.patient;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.aop.RedisLock;
import com.yihu.jw.care.aop.ServicesAuth;
@ -7,7 +8,9 @@ import com.yihu.jw.care.aop.ServicesAuthAOP;
import com.yihu.jw.care.dao.label.WlyyPatientLabelDao;
import com.yihu.jw.care.service.patient.CarePatientService;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
@ -123,7 +126,10 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
                                  @ApiParam(name = "doctorId", value = "医生id")
                                  @RequestParam(value = "doctorId", required = false)String doctorId)throws Exception{
        try{
            patientService.updPatient(jsonData, doctorId);
            JSONObject result =  patientService.updPatient(jsonData, doctorId);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return Envelop.getError(result.getString(ResponseContant.resultMsg));
            }
            return success("修改成功");
        }catch (Exception e){
            e.printStackTrace();

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

@ -21,6 +21,7 @@ import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
@ -183,9 +184,12 @@ public class SignEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "doctorId", value = "医生id", required = true)
            @RequestParam String doctorId) {
        try{
            ServicePackageSignRecordDO signRecordDO = servicePackageService.servicePackageSign(jsonData,doctorId,patientId);
            servicePackageService.setPatientServiceItems(signRecordDO.getPatient());
            return success("分配成功");
           JSONObject result  = servicePackageService.servicePackageSign(jsonData,doctorId,patientId);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return Envelop.getError(result.getString(ResponseContant.resultMsg));
            }
            servicePackageService.setPatientServiceItems(result.getJSONObject("resultMsg").getString("patient"));
            return Envelop.getSuccess("分配成功");
        }catch (Exception e){
            e.printStackTrace();
            return failed("分配失败",-1);

+ 11 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/apply/PatientBedApplyService.java

@ -89,8 +89,9 @@ public class PatientBedApplyService extends BaseJpaService<PatientBedApplyDo, Pa
        if (doctorDO.getLevel()==2){//助老员
            List<BaseDoctorHospitalDO> hospitalDOS = baseDoctorHospitalDao.findDistinctOrgByDoctorCode(doctor);
            for (BaseDoctorHospitalDO obj:hospitalDOS){
                String sql="select ap.id,p.id patientCode,p.name,p.sex,p.idcard,p.photo,ap.status,DATE_FORMAT(ap.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_patient_bed_apply ap INNER JOIN base_patient p where ap.idcard = p.idcard and org_code='"+obj.getOrgCode()+"' " +
                    "and ap.status <> -1 and ap.status<>0";
                String sql="select ap.id,p.id patientCode,ap.patient_name name,p.sex,ap.idcard,p.photo,ap.status,DATE_FORMAT(ap.create_time,'%Y-%m-%d %H:%i:%S') create_time " +
                        "from base_patient_bed_apply ap LEFT JOIN base_patient p ON ap.idcard = p.idcard WHERE org_code='"+obj.getOrgCode()+"' " +
                        "and ap.status <> -1 and ap.status<>0";
                List<Map<String,Object>> tmp = jdbcTemplate.queryForList(sql);
                for (Map<String,Object> map:tmp){
                    if (map.get("idcard")==null){
@ -100,7 +101,14 @@ public class PatientBedApplyService extends BaseJpaService<PatientBedApplyDo, Pa
                        Integer age  = IdCardUtil.getAgeForIdcard(map.get("idcard").toString());
                        map.put("age",age);
                    }
                    if (map.get("sex")==null){
                        try {
                            String sex = IdCardUtil.getSexForIdcard_new(map.get("idcard").toString());
                            map.put("sex",Integer.parseInt(sex));
                        }catch (Exception e){
                            e.printStackTrace();
                        }
                    }
                }
                result.addAll(tmp);
            }

+ 3 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yihu.jw.care.dao.assistance.EmergencyAssistanceDao;
import com.yihu.jw.care.dao.sign.ServicePackageItemDao;
import com.yihu.jw.care.dao.sign.ServicePackageSignRecordDao;
import com.yihu.jw.care.dao.team.BaseTeamMemberDao;
import com.yihu.jw.care.service.consult.ConsultTeamService;
@ -433,7 +434,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        if (!assistanceDO.getPatient().equals(patient)){
        if (!(assistanceDO.getPatient().equals(patient)||assistanceDO.getProxyPatient().equals(patient))){
            String failMsg = "当前救助工单不是您的工单,无法取消";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,failMsg);
@ -500,6 +501,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        emergencyAssistanceDao.save(assistanceDO);
        return getOrderDetail(orderId);
    }

+ 10 - 4
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java

@ -14,6 +14,7 @@ import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
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.ResponseContant;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.utils.StringUtil;
@ -141,7 +142,7 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
     * @param doctorId
     */
    @Transactional(rollbackFor = Exception.class)
    public void updPatient(String jsonData,String doctorId) throws Exception{
    public JSONObject updPatient(String jsonData,String doctorId) throws Exception{
        JSONObject jsonObject = JSON.parseObject(jsonData);
        BasePatientDO patientDetail = JSONObject.parseObject(jsonObject.getJSONObject("patient").toJSONString(), BasePatientDO.class);
        BasePatientDO patientBrief = patientDao.findById(patientDetail.getId());
@ -174,11 +175,16 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
        patientDao.save(patientBrief);
        JSONObject jsonObject1 = jsonObject.getJSONObject("signRecordDO");
        JSONObject result  = new JSONObject();
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg,"修改成功");
        if(jsonObject1!=null){
            servicePackageService.servicePackageSign(jsonObject1.toJSONString(),doctorId,patientBrief.getId());
            servicePackageService.setPatientServiceItems(patientBrief.getId());
            result = servicePackageService.servicePackageSign(jsonObject1.toJSONString(),doctorId,patientBrief.getId());
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.success) {
                servicePackageService.setPatientServiceItems(patientBrief.getId());
            }
        }
        return result;
    }
    /**

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

@ -15,6 +15,7 @@ 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.ResponseContant;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.utils.StringUtil;
@ -306,7 +307,8 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
     * @param doctorId
     */
    @Transactional(rollbackFor = Exception.class)
    public ServicePackageSignRecordDO servicePackageSign(String jsonData,String doctorId,String patientId) throws Exception{
    public JSONObject servicePackageSign(String jsonData,String doctorId,String patientId) throws Exception{
        JSONObject result = new JSONObject();
        ServicePackageSignRecordDO signRecordDO = objectMapper.readValue(jsonData, ServicePackageSignRecordDO.class);
        signRecordDO.setPatient(patientId);
        List<ServicePackageRecordDO> recordDOList = signRecordDO.getRecordDOList();
@ -340,6 +342,12 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
            }
        }
        //服务项目 emergencyAssistance 只能签约一个
        String sqlItem = "select item.`code`,item.name from base_service_package_item item INNER JOIN base_service_package_record pr on item.service_package_id = pr.service_package_id\n" +
                "where pr.sign_id='"+signId+"' GROUP BY item.`code`";
        List<Map<String,Object>> itemList = jdbcTemplate.queryForList(sqlItem);
        Map<String,List<Map<String,Object>>> signItem = itemList.stream().collect(Collectors.groupingBy(e->e.get("code").toString()));
        Iterator<ServicePackageRecordDO> iterator = recordDOList.iterator();
        while (iterator.hasNext()) {
            ServicePackageRecordDO recordDO = iterator.next();
@ -351,12 +359,26 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
        }
        if(recordDOList.size()>0){
            List<String> packages = recordDOList.stream().map(ServicePackageRecordDO::getServicePackageId).collect(Collectors.toList());
            String packagesId = packages.stream().map(String::valueOf).collect(Collectors.joining("','"));
            sqlItem = "select item.`code`,item.name from base_service_package_item item " +
                    "where item.service_package_id in ('"+packagesId+"') GROUP BY item.`code`";
            itemList = jdbcTemplate.queryForList(sqlItem);
           Map<String,List<Map<String,Object>>> newItem = itemList.stream().collect(Collectors.groupingBy(e->e.get("code").toString()));
           if (newItem.containsKey("emergencyAssistance")&&signItem.containsKey("emergencyAssistance")){
               String message = "重复签约服务项目:"+newItem.get("emergencyAssistance").get(0).get("name").toString();
               result.put(ResponseContant.resultFlag, ResponseContant.fail);
               result.put(ResponseContant.resultMsg,message);
               return result;
           }
            CapacityAssessmentRecordDO capacityAssessmentRecordDO = capacityAssessmentRecordService.findAssessmentByPatientId(patientId);
            capacityAssessmentRecordDO.setServicePackageStatus(1);
            capacityAssessmentRecordService.save(capacityAssessmentRecordDO);
            servicePackageRecordDao.save(recordDOList);
        }
        servicePackageRecordDao.save(recordDOList);
        return signRecordDO;
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg,"分配成功");
        return result;
    }