Selaa lähdekoodia

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

# Conflicts:
#	business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
wangzhinan 5 vuotta sitten
vanhempi
commit
fd900c24e4

+ 9 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -71,6 +71,7 @@ import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -176,6 +177,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private BusinessOrderService businessOrderService;
    @Autowired
    private YkyyService ykyyService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Value("${demo.flag}")
@ -3017,8 +3020,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                rs.put("roles",null);
            }
            //密码过期
            rs.put("authPw",baseDoctorService.findDoctorPwlimitDate(doctor));
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("pwOverDue");
            if (wlyyHospitalSysDictDO.getPyCode().equalsIgnoreCase("open")){
                //密码过期
                rs.put("authPw",baseDoctorService.findDoctorPwlimitDate(doctor));
            }
        }
        return rs;

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java

@ -933,7 +933,7 @@ public class YkyyEntranceService {
     * @return
     */
    public JSONArray findYpyf(String pydm) throws Exception {
        String sql = "select y.ypyf as \"ypyf\",y.pydm as \"pydm\",y.xmmc as \"xmmc\" from v_hlw_ypyf y where 1=1 ";
        String sql = "select y.ypyf as \"ypyf\",y.pydm as \"pydm\",y.xmmc as \"xmmc\" from v_hlw_ypyf y where 1=1  and y.pydm is not null";
        if (StringUtils.isNoneBlank(pydm)){
            sql+=" and y.pydm='"+pydm+"' ";
        }

+ 59 - 0
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -3,6 +3,7 @@ package com.yihu.jw.order;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPObject;
import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.base.im.ConsultDo;
@ -32,9 +33,11 @@ import com.yihu.jw.order.pay.ylz.YlzPayService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.common.BeanUtils;
import com.yihu.jw.util.common.QrcodeUtil;
import com.yihu.jw.util.common.XMLUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.WeiXinPayUtils;
import com.yihu.jw.utils.ByteToInputStream;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxPayLogDao;
@ -47,6 +50,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.*;
@ -752,6 +756,23 @@ public class BusinessOrderService extends BaseJpaService {
            String notifyUrl = hospitalSysDictDO.getDictCode();
            response = ylzPayService.rechargeConsume("123456",businessOrderDO.getPatientName(),"01",ssc,"01",idcard,depositType,
                    price,price,businessOrderDO.getOrderNo(),idcard,"0",businessOrderDO.getPatientName(),businessOrderDO.getRematk(),openId,notifyUrl,notifyUrl,null);
            if (depositType.equalsIgnoreCase("WX_QR")){
                JSONObject object = JSONObject.parseObject(response);
                if (object!=null){
                    JSONObject jsonObject = object.getJSONObject("param");
                    if (object.getString("respCode").equalsIgnoreCase("000000")){
                        InputStream qrcode = QrcodeUtil.createQrcode(jsonObject.getString("qrcode"),300,"jpg");
                        ByteToInputStream byteToInputStream = new ByteToInputStream();
                        String QRCodeImg = byteToInputStream.getBase64FromInputStream(qrcode);
                        jsonObject.put("qrcodeUrl","data:image/png;base64,"+ QRCodeImg);
                        String traceNo = jsonObject.getString("traceNo");
                        businessOrderDO.setTraceNo(traceNo);
                        businessOrderDao.save(businessOrderDO);
                    }
                    response = object.toJSONString();
                }
            }
        }else {
            return "找不到订单!";
        }
@ -759,6 +780,13 @@ public class BusinessOrderService extends BaseJpaService {
    }
    public BusinessOrderDO selectStatus(String relationCode){
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
        return businessOrderDO;
    }
    /**
     * 易联众退款
     * @param wechatId
@ -824,4 +852,35 @@ public class BusinessOrderService extends BaseJpaService {
        JSONObject object = JSONObject.parseObject(response);
        return object;
    }
    /**
     *
     * @param traceNo
     * @return
     */
    public BusinessOrderDO updatePayStatus(String traceNo) throws Exception {
        logger.info("入参:"+traceNo);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByTraceNo(traceNo);
        if (businessOrderDO==null){
            throw new Exception("查不到订单!");
        }
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
           ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
           consultDo.setPayStatus(1);
           consultOrderDao.save(consultDo);
        }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")){
           WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
           wlyyOutpatientDO.setPayStatus(1);
           outpatientDao.save(wlyyOutpatientDO);
        } else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("4")) {
           List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(businessOrderDO.getRelationCode());
           if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
               WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
               wlyyPrescriptionDO.setPayStatus(1);
               prescriptionDao.save(wlyyPrescriptionDO);
           }
        }
        return businessOrderDO;
    }
}

+ 4 - 0
business/base-service/src/main/java/com/yihu/jw/order/dao/BusinessOrderDao.java

@ -20,4 +20,8 @@ public interface BusinessOrderDao extends PagingAndSortingRepository<BusinessOrd
    @Query("from BusinessOrderDO w where w.relationCode = ?1 ")
    BusinessOrderDO selectByRelationCode(String relationCode);
    @Query("from BusinessOrderDO w where w.traceNo = ?1 ")
    BusinessOrderDO selectByTraceNo(String traceNo);
}

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java

@ -45,6 +45,7 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    private String updateUserName;
    private String ykOrderNo;
    private String ykOrderId;
    private String traceNo;//支付平台的订单号
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time", nullable = false, length = 0,updatable = false)
@ -276,4 +277,13 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    public void setYkOrderId(String ykOrderId) {
        this.ykOrderId = ykOrderId;
    }
    @Column(name = "trace_no")
    public String getTraceNo() {
        return traceNo;
    }
    public void setTraceNo(String traceNo) {
        this.traceNo = traceNo;
    }
}

+ 2 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -385,6 +385,8 @@ public class BaseHospitalRequestMapping {
        public static final String tradeQuery= "/tradeQuery";
        public static final String selectOrderStatus="/selectOrderStatus";
    }

+ 12 - 7
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -1422,12 +1422,14 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                                String familyList = ykyyService.getFamilyList(null,userId);
                                JSONObject familyJson = JSONObject.parseObject(familyList);
                                if (familyJson.getString("code").equalsIgnoreCase("200")){
                                    JSONArray list = familyJson.getJSONArray("list");
                                    JSONObject object1 = familyJson.getJSONObject("data");
                                    JSONArray list = object1.getJSONArray("list");
                                    if (list!=null&&list.size()!=0){
                                        for (int i=0;i<list.size();i++){
                                            JSONObject family = list.getJSONObject(i);
                                            if (family.getString("ILLNESS").equalsIgnoreCase("本人")){
                                                basePatientDO.setDel("1");
                                                basePatientDO.setName(family.getString("NAME"));
                                                basePatientDO.setCreateTime(new Date());
                                                basePatientDO.setUpdateTime(new Date());
                                                basePatientDO.setYktId(family.getString("ID"));
@ -1435,24 +1437,26 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                                                basePatientDO.setIdcard(family.getString("IDCARD"));
                                                String idcard = family.getString("IDCARD");
                                                Integer age = IdCardUtil.getAgeForIdcard(idcard);
                                                String birthday = IdCardUtil.getBirthdayForIdcardStr(idcard);
                                                Date birthDay = null;
                                                if (org.apache.commons.lang3.StringUtils.isNoneBlank(birthday)){
                                                    birthDay = com.yihu.jw.util.date.DateUtil.strToDateShort(birthday);
                                                }
                                                String sex = IdCardUtil.getSexForIdcard_new(idcard);
                                                Integer sexx = null;
                                                if (org.apache.commons.lang3.StringUtils.isNoneBlank(sex)){
                                                    sexx = Integer.parseInt(sex);
                                                }
                                                basePatientDO.setBirthday(birthDay);
                                                String birthDay = family.getString("BIRTHDAY");
                                                Date birthday = null;
                                                if (org.apache.commons.lang3.StringUtils.isNoneBlank(birthDay)){
                                                    birthday = DateUtil.strToDate(birthDay+" 00:00:00");;
                                                }
                                                basePatientDO.setBirthday(birthday);
                                                basePatientDO.setSex(sexx);
                                                basePatientDO.setMobile(tel);
                                                String salt = UUID.randomUUID().toString().substring(0,5);
                                                String pw = idcard.substring(idcard.length()-6,idcard.length());
                                                basePatientDO.setIdcard(idcard);
                                                basePatientDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                                                basePatientDO.setSalt(salt);
                                                basePatientDO.setLocked(0);
                                                basePatientDO.setEnabled(1);
                                                basePatientDO.setPatientStatus("1");
                                                basePatientDao.save(basePatientDO);
                                            }
@ -1468,6 +1472,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                                        basePatientDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                                        basePatientDO.setSalt(salt);
                                        basePatientDO.setLocked(0);
                                        basePatientDO.setEnabled(1);
                                        basePatientDO.setPatientStatus("1");
                                        basePatientDao.save(basePatientDO);
                                    }

+ 2 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java

@ -194,6 +194,8 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
						net.sf.json.JSONObject res = prescriptionService.registerOutPatient(outpatientCode,doctorCode);
						rsCode = (String)res.get("@RESULT");
						mes = (String)res.get("@MSG");
					/*	rsCode="0";
						mes="已挂号";*/
					}
					if("0".equals(rsCode)||"-2".equals(rsCode)){

+ 6 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -83,6 +83,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorByHospitalAndDiseaseAndDept)
    @ApiOperation(value = "根据疾病名称,热门部门查询医生", notes = "根据疾病名称,热门部门查询医生")
    public ListEnvelop findDoctorByHospitalAndDiseaseAndDept(@ApiParam(name = "iswork", value = "是否过滤排班,1是")
@ -339,7 +340,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        try {
            logger.info("解密前:{}", JSON.toJSONString(encryptRes));
            ResponseParams<?> decryptRes = client.decryptNotifyResponse(encryptRes);
            logger.info("解密后:{}", JSON.toJSONString(decryptRes));
            logger.info("解密后:{}",JSON.toJSONString(decryptRes) );
            boolean isDecrypt = ("-1".equals(decryptRes.getRespCode()) ? false : true); // 是否解密失败
            if (!isDecrypt) {
                response.getWriter().write("DECRYPT FAILURE");
@ -349,6 +350,10 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                if (!isVerify) {
                    response.getWriter().write("FAILURE");
                } else {
                    JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(decryptRes));
                    JSONObject param = jsonObject.getJSONObject("param");
                    String traceNo = param.getString("traceNo");
                    businessOrderService.updatePayStatus(traceNo);
                    response.getWriter().write("SUCCESS");
                }
            }

+ 18 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -1132,6 +1132,24 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    }
    /**
     * 查询支付状态
     * @param relationCode
     * @return
     * @throws Exception
     */
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.selectOrderStatus)
    @ApiOperation("查询支付状态")
    public ObjEnvelop selectOrderStatus(
            @ApiParam(name = "relationCode", value = "relationCode", required = true)
            @RequestParam(required = true)String relationCode) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.selectStatus(relationCode));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 易联众统一退款

+ 2 - 2
svr/svr-internet-hospital/src/main/resources/application.yml

@ -115,7 +115,7 @@ jw:
myFamily:
  qrCodeFailurTime: 2
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP
@ -182,7 +182,7 @@ fastDFS:
fast-dfs:
  tracker-server: 172.26.0.110:22122 #服务器地址
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP