Browse Source

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/XzzxEntranceService.java
wangzhinan 5 years ago
parent
commit
cf6f960d27

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

@ -41,6 +41,7 @@ import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BaseDoctorPatientFollowDao;
@ -172,6 +173,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    @Autowired
    private YkyyEntranceService ykyyEntranceService;
    @Autowired
    private BusinessOrderService businessOrderService;
    @Autowired
    private YkyyService ykyyService;
@ -1810,8 +1813,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        prescriptionDO.setDoctor(outpatientDO.getDoctor());
        prescriptionDO.setDoctorName(outpatientDO.getDoctorName());
        if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(prescriptionDO.getOutpatientId());
            prescriptionDO.setOrderNo(businessOrderDO.getOrderNo());
            prescriptionDO.setAdmNo(outpatientDO.getAdmNo());
        }
        WlyyPrescriptionDO prescription = prescriptionDao.save(prescriptionDO);
@ -1927,13 +1928,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            prescriptionDao.save(prescription);
            if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                ykyyEntranceService.findByRealOrder(prescription.getId());
                BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                BusinessOrderDO businessOrderDO1 = businessOrderDao.selectByRelationCode(prescription.getOrderNo());
              /*  ykyyService.updateDrugorderInfo(businessOrderDO.getOrderNo(),)*/
            }
            if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                outpatientDO.setStatus("2");
                outpatientDao.save(outpatientDO);
                businessOrderService.savePrescriptionOrder(prescription.getId());
                BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                BusinessOrderDO businessOrderDO1 = businessOrderDao.selectByRelationCode(prescription.getId());
                List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findById(prescription.getId());
                if(prescriptionDOList!=null&&prescriptionDOList.size()!=0){
                    WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDOList.get(0);
                    ykyyService.updateDrugorderInfo(businessOrderDO.getOrderNo(),businessOrderDO1.getYkOrderId(),wlyyPrescriptionDO.getRealOrder());
                }
                result.put("code", 1);
                result.put("mes", "诊断完成");
                return result;

+ 10 - 30
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java

@ -446,37 +446,17 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        if(wxWechatDO==null){
            throw new Exception("can't find wechat:the wxId is "+wechatId);
        }
        List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(code);
        if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
            WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
            BusinessOrderDO businessOrderDO = new BusinessOrderDO();
            businessOrderDO.setCreateTime(new Date());
            businessOrderDO.setUpdateTime(new Date());
            businessOrderDO.setStatus(0);
            businessOrderDO.setOrderNo("VAS"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100);
            businessOrderDO.setUploadStatus(0);
            businessOrderDO.setPayType(1);
            businessOrderDO.setRelationCode(code);
            businessOrderDO.setRelationName("处方结算");
            businessOrderDO.setOrderCategory("4");
            businessOrderDO.setOrderType(4);
            businessOrderDO.setDoctor(wlyyPrescriptionDO.getDoctor());
            businessOrderDO.setPatient(wlyyPrescriptionDO.getPatientCode());
            businessOrderDO.setPatientName(wlyyPrescriptionDO.getPatientName());
            businessOrderDO.setPayPrice(wlyyPrescriptionDO.getDrugFee()*100);
            businessOrderDO.setDescription("处方结算");
            businessOrderDO = businessOrderDao.save(businessOrderDO);
            if (businessOrderDO!=null){
                List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
                String openId = "";
                if (patientWechatDos!=null&&patientWechatDos.size()!=0){
                    openId = patientWechatDos.get(0).getOpenid();
                }
                String url = wxWechatDO.getBaseUrl();
                String notifyUrl =url;
                String totalFee =businessOrderDO.getPayPrice().intValue()+"";
                map = businessOrderService.unifiedorder(wechatId,businessOrderDO.getDescription(),totalFee, WeChatConfig.TRADE_TYPE_JSAPI,openId,businessOrderDO.getOrderNo(),notifyUrl);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(code);
        if (businessOrderDO!=null){
            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
            String openId = "";
            if (patientWechatDos!=null&&patientWechatDos.size()!=0){
                openId = patientWechatDos.get(0).getOpenid();
            }
            String url = wxWechatDO.getBaseUrl();
            String notifyUrl =url;
            String totalFee =businessOrderDO.getPayPrice().intValue()+"";
            map = businessOrderService.unifiedorder(wechatId,businessOrderDO.getDescription(),totalFee, WeChatConfig.TRADE_TYPE_JSAPI,openId,businessOrderDO.getOrderNo(),notifyUrl);
        }
        return map;
    }

+ 30 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java

@ -315,6 +315,36 @@ public class YkyyService {
    }
    /**增加处方订单接口
     *
     * drugType	String	药品类型【1,到院 2、到商城】
    orderId	String	订单Id
    userId	String	用户Id
    Shopping	String	药品列表
    commodityName	String	药品名称
    commodityPrice	String	价格
    purchaseQuantity	String	数量
    DrugUnit	String	单位
    MedicineDoctor	String	医生Id
    [{"commodityName":"","commodityPrice":"","DrugUnit":"","MedicineDoctor":""}]
     * @return
     */
    public String addOrder4Jkzl(String drugType,String orderId,String userId,JSONArray array ){
        String response="";
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("drugType",drugType);//药品类型【1,到院 2、到商城】
        jsonObject.put("orderId","");//订单Id
        jsonObject.put("userId",userId);//用户Id
        jsonObject.put("Shopping",array);//药品列表
        String url = "http://www.yanketong.com:90/api/Doctor/AddOrder4Jkzl";
        response = httpClientUtil.sendPost(url,jsonObject.toJSONString());
        logger.info("增加处方订单接口:"+response);
        return response;
    }
    /**获取眼科通忘记密码信息
     *
     * @param tel

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

@ -12,12 +12,14 @@ import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.order.BusinessOrderRefundDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.order.dao.BusinessOrderDao;
@ -79,9 +81,97 @@ public class BusinessOrderService {
    private PrescriptionDao prescriptionDao;
    @Autowired
    private YkyyEntranceService ykyyEntranceService;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    /**
     *
     * 处方下单
     * drugType	String	药品类型【1,到院 2、到商城】
     orderId	String	订单Id
     userId	String	用户Id
     Shopping	String	药品列表
     commodityName	String	药品名称
     commodityPrice	String	价格
     purchaseQuantity	String	数量
     DrugUnit	String	单位
     MedicineDoctor	String	医生Id
     [{"commodityName":"","commodityPrice":"","DrugUnit":"","MedicineDoctor":""}]
     * @return
     * @throws Exception
     */
    public List<BusinessOrderDO> savePrescriptionOrder(String code) throws Exception {
        List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(code);
        List<BusinessOrderDO> businessOrderDOS = new ArrayList<>();
        if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
            WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
            BusinessOrderDO businessOrderDO = new BusinessOrderDO();
            businessOrderDO.setCreateTime(new Date());
            businessOrderDO.setUpdateTime(new Date());
            businessOrderDO.setStatus(0);
            businessOrderDO.setOrderNo("VAS"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100);
            businessOrderDO.setUploadStatus(0);
            businessOrderDO.setPayType(1);
            businessOrderDO.setRelationCode(code);
            businessOrderDO.setRelationName("处方结算");
            businessOrderDO.setOrderCategory("4");
            businessOrderDO.setOrderType(4);
            businessOrderDO.setDoctor(wlyyPrescriptionDO.getDoctor());
            businessOrderDO.setPatient(wlyyPrescriptionDO.getPatientCode());
            businessOrderDO.setPatientName(wlyyPrescriptionDO.getPatientName());
            businessOrderDO.setPayPrice(wlyyPrescriptionDO.getDrugFee()*100);
            businessOrderDO.setDescription("处方结算");
            businessOrderDO = businessOrderDao.save(businessOrderDO);
            businessOrderDOS.add(businessOrderDO);
            wlyyPrescriptionDO.setOrderNo(businessOrderDO.getOrderNo());
            prescriptionDao.save(wlyyPrescriptionDO);
            JSONArray array = new JSONArray();
            List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(code);
            for (WlyyPrescriptionInfoDO prescriptionInfoDO:wlyyPrescriptionInfoDOS){
                JSONObject object = new JSONObject();
                //{"commodityName":"","commodityPrice":"","DrugUnit":"","MedicineDoctor":""}
                object.put("commodityName",prescriptionInfoDO.getDrugName());
                object.put("commodityPrice",prescriptionInfoDO.getPackRetprice());
                object.put("DrugUnit",prescriptionInfoDO.getPackUnitName());
                DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(businessOrderDO.getDoctor());
                String yktDoctor ="";
                if (doctorMappingDO!=null&&StringUtils.isNoneBlank(doctorMappingDO.getMappingCode())){
                    String doctorResponse = ykyyService.getYktDoctor(doctorMappingDO.getMappingCode());
                    JSONObject jsonObject = JSONObject.parseObject(doctorResponse);
                    if (jsonObject.getInteger("code")==200){
                        JSONArray array1 = jsonObject.getJSONArray("data");
                        if (array1!=null&&array1.size()!=0){
                            yktDoctor=array.getJSONObject(0).getString("DOCTORUSERID");
                        }
                    }
                }else {
                    throw new Exception("医生映射表不存在!");
                }
                object.put("MedicineDoctor",yktDoctor);
                array.add(object);
            }
            BasePatientDO patientDO = patientDao.findById(businessOrderDO.getPatient());
            String userId =null;
            if (patientDO!=null){
                userId = patientDO.getUserId();
            }
            String response = ykyyService.addOrder4Jkzl("1","",userId,array);
            if (StringUtils.isNoneBlank(response)){
                JSONObject jsonObject = JSONObject.parseObject(response);
                if (jsonObject.getString("code").equalsIgnoreCase("10000")){
                    String orderId = jsonObject.getString("orderId");
                    String orderNo = jsonObject.getString("orderNo");
                    businessOrderDO.setYkOrderId(orderId);
                    businessOrderDO.setYkOrderNo(orderNo);
                    businessOrderDao.save(businessOrderDO);
                }
            }
        }
        return businessOrderDOS;
    }
    /**
     * @param businessOrderDO

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

@ -43,6 +43,8 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    private Date updateTime;
    private String updateUser;
    private String updateUserName;
    private String ykOrderNo;
    private String ykOrderId;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time", nullable = false, length = 0,updatable = false)
@ -256,4 +258,22 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    public void setRematk(String rematk) {
        this.rematk = rematk;
    }
    @Column(name = "yk_order_no")
    public String getYkOrderNo() {
        return ykOrderNo;
    }
    public void setYkOrderNo(String ykOrderNo) {
        this.ykOrderNo = ykOrderNo;
    }
    @Column(name = "yk_order_id")
    public String getYkOrderId() {
        return ykOrderId;
    }
    public void setYkOrderId(String ykOrderId) {
        this.ykOrderId = ykOrderId;
    }
}

+ 1 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/service/YkyyService.java

@ -147,7 +147,7 @@ public class YkyyService {
     */
    public String getRegisterUser(String telephone,String patientPwd,String code,String inviteCode,String equipmentType,String equipmentGuid){
        String response="";
        String url = yktUrl+"user_center/patient_register01?telephone="+telephone+"&patient_pwd="+patientPwd+"&invite_code="+inviteCode+"&equipment_type="+equipmentType+
        String url = yktUrl+"user_center/patient_register01?telephone="+telephone+"&patient_pwd="+patientPwd+"&code="+code+"&invite_code="+inviteCode+"&equipment_type="+equipmentType+
                "&equipment_guid="+equipmentGuid;
        response = httpClientUtil.get(url,"GBK");
        logger.info("眼科通用户注册:"+response);