Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

yeshijie 7 years ago
parent
commit
fe62c3447d

+ 5 - 1
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/controller/medicine/PhysicalExaminationController.java

@ -186,9 +186,13 @@ public class PhysicalExaminationController extends WeixinBaseController {
    @ApiOperation(value = "获取微信文件,传到越人接口(四象采集,声音文件需要从微信接口获取)")
    @RequestMapping(value = "/dealVoice", produces="application/json;charset=UTF-8")
    @ResponseBody
    public String getFileFromWechat( @ApiParam(name = "mediaId", value = "微信媒体id", required = true)@RequestParam(required = true, name = "type") String mediaId,
    public String getFileFromWechat( @ApiParam(name = "mediaId", value = "微信媒体id", required = true)@RequestParam(required = true, name = "mediaId") String mediaId,
                                   @ApiParam(name = "type", value = "1.脸型  2.舌像  3.声音", required = true)@RequestParam(required = true, name = "type") String type,
                                   @ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id) throws Exception {
        System.out.println("===================================");
        System.out.println(mediaId);
        System.out.println("======================================");
        String voice = saveVoiceToDisk(mediaId);
        String uploadAttachment = physicalExaminationService.uploadAttachment(voice);
        JSONObject uploadResult = new JSONObject(uploadAttachment);

+ 7 - 3
patient-co-customization/patient-co-modern-medicine/src/main/resources/application.yml

@ -1,9 +1,6 @@
server:
  port: 8080
examCode: 84        #越人试卷编号
yuerenApi: http://172.19.103.88:9099/wlyy-manage/yueren       #越人api调用地址
#yuerenApi: http://127.0.0.1:8180/wlyy_admin/yueren    #my
security:
  basic:
    username: jkzl
@ -90,6 +87,10 @@ fastDFS:
server:
  server_url: http://ehr.yihu.com/wlyy/
examCode: 84        #越人试卷编号
yuerenApi: http://172.19.103.88:9099/wlyy-manage/yueren       #越人api调用地址
#yuerenApi: http://127.0.0.1:8180/wlyy_admin/yueren    #my
---
##正式的配置
@ -123,3 +124,6 @@ wechat:
  appId: wxd03f859efdf0873d
  appSecret: 2935b54b53a957d9516c920a544f2537
examCode: 84        #越人试卷编号
yuerenApi: http://127.0.0.1:8180/wlyy_admin/yueren       #越人api调用地址

+ 10 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/VO/PrescriptionExpressageVO.java

@ -49,6 +49,8 @@ public class PrescriptionExpressageVO extends Result {
    //付款方式:1:寄方付,2:收方付 3:第三方付
    private Integer pay_method;
    private String receive_time;//收件时间
    //订单的药品详情
    private List<PrescriptionInfo> infos = new ArrayList<>();
@ -195,4 +197,12 @@ public class PrescriptionExpressageVO extends Result {
    public void setDestcode(String destcode) {
        this.destcode = destcode;
    }
    public String getReceive_time() {
        return receive_time;
    }
    public void setReceive_time(String receive_time) {
        this.receive_time = receive_time;
    }
}

+ 1 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java

@ -875,6 +875,7 @@ public class PrescriptionService extends ZysoftBaseService{
        vo.setD_phone(prescriptionExpressage.getPhone());
        vo.setPay_method(2);
        vo.setExpress_type(11);
        vo.setReceive_time("");//---2017.08.22-huangwnejie,新增收件时间,默认先放空
        vo.setInfos(prescriptionInfolist);

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/MvcConfig.java

@ -15,7 +15,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
 * Created by chenweida on 2017/4/6.
 */
@Configuration
@Profile({"test", "prod"})
//@Profile({"test", "prod"})
public class MvcConfig extends WebMvcConfigurerAdapter {
    private Logger logger = LoggerFactory.getLogger(MvcConfig.class);

+ 49 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/GateWayAOP.java

@ -0,0 +1,49 @@
package com.yihu.wlyy.interceptors;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.json.JSONObject;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
/**
 * 由于用了@ResponseBody之后 拦截器返回值ModelAndView 是null 所以用线程变量解决
 */
@Aspect
@Component
public class GateWayAOP {
    private  ThreadLocal entityThreadLocal=new ThreadLocal();
    //Controller层切点路径
    @Pointcut("execution(* com.yihu.wlyy.web..*.*(..))")
    public void controllerAspect() {
    }
    public GateWayAOP() {
        //System.out.println("Observer---------------------------------------");
    }
    @Around("controllerAspect()")
    public Object checkToken(ProceedingJoinPoint point) throws Throwable {
        Object obj = null;
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        try {
            obj = point.proceed();
        }catch (Exception e){
            e.printStackTrace();
        }
        request.setAttribute("returnObj",obj);
        return obj;
    }
}

+ 7 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/GateWayInterceptor.java

@ -49,6 +49,7 @@ public class GateWayInterceptor implements HandlerInterceptor {
    @Autowired
    private GcTokenDao gcTokenDaoDao;
    /**
     * preHandle:预处理回调方法
     *
@ -114,8 +115,13 @@ public class GateWayInterceptor implements HandlerInterceptor {
        String output = "";
        if (modelAndView != null) {
            output = JSONObject.fromObject(modelAndView.getModelMap()).toString();
        } else {
            Object returnObj = request.getAttribute("returnObj");
            if (returnObj != null) {
                output = JSONObject.fromObject(returnObj).toString();
            }
        }
        HandlerMethod handlerMethod= (HandlerMethod) handler;
        HandlerMethod handlerMethod = (HandlerMethod) handler;
//        response.getOutputStream()
        String token = request.getHeader("accesstoken");
        String ip = NetworkUtil.getIpAddress(request);

+ 17 - 16
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java

@ -177,24 +177,24 @@ public class PatientPrescriptionPayService extends BaseService {
            Map temp = new HashMap();
            String code = (String) hspital.get("code");
            String name = (String) hspital.get("name");
            provinceCode = (String) hspital.get("provinceCode");
            provinceName = (String) hspital.get("provinceName");
            cityCode = (String) hspital.get("cityCode");
            cityName = (String) hspital.get("cityName");
            townCode = (String) hspital.get("townCode");
            townName = (String) hspital.get("townName");
            streeCode = (String) hspital.get("streeCode");
            address = (String) hspital.get("address");
            String manageProvinceCode = (String) hspital.get("provinceCode");
            String manageProvinceName = (String) hspital.get("provinceName");
            String manageCityCode = (String) hspital.get("cityCode");
            String manageCityName = (String) hspital.get("cityName");
            String manageTownCode = (String) hspital.get("townCode");
            String manageTownName = (String) hspital.get("townName");
            String manageStreeCode = (String) hspital.get("streeCode");
            String manageAddress = (String) hspital.get("address");
            temp.put("code", code);
            temp.put("name", name);
            temp.put("provinceCode", provinceCode);
            temp.put("provinceName", provinceName);
            temp.put("cityCode", cityCode);
            temp.put("cityName", cityName);
            temp.put("townCode", townCode);
            temp.put("townName", townName);
            temp.put("streeCode", streeCode);
            temp.put("address", address);
            temp.put("provinceCode", manageProvinceCode);
            temp.put("provinceName", manageProvinceName);
            temp.put("cityCode", manageCityCode);
            temp.put("cityName", manageCityName);
            temp.put("townCode", manageTownCode);
            temp.put("townName", manageTownName);
            temp.put("streeCode", manageStreeCode);
            temp.put("address", manageAddress);
            manage.add(temp);
        }
        //                社区下没有服务站只能自取或快递
@ -835,6 +835,7 @@ public class PatientPrescriptionPayService extends BaseService {
            //* ***************************  伪造数据 *************************************** ***************************  测通流程 ***************************************
//            JSONObject jsonParams = prescriptionService.getPayInfo("D21085562", "3277903");
            String visitNo = prescription.getVisitNo();//续方挂号号
            LOGGER.debug("======================> getPayInfo " + ssc + visitNo);
            if (visitNo == null || ssc == null) {
                resultMap.put("status", "-2");
                return resultMap;

+ 6 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -779,6 +779,11 @@ public class PrescriptionInfoService extends BaseService {
        }
    }
    /**
     * 获取订单跟踪下拉列表
     * @param doctor
     * @return
     */
    public JSONObject getPrescriptionExpressageFilter(String doctor) {
        JSONObject rs = new JSONObject();
@ -805,7 +810,7 @@ public class PrescriptionInfoService extends BaseService {
        states.add(map4);
        Map<String, Object> map5 = new HashMap<>();
        map2.put("name", "配药完成");
        map2.put("name", "已完成");
        map2.put("code", PrescriptionLog.PrescriptionLogStatus.finish.getValue());
        states.add(map2);
        //设置配送状态下拉框

+ 50 - 24
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcTokenController.java

@ -3,9 +3,11 @@ package com.yihu.wlyy.web.gateway.controller;
import com.fasterxml.jackson.databind.deser.Deserializers;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.gateway.GcClientDetails;
import com.yihu.wlyy.entity.gateway.GcHttpLog;
import com.yihu.wlyy.entity.gateway.GcToken;
import com.yihu.wlyy.entity.login.LoginLog;
import com.yihu.wlyy.entity.security.Token;
import com.yihu.wlyy.repository.gateway.GcHttpLogDao;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.TokenService;
import com.yihu.wlyy.service.common.login.LoginLogService;
@ -22,6 +24,7 @@ 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.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
@ -45,6 +48,8 @@ public class GcTokenController {
    private GcTokenService gcTokenService;
    @Autowired
    private GcClientDetailsService clientDetailsService;
    @Autowired
    private GcHttpLogDao httpLogDao;
    @ApiOperation("获取accesstoken")
    @RequestMapping(value = "accesstoken", method = RequestMethod.POST)
@ -52,33 +57,54 @@ public class GcTokenController {
            @ApiParam(name = "appid", value = "appid", required = true) @RequestParam(required = true, value = "appid") String appid,
            @ApiParam(name = "appSecret", value = "appSecret", required = true) @RequestParam(required = true, value = "appSecret") String appSecret,
            HttpServletRequest request) {
        //得到用户
        GcClientDetails clientDetails = clientDetailsService.findByAppId(appid);
        if (clientDetails == null) {
            ResultOneModel resultOneModel = new ResultOneModel(null);
            resultOneModel.setCode(BaseResultModel.codeEm.error_Appid.getCode());
            resultOneModel.setMessage(BaseResultModel.codeEm.error_Appid.getMessage());
            return resultOneModel;
        }
        //判断appSecret
        if (!appSecret.equals(clientDetails.getAppSecret())) {
            ResultOneModel resultOneModel = new ResultOneModel(null);
            resultOneModel.setCode(BaseResultModel.codeEm.error_AppSecret.getCode());
            resultOneModel.setMessage(BaseResultModel.codeEm.error_AppSecret.getMessage());
            return resultOneModel;
        }
        //生成token
        GcToken gcToken = null;
        String ip = "";
        try {
            gcToken = gcTokenService.createToken(appid, appSecret, NetworkUtil.getIpAddress(request));
        } catch (IOException e) {
            e.printStackTrace();
            ip = NetworkUtil.getIpAddress(request);
            //得到用户
            GcClientDetails clientDetails = clientDetailsService.findByAppId(appid);
            if (clientDetails == null) {
                ResultOneModel resultOneModel = new ResultOneModel(null);
                resultOneModel.setCode(BaseResultModel.codeEm.error_Appid.getCode());
                resultOneModel.setMessage(BaseResultModel.codeEm.error_Appid.getMessage());
                saveHttpLog(ip, new JSONObject(request.getParameterMap()).toString(), "", "", request.getRequestURI(), 0, BaseResultModel.codeEm.error_Appid.getMessage());
                return resultOneModel;
            }
            //判断appSecret
            if (!appSecret.equals(clientDetails.getAppSecret())) {
                ResultOneModel resultOneModel = new ResultOneModel(null);
                resultOneModel.setCode(BaseResultModel.codeEm.error_AppSecret.getCode());
                resultOneModel.setMessage(BaseResultModel.codeEm.error_AppSecret.getMessage());
                saveHttpLog(ip, new JSONObject(request.getParameterMap()).toString(), "", "", request.getRequestURI(), 0, BaseResultModel.codeEm.error_Appid.getMessage());
                return resultOneModel;
            }
            //生成token
            GcToken gcToken = null;
            try {
                gcToken = gcTokenService.createToken(appid, appSecret, NetworkUtil.getIpAddress(request));
                saveHttpLog(ip, new JSONObject(request.getParameterMap()).toString(), new JSONObject(gcToken).toString(), gcToken.getAccesstoken(), request.getRequestURI(), 1, "成功");
            } catch (IOException e) {
                e.printStackTrace();
            }
            GcTokenModel gcTokenModel = new GcTokenModel();
            BeanUtils.copyProperties(gcToken, gcTokenModel);
            return new ResultOneModel(gcTokenModel);
        } catch (Exception e) {
            saveHttpLog(ip, new JSONObject(request.getParameterMap()).toString(), "", "", request.getRequestURI(), 0, BaseResultModel.codeEm.login_system_error.getMessage());
            return new ResultOneModel(BaseResultModel.codeEm.login_system_error.getCode(), BaseResultModel.codeEm.login_system_error.getMessage());
        }
        GcTokenModel gcTokenModel = new GcTokenModel();
        BeanUtils.copyProperties(gcToken, gcTokenModel);
        return new ResultOneModel(gcTokenModel);
    }
    private void saveHttpLog(String ip, String input, String output, String token, String method, Integer flag, String message) {
        GcHttpLog gcHttpLog = new GcHttpLog();
        gcHttpLog.setCreateTime(new Date());
        gcHttpLog.setIp(ip);
        gcHttpLog.setInput(input);
        gcHttpLog.setOutput(output);
        gcHttpLog.setToken(token);
        gcHttpLog.setMethod(method);
        gcHttpLog.setFlag(flag);
        gcHttpLog.setMessage(message);
        httpLogDao.save(gcHttpLog);
    }
}