Browse Source

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

shikejing 4 years ago
parent
commit
e78fa82b31

+ 44 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorToDoWorkEndpoint.java

@ -0,0 +1,44 @@
package com.yihu.jw.care.endpoint.doctor;
import com.yihu.jw.care.service.message.DoctorMessageService;
import com.yihu.jw.restmodel.web.ObjEnvelop;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/***
 * @ClassName: DoctorToDoWorkEndpoint
 * @Description: 助老员 待办工作
 * @Auther: shi kejing
 * @Date: 2021/5/8 17:42
 */
@RestController
@RequestMapping(value = "doctor/todowork")
@Api(description = "助老员 - 待办工作")
public class DoctorToDoWorkEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private DoctorMessageService doctorMessageService;
    @GetMapping(value = "todowork")
    @ApiOperation("待办工作")
    public ObjEnvelop messages(@ApiParam(name = "serviceSype", value = "工作类型: 生活照料,安防监护=preventLost,紧急救助=emergencyAssistance,生活照料=fifeCare")
                               @RequestParam(value = "serviceSype", required = false) String serviceSype,
                               @ApiParam(name = "id", value = "查看详情需要传id")
                               @RequestParam(value = "id", required = false) String id,
                               @ApiParam(name = "doctor", value = "doctor")
                               @RequestParam(value = "doctor", required = true) String doctor){
        try {
            return ObjEnvelop.getSuccess("查询成功",doctorMessageService.getPreventLost(doctor,id,serviceSype));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败"+e.getMessage());
        }
    }
}

+ 84 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/DoctorMessageService.java

@ -127,4 +127,88 @@ public class DoctorMessageService {
        return result;
    }
    public JSONObject getPreventLost(String doctor,String id,String type){
        JSONObject result = new JSONObject();
        boolean typeNull = StringUtils.isBlank(type);
        if (typeNull||type.equals("preventLost")){//安全监护
            String sql ="select id,patient_name,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') create_time,'preventLost' as service_type from base_security_monitoring_order ord where 1=1 \n" +
                    "and status <>-1 and status<> 7  \n" +
                    "and  EXISTS ( \n" +
                    "SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ,\n" +
                    "base_team_member m where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and \n" +
                    "r.service_package_id = i.service_package_id and  m.team_code = i.team_code  and i.del = 1 and sr.`status`=1  and i.code='preventLost' \n" +
                    "and m.doctor_code = '"+doctor+"' and m.del = '1') \n" +
                    "order by create_time DESC ";
            if (StringUtils.isNotBlank(id)){
                sql = "select * from base_security_monitoring_order ord where 1=1 \n" +
                        "AND id = '"+id+"'\n" +
                        "and status <>-1 and status<> 7  \n" +
                        "and  EXISTS ( \n" +
                        "SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ,\n" +
                        "base_team_member m where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and \n" +
                        "r.service_package_id = i.service_package_id and  m.team_code = i.team_code  and i.del = 1 and sr.`status`=1  and i.code='preventLost' \n" +
                        "and m.doctor_code = '13' and m.del = '1') ";
            }
            List<Map<String,Object>> sqlResult  = jdbcTemplate.queryForList(sql);
            result.put("preventLost",sqlResult);
        }
        if (typeNull||type.equals("emergencyAssistance")){//紧急救助
            String sql ="select id,patient_name,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') create_time,'emergencyAssistance' as service_type from base_emergency_assistance_order ord where 1=1\n" +
                    "and status =1 \n" +
                    "and EXISTS ( \n" +
                    "SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ,\n" +
                    "base_team_member m where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and \n" +
                    "r.service_package_id = i.service_package_id and  m.team_code = i.team_code  and i.del = 1 and sr.`status`=1  and i.code='emergencyAssistance' \n" +
                    "and m.doctor_code = '"+doctor+"' and m.del = '1')\n" +
                    "order by create_time DESC ";
            if (StringUtils.isNotBlank(id)){
                sql = "select * from base_emergency_assistance_order ord where 1=1\n" +
                        "\n" +
                        "AND id = '"+id+"'\n" +
                        "\n" +
                        "and status =1 \n" +
                        "and EXISTS ( \n" +
                        "SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ,\n" +
                        "base_team_member m where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and \n" +
                        "r.service_package_id = i.service_package_id and  m.team_code = i.team_code  and i.del = 1 and sr.`status`=1  and i.code='emergencyAssistance' \n" +
                        "and m.doctor_code = '13' and m.del = '1')";
            }
            List<Map<String,Object>> sqlResult  = jdbcTemplate.queryForList(sql);
            result.put("emergencyAssistance",sqlResult);
        }
        if (typeNull||type.equals("fifeCare")){//生活照料
            String sql ="select id,patient_name,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') create_time,'fifeCare' as service_type from base_life_care_order lco where 1=1\n" +
                    "and status =1 \n" +
                    "and EXISTS ( \n" +
                    "SELECT 1 from base_service_package_sign_record sr,base_service_package_record r,\n" +
                    "base_team_member m where lco.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and sr.`status`=1 \n" +
                    "and m.team_code\n" +
                    "and m.doctor_code = '"+doctor+"' and m.del = '1')\n" +
                    "order by create_time DESC ";
            if (StringUtils.isNotBlank(id)){
                sql = "select * from base_life_care_order lco where 1=1\n" +
                        "AND id = '"+id+"'\n" +
                        "and status =1 \n" +
                        "and EXISTS ( \n" +
                        "SELECT 1 from base_service_package_sign_record sr,base_service_package_record r,\n" +
                        "base_team_member m where lco.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and sr.`status`=1 \n" +
                        "and m.doctor_code = '"+doctor+"' and m.del = '1')";
            }
            List<Map<String,Object>> sqlResult  = jdbcTemplate.queryForList(sql);
            result.put("fifeCare",sqlResult);
        }
        return result;
    }
}