Просмотр исходного кода

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/PrescriptionService.java
wangzhinan 4 лет назад
Родитель
Сommit
a20c7eb53b

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

@ -431,7 +431,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param outpatientId
     * @return
     */
    public com.alibaba.fastjson.JSONObject findReOutpatientInfo(String outpatientId,String prescriptionId){
    public com.alibaba.fastjson.JSONObject findReOutpatientInfo(String outpatientId,String prescriptionId) throws Exception {
        com.alibaba.fastjson.JSONObject rs = new com.alibaba.fastjson.JSONObject();
        //复诊信息
@ -476,8 +476,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                List<WlyyInspectionVO> inspectionVOs = new ArrayList<>();
                vo.setInspectionVOs(convertToModels(wlyyInspectionDao.findByPrescriptionId(vo.getId(),1),inspectionVOs,WlyyInspectionVO.class));
                WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO = readOutPatientXml(outpatientDO.getOriginRegisterNo());
                //电子病历
                vo.setWlyyPrescriptionEmrDO(prescriptionEmrDao.findEmrByPrescriptionId(vo.getId()));
                vo.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO);
            }
        }
        rs.put("prescriptions",prescriptionVOs);
@ -2958,6 +2959,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                rs.put("doctorAge","");
            }
            rs.put("doctor",doctorDO.getName());
            rs.put("fee",doctorDO.getFee());
            rs.put("jobTitleCode",doctorDO.getJobTitleCode());
            rs.put("jobTitleName",doctorDO.getJobTitleName());
            rs.put("chargeType",doctorDO.getChargeType());

+ 104 - 1
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -5,7 +5,9 @@ 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.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
@ -24,6 +26,7 @@ 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.PrescriptionLogService;
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.dao.BusinessOrderDao;
@ -99,6 +102,10 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    private YlzPayService ylzPayService;
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private EntranceService entranceService;
@ -512,6 +519,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
            orderRefundDO.setStatus(2);
            orderRefundDO.setRefundTime(new Date());
            orderRefundDao.save(orderRefundDO);
            updatePayStatusByRefund(orderNo);
        }
        return map;
    }
@ -872,6 +880,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
            orderRefundDO.setStatus(2);
            orderRefundDO.setRefundTime(new Date());
            orderRefundDao.save(orderRefundDO);
            updatePayStatusByRefund(orderNo);
        }
        return object;
@ -895,6 +904,32 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    }
    /**
     *  退款修改状态
     * @param orderNo
     * @return
     */
    public BusinessOrderDO updatePayStatusByRefund(String orderNo) throws Exception {
        logger.info("入参:"+orderNo);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(orderNo);
        if (businessOrderDO==null){
            throw new Exception("查不到订单!");
        }
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
            ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
            consultDo.setPayStatus(2);
            consultOrderDao.save(consultDo);
        }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")){
            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
            wlyyOutpatientDO.setPayStatus(2);
            outpatientDao.save(wlyyOutpatientDO);
        }
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setStatus(9);
        businessOrderDao.save(businessOrderDO);
        return businessOrderDO;
    }
    /**
     *
     * @param orderNo
@ -930,6 +965,41 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    }
    /**
     *无需支付
     * @param relationCode
     * @return
     */
    public BusinessOrderDO updatePayStatusByRelation(String relationCode) throws Exception {
        logger.info("入参:"+relationCode);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
        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);
                prescriptionLogService.addPrescriptionLog(businessOrderDO.getRelationCode(),30,1,businessOrderDO.getPatient(),businessOrderDO.getPatientName(),businessOrderDO.getDescription(),new Date());
            }
        }
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setStatus(1);
        businessOrderDao.save(businessOrderDO);
        return businessOrderDO;
    }
    public JSONObject selectOrderTime(String relationCode){
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("PAY_TIME");
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
@ -958,7 +1028,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
     * @return
     * @throws Exception
     */
    public String ylzRechargeJson(String code,String depositType,String wechatId,String cardType,String cardNo) throws Exception {
    public String ylzRechargeJson(String code,String depositType,String wechatId,String cardType,String cardNo,boolean demoFlag) throws Exception {
        String response = null;
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        if(wxWechatDO==null){
@ -974,6 +1044,17 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                idcard = patientDO.getIdcard();
            }
            String openId = "";
            BaseDoctorDO doctorDO = doctorDao.findById(businessOrderDO.getDoctor());
            String fee = doctorDO.getFee();
            if (!StringUtils.isNoneBlank(fee)){
                throw new Exception("医生费用为空");
            }
            net.sf.json.JSONObject object1 = entranceService.qutpatientBalance(cardNo, demoFlag);
            Double cardFee = object1.getDouble("ZHYE");
            Double doctorFee = Double.parseDouble(fee);
            Double balance = doctorFee-cardFee;
            businessOrderDO.setPayPrice(balance);
            businessOrderDao.save(businessOrderDO);
            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
            if (patientWechatDos!=null&&patientWechatDos.size()!=0){
                BasePatientWechatDo patientWechatDo = patientWechatDos.get(0);
@ -1005,4 +1086,26 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        return response;
    }
    /**
     * 咨询退费
     * @param consult
     * @return
     */
    public BusinessOrderDO consultRefund(String consult,String wxId) throws Exception {
        String base = hospitalSysDictDao.findByDictName("imData").get(0).getDictCode();
        String sql ="select id as \"id\",reply as \"reply\" from "+base+".topics where id='"+consult+"' AND reply=0";
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
        if (mapList!=null&&mapList.size()!=0){
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(consult);
            if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
                this.orderRefund(wxId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
            }else if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                this.ylzOrderRefund(wxId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
            }
            return businessOrderDO;
        }
        return null;
    }
}

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

@ -448,6 +448,8 @@ public class BaseHospitalRequestMapping {
        public static final String selectByUrl="/selectByUrl";
        public static final String updatePayStatus = "/updatePayStatus";
    }

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

@ -566,6 +566,12 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			) throws Exception {
		int resutl = imService.finish(consult,patientCode,1);
		//医生未回复可以退费
		try {
			businessOrderService.consultRefund(consult,wxId);
		}catch (Exception e){
			e.printStackTrace();
		}
		BasePatientDO basePatientDO = basePatientService.findByIdAndDel(patientCode);
		JSONObject msgObj = new JSONObject();
		msgObj.put("msg",basePatientDO.getName()+"结束了咨询");

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

@ -1216,7 +1216,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "cardNo", value = "cardNo", required = true)
            @RequestParam(required = true)String cardNo) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.ylzRechargeJson(relationCode,depositType,wxId,cardType,cardNo));
            return ObjEnvelop.getSuccess("ok",businessOrderService.ylzRechargeJson(relationCode,depositType,wxId,cardType,cardNo,demoFlag));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
@ -1763,4 +1763,16 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "patientCode", required = false) String patientCode) throws Exception {
      return   prescriptionService.findPatientOpenId(patientCode);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.updatePayStatus)
    @ApiOperation(value = "无需支付时调用")
    public ObjEnvelop updatePayStatus (
            @ApiParam(name = "relationCode", value = "业务code")
            @RequestParam(value = "relationCode", required = false) String relationCode) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.updatePayStatusByRelation(relationCode));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
}