Просмотр исходного кода

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

Conflicts:
	svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/CreditsDetailService.java
yeshijie 4 лет назад
Родитель
Сommit
2506bf6e24

+ 64 - 4
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoctorController.java

@ -1,21 +1,27 @@
package com.yihu.jw.door.controller.doctor;
import com.alibaba.fastjson.JSON;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.door.controller.BaseController;
import com.yihu.jw.door.service.common.WlyyMessageService;
import com.yihu.jw.door.service.common.PatientService;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by yeshijie on 2020/12/30.
@ -33,6 +39,48 @@ public class DoctorController extends BaseController {
    private BasePatientDao patientDao;
    @Autowired
    private PatientService patientService;
    @Autowired
    private BaseOrgDao orgDao;
    @Autowired
    private WlyyMessageService messageService;
    @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 (StringUtils.isBlank(pageSize)) {
            pageSize = "10";
        }
        if (page.equals("0")) {
            page = "1";
        }
        String[] split = 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 {
            JSONObject waitingMessages = messageService.getWaitingMessages(message1, types, Integer.valueOf(page), Integer.valueOf(pageSize));
            return write(200, "查询成功","data",waitingMessages);
        }catch (Exception e){
            error(e);
            return error( -1, "查询失败!");
        }
    }
    /**
     * 查询居民信息
@ -55,6 +103,18 @@ public class DoctorController extends BaseController {
        }
    }
    @GetMapping(value = "getHospitalInfoByCode")
    @ApiOperation("根据机构code获取机构信息")
    public String getHospitalInfoByCode(String code) {
        try {
            BaseOrgDO baseOrgDO = orgDao.findByCode(code);
            return write(200, "查询成功", "data", baseOrgDO);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
    /**
     * 医生基本信息查询接口
     *

+ 14 - 1
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoorOrderController.java

@ -243,7 +243,7 @@ public class DoorOrderController extends BaseController {
            @ApiParam(value = "二维码内容", name = "twoDimensionalCode")
            @RequestParam(value = "twoDimensionalCode", required = false) String twoDimensionalCode) {
        try {
            WlyyDoorServiceOrderDO wlyyDoorServiceOrderDO = doorOrderService.signIn(orderId, signTime, signWay, signLocation, signImg,twoDimensionalCode);
            WlyyDoorServiceOrderDO wlyyDoorServiceOrderDO = doorOrderService.signIn(orderId, signTime, signWay, signLocation, signImg,twoDimensionalCode,getUID());
            if (wlyyDoorServiceOrderDO != null){
                return write(200, "操作成功", "data", wlyyDoorServiceOrderDO);
            }else {
@ -935,6 +935,19 @@ public class DoorOrderController extends BaseController {
        }
    }
    @PostMapping(value = "savePrescription")
    @ApiOperation("上门服务前手工开方接口")
    public String savePrescription(@ApiParam(name = "orderId", value = "工单id", required = true) @RequestParam String orderId,
                                     @ApiParam(name = "prescriptionCode", value = "处方单号,多个用逗号隔开", required = true) @RequestParam String prescriptionCode) {
        try {
            wlyyDoorServiceOrderService.savePrescription(orderId, prescriptionCode);
            return write(200, "操作成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败");
        }
    }
    @PostMapping(value = "createPrescription")
    @ResponseBody
    @ApiOperation("上门服务前手工开方接口")

+ 34 - 5
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/DoorOrderService.java

@ -12,6 +12,7 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.door.*;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.dao.ConsultTeamDao;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.message.dao.MessageDao;
import com.yihu.jw.patient.dao.BasePatientDao;
@ -109,6 +110,10 @@ public class DoorOrderService {
    private WlyyDoorServiceOrderDao wlyyDoorServiceOrderDao;
    @Autowired
    private WlyyDoorFeeDetailDao wlyyDoorFeeDetailDao;
    @Value("${base.hospitalUrl}")
    private String hospitalUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    /**
     * 顶部状态栏订单各分类总条数
@ -151,9 +156,15 @@ public class DoorOrderService {
        if (!map.containsKey("completed")) {
            map.put("completed", "0");
        }
        if(!map.containsKey("exampaperstatus")){
        //待补录
        String sqlCount = "SELECT COUNT(DISTINCT o.id) FROM wlyy_door_service_order o LEFT JOIN wlyy_door_doctor d ON d.order_id = o.id " +
                "WHERE o.conclusion_status = 1 and (d.doctor='"+doctor+"' or o.doctor='"+doctor+"')";
        Integer count = jdbcTemplate.queryForObject(sqlCount,Integer.class);
        map.put("exampaperstatus", String.valueOf(count));
/*        if(!map.containsKey("exampaperstatus")){
            map.put("exampaperstatus", "0");
        }
        }*/
        return map;
    }
@ -355,14 +366,15 @@ public class DoorOrderService {
     * @param signImg
     * @return
     */
    public WlyyDoorServiceOrderDO signIn(String orderId, String signTime, Integer signWay, String signLocation, String signImg, String twoDimensionalCode) throws Exception {
    public WlyyDoorServiceOrderDO signIn(String orderId, String signTime, Integer signWay, String signLocation,
                                         String signImg, String twoDimensionalCode,String doctorId) throws Exception {
        WlyyDoorServiceOrderDO doorServiceOrder = this.doorServiceOrderDao.findOne(orderId);
        doorServiceOrder.setDoctorSignTime(DateUtil.strToDate(signTime));
        doorServiceOrder.setDoctorSignWay(signWay);
        // 签到方式-2扫码时,需要去解析地址
        doorServiceOrder.setDoctorSignLocation(signLocation);
        doorServiceOrder.setDoctorSignImg(StringUtils.isEmpty(signImg) ? null : signImg);
        doorServiceOrder.setStatus(4);
        if(signWay == 4 ){//扫码签到
            if (twoDimensionalCode.equals(doorServiceOrder.getNumber())){
@ -384,6 +396,23 @@ public class DoorOrderService {
        }
    }
    public void appointmentRevisitOnDoor(WlyyDoorServiceOrderDO orderDO,String doctorId){
        BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
        JSONObject outpatientJson = new JSONObject();
        outpatientJson.put("hospital",orderDO.getHospital());
        outpatientJson.put("patient",orderDO.getPatient());
        outpatientJson.put("patientName",orderDO.getPatientName());
        outpatientJson.put("mobile",orderDO.getPatientPhone());
        outpatientJson.put("doctor",doctorId);
        outpatientJson.put("doctorName",doctorDO.getName());
//        expressageJson: {"name":"王俊","oneselfPickupFlg":1自取,"hospitalCode":"传取药的药房code 默认1"}
        String url = hospitalUrl + "/open/noLogin/appointmentRevisitOnDoor";
//        httpClientUtil.post(url)
    }
    /**
     * 编辑保存服务工单小结
     * @param model
@ -731,7 +760,7 @@ public class DoorOrderService {
            BasePatientDO patient = patientInfoService.findById(String.valueOf(one.get("patientCode")));
            if (patient != null) {
                String sex = IdCardUtil.getSexForIdcard(patient.getIdcard());
                object.put("sex", "1".equals(sex) ? "男" : "2".equals(sex) ? "女" : "未知");
                object.put("sex", sex);
                object.put("age", IdCardUtil.getAgeByIdcardOrBirthday(patient.getIdcard(),patient.getBirthday()));
                object.put("photo", patient.getPhoto());

+ 44 - 27
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorServiceOrderService.java

@ -1745,6 +1745,24 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        }else if (StringUtils.isNoneBlank(phone)){
            buffer.append(" AND o.`proxy_patient_phone` like '%"+phone+"%'");
        }
        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 ";
        }
        String sql = "SELECT " +
                "  p.name AS patientName, " +
                "  p.photo AS photo, " +
@ -1764,23 +1782,12 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
                "  o.serve_lat as lat, " +
                "  o.`status` as status, " +
                "  o.`dispatcher_name` as dispatcherName, " +
                "  concat( o.patient,'_' ,c.id, '_',o.`number`,'_11' ) as sessionId, " +
                "   t1.`type` as patientType " +
                "  concat( o.patient,'_' ,c.id, '_',o.`number`,'_11' ) as sessionId " +
                patientTypeTemp +
                " FROM " +
                " ( wlyy_door_service_order o " +
                " LEFT JOIN base_patient p ON o.patient = p.id ) LEFT JOIN wlyy_consult c on o.id = c.relation_code" +
                " 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" +
                " WHERE " +
                " 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+
                " AND ( o.`status` = {status} OR -100 = {status} ) " +
                " ORDER BY o.create_time desc " +
@ -1797,17 +1804,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
                " FROM  " +
                "   wlyy_door_service_order o  " +
                " LEFT JOIN base_patient p ON o.patient = p.id " +
                " 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" +
                applicationSql +
                " WHERE  " +
                "  o.hospital = '{hospital}' " +buffer+
                " AND (o.`status` = {status} or -100 = {status})";
@ -1852,7 +1849,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
                    JSONArray parArray = imUtill.getParticipants(sessionId);
                    parArray.forEach(
                            oneParObj -> {
                                org.json.JSONObject oneParJson = (org.json.JSONObject)oneParObj;
                                JSONObject oneParJson = (com.alibaba.fastjson.JSONObject)oneParObj;
                                if(StringUtils.equalsIgnoreCase(oneParJson.getString("id"),dispatcher)){
                                    oneMap.put("isInSession",true);
                                }
@ -2533,6 +2530,26 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        return res;
    }
    /**
     * 互联网医院开方后 关联上门工单
     * @param orderId
     * @param prescriptionCode
     */
    public void savePrescription(String orderId,String prescriptionCode){
        WlyyDoorServiceOrderDO orderDO = wlyyDoorServiceOrderDao.findOne(orderId);
        orderDO.setPrescriptionCode(prescriptionCode);
        orderDO.setPrescriptionTime(new Date());
        orderDO.setPrescriptionStatus(1);
        wlyyDoorServiceOrderDao.save(orderDO);
        //非代预约才发送im消息
        if(orderDO.getType() != null && orderDO.getType() != 3) {
            //发送 预约卡片信息(2101类型)
            JSONObject orderInfoContent = this.queryOrderCardInfo(orderDO);
            orderInfoContent.put("re_msg_type", 2);//开方完成消息
            this.qucikSendIM(orderDO.getId(), orderDO.getDispatcher(), "智能助手", "2101", orderInfoContent.toJSONString());
        }
    }
    /**
     *  更新医生地理位置状态

+ 10 - 2
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/common/PatientService.java

@ -2,8 +2,10 @@ package com.yihu.jw.door.service.common;
import com.yihu.jw.door.dao.common.SignFamilyDao;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.door.SignFamily;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang3.StringUtils;
@ -22,6 +24,8 @@ public class PatientService {
    private BasePatientDao patientDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private BasePatientMedicareCardDao patientMedicareCardDao;
    /**
     * 查询单个居民信息
@ -34,10 +38,12 @@ public class PatientService {
        JSONObject json = new JSONObject();
        BasePatientDO p = patientDao.findById(patient);
        PatientMedicareCardDO medicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
        if (p == null) {
            throw new Exception("patient info can not find");
        }
        // 设置患者标识
        json.put("code", p.getId());
        // 设置患者姓名
@ -66,8 +72,10 @@ public class PatientService {
        json.put("streetName", p.getStreetName());
        // 设置患者地址
        json.put("address", p.getAddress());
        // 社保号
//        json.put("ssc", p.getSsc());
        // 社保号/医保卡
        if(medicareCardDO!=null){
            json.put("ssc", medicareCardDO.getCode());
        }
        //病情类型:0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
/*        json.put("disease",p.getDisease());

+ 82 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/common/WlyyMessageService.java

@ -0,0 +1,82 @@
package com.yihu.jw.door.service.common;
import com.alibaba.fastjson.JSONArray;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by yeshijie on 2021/1/4.
 */
@Service
public class WlyyMessageService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 获取待接单的接口
     *
     * @param message {"read":1,"over":0}
     * @param page 页码
     * @param size 分页大小
     * @return
     * @throws Exception
     */
    public JSONObject getWaitingMessages(SystemMessageDO message, String types, Integer page, Integer size) throws Exception{
        String sqlList = " SELECT a.*, b.`status` AS appliStatus ";
        String sqlCount = " select count(*) as total ";
        String sql =  " FROM base_system_message a " +
                " LEFT JOIN wlyy_door_service_application b ON a.relation_code = b.id ";
//        sql+= " where 1=1 AND a.state = 1 AND a.over = 1 ";
        sql+= " where 1=1  ";
        if(!StringUtils.isEmpty(message.getReceiver())){
            sql+=" AND a.receiver = '"+message.getReceiver()+"'";
        }
        if(!StringUtils.isEmpty(types)){
            sql+=" AND a.type IN ("+types+")";
        }
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlCount+sql);
        sql+=" ORDER BY a.create_time DESC LIMIT "+(page-1)*size+","+size;
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sqlList+sql);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
            count = (Long) rstotal.get(0).get("total");
        }
        JSONArray jsonArray = new JSONArray();
        for(Map<String,Object> one:mapList){
            JSONObject object = new JSONObject();
            object.put("over",one.get("over"));
            object.put("code",one.get("code"));
            object.put("receiver",one.get("receiver"));
            object.put("del",one.get("del"));
            object.put("title",one.get("title"));
            object.put("type",one.get("type"));
            object.put("content",one.get("content"));
            object.put("sender",one.get("sender"));
            object.put("id",one.get("id"));
            object.put("state",one.get("state"));
            object.put("relation_code",one.get("relation_code"));
            object.put("has_read",one.get("is_read"));
            object.put("appliStatus",one.get("appliStatus"));
            Date date = (Date)one.get("create_time");
            object.put("create_time", DateUtil.dateToStr(date,"yyyy-MM-dd HH:mm:ss"));
            Date date1 = (Date)one.get("czrq");
            object.put("czrq", DateUtil.dateToStr(date1,"yyyy-MM-dd HH:mm:ss"));
            jsonArray.add(object);
        }
        JSONObject object = new JSONObject();
        object.put("total",count);
        object.put("waitingMessages",jsonArray);
        object.put("currPage",page);
        object.put("pageSize",size);
        return object;
    }
}

+ 3 - 1
svr/svr-door-serivce/src/main/resources/application.yml

@ -94,7 +94,7 @@ neiwang:
base:
  url: http://172.17.110.212:10020/
  hospitalUrl: http://172.26.0.107:10022/
wechat:
  appId: wxd03f859efdf0873d
  appSecret: 2935b54b53a957d9516c920a544f2537
@ -173,6 +173,7 @@ neiwang:
base:
  url: http://172.17.110.212:10020/
  hospitalUrl: http://172.26.0.107:10022/
wechat:
  appId: wx1f129f7b51701428
@ -251,6 +252,7 @@ server:
base:
  url: http://192.168.120.96:10020/svr-base/
  hospitalUrl: http://172.26.0.107:10022/
wechat:
  appId: wxad04e9c4c5255acf