Browse Source

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

Conflicts:
	svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/DoorServiceApplicationService.java
	svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorServiceOrderService.java
	svr/svr-door-serivce/src/main/java/com/yihu/jw/door/util/MessageUtil.java
	svr/svr-door-serivce/src/main/resources/application.yml
yeshijie 4 years ago
parent
commit
c6f1320974

+ 85 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/DoorCommentController.java

@ -0,0 +1,85 @@
package com.yihu.jw.door.controller.patient;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.door.controller.BaseController;
import com.yihu.jw.door.service.DoorCommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by wangpeiqiang on 2019/3/16.
 * 居民端-评分接口.
 */
@RestController
@RequestMapping(value = "/patient/door_comment")
@Api(description = "居民端-评分")
public class DoorCommentController extends BaseController {
    @Autowired
    DoorCommentService doorCommentService;
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ApiOperation(value = "添加居民评分")
    public String add(
            @ApiParam(name = "orderId", value = "工单id", required = true)
            @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(name = "professionalSkill", value = "专业能力", required = false)
            @RequestParam(value = "professionalSkill", required = false) Integer professionalSkill,
            @ApiParam(name = "serveAttitude", value = "服务态度", required = false)
            @RequestParam(value = "serveAttitude", required = false) Integer serveAttitude,
            @ApiParam(name = "serveEfficiency", value = "服务效率", required = false)
            @RequestParam(value = "serveEfficiency", required = false) Integer serveEfficiency,
            @ApiParam(name = "description", value = "服务描述或建议", required = false)
            @RequestParam(value = "description", required = false) String description,
            @ApiParam(name = "isAnonymous", value = "是否匿名", required = false)
            @RequestParam(value = "isAnonymous", required = false) Integer isAnonymous
    ){
        try {
            if(orderId==null){
                return "工单id不能为空";
            }
            String dc = doorCommentService.add(getUID(), orderId, professionalSkill,serveAttitude,serveEfficiency,description,isAnonymous);
            if("-1".equals(dc)){
                return error(-2,"评分失败");
            }
            return write(200,"评分成功","data",dc);
        } catch (Exception e) {
            error(e);
            return error(-1,"评分失败");
        }
    }
    /**
     * 根据医生code查询居民评价详情
     *
     * @return
     */
    @RequestMapping(value = "/commentDetail", method = RequestMethod.GET)
    @ApiOperation("查询居民评价详情")
    public String commentDetail(
            @ApiParam(name = "patient", value = "居民code", required = false)
            @RequestParam(value = "patient", required = false)String patient,
            @ApiParam(name = "orderId", value = "工单id", required = true)
            @RequestParam(value = "orderId", required = true) String orderId
    ){
        try {
            if(StringUtils.isEmpty(patient)){
                patient = getUID();
            }
            JSONObject result = doorCommentService.commentDetail(patient,orderId);
            return write(200, "请求成功!","data",result);
        }catch (Exception e){
            error(e);
            return error(-1, "请求失败");
        }
    }
}

+ 101 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/DoorCommentService.java

@ -0,0 +1,101 @@
package com.yihu.jw.door.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.door.dao.WlyyDoorCommentDao;
import com.yihu.jw.door.dao.WlyyDoorCommentDoctorDao;
import com.yihu.jw.door.dao.WlyyDoorDoctorDao;
import com.yihu.jw.door.dao.WlyyDoorServiceOrderDao;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.door.WlyyDoorCommentDO;
import com.yihu.jw.entity.door.WlyyDoorCommentDoctorDO;
import com.yihu.jw.entity.door.WlyyDoorDoctorDO;
import com.yihu.jw.entity.door.WlyyDoorServiceOrderDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
 * Created by wangpeiqiang on 2019/3/16.
 * 居民端-评分
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class DoorCommentService extends BaseJpaService<WlyyDoorCommentDO, WlyyDoorCommentDao> {
    @Autowired
    BasePatientDao patientDao;
    @Autowired
    WlyyDoorCommentDao doorCommentDao;
    @Autowired
    WlyyDoorCommentDoctorDao doorCommentDoctorDao;
    @Autowired
    WlyyDoorServiceOrderDao wlyyDoorServiceOrderDao;
    @Autowired
    WlyyDoorDoctorDao wlyyDoorDoctorDao;
    public String add(String patientCode,String orderId, Integer professionalSkill,Integer serveAttitude,Integer serveEfficiency,String description,Integer isAnonymous){
        BasePatientDO patient =patientDao.findById(patientCode);
        WlyyDoorCommentDO doorComment = new WlyyDoorCommentDO();
        BigDecimal evaluateSplit = BigDecimal.ZERO;
        BigDecimal num = new BigDecimal("3");
        //计算三项评分平均分
        evaluateSplit = evaluateSplit.add(
                (new BigDecimal(professionalSkill).add(new BigDecimal(serveAttitude)).add(new BigDecimal(serveEfficiency))).divide(num,2,BigDecimal.ROUND_HALF_UP)
        );
        doorComment.setOrderId(orderId);
        doorComment.setCode(getCode());
        doorComment.setProfessionalSkill(professionalSkill);
        doorComment.setServeAttitude(serveAttitude);
        doorComment.setServeEfficiency(serveEfficiency);
        doorComment.setEvaluateSplit(evaluateSplit);
        doorComment.setIsAnonymous(isAnonymous);
        doorComment.setDescription(description);
        doorComment.setPatient(patientCode);
        doorComment.setCreateUser(patientCode);
        doorComment.setCreateUserName(patient.getName());
        doorComment.setCreateTime(new Date());
        doorCommentDao.save(doorComment);
        //更新工单状态
        WlyyDoorServiceOrderDO wlyyDoorServiceOrderDO =wlyyDoorServiceOrderDao.findOne(orderId);
        wlyyDoorServiceOrderDO.setStatus(6);
        wlyyDoorServiceOrderDO.setCompleteTime(new Date());
        wlyyDoorServiceOrderDO.setUpdateUser(patientCode);
        wlyyDoorServiceOrderDO.setUpdateUserName(patient.getName());
        wlyyDoorServiceOrderDO.setUpdateTime(new Date());
        wlyyDoorServiceOrderDao.save(wlyyDoorServiceOrderDO);
        List<WlyyDoorDoctorDO> wlyyDoorDoctorDOList =this.wlyyDoorDoctorDao.findByOrderId(orderId);
        for(WlyyDoorDoctorDO wlyyDoorDoctorDO:wlyyDoorDoctorDOList) {
            WlyyDoorCommentDoctorDO doorCommentDoctor = new WlyyDoorCommentDoctorDO();
            doorCommentDoctor.setOrderId(orderId);
            doorCommentDoctor.setCode(getCode());
            doorCommentDoctor.setDoctorCode(wlyyDoorDoctorDO.getDoctor());
            doorCommentDoctor.setProfessionalSkill(professionalSkill);
            doorCommentDoctor.setServeAttitude(serveAttitude);
            doorCommentDoctor.setServeEfficiency(serveEfficiency);
            doorCommentDoctor.setEvaluateSplit(evaluateSplit);
            doorCommentDoctor.setIsAnonymous(isAnonymous);
            doorCommentDoctor.setDescription(description);
            doorCommentDoctor.setPatient(patientCode);
            doorCommentDoctor.setCreateUser(patientCode);
            doorCommentDoctor.setCreateUserName(patient.getName());
            doorCommentDoctor.setCreateTime(new Date());
            doorCommentDoctorDao.save(doorCommentDoctor);
        }
        return"1";
    }
    public JSONObject commentDetail(String patient,String orderId)throws Exception{
        JSONObject result = new JSONObject();
        WlyyDoorCommentDO commentDetail = doorCommentDao.selectCommentDoctor(patient,orderId);
        result.put("commentDetail",commentDetail);
        return result;
    }
}

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

@ -308,7 +308,7 @@ systemSetting:
spring:
  profiles: tnJwprod
  datasource:
    url: jdbc:mysql://10.9.1.247:3306/base?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    url: jdbc:mysql://10.9.1.247:3310/base?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: wlyy
    password: qY#j2n5O
  redis:
@ -330,8 +330,8 @@ server:
  server_url: http://ehr.yihu.com/wlyy/
base:
  url: http://192.168.120.96:10020/svr-base/
  hospitalUrl: http://172.26.0.107:10022/
  url: http://127.0.0.1:10020/svr-base/
  hospitalUrl: http://127.0.0.1:10022/
wechat:
  appId: wxad04e9c4c5255acf

+ 8 - 1
svr/svr-door-serivce/src/main/resources/bootstrap.yml

@ -43,4 +43,11 @@ spring:
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://192.168.120.153:1221}
      label: ${wlyy.spring.config.label:prod}
      label: ${wlyy.spring.config.label:prod}
---
spring:
  profiles: tnJwprod
  cloud:
    config:
      uri: ${wlyy.pring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy.spring.config.label:master}