Browse Source

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

liubing 3 years ago
parent
commit
73bb032d84

+ 16 - 17
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doorCoach/DoctorDoorCoachOrderController.java

@ -71,12 +71,11 @@ public class DoctorDoorCoachOrderController extends BaseController {
    @GetMapping(value = "queryDoctorListNotStopped")
    @ApiOperation(value = "服务人员列表(可接单状态的医生列表)")
    public String queryDoctorListWithNotStopped(
            @ApiParam(name = "patient", value = "服务对象code", required = true) @RequestParam(value = "patient") String patient,
            @ApiParam(name = "hospital", value = "机构code", required = true) @RequestParam(value = "hospital") String hospital,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1") @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15") @RequestParam(value = "size") int size) {
        try{
            JSONObject result = patientDoorCoachOrderService.queryDoctorListWithNotStopped(patient,hospital,page, size);
            JSONObject result = patientDoorCoachOrderService.queryDoctorListWithNotStopped(hospital,page, size);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return error(-1,result.getString(ResponseContant.resultMsg));
            }
@ -102,7 +101,7 @@ public class DoctorDoorCoachOrderController extends BaseController {
            @ApiParam(name = "dispathcherName", value = "调度员姓名") @RequestParam(value = "dispathcherName", required = true) String dispathcherName,
            @ApiParam(name = "doctor", value = "医生code") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "doctorName", value = "医生姓名") @RequestParam(value = "doctorName", required = true) String doctorName,
            @ApiParam(name = "doctorJobName", value = "医生职称") @RequestParam(value = "doctorJobName", required = true) String doctorJobName) {
            @ApiParam(name = "doctorJobName", value = "医生职称") @RequestParam(value = "doctorJobName", required = false) String doctorJobName) {
        try{
            JSONObject result = patientDoorCoachOrderService.sendOrderToDoctor(orderId, remark,dispatcher,dispathcherName, doctor, doctorName ,doctorJobName);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
@ -124,7 +123,7 @@ public class DoctorDoorCoachOrderController extends BaseController {
            @ApiParam(name = "dispathcherName", value = "当前医生姓名") @RequestParam(value = "dispathcherName", required = true) String dispathcherName,
            @ApiParam(name = "doctor", value = "医生code") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "doctorName", value = "医生姓名") @RequestParam(value = "doctorName", required = true) String doctorName,
            @ApiParam(name = "doctorJobName", value = "医生职称") @RequestParam(value = "doctorJobName", required = true) String doctorJobName) {
            @ApiParam(name = "doctorJobName", value = "医生职称") @RequestParam(value = "doctorJobName", required = false) String doctorJobName) {
        try{
            JSONObject result = patientDoorCoachOrderService.transferOrder(orderId, remark,dispatcher,dispathcherName, doctor, doctorName ,doctorJobName);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
@ -141,9 +140,9 @@ public class DoctorDoorCoachOrderController extends BaseController {
    @ApiOperation(value = "接单")
    public String acceptOrder(
            @ApiParam(value = "工单id", name = "orderId", required = true) @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "医生职称code", name = "jobCode", required = false) @RequestParam(value = "jobCode", required = true) String jobCode,
            @ApiParam(value = "医生职称", name = "jobCodeName", required = false) @RequestParam(value = "jobCodeName", required = true) String jobCodeName,
            @ApiParam(value = "医院级别", name = "hospitalLevel", required = false) @RequestParam(value = "hospitalLevel", required = false) int hospitalLevel) {
            @ApiParam(value = "医生职称code", name = "jobCode", required = false) @RequestParam(value = "jobCode", required = false) String jobCode,
            @ApiParam(value = "医生职称", name = "jobCodeName", required = false) @RequestParam(value = "jobCodeName", required = false) String jobCodeName,
            @ApiParam(value = "医院级别", name = "hospitalLevel", required = false) @RequestParam(value = "hospitalLevel",defaultValue = "4",required = false) int hospitalLevel) {
        try {
            doctorDoorCoachOrderService.acceptOrder(orderId,jobCode,jobCodeName,hospitalLevel);
            return write(200, "操作成功");
@ -220,12 +219,12 @@ public class DoctorDoorCoachOrderController extends BaseController {
    @PostMapping("updateDoorConclusion")
    @ApiOperation("编辑保存服务工单小结")
    public String updateDoorConclusion(
            @ApiParam(value = "服务附件,至少一张,至多3张", name = "orderId",required = true)
            @ApiParam(value = "工单id", name = "orderId",required = true)
            @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "服务附件,至少一张,至多3张", name = "conclusionImg",required = true)
            @RequestParam(value = "conclusionImg", required = true) String conclusionImg,
            @ApiParam(value = "服务小结", name = "conclusion",required = true)
            @RequestParam(value = "conclusion", required = true) String conclusion,
            @ApiParam(value = "服务附件,至少一张,至多3张", name = "conclusionImg",required = false)
            @RequestParam(value = "conclusionImg", required = false) String conclusionImg,
            @ApiParam(value = "服务小结", name = "conclusion",required = false)
            @RequestParam(value = "conclusion", required = false) String conclusion,
            @ApiParam(value = "服务小结是否登记,1跳过登记;2-登记", name = "conclusionStatus")
            @RequestParam(value = "conclusionStatus", required = false,defaultValue = "2") Integer conclusionStatus) {
        try {
@ -267,9 +266,9 @@ public class DoctorDoorCoachOrderController extends BaseController {
    public String saveOrderFinishByDoctor(
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "居民确认结束服务方式", name = "finishWay")
            @ApiParam(value = "确认结束服务方式 1-电子签名,2-手持身份证拍照", name = "finishWay")
            @RequestParam(value = "finishWay", required = false) Integer finishWay,
            @ApiParam(value = "居民确认结束服务照片", name = "finishImg")
            @ApiParam(value = "确认结束服务照片", name = "finishImg")
            @RequestParam(value = "finishImg", required = false) String finishImg) {
        try {
            return write(200, "获取成功", "data", doctorDoorCoachOrderService.saveOrderFinishByDoctor(orderId, finishWay, finishImg));
@ -417,14 +416,14 @@ public class DoctorDoorCoachOrderController extends BaseController {
    @GetMapping(value = "queryDoctorList")
    @ApiOperation(value = "服务人员列表(医生列表)")
    public String queryDoctorList(
            @ApiParam(name = "town", value = "调度员所在的机构code") @RequestParam(value = "town", required = false) String town,
            @ApiParam(name = "hospital", value = "调度员所在的机构code") @RequestParam(value = "hospital", required = false) String hospital,
            @ApiParam(name = "doctorName", value = "医生姓名") @RequestParam(value = "doctorName", required = false) String doctorName,
            @ApiParam(name = "status", value = "医生接单状态,状态为全部时不传") @RequestParam(value = "status", required = false) String status,
            @ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient", required = false) String patient,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1") @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15") @RequestParam(value = "size") int size) {
        try{
            JSONObject result = doctorDoorCoachOrderService.queryDoctorList(patient,town, doctorName, status, page, size);
            JSONObject result = doctorDoorCoachOrderService.queryDoctorList(patient,hospital, doctorName, status, page, size);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return error(-1,result.getString(ResponseContant.resultMsg));
            }
@ -509,7 +508,7 @@ public class DoctorDoorCoachOrderController extends BaseController {
    @GetMapping("/getDispatchOrderSwitch")
    @ApiOperation(value = "获取医生分派订单开关状态")
    public String getDispatchOrderSwitch(
            @ApiParam(name = "doctor", value = "医生codedoctor")
            @ApiParam(name = "doctor", value = "医生id")
            @RequestParam(value = "doctor", required = true) String doctor) {
        try {
            String status = doctorDoorCoachOrderService.findDispatchStatusByDoctor(doctor);

+ 24 - 24
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/DoctorDoorCoachOrderService.java

@ -221,7 +221,7 @@ public class DoctorDoorCoachOrderService {
        if(type != null && type == 3 ){
            sql += " and o.type = " + type + " and o.proxy_patient = '" + doctorCode + "'";
        }else{
            sql += " and o.type = " + type ;
            sql += " and o.type = " + type +" ";
        }
        if(StringUtils.isNotBlank(doctorCode)){
            sql += "and o.doctor= '"+doctorCode+"' ";
@ -717,20 +717,20 @@ public class DoctorDoorCoachOrderService {
        String applicationSql = "";
        String patientTypeTemp = "";
        if("1".equals(isApplication)){
            applicationSql +=                 " JOIN ( " +
                    "         select a.patient, group_concat(v.type) as type " +
                    "         from wlyy_door_service_voucher v " +
                    "                  JOIN (select t.id, t.patient, max(t.create_time) " +
                    "                        from wlyy_door_service_application t " +
                    "                        where t.status in (2, 3) " +
                    "                        group by t.patient) as a " +
                    "                       on a.id = v.service_id " +
                    "         where v.status = 1 " +
                    "         group by a.patient " +
                    "        ) as t1 on o.patient = t1.patient" ;
            patientTypeTemp = " ,t1.`type` as patientType ";
        }
//        if("1".equals(isApplication)){
//            applicationSql +=                 " JOIN ( " +
//                    "         select a.patient, group_concat(v.type) as type " +
//                    "         from wlyy_door_service_voucher v " +
//                    "                  JOIN (select t.id, t.patient, max(t.create_time) " +
//                    "                        from wlyy_door_service_application t " +
//                    "                        where t.status in (2, 3) " +
//                    "                        group by t.patient) as a " +
//                    "                       on a.id = v.service_id " +
//                    "         where v.status = 1 " +
//                    "         group by a.patient " +
//                    "        ) as t1 on o.patient = t1.patient" ;
//            patientTypeTemp = " ,t1.`type` as patientType ";
//        }
        String sql = "SELECT " +
                "  p.name AS patientName, " +
@ -754,7 +754,7 @@ public class DoctorDoorCoachOrderService {
                "  concat( o.patient,'_' ,c.id, '_',o.`number`,'_11' ) as sessionId " +
                patientTypeTemp +
                " FROM " +
                " ( wlyy_door_service_order o " +
                " ( base_door_coach_order o " +
                " LEFT JOIN base_patient p ON o.patient = p.id ) LEFT JOIN wlyy_consult c on o.id = c.relation_code"+
                applicationSql+" WHERE " +
                "  o.hospital = '{hospital}' and o.type != 3 " +buffer+
@ -771,7 +771,7 @@ public class DoctorDoorCoachOrderService {
        String countSql = "SELECT  " +
                "   count(o.id)  " +
                " FROM  " +
                "   wlyy_door_service_order o  " +
                "   base_door_coach_order o  " +
                " LEFT JOIN base_patient p ON o.patient = p.id " +
                applicationSql +
                " WHERE  " +
@ -807,7 +807,7 @@ public class DoctorDoorCoachOrderService {
        }else{
            types = new String[]{"1","2","3","4","5","6"};
        }
        String serviceSql = "SELECT count(d.id) times FROM wlyy_door_doctor d where d.order_id in(SELECT id from wlyy_door_service_order WHERE DATE_FORMAT(doctor_sign_time, '%Y') = DATE_FORMAT(NOW(), '%Y') AND patient=?)";
        String serviceSql = "SELECT count(id) times FROM base_door_coach_order WHERE DATE_FORMAT(doctor_sign_time, '%Y') = DATE_FORMAT(NOW(), '%Y') AND patient=? and status>="+BaseDoorCoachOrderDO.Status.waitForCommnet.getType();
        sqlResultlist.forEach(
                oneMap -> {
                    // 获取服务次数
@ -850,7 +850,7 @@ public class DoctorDoorCoachOrderService {
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : size;
        if(org.apache.commons.lang3.StringUtils.isEmpty(hospital)){
            hospital = "350211A1002";
            hospital = "xm10086";
        }
        //
        String sql = "SELECT " +
@ -868,8 +868,8 @@ public class DoctorDoorCoachOrderService {
                "  1 as sortFlag ,count(o.id) as count" +
                " FROM " +
                " base_doctor d " +
                " LEFT JOIN wlyy_door_doctor_status ds ON d.id = ds.doctor " +
                " LEFT JOIN wlyy_door_service_order o on o.doctor = d.id and o.`status` in (2,3,4) " +
                " LEFT JOIN base_door_coach_doctor_status ds ON d.id = ds.doctor " +
                " LEFT JOIN base_door_coach_order o on o.doctor = d.id and o.`status` in (2,3,4) " +
                " LEFT JOIN base_doctor_hospital dh on dh.doctor_code = d.id " +
                " WHERE d.enabled = 1" +
                " AND dh.org_code = '{hospital}' "+
@ -889,7 +889,7 @@ public class DoctorDoorCoachOrderService {
                "   count(d.id)  " +
                " FROM  " +
                "   base_doctor d  " +
                " LEFT JOIN wlyy_door_doctor_status ds ON d.id = ds.doctor " +
                " LEFT JOIN base_door_coach_doctor_status ds ON d.id = ds.doctor " +
                " LEFT JOIN base_doctor_hospital dh on dh.doctor_code = d.id " +
                " WHERE d.enabled = 1" +
                " AND dh.org_code = '{hospital}' "+
@ -933,7 +933,7 @@ public class DoctorDoorCoachOrderService {
            if(notFinish > 0 && org.apache.commons.lang3.StringUtils.isNotBlank(doctor)){
                String notFinishSql ="select o.id,o.number,o.patient,o.patient_name,o.patient_phone,o.patient_expected_serve_time,o.`status`, CASE p.sex when 1 then '男' when 2 THEN '女' END as sex,p.idcard, " +
                        "year(now()) - ((CASE LENGTH(p.idcard) WHEN 18 THEN substring(p.idcard, 7, 4) WHEN 15 THEN CONCAT('19',substring(p.idcard, 7, 2)) END )) as age , p.photo,o.serve_lat AS lat,o.serve_lon AS lon,o.id AS orderId " +
                        "from wlyy_door_service_order o LEFT JOIN base_patient p on o.patient = p.id and p.patient_status=1  " +
                        "from base_door_coach_order o LEFT JOIN base_patient p on o.patient = p.id and p.patient_status=1  " +
                        "where o.doctor ='"+doctor + "' and o.status in (2,3,4)";
                List<Map<String, Object>> notFinishList = jdbcTemplate.queryForList(notFinishSql);
                map.put("notFinishList", notFinishList);
@ -994,7 +994,7 @@ public class DoctorDoorCoachOrderService {
    }
    public void initDoorStatus(){
        String sql = "SELECT * from base_doctor WHERE id not in ( " +
        String sql = "SELECT * from base_doctor WHERE doctor_level=3 and id not in ( " +
                "SELECT doctor from base_door_coach_doctor_status " +
                ")";
        List<BaseDoctorDO> doctorDOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(BaseDoctorDO.class));

+ 7 - 7
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/PatientDoorCoachOrderService.java

@ -371,7 +371,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
     *
     * @return
     */
    public JSONObject queryDoctorListWithNotStopped(String patient,String hospital,int page, int size) {
    public JSONObject queryDoctorListWithNotStopped(String hospital,int page, int size) {
        JSONObject result = new JSONObject();
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : page * size;
@ -379,13 +379,13 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
        String sql = "select DISTINCT ds.doctor,d.name, d.job_title_name as jobName, 1 as sortFlag " +
                " from base_door_coach_doctor_status ds " +
                "        JOIN (select b.* from base_doctor b,base_doctor_hospital dh where b.id=dh.doctor_code and dh.del = 1 and dh.org_code='" + hospital + "')  d on ds.doctor = d.id " +
                " LEFT JOIN base_doctor_role dr ON dr.doctor_code = d.id where ds.status in (1,2,3,4) AND dr.role_code != 'nurse' " +
                "  where ds.status in (1,2,3,4)  " +
                " limit " + start + "," + end ;
        String countSql = "select DISTINCT count(ds.id) " +
                "from wlyy_door_doctor_status ds " +
                "         JOIN (select b.* from base_doctor b,base_door_coach_doctor_status dh where b.id=dh.doctor_code and dh.del = 1 and dh.org_code= '" + hospital + "') d on ds.doctor = d.id " +
                " LEFT JOIN base_doctor_role dr ON dr.doctor_code = d.id where ds.status in (1,2,3,4) AND dr.role_code != 'nurse' ";
                "from base_door_coach_doctor_status ds " +
                "         JOIN (select b.* from base_doctor b,base_doctor_hospital dh where b.id=dh.doctor_code and dh.del = 1 and dh.org_code= '" + hospital + "') d on ds.doctor = d.id " +
                " LEFT JOIN base_doctor_role dr ON dr.doctor_code = d.id where ds.status in (1,2,3,4)  ";
        List<Map<String,Object>> doctorList = new ArrayList<>();
        try {
            doctorList = jdbcTemplate.queryForList(sql);
@ -724,8 +724,8 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
        doorServiceOrderDO.setDispatcherResponseTime(new Date());
        System.out.println(dispathcherName+"医生派单给"+doctorName+"医生");
        String sql = "DELETE FROM wlyy_door_doctor WHERE order_id ='"+orderId+"' AND doctor = '"+dispatcher+"'";
        jdbcTemplate.execute(sql);
//        String sql = "DELETE FROM wlyy_door_doctor WHERE order_id ='"+orderId+"' AND doctor = '"+dispatcher+"'";
//        jdbcTemplate.execute(sql);
        this.save(doorServiceOrderDO);
        // 给医生发派单消息