Bläddra i källkod

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

wangzhinan 6 år sedan
förälder
incheckning
2ab95222d5

+ 3 - 2
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistController.java

@ -269,9 +269,10 @@ public class SpecialistController extends EnvelopRestEndpoint {
    @GetMapping(value = SpecialistMapping.specialist.findDoctorAndDoctorHealthBySpecialDoctor)
    @ApiOperation(value = "获取当前专科医生有关联的家庭医生和健管师列表")
    public MixEnvelop findDoctorAndDoctorHealthBySpecialDoctor(
            @ApiParam(name = "doctor", value = "专科医生code") @RequestParam(required = true)String doctor){
            @ApiParam(name = "doctor", value = "专科医生code") @RequestParam(required = true)String doctor,
            @ApiParam(name = "name", value = "家庭医生姓名") @RequestParam(required = false)String name){
        try {
            return specialistService.findDoctorAndDoctorHealthBySpecialDoctor(doctor);
            return specialistService.findDoctorAndDoctorHealthBySpecialDoctor(doctor,name);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());

+ 2 - 4
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/rehabilitation/RehabilitationManageController.java

@ -295,10 +295,8 @@ public class RehabilitationManageController {
                                                           @ApiParam(name = "image", value = "相关记录图片,json格式", required = true)@RequestParam(value = "image", required = false)String image){
        try {
            Map<String,Object> map = rehabilitationManageService.updateNodeAndRelationRecordImg(node,image,planDetailId);
            if(Integer.parseInt(String.valueOf(map.get("count")))>1){
                return ObjEnvelop.getSuccess(SpecialistMapping.api_success,map);
            }
            return ObjEnvelop.getError("update error!");
            return ObjEnvelop.getSuccess(SpecialistMapping.api_success,map);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());

+ 61 - 28
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

@ -243,7 +243,7 @@ public class SpecialistService{
                    "a.health_assistant AS healthAssistant," +
                    "a.health_assistant_name AS healthAssistantName " +
                    "FROM wlyy_specialist.wlyy_specialist_patient_relation a " +
                    "JOIN "+basedb+".wlyy_patient_disease_server b ON a.code=b.specialist_relation_code AND b.disease=" +labelCode+" and b.del=1 "+
                    "JOIN "+basedb+".wlyy_patient_disease_server b ON a.id=b.specialist_relation_code AND b.disease=" +labelCode+" and b.del=1 "+
                    "JOIN "+basedb+".wlyy_patient c ON a.patient=c.CODE " +
                    "LEFT JOIN "+basedb+".wlyy_sign_patient_label_info d ON a.patient=d.patient AND d.label_type=8 AND d.`status`=1" +
                    " WHERE a.sign_status> 0 AND a.`status`>=0 AND a.doctor='"+doctor+"'"+
@ -626,33 +626,66 @@ public class SpecialistService{
        return MixEnvelop.getSuccess(SpecialistMapping.api_success,patientSignInfoVOs.get(0));
    }
    
    public MixEnvelop findDoctorAndDoctorHealthBySpecialDoctor(String doctor) {
        String sql = "SELECT " +
                "doctor.CODE AS CODE," +
                "doctor.NAME AS NAME," +
                "doctor.sex AS sex," +
                "doctor.birthday AS birthday," +
                "doctor.photo AS photo," +
                "doctor.mobile AS mobile," +
                "doctor.hospital AS hospital," +
                "doctor.hospital_name AS hospitalName," +
                "doctor.dept AS dept," +
                "doctor.dept_name AS deptName," +
                "doctor.job AS job," +
                "doctor.job_name AS jobName," +
                "doctor.LEVEL AS LEVEL," +
                "doctor.qrcode AS qrcode," +
                "doctor.czrq AS czrq," +
                "doctor.del AS del," +
                "doctor.idcard AS idcard " +
                "FROM wlyy.wlyy_doctor doctor JOIN ( " +
                "SELECT a.doctor AS doctorcode FROM wlyy.wlyy_sign_family a RIGHT JOIN ( " +
                "SELECT patient FROM wlyy_specialist_patient_relation WHERE sign_status> 0 AND `status`>=0 AND doctor='"+doctor+"') b ON a.patient=b.patient WHERE a.`status`=1 AND a.expenses_status = 1 " +
                "UNION  " +
                "SELECT a.doctor_health AS doctorcode FROM wlyy.wlyy_sign_family a RIGHT JOIN ( " +
                "SELECT patient FROM wlyy_specialist_patient_relation WHERE sign_status> 0 AND `status`>=0 AND doctor='"+doctor+"') b ON a.patient=b.patient WHERE a.`status`=1 AND a.expenses_status = 1 " +
                ") " +
                "t ON doctor.CODE=t.doctorcode";
    public MixEnvelop findDoctorAndDoctorHealthBySpecialDoctor(String doctor,String name) {
    
        String sql = "";
        
        if(StringUtils.isNotBlank(name)){
            sql = "SELECT " +
                    "doctor.CODE AS CODE," +
                    "doctor.NAME AS NAME," +
                    "doctor.sex AS sex," +
                    "doctor.birthday AS birthday," +
                    "doctor.photo AS photo," +
                    "doctor.mobile AS mobile," +
                    "doctor.hospital AS hospital," +
                    "doctor.hospital_name AS hospitalName," +
                    "doctor.dept AS dept," +
                    "doctor.dept_name AS deptName," +
                    "doctor.job AS job," +
                    "doctor.job_name AS jobName," +
                    "doctor.LEVEL AS LEVEL," +
                    "doctor.qrcode AS qrcode," +
                    "doctor.czrq AS czrq," +
                    "doctor.del AS del," +
                    "doctor.idcard AS idcard " +
                    "FROM wlyy.wlyy_doctor doctor JOIN ( " +
                    "SELECT a.doctor AS doctorcode FROM wlyy.wlyy_sign_family a RIGHT JOIN ( " +
                    "SELECT patient FROM wlyy_specialist_patient_relation WHERE sign_status> 0 AND `status`>=0 AND doctor='"+doctor+"') b ON a.patient=b.patient WHERE a.`status`=1 AND a.expenses_status = 1 " +
                    "UNION  " +
                    "SELECT a.doctor_health AS doctorcode FROM wlyy.wlyy_sign_family a RIGHT JOIN ( " +
                    "SELECT patient FROM wlyy_specialist_patient_relation WHERE sign_status> 0 AND `status`>=0 AND doctor='"+doctor+"') b ON a.patient=b.patient WHERE a.`status`=1 AND a.expenses_status = 1 " +
                    ") " +
                    "t ON doctor.CODE=t.doctorcode and doctor.NAME like '%"+name+"%'";
        }else{
            sql = "SELECT " +
                    "doctor.CODE AS CODE," +
                    "doctor.NAME AS NAME," +
                    "doctor.sex AS sex," +
                    "doctor.birthday AS birthday," +
                    "doctor.photo AS photo," +
                    "doctor.mobile AS mobile," +
                    "doctor.hospital AS hospital," +
                    "doctor.hospital_name AS hospitalName," +
                    "doctor.dept AS dept," +
                    "doctor.dept_name AS deptName," +
                    "doctor.job AS job," +
                    "doctor.job_name AS jobName," +
                    "doctor.LEVEL AS LEVEL," +
                    "doctor.qrcode AS qrcode," +
                    "doctor.czrq AS czrq," +
                    "doctor.del AS del," +
                    "doctor.idcard AS idcard " +
                    "FROM wlyy.wlyy_doctor doctor JOIN ( " +
                    "SELECT a.doctor AS doctorcode FROM wlyy.wlyy_sign_family a RIGHT JOIN ( " +
                    "SELECT patient FROM wlyy_specialist_patient_relation WHERE sign_status> 0 AND `status`>=0 AND doctor='"+doctor+"') b ON a.patient=b.patient WHERE a.`status`=1 AND a.expenses_status = 1 " +
                    "UNION  " +
                    "SELECT a.doctor_health AS doctorcode FROM wlyy.wlyy_sign_family a RIGHT JOIN ( " +
                    "SELECT patient FROM wlyy_specialist_patient_relation WHERE sign_status> 0 AND `status`>=0 AND doctor='"+doctor+"') b ON a.patient=b.patient WHERE a.`status`=1 AND a.expenses_status = 1 " +
                    ") " +
                    "t ON doctor.CODE=t.doctorcode";
        }
        
        List<SignFamilyDoctorVO> patientSignInfoVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamilyDoctorVO.class));
        return MixEnvelop.getSuccess(SpecialistMapping.api_success,patientSignInfoVOs);
    }

+ 35 - 18
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java

@ -410,7 +410,7 @@ public class RehabilitationManageService {
                sql+="and d.doctor='"+doctorCode+"' ";
            }else if(searchTask==2||searchTask==4||searchTask==3){
                sql+=" and i.type="+searchTask+" " ;
            }else if(searchTask==3){
            }else if(searchTask==5){
                sql+=" and i.reserve=1 " ;
            }
        }
@ -492,9 +492,10 @@ public class RehabilitationManageService {
                map.put("createTime",DateUtil.dateToStr(one2.getCreateTime(),"MM-dd HH:mm"));
                messageMapList.add(map);
            }
            Integer itemType = (Integer) one.get("itemType");
            resultMap.put("messageList",messageMapList);//指导与汇报记录
            resultMap.put("patient",one.get("patient"));
            resultMap.put("itemType",one.get("itemType"));
            resultMap.put("itemType",itemType);
            resultMap.put("detaiType",one.get("detaiType"));
            resultMap.put("status",status);//状态
            //是否完成任务
@ -502,6 +503,18 @@ public class RehabilitationManageService {
            Integer operate = 0;
            if(operateList.size()>0){
                operate =1;
                RehabilitationOperateRecordsDO temp = operateList.get(0);
                operate =1;
                Date completeTime = temp.getCompleteTime();
                String completeTimeStr = DateUtil.dateToStr(completeTime,DateUtil.YYYY_MM_DD_HH_MM);
                resultMap.put("completeTime",completeTimeStr);//完成时间
                resultMap.put("operatorDoctorName",temp.getDoctorName());//执行医生名称
                resultMap.put("node",temp.getNode());
                resultMap.put("relationRecordImg",(temp.getRelationRecordImg()!=null&&StringUtils.isNotEmpty(temp.getRelationRecordImg()))?(new JSONArray(temp.getRelationRecordImg())):null);//json格式
                if(itemType!=1&&itemType!=0){
                    resultMap.put("relationRecordCode",temp.getRelationRecordCode());
                    resultMap.put("completeTimeShort",DateUtil.dateToStr(completeTime,"yyyy/MM/dd"));
                }
            }
            resultMap.put("operate",operate);//是否完成任务(默认0:未完成,1:已完成)
            resultList.add(resultMap);
@ -1023,27 +1036,32 @@ public class RehabilitationManageService {
     */
    public Map<String,Object> updateNodeAndRelationRecordImg(String node,String image,String planDeatilId)throws Exception{
        Map<String,Object> resultMap = new HashedMap();
        int i = rehabilitationDetailDao.updateStatusById(1,planDeatilId);
        int j = rehabilitationOperateRecordsDao.updateNodeAndRelationRecordImg(node,image,planDeatilId);
        //如果整个计划的服务项都完成了,整个计划也完成了
        String allSql ="SELECT * FROM wlyy_rehabilitation_plan_detail where plan_id = (SELECT plan_id FROM `wlyy_rehabilitation_plan_detail` WHERE id='"+planDeatilId+"')";
        List<RehabilitationDetailDO> rehabilitationDetailDOList = jdbcTemplate.query(allSql,new BeanPropertyRowMapper<>(RehabilitationDetailDO.class));
        int allCount=0;
        String planId="";
        for (RehabilitationDetailDO rehabilitationDetailDO : rehabilitationDetailDOList){
            if (rehabilitationDetailDO.getStatus()==1){
                allCount++;
        try{
            int i = rehabilitationDetailDao.updateStatusById(1,planDeatilId);
            int j = rehabilitationOperateRecordsDao.updateNodeAndRelationRecordImg(node,image,planDeatilId);
            //如果整个计划的服务项都完成了,整个计划也完成了
            String allSql ="SELECT * FROM wlyy_rehabilitation_plan_detail where plan_id = (SELECT plan_id FROM `wlyy_rehabilitation_plan_detail` WHERE id='"+planDeatilId+"')";
            List<RehabilitationDetailDO> rehabilitationDetailDOList = jdbcTemplate.query(allSql,new BeanPropertyRowMapper<>(RehabilitationDetailDO.class));
            int allCount=0;
            String planId="";
            for (RehabilitationDetailDO rehabilitationDetailDO : rehabilitationDetailDOList){
                if (rehabilitationDetailDO.getStatus()==1){
                    allCount++;
                }
            }
        }
        if (rehabilitationDetailDOList.size()>0 && rehabilitationDetailDOList.size()==allCount){
            planId = rehabilitationDetailDOList.get(0).getPlanId();
            patientRehabilitationPlanDao.updateStatusById(2,planId);
            if (rehabilitationDetailDOList.size()>0 && rehabilitationDetailDOList.size()==allCount){
                planId = rehabilitationDetailDOList.get(0).getPlanId();
                patientRehabilitationPlanDao.updateStatusById(2,planId);
            }
        }catch (Exception e){
            throw  new Exception("更新服务状态失败!");
        }
        //更新返回数据提供发送消息使用
        String sql ="SELECT" +
                " i.service_item_id," +
                " r.doctor_code," +
                " r.patient_code" +
                " r.patient_code," +
                " pd.hospital" +
                " FROM" +
                " wlyy_rehabilitation_plan_detail pd" +
                " LEFT JOIN wlyy_hospital_service_item i ON pd.hospital_service_item_id = i.id" +
@ -1060,7 +1078,6 @@ public class RehabilitationManageService {
            resultMap.put("evaluation",itemList.get(0).get("evaluation"));
            resultMap.put("title",itemList.get(0).get("title"));
        }
        resultMap.put("count",i+j);
        return resultMap;
    }