Shi Kejing 3 jaren geleden
bovenliggende
commit
80f29af737

+ 557 - 33
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/admin/AdminDoorCoachOrderController.java

@ -4,19 +4,28 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.endpoint.BaseController;
import com.yihu.jw.care.endpoint.BaseController;
import com.yihu.jw.care.service.admin.AdminDoorCoachOrderService;
import com.yihu.jw.care.service.admin.AdminDoorCoachOrderService;
import com.yihu.jw.care.service.consult.ConsultTeamService;
import com.yihu.jw.care.service.doorCoach.DoctorDoorCoachOrderService;
import com.yihu.jw.care.service.doorCoach.DoctorDoorCoachOrderService;
import com.yihu.jw.care.service.doorCoach.PatientDoorCoachOrderService;
import com.yihu.jw.entity.care.doorCoach.BaseDoorCoachConclusionDO;
import com.yihu.jw.entity.care.doorCoach.BaseDoorCoachOrderDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.List;
import java.util.List;
import java.util.Map;
/***
/***
 * @ClassName: AdminDoorCoachOrderController
 * @ClassName: AdminDoorCoachOrderController
@ -30,11 +39,396 @@ import java.util.List;
@Api(description = "管理员调度大屏")
@Api(description = "管理员调度大屏")
public class AdminDoorCoachOrderController extends EnvelopRestEndpoint {
public class AdminDoorCoachOrderController extends EnvelopRestEndpoint {
    @Autowired
    private PatientDoorCoachOrderService patientDoorCoachOrderService;
    @Autowired
    @Autowired
    private DoctorDoorCoachOrderService doctorDoorCoachOrderService;
    private DoctorDoorCoachOrderService doctorDoorCoachOrderService;
    @Autowired
    @Autowired
    private AdminDoorCoachOrderService adminDoorCoachOrderService;
    private ImService imService;
    @Autowired
    private ConsultTeamService consultTeamService;
    private BaseController baseController = new BaseController();
    private BaseController baseController = new BaseController();
    @Autowired
    private AdminDoorCoachOrderService adminDoorCoachOrderService;
    @GetMapping(value = "getServiceDynamic")
    @ApiOperation(value = "管理员调度实时动态")
    public String getServiceDynamic(
            @ApiParam(name = "page", value = "分页大小", required = true) @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true) @RequestParam(value = "size") int size) {
        try{
            return baseController.write(200,"查询成功","data",adminDoorCoachOrderService.getServiceDynamic(page,size));
        }catch (Exception e){
            return baseController.errorResult(e);
        }
    }
    @PostMapping(value = "proxyCreate")
    @ApiOperation(value = "创建上门预约咨询--医生代预约")
    public String create(@ApiParam(name = "jsonData", value = "Json数据", required = true) @RequestParam String jsonData) {
        try{
            JSONObject result = patientDoorCoachOrderService.proxyCreate(jsonData,getUID());
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return baseController.error(-1, result.getString(ResponseContant.resultMsg));
            }
            return baseController.write(200, "提交成功!","orderId",result.getString("orderId"));
        }catch (Exception e){
            return baseController.errorResult(e);
        }
    }
    @GetMapping("/getDoorOrderNum")
    @ApiOperation(value = "获取医生待服务工单数量")
    public String getDoorOrderNum(
            @ApiParam(name = "doctor", value = "医生codedoctor")
            @RequestParam(value = "doctor", required = true) String doctor) {
        try {
            return  baseController.write(200, "获取成功", "data",doctorDoorCoachOrderService.getDoorOrderNum(doctor));
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @GetMapping(value = "queryDoctorListNotStopped")
    @ApiOperation(value = "服务人员列表(可接单状态的医生列表)")
    public String queryDoctorListWithNotStopped(
            @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{
            doctorDoorCoachOrderService.initDoorStatus(hospital);
            JSONObject result = patientDoorCoachOrderService.queryDoctorListWithNotStopped(hospital,page, size);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return baseController.error(-1,result.getString(ResponseContant.resultMsg));
            }
            int count = result.getIntValue(ResponseContant.count);
            JSONObject object = new JSONObject();
            object.put("total",count);
            object.put("detailModelList",result.get(ResponseContant.resultMsg));
            object.put("currPage",page);
            object.put("pageSize",size);
            return baseController.write(200,"查询成功","data",object);
        }catch (Exception e){
            return baseController.errorResult(e);
        }
    }
    @PostMapping(value = "sendOrderToDoctor")
    @ApiOperation(value = "调度员给医生派单")
    public String sendOrderToDoctor(
            @ApiParam(name = "orderId", value = "工单id") @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(name = "remark", value = "调度员备注") @RequestParam(value = "remark", required = false) String remark,
            @ApiParam(name = "dispatcher", value = "调度员code") @RequestParam(value = "dispatcher", required = true) String dispatcher,
            @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 = false) String doctorJobName) {
        try{
            JSONObject result = patientDoorCoachOrderService.sendOrderToDoctor(orderId, remark,dispatcher,dispathcherName, doctor, doctorName ,doctorJobName);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return baseController.error( -1,result.getString(ResponseContant.resultMsg));
            }
            return baseController.write(200,"派单成功","data",result.get(ResponseContant.resultMsg));
        }catch (Exception e){
            return baseController.errorResult(e);
        }
    }
    @PostMapping(value = "transferOrder")
    @ApiOperation(value = "医生转派单")
    public String transferOrder(
            @ApiParam(name = "orderId", value = "工单id") @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(name = "remark", value = "当前医生备注") @RequestParam(value = "remark", required = false) String remark,
            @ApiParam(name = "dispatcher", value = "当前医生code") @RequestParam(value = "dispatcher", required = true) String dispatcher,
            @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 = false) String doctorJobName) {
        try{
            JSONObject result = patientDoorCoachOrderService.transferOrder(orderId, remark,dispatcher,dispathcherName, doctor, doctorName ,doctorJobName);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return baseController.error( -1,result.getString(ResponseContant.resultMsg));
            }
            return baseController.write(200,"派单成功","data",result.get(ResponseContant.resultMsg));
        }catch (Exception e){
            return baseController.errorResult(e);
        }
    }
    @PostMapping("acceptOrder")
    @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 = 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 baseController.write(200, "操作成功");
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @PostMapping("refuse")
    @ApiOperation(value = "拒单")
    public String refuseOrder(
            @ApiParam(value = "工单id", name = "orderId", required = true)
            @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "拒绝原因", name = "reason", required = false)
            @RequestParam(value = "reason", required = false) String reason) {
        try {
            doctorDoorCoachOrderService.refuseOrder(getUID(),orderId, reason);
            return baseController.write(200, "操作成功");
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @PostMapping(value = "cancelOrder")
    @ApiOperation(value = "取消工单")
    public String cancelOrder(
            @ApiParam(name = "orderId", value = "工单id") @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(name = "type", value = "取消类型:1-调度员主动取消,2-居民取消, 3-医生取消") @RequestParam(value = "type", required = true) int type,
            @ApiParam(name = "reason", value = "取消理由") @RequestParam(value = "reason", required = false) String reason,
            @ApiParam(name = "dispatcher", value = "取消工单的调度员(只允许调度员来操作)") @RequestParam(value = "dispatcher", required = false) String dispatcher,
            @ApiParam(name = "dispathcherName", value = "调度员姓名") @RequestParam(value = "dispathcherName", required = false) String dispatcherName) {
        try{
            JSONObject result = patientDoorCoachOrderService.cancelOrder(orderId, type, reason,dispatcher,dispatcherName);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return baseController.error(-1,result.getString(ResponseContant.resultMsg));
            }
            return baseController.write(200,"取消成功","data",result.get(ResponseContant.resultMsg));
        }catch (Exception e){
            return baseController.errorResult(e);
        }
    }
    @PostMapping("signIn")
    @ApiOperation(value = "上门预约签到")
    public String signIn(
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "签到时间", name = "signTime")
            @RequestParam(value = "signTime", required = false) String signTime,
            @ApiParam(value = "签到方式:1-定位,2-扫码,3-拍照,4-二维码", name = "signWay")
            @RequestParam(value = "signWay", required = false) Integer signWay,
            @ApiParam(value = "签到地址", name = "signLocation")
            @RequestParam(value = "signLocation", required = false) String signLocation,
            @ApiParam(value = "签到照片", name = "signImg")
            @RequestParam(value = "signImg", required = false) String signImg,
            @ApiParam(value = "二维码内容", name = "twoDimensionalCode")
            @RequestParam(value = "twoDimensionalCode", required = false) String twoDimensionalCode) {
        try {
            BaseDoorCoachOrderDO baseDoorCoachOrderDO = doctorDoorCoachOrderService.signIn(orderId, signTime, signWay, signLocation, signImg,twoDimensionalCode,getUID());
            if (baseDoorCoachOrderDO != null){
                return baseController.write(200, "操作成功", "data", baseDoorCoachOrderDO);
            }else {
                return baseController.error(-1,"扫码签到失败");
            }
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @PostMapping("updateDoorConclusion")
    @ApiOperation("编辑保存服务工单小结")
    public String updateDoorConclusion(
            @ApiParam(value = "工单id", name = "orderId",required = true)
            @RequestParam(value = "orderId", required = true) String orderId,
            @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 {
            BaseDoorCoachConclusionDO doorConclusion = doctorDoorCoachOrderService.updateDoorConclusion(orderId,conclusion,conclusionImg,conclusionStatus);
            return baseController.write(200, "保存成功", "data", doorConclusion);
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @GetMapping("getDoorConclusion")
    @ApiOperation("获取服务工单小结")
    public String getDoorConclusion(
            @ApiParam(value = "医生code", name = "doctor")
            @RequestParam(value = "doctor", required = false) String doctor,
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = false) String orderId) {
        try {
            // 没有提供工单id的情况下,默认代入上一次服务信息记录
            if (StringUtils.isEmpty(orderId)) {
                orderId = doctorDoorCoachOrderService.getOrderIdByDoctor(doctor);
                if (StringUtils.isBlank(orderId)) {
                    return baseController.error(-1, "获取失败,该医生暂无工单" );
                }
            }
            // 根据orderId查询工单小结表
            BaseDoorCoachConclusionDO doorConclusion = doctorDoorCoachOrderService.getDoorConclusion(orderId);
            return baseController.write(200, "获取成功", "data", doorConclusion);
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @PostMapping("saveOrderFinishByDoctor")
    @ApiOperation(value = "确认完成工单")
    public String saveOrderFinishByDoctor(
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "确认结束服务方式 1-电子签名,2-手持身份证拍照", name = "finishWay")
            @RequestParam(value = "finishWay", required = false) Integer finishWay,
            @ApiParam(value = "确认结束服务照片", name = "finishImg")
            @RequestParam(value = "finishImg", required = false) String finishImg) {
        try {
            return baseController.write(200, "获取成功", "data", doctorDoorCoachOrderService.saveOrderFinishByDoctor(orderId, finishWay, finishImg));
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @PostMapping("updateArrivingTime")
    @ApiOperation(value = "修改预计到达时间")
    public String updateArrivingTime(
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "医生预计到达时间", name = "arrivingTime")
            @RequestParam(value = "arrivingTime", required = true) String arrivingTime) {
        try {
            BaseDoorCoachOrderDO baseDoorCoachOrderDO = doctorDoorCoachOrderService.updateArrivingTime(orderId, arrivingTime);
            return baseController.write(200, "修改成功", "data", baseDoorCoachOrderDO);
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @GetMapping("/topStatusBarNum")
    @ApiOperation(value = "顶部状态栏订单分类tab")
    public String topStatusBarNum(
            @ApiParam(name = "doctor", value = "医生code")
            @RequestParam(value = "doctor", required = true) String doctor) {
        try {
            Map<String, Integer> map = doctorDoorCoachOrderService.getNumGroupByStatus(doctor);
            return baseController.write(200, "获取成功", "data", map);
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @RequestMapping(value = "message/getWaitingMessages",method = RequestMethod.GET)
    @ApiOperation("调度员获取服务工单待接单列表")
    public String getWaitingMessages(
            @ApiParam(name = "message",value = "消息对象")
            @RequestParam(value = "message")String message,
            @ApiParam(name="types",value="消息类型")
            @RequestParam(value="types",required = true) String types,
            @ApiParam(name="page",value="第几页",defaultValue = "1")
            @RequestParam(value="page",required = true) String page,
            @ApiParam(name="pageSize",value="",defaultValue = "10")
            @RequestParam(value="pageSize",required = true) String pageSize){
        if (org.apache.commons.lang3.StringUtils.isBlank(pageSize)) {
            pageSize = "10";
        }
        if (page.equals("0")) {
            page = "1";
        }
        String[] split = org.apache.commons.lang3.StringUtils.split(types, ",");
        List<Integer> typeList = new ArrayList<>();
        for (String s : split) {
            typeList.add(Integer.valueOf(s));
        }
        SystemMessageDO message1 = new SystemMessageDO();
        com.alibaba.fastjson.JSONObject object = JSON.parseObject(message);
        message1.setOver(object.getString("over"));
        message1.setIsRead(object.get("read")+"");
        message1.setReceiver(getUID());
        try {
            org.json.JSONObject waitingMessages = doctorDoorCoachOrderService.getWaitingMessages(message1, types, Integer.valueOf(page), Integer.valueOf(pageSize));
            return baseController.write(200, "查询成功","data",waitingMessages);
        }catch (Exception e){
            return baseController.errorResult(e);
        }
    }
    @GetMapping("/getDoorOrderList")
    @ApiOperation(value = "服务工单列表")
    public String getDoorOrderList(
            @ApiParam(value = "工单服务编号", name = "orderId",required = false)
            @RequestParam(value = "orderId", required = false) String orderId,
            @ApiParam(value = "居民姓名", name = "patientName",required = false)
            @RequestParam(value = "patientName", required = false) String patientName,
            @ApiParam(value = "联系方式", name = "patientPhone",required = false)
            @RequestParam(value = "patientPhone", required = false) String patientPhone,
            @ApiParam(value = "服务机构", name = "hospitalCode",required = false)
            @RequestParam(value = "hospitalCode", required = false) String hospitalCode,
            @ApiParam(value = "工单状态", name = "status",required = false)
            @RequestParam(value = "status", required = false) Integer[] status,
            @ApiParam(value = "创建时间开始,格式(yyyy-MM-dd mm:dd:ss)", name = "createTimeStart",required = false)
            @RequestParam(value = "createTimeStart", required = false) String createTimeStart,
            @ApiParam(value = "创建时间结束,格式(yyyy-MM-dd mm:dd:ss)", name = "createTimeEnd",required = false)
            @RequestParam(value = "createTimeEnd", required = false) String createTimeEnd,
            @ApiParam(value = "服务医生的名称", name = "serverDoctorName",required = false)
            @RequestParam(value = "serverDoctorName", required = false) String serverDoctorName,
            @ApiParam(value = "医生的code", name = "doctorCode",required = false)
            @RequestParam(value = "doctorCode", required = false) String doctorCode,
            @ApiParam(value = "角色0、医生,1、管理员", name = "isManage",required = false)
            @RequestParam(value = "isManage", required = false) String isManage,
            @ApiParam(value = "发起类型(1本人发起 2家人待预约 3医生代预约)", name = "type")
            @RequestParam(value = "type", required = false) Integer type,
            @ApiParam(value = "页码", name = "page",defaultValue = "1",required = true)
            @RequestParam(value = "page", required = true) Integer page,
            @ApiParam(value = "每页数目", name = "pageSize",defaultValue = "10",required = true)
            @RequestParam(value = "pageSize", required = true) Integer pageSize) {
        try {
            if(StringUtils.isEmpty(isManage)){
                isManage = baseController.getCurrentRoleIsManange();
            }
            if("0".equals(isManage)){
                if(StringUtils.isEmpty(doctorCode)){
                    doctorCode=getUID();
                }
            }else if ("1".equals(isManage) && StringUtils.isBlank(hospitalCode)){
                //如果是管理员并且未筛选机构,就默认展示其管理下所有机构
                String level = baseController.getCurrentRoleLevel();
                String currentRoleCode = baseController.getCurrentRoleCode();
                if(level.equals("2")) {
                    //市管理员
                    hospitalCode = currentRoleCode.substring(0, currentRoleCode.length() - 2) + "%";
                }else if(level.equals("3")){
                    //区管理员
                    hospitalCode = currentRoleCode + "%";
                }else if (level.equals("4")){
                    //机构管理员
                    hospitalCode = currentRoleCode;
                }
            }else if(StringUtils.isNotBlank(hospitalCode) && hospitalCode.length() < 10 ){
                hospitalCode += "%";
            }
            StringBuffer ss = new StringBuffer();
            if (status != null && status.length > 0){
                int statusLength = status.length;
                for (int i =0 ; i < statusLength ; i++){
                    ss .append(status[i]);
                    if (i<statusLength-1){
                        ss.append(",");
                    }
                }
            }else {
                ss = null;
            }
            JSONObject result = doctorDoorCoachOrderService.getDoorOrderList(orderId,patientName,patientPhone,hospitalCode,
                    ss,createTimeStart,createTimeEnd,serverDoctorName,doctorCode,page,pageSize, type);
            return baseController.write(200, "获取成功","data",result);
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @GetMapping(value = "queryBriefList")
    @GetMapping(value = "queryBriefList")
    @ApiOperation(value = "调度员查询工单列表")
    @ApiOperation(value = "调度员查询工单列表")
@ -63,6 +457,7 @@ public class AdminDoorCoachOrderController extends EnvelopRestEndpoint {
        }catch (Exception e){
        }catch (Exception e){
            return baseController.errorResult(e);
            return baseController.errorResult(e);
        }
        }
    }
    }
    @GetMapping(value = "queryDoctorList")
    @GetMapping(value = "queryDoctorList")
@ -95,53 +490,182 @@ public class AdminDoorCoachOrderController extends EnvelopRestEndpoint {
        }catch (Exception e){
        }catch (Exception e){
            return baseController.errorResult(e);
            return baseController.errorResult(e);
        }
        }
    }
    }
    @RequestMapping(value = "message/getWaitingMessages",method = RequestMethod.GET)
    @ApiOperation("调度员获取服务工单待接单列表")
    public String getWaitingMessages(
            @ApiParam(name = "message",value = "消息对象")
            @RequestParam(value = "message")String message,
            @ApiParam(name="types",value="消息类型")
            @RequestParam(value="types",required = true) String types,
            @ApiParam(name="page",value="第几页",defaultValue = "1")
            @RequestParam(value="page",required = true) String page,
            @ApiParam(name="pageSize",value="",defaultValue = "10")
            @RequestParam(value="pageSize",required = true) String pageSize){
        if (org.apache.commons.lang3.StringUtils.isBlank(pageSize)) {
            pageSize = "10";
    @GetMapping("getByOrderId")
    @ApiOperation(value = "根据工单id获取相应的工单,如果为空,则获取该医生当前最新一条的工单")
    public String getByOrderId(
            @ApiParam(value = "医生code", name = "doctor")
            @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = false) String orderId) {
        try {
            // 没有提供工单id的情况下,则获取该医生当前最新一条的工单
            if (StringUtils.isEmpty(orderId)) {
                // 根据接单医生code获取最近一次服务orderId
                orderId = doctorDoorCoachOrderService.getOrderIdByDoctor(doctor);
                if (StringUtils.isBlank(orderId)) {
                    return baseController.error(-1, "获取失败, 该医生暂无工单" );
                }
            }
            // 根据orderId获取工单信息
            BaseDoorCoachOrderDO baseDoorCoachOrderDO = doctorDoorCoachOrderService.getDoorServiceOrderById(orderId);
            return baseController.write(200, "获取成功", "data", baseDoorCoachOrderDO);
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
        }
        if (page.equals("0")) {
            page = "1";
    }
    @PostMapping(value = "payOrder")
    @ApiOperation(value = "医生确认付款")
    public ObjEnvelop payOrder(
            @ApiParam(name = "orderId", value = "工单id") @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(name = "payWay", value = "支付方式:1-微信支付,2-线下支付") @RequestParam(value = "payWay", required = false,defaultValue = "2") int payWay) {
        try {
            return ObjEnvelop.getSuccess("操作成功",doctorDoorCoachOrderService.payOrder(orderId, payWay));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
        }
        String[] split = org.apache.commons.lang3.StringUtils.split(types, ",");
        List<Integer> typeList = new ArrayList<>();
        for (String s : split) {
            typeList.add(Integer.valueOf(s));
    }
    /**
     * 获取服务项目
     *
     * @param hospital
     * @return
     */
    @GetMapping("selectItemsByHospital")
    @ApiOperation(value = "获取服务项目")
    public String selectItemsByHospital(
            @ApiParam(value = "机构code", name = "hospital")
            @RequestParam(value = "hospital", required = false) String hospital,
            @ApiParam(value = "服务项目名称", name = "serverItemName")
            @RequestParam(value = "serverItemName", required = false) String serverItemName) {
        try {
            return baseController.write(200, "获取成功","dara",patientDoorCoachOrderService.selectItemsByHospital(hospital,serverItemName));
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
        }
        SystemMessageDO message1 = new SystemMessageDO();
        com.alibaba.fastjson.JSONObject object = JSON.parseObject(message);
        message1.setOver(object.getString("over"));
        message1.setIsRead(object.get("read")+"");
        message1.setReceiver(getUID());
    }
    @PostMapping("/initDoorStatus")
    @ApiOperation(value = "初始化医生分派订单开关状态")
    public String initDoorStatus() {
        try {
        try {
            org.json.JSONObject waitingMessages = doctorDoorCoachOrderService.getWaitingMessages(message1, types, Integer.valueOf(page), Integer.valueOf(pageSize));
            return baseController.write(200, "查询成功","data",waitingMessages);
            doctorDoorCoachOrderService.initDoorStatus(null);
            return baseController.success("成功");
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @GetMapping("/getDispatchOrderSwitch")
    @ApiOperation(value = "获取医生分派订单开关状态")
    public String getDispatchOrderSwitch(
            @ApiParam(name = "doctor", value = "医生id")
            @RequestParam(value = "doctor", required = true) String doctor) {
        try {
            String status = doctorDoorCoachOrderService.findDispatchStatusByDoctor(doctor);
            return baseController.write(200, "获取成功", "data", status);
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @PostMapping("/dispatchOrderSwitch")
    @ApiOperation(value = "分派订单开关修改")
    public String dispatchOrderSwitch(
            @ApiParam(name = "doctor", value = "医生code")
            @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(value = "开关值,5关闭 1开启", name = "value")
            @RequestParam(value = "value", required = true) Integer value) {
        try {
            doctorDoorCoachOrderService.updateDispatchStatusByDoctor(doctor, value);
            return baseController.write(200, "修改成功");
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @PostMapping(value = "dispatcherIntoTopic")
    @ApiOperation(value = "调度员进入会话")
    public ObjEnvelop dispatcherIntoTopic(
            @ApiParam(name = "orderId", value = "工单id", required = true) @RequestParam String orderId,
            @ApiParam(name = "hospitalName", value = "机构名称", required = true) @RequestParam String hospitalName,
            @ApiParam(name = "dispatcher", value = "调度员code", required = true) @RequestParam String dispatcher,
            @ApiParam(name = "dispatcherName", value = "调度员姓名", required = true) @RequestParam  String dispatcherName
    ) {
        try{
            JSONObject result = patientDoorCoachOrderService.dispatcherIntoTopic(orderId,hospitalName,dispatcher,dispatcherName);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            return ObjEnvelop.getSuccess("转接成功",result.get(ResponseContant.resultMsg));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
    @RequestMapping(value = "/urlAnalysis",produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ApiOperation("门牌解析上门地址")
    @ResponseBody
    public String urlAnalysis(@ApiParam(name = "url", value = "地址解析", defaultValue = "")
                              @RequestParam(value = "url", required = true)String url)throws Exception {
        try {
            return baseController.write(200, "操作成功!","data",doctorDoorCoachOrderService.urlAnalysis(url));
        }catch (Exception e){
        }catch (Exception e){
            //日志文件中记录异常信息
            //返回接口异常信息处理结果
            return baseController.errorResult(e);
            return baseController.errorResult(e);
        }
        }
    }
    }
    @GetMapping(value = "getServiceDynamic")
    @ApiOperation(value = "管理员调度实时动态")
    public String getServiceDynamic(
            @ApiParam(name = "page", value = "分页大小", required = true) @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true) @RequestParam(value = "size") int size) {
    @GetMapping(value = BaseHospitalRequestMapping.DodtorIM.getConsultInfoAndPatientInfo)
    @ApiOperation(value = "获取咨询问题,图片,居民信息", notes = "获取咨询问题,图片,居民信息")
    public ObjEnvelop getConsultInfoAndPatientInfo(
            @ApiParam(name = "consult", value = "咨询CODE")
            @RequestParam(value = "consult",required = false) String consult,
            @ApiParam(name = "patientCode", value = "居民COEE")
            @RequestParam(value = "patientCode",required = false) String patientCode){
        try {
            return ObjEnvelop.getSuccess("请求成功", imService.getConsultInfoAndPatientInfo(consult, patientCode));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
    @RequestMapping(value = "queryByConsultCode",method = RequestMethod.GET)
    @ApiOperation("根据咨询code查询关联业务项详情")
    public ObjEnvelop queryByConsultCode(@ApiParam(name = "code", value = "咨询code") @RequestParam(value = "code", required = true) String code,
                                         @ApiParam(name = "type", value = "咨询类型") @RequestParam(value = "type", required = true) Integer type){
        try{
        try{
            return baseController.write(200,"查询成功","data",adminDoorCoachOrderService.getServiceDynamic(page,size));
            JSONObject detail = consultTeamService.queryByConsultCode(code,type);
            return ObjEnvelop.getSuccess("查询成功", detail.get("data"));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
    @PostMapping(value = "updateOrderCardInfo")
    @ApiOperation(value = "更新预约简要信息")
    public String updateOrderCardInfo(
            @ApiParam(name = "jsonData", value = "json数据") @RequestParam(value = "jsonData", required = true) String jsonData) {
        try{
            JSONObject result = patientDoorCoachOrderService.updateOrderCardInfo(jsonData);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return baseController.error(-1,result.getString(ResponseContant.resultMsg));
            }
            return baseController.write(200,"保存成功","data",result.get(ResponseContant.resultMsg));
        }catch (Exception e){
        }catch (Exception e){
            return baseController.errorResult(e);
            return baseController.errorResult(e);
        }
        }
    }
    }
}
}

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/admin/AdminDoorCoachOrderService.java

@ -23,7 +23,7 @@ public class AdminDoorCoachOrderService {
    private JdbcTemplate jdbcTemplate;
    private JdbcTemplate jdbcTemplate;
    public List<Map<String , Object>> getServiceDynamic(Integer page,Integer size){
    public List<Map<String , Object>> getServiceDynamic(Integer page,Integer size){
        size = (page-1)*size;
        page = (page-1)*size;
        String sql = "SELECT * FROM base_admin_service_dynamic ORDER BY create_time DESC LIMIT "+page+","+size+"";
        String sql = "SELECT * FROM base_admin_service_dynamic ORDER BY create_time DESC LIMIT "+page+","+size+"";
        List<Map<String , Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String , Object>> list = jdbcTemplate.queryForList(sql);
        return list;
        return list;