Przeglądaj źródła

基卫线下缴费生成二维码

wujunjie 7 lat temu
rodzic
commit
7017a90b7a

+ 19 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/common/util/DateUtil.java

@ -78,6 +78,25 @@ public class DateUtil {
        return formatter.format(dateDate);
    }
    /**
     *  字符串转时间
     * @param str 时间字符串
     * @param eg 格式
     * @return
     */
    public static java.util.Date stringToDate(String str, String eg) {
        DateFormat format = new SimpleDateFormat(eg);
        java.util.Date date = null;
        if (str != null && !"".equals(str)) {
            try {
                date = format.parse(str);
            } catch (Exception e) {
                return null;
            }
        }
        return date;
    }
    /**
     * 将短时间格式时间转换为字符串 yyyy-MM-dd
     *

Plik diff jest za duży
+ 2 - 2
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java


+ 7 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionExpressage.java

@ -31,6 +31,7 @@ public class PrescriptionExpressage extends IdEntity {
    private Integer weight;                  //快递重量  单位是g
    //配送人信息
    private String hospitalName;            // 如果配送方式是健管师那么这个字段存服务站名称,如果是快递配送那么是快递公司名称
    private String hospitalCode;            // 配药机构code
    private String hospitalAddress;         // 机构地址
    private String expressageName;          //配送人名称
    private String expressageCode;          //配送人code
@ -51,7 +52,13 @@ public class PrescriptionExpressage extends IdEntity {
    private Date deliveryTime; //送达时间
    public String getHospitalCode() {
        return hospitalCode;
    }
    public void setHospitalCode(String hospitalCode) {
        this.hospitalCode = hospitalCode;
    }
    @Column(name = "code", unique = true , nullable=false)
    public String getCode() {

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

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.service.common.SystemConfig;
import com.yihu.wlyy.service.common.http.HttpClientUtil;
import com.yihu.wlyy.service.common.model.Result;
import com.yihu.wlyy.service.common.util.AmoutUtils;
import com.yihu.wlyy.service.common.util.CommonUtil;
@ -18,6 +19,7 @@ import com.yihu.wlyy.service.entity.consult.ConsultTeam;
import com.yihu.wlyy.service.entity.prescription.*;
import com.yihu.wlyy.service.entity.prescription.VO.PrescriptionExpressageVO;
import com.yihu.wlyy.service.service.ZysoftBaseService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -74,6 +76,8 @@ public class PrescriptionService extends ZysoftBaseService{
    private String im;
    @Value("${redisChannel.prescription}")
    private String channelTopic;
    @Value("${wlyy.api}")
    private String wlyyApi;
    @Autowired
    private ConsultTeamDao consultTeamDao;
    @Autowired
@ -82,6 +86,8 @@ public class PrescriptionService extends ZysoftBaseService{
    private ZyIvPhysicDictDao zyIvPhysicDictDao;
    @Autowired
    private FollowupDao followupDao;
    @Autowired
    private PrescriptionExpressageDao expressageDao;
    /**
     * 新增续方日志
@ -1238,6 +1244,7 @@ public class PrescriptionService extends ZysoftBaseService{
     * @return
     * @throws Exception
     */
    @Transactional
    public Result offlinepay(String data)  throws Exception{
        String error = null;
        String status = "1";
@ -1248,6 +1255,8 @@ public class PrescriptionService extends ZysoftBaseService{
            if(code==1){
                String orderNo = json.getString("orderNo");//挂号编号
                String recipeNo = json.getString("recipeNo");//处方编号
                String idCard = json.containsKey("idNo")?json.getString("idNo"):null;
                String outChargeTime = json.containsKey("outChargeTime")?json.getString("outChargeTime"):null;
            
                Prescription prescription = prescriptionDao.findByVisitNoAndRecipeNo(orderNo,recipeNo);
                if(prescription.getStatus().equals(PrescriptionLog.PrescriptionLogStatus.wait_pay.getValue())){
@ -1256,6 +1265,7 @@ public class PrescriptionService extends ZysoftBaseService{
                    } else{
                        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
                    }*/
                    String prescriptionCode = prescription.getCode();
                    prescription.setDispensaryType(1);
                    prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.pay_success.getValue());
@ -1269,9 +1279,9 @@ public class PrescriptionService extends ZysoftBaseService{
                    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    String uuid = sdf.format(new Date()) + UUID.randomUUID().toString().replaceAll("-", "").substring(0, 4);
                    pay.setCode(uuid); //接入应用业务流水号outChargeNo
                    pay.setPrescriptionCode(prescription.getCode());//开处方的医生code 关联 wlyy_prescription
                    pay.setPrescriptionCode(prescriptionCode);//开处方的医生code 关联 wlyy_prescription
                    pay.setType(2);//1 医保支付 2基卫线下支付
                    pay.setOutChargeTime(json.containsKey("outChargeTime")?format.parse(json.getString("outChargeTime")):null);//支付日期
                    pay.setOutChargeTime(outChargeTime == null?null:format.parse(outChargeTime));//支付日期
                    pay.setChannel("offline");//支付方式
                    pay.setChargeNo(json.containsKey("chargeNo")?json.getString("chargeNo"):null);//支付平台流水号
                    pay.setChargeTime(json.containsKey("chargeTime")?format.parse(json.getString("chargeTime")):null);//支付平台交易成功时间
@ -1283,7 +1293,7 @@ public class PrescriptionService extends ZysoftBaseService{
                    pay.setOpenid(null);//用户openID
                    pay.setUserName(json.containsKey("userName")?json.getString("userName"):null);//用户名字
                    pay.setIdType("01"); //证件类型
                    pay.setIdNo(json.containsKey("idNo")?json.getString("idNo"):null);//证件号码
                    pay.setIdNo(idCard);//证件号码
                    pay.setTradeStatus("1");//交易状态
                    pay.setMiSettleNo(json.containsKey("miSettleNo")?json.getString("miSettleNo"):null);//医保收费单据号
                    pay.setMiRegisterNo(json.containsKey("miRegisterNo")?json.getString("miRegisterNo"):null); //医保挂号
@ -1321,7 +1331,7 @@ public class PrescriptionService extends ZysoftBaseService{
                    //新增log表
                    PrescriptionLog log = new PrescriptionLog();
                    log.setPrescriptionCode(prescription.getCode());
                    log.setPrescriptionCode(prescriptionCode);
                    log.setCode(getCode());
                    log.setCreateTime(new Date());
                    log.setType(PrescriptionLog.PrescriptionLogType.zy.getValue());
@ -1335,6 +1345,58 @@ public class PrescriptionService extends ZysoftBaseService{
                    log.setRemark("待配药");
                    prescriptionLogDao.save(log);
                    //新增wlyy_prescription_expressage表
                    PrescriptionExpressage expressage = expressageDao.findByPrescriptionPay(prescriptionCode);
                    if (expressage == null) {
                        expressage = new PrescriptionExpressage();
                        expressage.setCode(getCode());
                    }
                    expressage.setPrescriptionCode(prescriptionCode);
                    if (StringUtils.isEmpty(idCard)){
                        errMsg = "患者身份证为空!";
                    }
                    Patient pateint = patientDao.findByIdcard(idCard);
                    if(pateint != null){
                        expressage.setMobile(pateint.getMobile());//收货人手机号码
                        expressage.setName(pateint.getName());//居民姓名
                        expressage.setProvinceCode(pateint.getProvince());//省代码
                        expressage.setProvinceName(pateint.getProvinceName());//省名称
                        expressage.setCityCode(pateint.getCity());//市代码
                        expressage.setCityName(pateint.getCityName());//市名称
                        expressage.setTownCode(pateint.getTown());//区code
                        expressage.setTownName(pateint.getTownName());//区名称
                        expressage.setStreetCode(pateint.getStreet());//街道code
                        expressage.setStreetName(pateint.getStreetName());//街道名称
                        expressage.setAddress(pateint.getAddress());//居民详细地址
                        //        配药机构信息(签约机构)
                        SignFamily signFamily = signFamilyDao.findByPatient(pateint.getCode());
                        if (signFamily != null && signFamily.getHospital()!=null){
                            String hospitalCode  = signFamily.getHospital();
                            Hospital hospital = hospitalDao.findByCode(hospitalCode);
                            expressage.setHospitalCode(hospitalCode);
                            expressage.setHospitalName(hospital.getName());
                            expressage.setHospitalAddress(hospital.getAddress());
                        }
                        expressage.setCreateTime(new Date());//创建时间
                        expressage.setOneselfPickupFlg(1);//是否自取 1是 0否
                        expressage.setDel(1);//有效
                        if (StringUtils.isNotBlank(outChargeTime)) {
                            Date dt = DateUtil.stringToDate(outChargeTime, "yyyy-MM-dd");
                            expressage.setDeliveryTime(dt);//送达时间
                        }
                        //保存物流信息
                        expressageDao.save(expressage);
                    }
                    //调用生成取药二维码接口
                    Map<String,Object> params = new HashedMap();
                    params.put("prescriptionCode",prescriptionCode);
                    HttpClientUtil.request("POST",wlyyApi+"/third/pay/dispensaryCode/saveQRCode",params,null,null,null,null);
     /*               if(2 == prescription.getDispensaryType()){//如果是快递配送,则直接修改成配送中
                        log.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
                        log.setRemark("快递配送:配药成功,配送中");

+ 13 - 1
patient-co-service/wlyy_service/src/main/resources/application.yml

@ -77,6 +77,9 @@ im:
zyapi:
  openCrypto: false
#    i健康项目地址
wlyy:
  api: http://192.168.131.113:8081
---
spring:
  profiles: devtest
@ -98,6 +101,9 @@ im:
zyapi:
  openCrypto: false
#    i健康项目地址
wlyy:
  api: http://192.168.131.113:8081
---
spring:
  profiles: test
@ -118,6 +124,9 @@ im:
zyapi:
  openCrypto: false
#    i健康项目地址
wlyy:
  api: http://172.19.103.88:9092/wlyy
---
spring:
  profiles: production
@ -137,4 +146,7 @@ im:
  data_base_name: im
zyapi:
  openCrypto: true
  openCrypto: true
#    i健康项目地址
wlyy:
  api: http://www.xmtyw.cn/wlyy

+ 24 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/ylzpay/ThirdPayController.java

@ -1,14 +1,15 @@
package com.yihu.wlyy.web.third.ylzpay;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.service.app.prescription.PatientPrescriptionPayService;
import com.yihu.wlyy.service.app.prescription.PrescriptionDispensaryCodeService;
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
import com.yihu.wlyy.web.WeixinBaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -27,6 +28,8 @@ public class ThirdPayController extends WeixinBaseController {
    private PatientPrescriptionPayService payService;
    @Autowired
    private JwPrescriptionService jwPrescriptionService;
    @Autowired
    private PrescriptionDispensaryCodeService prescriptionDispensaryCodeService;
    /**
@ -51,4 +54,22 @@ public class ThirdPayController extends WeixinBaseController {
        }
    }
    /**
     * 生成取药码
     */
    @RequestMapping(value = "/dispensaryCode/saveQRCode", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String saveQRCode2(
            @ApiParam(required = true, name = "prescriptionCode", value = "处方code") @RequestParam(value = "prescriptionCode", required = true) String prescriptionCode) {
        try {
            prescriptionDispensaryCodeService.saveQRCode(prescriptionCode);
            return write(200, "生成二维码成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "生成二维码失败!");
        }
    }
}