Pārlūkot izejas kodu

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 5 gadi atpakaļ
vecāks
revīzija
8384414a9a

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

@ -22,6 +22,7 @@ import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
@ -35,6 +36,7 @@ import com.yihu.jw.hospital.doctor.dao.DoctorWorkTimeDao;
import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao;
import com.yihu.jw.hospital.doctor.dao.WlyyDoctorOnlineTimeDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.message.service.SystemMessageService;
@ -44,6 +46,7 @@ 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.order.pay.ylz.YlzPayService;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BaseDoctorPatientFollowDao;
import com.yihu.jw.patient.dao.BasePatientDao;
@ -59,6 +62,7 @@ import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.WebserviceUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
@ -193,6 +197,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private WlyyConsultAdviceDao wlyyConsultAdviceDao;
    @Autowired
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    @Autowired
    private YlzPayService ylzPayService;
    @Autowired
    private BasePatientMedicareCardDao patientMedicareCardDao;
    @Autowired
    private PatientMappingDao patientMappingDao;
    @Value("${demo.flag}")
@ -669,6 +679,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //1.保存就诊实体
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson,WlyyOutpatientDO.class);
        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
        BaseDoctorDO doctorDO = baseDoctorDao.findById(outpatientDO.getDoctor());
        outpatientDO.setMjz("mz");
        outpatientDO.setStatus("0");
@ -683,8 +694,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        Double price = 0.0;
        if(doctorDO!=null&&StringUtils.isNoneBlank(doctorDO.getFee())){
             price = Double.parseDouble(doctorDO.getFee());
        }
        Double price = 0.01;
        businessOrderService.recharge(outpatient.getId(),"复诊-诊查费","2","复诊-诊查费",patientDO.getId(),patientDO.getName(),outpatient.getDoctor(),price);
@ -2028,7 +2043,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                result.put("mes", "诊断完成");
                return result;
            }else if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
                Double price = 0.01;
                Double price =  prescription.getDrugFee();
                businessOrderService.recharge(prescription.getId(),"处方收费","4","处方收费",prescription.getPatientCode(),prescription.getPatientName(),prescription.getDoctor(),price);
                //上传his开方
                //sendHisDiagnosis(jsonData, outpatientDO, prescription)
@ -4036,18 +4051,43 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    public Map<String,Object> updatePatientInfo(String patient,String name,String idcard,String ssc,Integer sex,String townCode,String townName,String committeeCode,String committeeName,String address){
    public Map<String,Object> updatePatientInfo(String patient,String name,String idcard,String ssc,Integer sex,String townCode,String townName,String committeeCode,String committeeName,String address,String photo,String mobile){
        Map<String,Object> rs = new HashedMap();
        BasePatientDO basePatientDO = basePatientDao.findById(patient);
        PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
        basePatientDO.setName(name);
        basePatientDO.setIdcard(idcard);
        basePatientDO.setSex(sex);
        basePatientDO.setTownCode(townCode);
        basePatientDO.setTownName(townName);
        basePatientDO.setCommitteeCode(committeeCode);
        basePatientDO.setCommitteeName(committeeName);
        basePatientDO.setAddress(address);
        if (StringUtils.isNoneBlank(name)){
            basePatientDO.setName(name);
        }
        if (StringUtils.isNoneBlank(idcard)){
            basePatientDO.setIdcard(idcard);
        }
        if (sex!=null){
            basePatientDO.setSex(sex);
        }
        if (StringUtils.isNoneBlank(townCode)){
            basePatientDO.setTownCode(townCode);
        }
        if (StringUtils.isNoneBlank(townName)){
            basePatientDO.setTownName(townName);
        }
        if (StringUtils.isNoneBlank(committeeCode)){
            basePatientDO.setCommitteeCode(committeeCode);
        }
        if (StringUtils.isNoneBlank(committeeName)){
            basePatientDO.setCommitteeName(committeeName);
        }
        if (StringUtils.isNoneBlank(address)){
            basePatientDO.setAddress(address);
        }
        if (StringUtils.isNoneBlank(photo)){
            basePatientDO.setPhoto(photo);
        }
        if (StringUtils.isNoneBlank(mobile)){
            basePatientDO.setMobile(mobile);
        }
        basePatientDO = basePatientDao.save(basePatientDO);
        if (patientMedicareCardDO!=null){
            patientMedicareCardDO.setCode(ssc);
@ -5590,7 +5630,31 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        //设置his药品查询条件
                        setInspectionParam(jsonData, doctorMappingDO, outpatientDO, wlyyPrescriptionDO, ins, outpatientDO.getIcd10());
                    }
                    sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);
                    Map<String,Object> map = sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);
                    if (map.get("code").toString().equalsIgnoreCase("0")){
                        //  * @param applyDepaName @param applyDoctorName
                        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
                        String patientCode = prescriptionDO.getPatientCode();
                        String realerOrder = prescriptionDO.getRealOrder();
                        String free  = prescriptionDO.getDrugFee()+"";
                        String recipeTime = DateUtil.dateToStr(prescriptionDO.getCreateTime(),"yyyyMMddHHmmss");
                        String applyDepaName = prescriptionDO.getDeptName();
                        String applyDoctorName = prescriptionDO.getDoctorName();
                        BasePatientDO patientDO = basePatientDao.findById(patientCode);
                        String userName = null;
                        String idcard = null;
                        if (patientDO!=null){
                            userName = patientDO.getName();
                            idcard = patientDO.getIdcard();
                        }
                        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patientCode);
                        String userNo = null;
                        if (patientMappingDO!=null){
                            userNo = patientMappingDO.getMappingCode();
                        }
                        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patientCode,"1");
                        ylzPayService.msgPush("01",patientMedicareCardDO.getCode(),"01",patientDO.getMobile(),"03",userNo,userName,idcard,realerOrder,applyDepaName,applyDoctorName,recipeTime,free,"1");
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
@ -5865,7 +5929,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    /**
     * 保存排班规则
     * @param workRoleJsons
     * @param
     * @return
     */
    public Boolean sendOutPatientSuggest(String advicesJson){

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

@ -409,7 +409,9 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        map.put("spbill_create_ip",getServerIp());
        map.put("notify_url",notifyUrl);
        map.put("trade_type", tradeType);
        map.put("openid", openId);
        if (tradeType.equalsIgnoreCase("JSAPI")){
            map.put("openid", openId);
        }
      /*  String token_url = "https://api.weixin.qq.com/cgi-bin/token";
        String params = "grant_type=client_credential&appid=" + wxWechatDO.getAppId() + "&secret=" + wxWechatDO.getAppSecret();
        String result = HttpUtil.sendGet(token_url, params);

+ 1 - 0
business/base-service/src/main/java/com/yihu/jw/order/pay/utils/PayLogService.java

@ -19,6 +19,7 @@ public class PayLogService {
    public String onepayType = "0"; //诊断支付
    public String pushType = "3"; //推送
    public String onepayRecipeType = "1";     //1续方支付
    public String shoppatType="2";//商城支付

+ 88 - 19
business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java

@ -227,9 +227,86 @@ public class YlzPayService {
    }
    /**
     * 统一平台推送消息
     * @param cardType
     * @param cardNo
     * @param accountType
     * @param contactNumber
     * @param feeType
     * @param userNo
     * @param userName
     * @param idNo
     * @param voucherNo
     * @param applyDepaName
     * @param applyDoctorName
     * @param recipeTime
     * @param fee
     * @param recipeNum
     * @return
     */
    public String msgPush(String cardType,String cardNo,String accountType,String contactNumber,String feeType,String userNo,String userName,String idNo,String voucherNo,
                          String applyDepaName,String applyDoctorName,String recipeTime,String fee,String recipeNum){
        String object  = null;
        Boolean isSuccess = true;
        String error = null;
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_pay_config");
        if(oauthYlzConfigDO==null){
            return "未找到支付配置文件";
        }
        String appId = oauthYlzConfigDO.getAppId();
        String appSecret = oauthYlzConfigDO.getAppKey();
        String onepayUrl = oauthYlzConfigDO.getUrl();
        String signType=oauthYlzConfigDO.getSignType();
        String encryptType = oauthYlzConfigDO.getEncType();
        HisOnepayClient onepayClient = new HisOnepayClient(onepayUrl, appId, appSecret, signType, encryptType);
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("cardType",cardType);//卡类型01 社保卡 06 临时卡
            jsonObject.put("cardNo",cardNo);//卡号
            jsonObject.put("accountType",accountType);//帐户类型
            jsonObject.put("contactNumber",contactNumber);//手机号码
            jsonObject.put("feeType",feeType);//费用类型(病人身份)
            jsonObject.put("userNo",userNo);//用户编号
            jsonObject.put("userName",userName);//用户姓名
            jsonObject.put("idNo",idNo);//身份证号
            jsonObject.put("voucherNo",voucherNo);//单据号
            jsonObject.put("applyDepaName",applyDepaName);//申请科室名称
            jsonObject.put("applyDoctorName",applyDoctorName);//申请医生姓名
            jsonObject.put("recipeTime",recipeTime);//处方时间yyyyMMddHHmmss
            jsonObject.put("fee",fee);//总费用
            jsonObject.put("recipeNum",recipeNum);//处方数
            //jsonObject.put("extra")
            ResponseParams<MmpPushResult> response = onepayClient.mmpMsgPush(jsonObject);
            if (response.getRespCode().equals("000000")){
                object = JSON.toJSONString(response);
            }else {
                isSuccess = false;
                object = JSON.toJSONString(response);
                error = "请求失败,返回结果:" + response.getRespCode() + "," + response.getRespMsg();
            }
        } catch (Exception e) {
            e.printStackTrace();
            isSuccess = false;
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            error = sw.toString();
        }
        logService.saveHttpLog(isSuccess, "hop.mmpay.msg.push", "互联网医院消息推送", "POST", null,JSON.toJSONString(jsonObject), object, error,logService.pushType);
        return object;
    }
   /* public String msgPush(String hisCustId,String operatorId,String operatorName,String cardType,String cardNo,String accountType,String amount,
                         String withdrawMode,String outChargeNo,String outRefundNo,String idNo){
    /**
     * 生成门诊结算url
     * @param accId
     * @param openId
     * @param cardNo
     * @param channel
     * @return
     */
    public String createSicardPayUrl(String accId,String openId,String cardNo,String channel){
        String object  = null;
        Boolean isSuccess = true;
        String error = null;
@ -243,22 +320,14 @@ public class YlzPayService {
        String signType=oauthYlzConfigDO.getSignType();
        String encryptType = oauthYlzConfigDO.getEncType();
        HisOnepayClient onepayClient = new HisOnepayClient(onepayUrl, appId, appSecret, signType, encryptType);
        RefundParams param = new RefundParams();
        JSONObject jsonObject = new JSONObject();
        try {
            param.setTermNo("123456");
            param.setHisCustId(hisCustId);
            param.setOperatorId(operatorId);
            param.setOperatorName(operatorName);
            param.setCardType(cardType);
            param.setCardNo(cardNo);
            param.setAccountType(accountType);
            param.setAmount(amount);
            param.setWithdrawMode(withdrawMode);
            param.setOutChargeNo(outChargeNo);
            param.setOutRefundNo(outRefundNo);
            param.setIdNo(idNo);
            ResponseParams<RefundResult> response = onepayClient.refund(param);
            onepayClient.mmpMsgPush();
            jsonObject.put("accId", accId);// 第三方应用原始ID微信公众号(支付宝)原始ID市民卡APP商户(医院)Id平安APP商户(医院)Id银联商户(医院)Id如:gh_54ec946bd3cd
            jsonObject.put("openId", openId);// openid
            jsonObject.put("cardNo",cardNo);//就诊卡或社保卡
            jsonObject.put("channel", channel);//WX: 微信 (默认)ALI: 支付宝PA: 平安SMK:市民卡APP
            //jsonObject.put("extra")
            ResponseParams<JSONObject> response = onepayClient.createSicardUrl(jsonObject);
            if (response.getRespCode().equals("000000")){
                object = JSON.toJSONString(response);
            }else {
@ -274,7 +343,7 @@ public class YlzPayService {
            e.printStackTrace(pw);
            error = sw.toString();
        }
        logService.saveHttpLog(isSuccess, "hop.trade.refund", "互联网医院退款", "POST", null,JSON.toJSONString(param), object, error,logService.onepayType);
        logService.saveHttpLog(isSuccess, "hop.mmpay.msg.push", "互联网医院消息推送", "POST", null,JSON.toJSONString(jsonObject), object, error,logService.pushType);
        return object;
    }*/
    }
}

+ 14 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java

@ -190,6 +190,11 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
     */
    private String consultStatus;
    /**
     * 医生费用
     */
    private String fee;
	@Column(name = "password")
    public String getPassword() {
        return password;
@ -463,4 +468,13 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    public void setEnabled(Integer enabled) {
        this.enabled = enabled;
    }
    @Column(name = "fee")
    public String getFee() {
        return fee;
    }
    public void setFee(String fee) {
        this.fee = fee;
    }
}

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

@ -443,7 +443,10 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
					}
					businessOrderService.saveOrder(businessOrderDO);
				}else if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
					Double price = 0.01;
					Double price = 0.0;
					if(d!=null&& org.apache.commons.lang3.StringUtils.isNoneBlank(d.getFee())){
						price = Double.parseDouble(d.getFee());
					}
					businessOrderService.recharge(re.getString("consult"),"新增专家咨询","1","专家咨询费",patient,re.getString("patientName"),doctor,price);
				}
			}catch (Exception e){

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

@ -714,8 +714,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                      @ApiParam(name = "committeeName", value = "居委会code")
                                          @RequestParam(value = "committeeName", required = false)String committeeName,
                                      @ApiParam(name = "address", value = "常驻地址")
                                          @RequestParam(value = "address", required = false)String address){
        return success(prescriptionService.updatePatientInfo(patient,name,idcard,ssc,sex,town,townName,committeeCode,committeeName,address));
                                          @RequestParam(value = "address", required = false)String address,
                                      @ApiParam(name = "photo", value = "头像")
                                          @RequestParam(value = "photo", required = false)String photo,
                                      @ApiParam(name = "mobile", value = "手机号")
                                          @RequestParam(value = "mobile", required = false)String mobile){
        return success(prescriptionService.updatePatientInfo(patient,name,idcard,ssc,sex,town,townName,committeeCode,committeeName,address,photo,mobile));
    }