浏览代码

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

# Conflicts:
#	common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java
#	server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
wangzhinan 3 年之前
父节点
当前提交
e0b7e93325
共有 20 个文件被更改,包括 1867 次插入205 次删除
  1. 193 88
      business/base-service/src/main/java/com/yihu/jw/healthCare/service/HealthCareService.java
  2. 5 2
      business/base-service/src/main/java/com/yihu/jw/hospital/healthCare/YlzMedicailRelationDao.java
  3. 1 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionExpressageService.java
  4. 290 41
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  5. 257 32
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  6. 7 5
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java
  7. 88 7
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  8. 181 2
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  9. 0 1
      business/base-service/src/main/java/com/yihu/jw/order/dao/BusinessOrderDao.java
  10. 2 2
      business/base-service/src/main/java/com/yihu/jw/utils/YkyySMSService.java
  11. 4 0
      business/base-service/src/mqConfig/esbmq-config.xml
  12. 234 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/healthCare/YlzMedicalRelationDO.java
  13. 1 0
      common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java
  14. 1 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  15. 515 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyHisSettleVO.java
  16. 4 2
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/XzzxCotroller.java
  17. 21 21
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/healthCare/HealthCareEndPoint.java
  18. 1 1
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/UnSettledHISPrescriptionService.java
  19. 12 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  20. 50 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

+ 193 - 88
business/base-service/src/main/java/com/yihu/jw/healthCare/service/HealthCareService.java

@ -30,6 +30,7 @@ import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.ylzinfo.ehc.common.utils.DateUtils;
import net.sf.json.util.JSONTokener;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@ -637,34 +638,43 @@ public class HealthCareService {
        if (outpatientDO == null){
            throw new Exception("门诊信息不存在");
        }
        JSONObject data = new JSONObject();
        data.put("order_code","");//订单号
        data.put("order_time",DateUtil.dateToStrLong(outpatientDO.getCreateTime()));//订单时间
        List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(outpatientId);
        if(wlyyPrescriptionDOS.size()==0){
            throw new Exception("处方信息不存在");
        }
        data.put("prescription_code",wlyyPrescriptionDOS.get(0).getRealOrder());//医院处方编号
        data.put("channel","1");//1、微信公众号,2、app,3、web
//        data.put("insurance_ticket_no","");//医保收费单据号	String	N	订单结算后的收费单据号
        data.put("order_state","");//订单状态    --1待发货、2配送中、3已签收、4已取消	String	Y
        List<WlyyPrescriptionExpressageDO> expressageDOList = prescriptionExpressageDao.findByOutpatientId(outpatientId);
        if(expressageDOList.size()==0){
            throw new Exception("收获信息不存在");
        }
        BasePatientDO patientDO = patientDao.findById(outpatientDO.getPatient());
        if(patientDO==null){
            throw new Exception("居民信息不存在");
        }
        WlyyPrescriptionExpressageDO expressageDO = expressageDOList.get(0);
        data.put("order_addr_detail",expressageDO.getAddress());//订单详细地址
        JSONObject data = new JSONObject();
        data.put("order_code",outpatientDO.getRegisterNo());//订单号
        data.put("order_time",DateUtil.dateToStrFormatLong(expressageDO.getCreateTime()));//订单时间
        List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(outpatientId);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if(wlyyPrescriptionDOS.size()==0){
            throw new Exception("处方信息不存在");
        }
        WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
        data.put("prescription_code",wlyyPrescriptionDO.getRealOrder());//医院处方编号
        data.put("channel","1");//1、微信公众号,2、app,3、web
        data.put("insurance_ticket_no",ylzMedicalRelationDO.getBillSerial());//医保收费单据号	String	N	订单结算后的收费单据号
        String order_state = "";
        if (wlyyPrescriptionDO.getStatus()==30){
            order_state = "1";
        }else if (wlyyPrescriptionDO.getStatus()==31){
            order_state = "2";
        }else if (wlyyPrescriptionDO.getStatus()==100){
            order_state = "3";
        }
        data.put("order_state",order_state);//订单状态    --1待发货、2配送中、3已签收、4已取消	String	Y
        data.put("order_addr_detail",expressageDO.getProvinceName()+expressageDO.getCityName()+expressageDO.getTownName()+expressageDO.getStreetName()+expressageDO.getAddress());//订单详细地址
        data.put("order_owner",expressageDO.getName());
        data.put("order_owner_idcard",patientDO.getIdcard());
        data.put("order_owner_phone",patientDO.getMobile());
        Map<String,String> map = LatitudeUtils.getGeocoderLatitude(expressageDO.getAddress());
        Map<String,String> map = LatitudeUtils.getGeocoderLatitude(expressageDO.getProvinceName()+expressageDO.getCityName()+expressageDO.getTownName()+expressageDO.getStreetName()+expressageDO.getAddress());
        data.put("addr_lat",map.get("lat"));//收货地址纬度
        data.put("addr_lng",map.get("lng"));//收货地址经度
        if(expressageDO.getOneselfPickupFlg()==1){
@ -676,12 +686,12 @@ public class HealthCareService {
            //非自取
            data.put("delivery_way","1");//配送方式 1.网订配送,2.网订自取
            data.put("delivery_number",expressageDO.getMailno());//配送单号
            data.put("delivery_org","");//配送单位
            data.put("delivery_take_time","");//配送接单时间
            data.put("delivery_name","");//配送人姓名
            data.put("delivery_id_card","");//配送人身份证
            data.put("delivery_org","顺丰");//配送单位
            data.put("delivery_take_time",DateUtil.dateToStrFormatLong(wlyyPrescriptionDO.getPayTime()));//配送接单时间
            data.put("delivery_name","顺丰");//配送人姓名
            data.put("delivery_id_card","顺丰");//配送人身份证
//            data.put("delivery_phone","");//配送人联系电话 N
            data.put("getmedical_time","");//骑手取药记录
            data.put("getmedical_time",DateUtil.dateToStrFormatLong(wlyyPrescriptionDO.getPayTime()));//骑手取药记录
            data.put("delivery_money","");//配送费
        }
@ -689,17 +699,26 @@ public class HealthCareService {
//        apothecary_id_card	药师身份证	String	N
//        apothecary_audit	药师审核时间	String	N
        data.put("money","");//商品金额
        data.put("settlement_time","");//结算时间
        data.put("data_source","");//数据来源
        data.put("delivery_time","");//发单时间
        data.put("money",ylzMedicalRelationDO.getTotalAmount());//商品金额
        data.put("settlement_time",DateUtil.dateToStrFormatLong(ylzMedicalRelationDO.getPayDate()));//结算时间
        data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
        data.put("delivery_time",DateUtil.dateToStrFormatLong(wlyyPrescriptionDO.getPayTime()));//发单时间
        data.put("elec_prescription_code",wlyyPrescriptionDOS.get(0).getId());//平台处方编号
        data.put("prescription_code",wlyyPrescriptionDOS.get(0).getRealOrder());//医院处方编号
        data.put("elec_prescription_code",wlyyPrescriptionDO.getId());//平台处方编号
        data.put("prescription_code",wlyyPrescriptionDO.getRealOrder());//医院处方编号
//        data.put("insurance_serial",outpatientDO.getInsuranceSerial());//医保门诊流水号
        data.put("his_serial","");//门诊业务流水号
        data.put("his_serial",ylzMedicalRelationDO.getHisSerial());//门诊业务流水号
        JSONArray array = new JSONArray();
        List<YlzMedicalMxDO> ylzMedicalMxDOS = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
        for (YlzMedicalMxDO ylzMedicalMxDO:ylzMedicalMxDOS){
            JSONObject object = new JSONObject();
            object.put("order_id",outpatientDO.getRegisterNo());
            object.put("settlement_no",ylzMedicalRelationDO.getHisBillSerial());
            object.put("item_name",ylzMedicalMxDO.getItemName());
            object.put("item_code",ylzMedicalMxDO.getItemCode());
            array.add(object);
        }
        data.put("MXLIST",array);
//        mxlist	药品明细	MXLIST	N
//        MXLIST
//        order_id	订单号	String	Y
@ -1144,13 +1163,13 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 系统id
     * @return
     * @throws Exception
     */
    public String register(String registerNo) throws Exception{
    public String register(String outpatientId) throws Exception{
        String funid = "N20.17.04.01";
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if (ylzMedicalRelationDO==null){
            throw new Exception("上传医保挂号失败:结算信息为空!");
        }
@ -1177,6 +1196,8 @@ public class HealthCareService {
            JSONObject encryptData = object.getJSONObject("encrypt_data");
            String insuranceSerial = encryptData.getString("insurance_serial");
            ylzMedicalRelationDO.setInsuranceSerial(insuranceSerial);
            ylzMedicalRelationDO.setInsuranceType(encryptData.getString("insurance_type"));
            ylzMedicalRelationDO.setInsuranceTypeName(encryptData.getString("insurance_type_name"));
            ylzMedicailRelationDao.save(ylzMedicalRelationDO);
            logger.info("医保挂号流水号保存成功");
        }
@ -1188,14 +1209,14 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 门诊id
     * @return
     * @throws Exception
     */
    public String registerToEntrance(String registerNo) throws Exception{
    public String registerToEntrance(String outpatientId) throws Exception{
        String result = "";
        String response="";
        String url = entranceHealthCareUrl+"register?registerNo="+registerNo;
        String url = entranceHealthCareUrl+"register?outpatientId="+outpatientId;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
@ -1210,13 +1231,13 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 挂号号
     * @return
     * @throws Exception
     */
    public String registerBack(String registerNo) throws Exception{
    public String registerBack(String outpatientId) throws Exception{
        String funid = "N20.17.04.02";
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if (ylzMedicalRelationDO==null){
            throw new Exception("医保挂号冲销失败:结算信息为空!");
        }
@ -1249,14 +1270,14 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 挂号号
     * @return
     * @throws Exception
     */
    public String registerBackToEntrance(String registerNo) throws Exception{
    public String registerBackToEntrance(String outpatientId) throws Exception{
        String result = "";
        String response="";
        String url = entranceHealthCareUrl+"registerBack?registerNo="+registerNo;
        String url = entranceHealthCareUrl+"registerBack?outpatientId="+outpatientId;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
@ -1269,13 +1290,13 @@ public class HealthCareService {
    /**
     * 2.5.3医保费用明细上传(N20.17.04.03)
     *
     * @param registerNo 挂号号
     * @param outpatientId 挂号号
     * @return
     * @throws Exception
     */
    public String feeDetailUpload(String registerNo) throws Exception{
    public String feeDetailUpload(String outpatientId) throws Exception{
        String funid = "N20.17.04.03";
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if (ylzMedicalRelationDO==null){
            throw new Exception("医保费用明细上传:结算信息为空!");
        }
@ -1353,14 +1374,14 @@ public class HealthCareService {
    /**
     * 2.5.3医保费用明细上传(N20.17.04.03)
     *
     * @param registerNo 挂号号
     * @param outpatientId 挂号号
     * @return
     * @throws Exception
     */
    public String feeDetailUploadToEntrance(String registerNo) throws Exception{
    public String feeDetailUploadToEntrance(String outpatientId) throws Exception{
        String result = "";
        String response="";
        String url = entranceHealthCareUrl+"feeDetailUpload?registerNo="+registerNo;
        String url = entranceHealthCareUrl+"feeDetailUpload?outpatientId="+outpatientId;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
@ -1375,13 +1396,13 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 挂号号
     * @return
     * @throws Exception
     */
    public String feeDetailRefund(String registerNo,String remark) throws Exception{
    public String feeDetailRefund(String outpatientId,String remark) throws Exception{
        String funid = "N20.17.04.04";
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if (ylzMedicalRelationDO==null){
            throw new Exception("医保费用明细上传:结算信息为空!");
        }
@ -1413,14 +1434,14 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 门诊id
     * @return
     * @throws Exception
     */
    public String feeDetailRefundToEntrance(String registerNo,String remark) throws Exception{
    public String feeDetailRefundToEntrance(String outpatientId,String remark) throws Exception{
        String result = "";
        String response="";
        String url = entranceHealthCareUrl+"feeDetailRefund?registerNo="+registerNo+"&remark="+remark;
        String url = entranceHealthCareUrl+"feeDetailRefund?outpatientId="+outpatientId+"&remark="+remark;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
@ -1435,13 +1456,13 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 挂号号
     * @return
     * @throws Exception
     */
    public YlzMedicalRelationDO preSettlement(String registerNo) throws Exception{
    public YlzMedicalRelationDO preSettlement(String outpatientId) throws Exception{
        String funid = "N20.17.04.05";
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if (ylzMedicalRelationDO==null){
            throw new Exception("医保费用明细上传:结算信息为空!");
        }
@ -1474,8 +1495,69 @@ public class HealthCareService {
        String result = requestYlz(data,funid,"医保预结算服务");
        if (result==null){
            throw new Exception("医保预结算服务失败!");
        }
        }else {
            JSONObject resObj = JSONObject.parseObject(result);
            if (resObj.getString("flag").equalsIgnoreCase("1")){
                JSONObject jsonObject = resObj.getJSONObject("encrypt_data");
                ylzMedicalRelationDO.setAccountBalance(jsonObject.getString("account_balance"));
                ylzMedicalRelationDO.setBillSerial(jsonObject.getString("bill_serial"));
                ylzMedicalRelationDO.setPersonalCode(jsonObject.getString("personal_code"));
                ylzMedicalRelationDO.setSex(jsonObject.getString("sex"));
                ylzMedicalRelationDO.setSexMc(jsonObject.getString("sex_mc"));
                ylzMedicalRelationDO.setPersonCash(jsonObject.getString("person_cash"));
                ylzMedicalRelationDO.setPersonAccount(jsonObject.getString("person_account"));
                ylzMedicalRelationDO.setFundPrice(jsonObject.getString("fund_price"));
                ylzMedicalRelationDO.setJkzhPay(jsonObject.getString("own_jkzh_pay"));
                ylzMedicalRelationDO.setOwnPay(jsonObject.getString("own_pay"));
                ylzMedicalRelationDO.setCardNo(jsonObject.getString("card_no"));
                ylzMedicalRelationDO.setHospitalizationQty(jsonObject.getString("hospitalization_times"));
                ylzMedicalRelationDO.setPayDate(DateUtil.strToDate(jsonObject.getString("pay_date")+jsonObject.getString("pay_time")));
                ylzMedicalRelationDO.setInvoiceJj(jsonObject.getString("invoice_jj"));
                ylzMedicalRelationDO.setInvoiceXj(jsonObject.getString("invoice_xj"));
                ylzMedicalRelationDO.setInvoiceZh(jsonObject.getString("invoice_zh"));
                ylzMedicalRelationDO.setDiseaseCode(jsonObject.getString("disease_code"));
                ylzMedicalRelationDO.setTreatmentType(jsonObject.getString("treatment_type"));
                ylzMedicalRelationDO.setTreatmentTypeName(jsonObject.getString("treatment_type_name"));
                ylzMedicalRelationDO.setAllopatryType(jsonObject.getString("allopatry_type"));
                ylzMedicalRelationDO.setAllopatryTypeName(jsonObject.getString("allopatry_type_name"));
                ylzMedicalRelationDO.setAdministrativeArea(jsonObject.getString("administrative_area"));
                ylzMedicalRelationDO.setPayStandard(jsonObject.getString("pay_standard"));
                ylzMedicalRelationDO.setTcjjPay(jsonObject.getString("tcjj_pay"));
                ylzMedicalRelationDO.setSbjjPay(jsonObject.getString("sbjj_pay"));
                ylzMedicalRelationDO.setGwyPay(jsonObject.getString("gwy_pay"));
                ylzMedicalRelationDO.setJzfpPay(jsonObject.getString("jzfp_pay"));
                ylzMedicalRelationDO.setYljzPay(jsonObject.getString("yljz_pay"));
                ylzMedicalRelationDO.setOtherPay(jsonObject.getString("other_pay"));
                ylzMedicalRelationDO.setEnterpriseSupplement(jsonObject.getString("enterprise_supplement"));
                ylzMedicalRelationDO.setJtgjPay(jsonObject.getString("jtgj_pay"));
                ylzMedicalRelationDO.setCollector(jsonObject.getString("collector"));
                Double price= Double.parseDouble(ylzMedicalRelationDO.getTcjjPay())+Double.parseDouble(ylzMedicalRelationDO.getSbjjPay())+
                        Double.parseDouble(ylzMedicalRelationDO.getJzfpPay())+Double.parseDouble(ylzMedicalRelationDO.getYljzPay())+
                        Double.parseDouble(ylzMedicalRelationDO.getOtherPay())+Double.parseDouble(ylzMedicalRelationDO.getEnterpriseSupplement());
                ylzMedicalRelationDO.setMedicalPrice(price+"");
                ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                JSONArray jsonArray = jsonObject.getJSONArray("fplist");
                for (int i=0;i<jsonArray.size();i++){
                    JSONObject jsonObject1 = jsonArray.getJSONObject(i);
                    YlzMedicalBillDO ylzMb = new YlzMedicalBillDO();
                    ylzMb.setMedicalId(ylzMedicalRelationDO.getId());
                    ylzMb.setInvoicePay(jsonObject1.getString("invoice_pay"));
                    ylzMb.setInvoiceType(jsonObject1.getString("invoice_type"));
                    ylzMb.setInvoiceTypeName(jsonObject1.getString("invoice_type_name"));
                    ylzMb.setProjectPay(jsonObject1.getString("project_pay"));
                    ylzMb.setOwnPay(jsonObject1.getString("own_pay"));
                    ylzMb.setSpecialPay(jsonObject1.getString("special_pay"));
                    ylzMb.setUninsurancePay(jsonObject1.getString("uninsurance_pay"));
                    ylzMb.setCreateTime(new Date());
                    ylzMedicailBillDao.save(ylzMb);
                }
            }
        }
        List<YlzMedicalIcdDO> icdDOList = ylzMedicailIcdDao.findByMedicalId(ylzMedicalRelationDO.getId());
        List<YlzMedicalMxDO> mxDOList = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
        ylzMedicalRelationDO.setYlzMedicalIcdDOList(icdDOList);
        ylzMedicalRelationDO.setYlzMedicalMxDOList(mxDOList);
        return ylzMedicalRelationDO;
    }
@ -1484,12 +1566,12 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 门诊id
     * @return
     * @throws Exception
     */
    public YlzMedicalRelationDO preSettlementToEntrance(String registerNo) throws Exception{
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
    public YlzMedicalRelationDO preSettlementToEntrance(String outpatientId) throws Exception{
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if (ylzMedicalRelationDO==null){
            throw new Exception("医保费用明细上传:结算信息为空!");
        }
@ -1503,7 +1585,7 @@ public class HealthCareService {
        }
        String result = "";
        String response="";
        String url = entranceHealthCareUrl+"preSettlement?registerNo="+registerNo;
        String url = entranceHealthCareUrl+"preSettlement?outpatientId="+outpatientId;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
@ -1557,14 +1639,14 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo
     * @param outpatientId
     * @return
     * @throws Exception
     */
    public String preSettlementRefundToEntrance(String registerNo) throws Exception{
    public String preSettlementRefundToEntrance(String outpatientId) throws Exception{
        String result = "";
        String response="";
        String url = entranceHealthCareUrl+"feeDetailRefund?registerNo="+registerNo;
        String url = entranceHealthCareUrl+"feeDetailRefund?outpatientId="+outpatientId;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
@ -1579,13 +1661,13 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo
     * @param outpatientId
     * @return
     * @throws Exception
     */
    public String preSettlementRefund(String registerNo) throws Exception{
    public String preSettlementRefund(String outpatientId) throws Exception{
        String funid = "N20.17.04.06";
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if (ylzMedicalRelationDO==null){
            throw new Exception("医保结算冲销上传:结算信息为空!");
        }
@ -1596,7 +1678,7 @@ public class HealthCareService {
        data.put("cert_type",ylzMedicalRelationDO.getCertType());//证件类型
        data.put("medical_mode",ylzMedicalRelationDO.getMedicalMode());//医疗就诊方式
        data.put("bill_serial",ylzMedicalRelationDO.getBillSerial());//医保收费流水号
        data.put("his_bill_serial",ylzMedicalRelationDO.getHisSerial());//his收费单据流水号
        data.put("his_bill_serial",ylzMedicalRelationDO.getHisSettleNo());//his收费单据流水号
        data.put("insurance_serial",ylzMedicalRelationDO.getInsuranceSerial());//医保流水号
        data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
        data.put("refund_serial",ylzMedicalRelationDO.getHisSerial());//医院退费操作流水号
@ -1617,14 +1699,14 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 挂号号
     * @return
     * @throws Exception
     */
    public String getSettlementResultUrl(String registerNo) throws Exception{
    public String getSettlementResultUrl(String outpatientId) throws Exception{
        String funid = "N20.17.04.07";
        JSONObject data = new JSONObject();
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if (ylzMedicalRelationDO==null){
            throw new Exception("获取医保结算页面地址:结算信息为空!");
        }
@ -1640,13 +1722,13 @@ public class HealthCareService {
        data.put("medical_type",ylzMedicalRelationDO.getMedicalType());//医疗类别
        data.put("insurance_serial",ylzMedicalRelationDO.getInsuranceSerial());//
        data.put("his_bill_serial",ylzMedicalRelationDO.getHisBillSerial());//his收费单据流水号
        data.put("date",DateUtil.dateToStrFormatLong(ylzMedicalRelationDO.getDate()));//实际就诊日期
        data.put("date",DateUtil.dateToStrFormatShort(ylzMedicalRelationDO.getDate()));//实际就诊日期
        data.put("leave_method","09");//离院方式
        data.put("pre_count",ylzMedicalRelationDO.getPreCount());//处方项目数
        data.put("total_amount",ylzMedicalRelationDO.getTotalAmount());//医疗费总金额
        data.put("person_cash",ylzMedicalRelationDO.getPersonCash());//个人现金支付金额(实付现金)
        data.put("person_account",ylzMedicalRelationDO.getPersonAccount());//个人账户支付金额
        data.put("fund_price",ylzMedicalRelationDO.getFundPrice());//基金支付总额
        data.put("fund_price",ylzMedicalRelationDO.getMedicalPrice());//基金支付总额
        data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
        data.put("his_serial",ylzMedicalRelationDO.getHisSerial());//his流水号
        data.put("doctor_level",ylzMedicalRelationDO.getDoctorLevel());//医师诊查费等级
@ -1656,9 +1738,19 @@ public class HealthCareService {
        object.put("detail_serial",ylzMedicalRelationDO.getDetailSerial());
        array.add(object);
        data.put("cflist",array);
        String result = requestYlz(data,funid,"获取医保结算结果");
        String result = requestYlz(data,funid,"获取医保结算页面地址");
        if (result==null){
            throw new Exception("获取医保结算结果失败!");
            throw new Exception("获取医保结算页面地址失败!");
        }else {
            JSONObject resObj = JSONObject.parseObject(result);
            if (resObj.getString("flag").equalsIgnoreCase("1")){
                JSONObject jsonObject = resObj.getJSONObject("encrypt_data");
                String link_url = jsonObject.getString("link_url");
                String str1=link_url.substring(0, link_url.indexOf("="));
                String str2=link_url.substring(str1.length()+1, link_url.length());
                ylzMedicalRelationDO.setPageCode(str2);
                ylzMedicailRelationDao.save(ylzMedicalRelationDO);
            }
        }
        return result;
    }
@ -1669,14 +1761,14 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 挂号号
     * @return
     * @throws Exception
     */
    public String getSettlementResultUrlToEntrance(String registerNo) throws Exception{
    public String getSettlementResultUrlToEntrance(String outpatientId) throws Exception{
        String result = "";
        String response="";
        String url = entranceHealthCareUrl+"getSettlementResultUrl?registerNo="+registerNo;
        String url = entranceHealthCareUrl+"getSettlementResultUrl?outpatientId="+outpatientId;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
@ -1693,14 +1785,14 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 挂号号
     * @return
     * @throws Exception
     */
    public String getSettlementResultUrlBase64(String registerNo) throws Exception{
    public String getSettlementResultUrlBase64(String outpatientId) throws Exception{
        String funid = "N20.17.04.08";
        JSONObject data = new JSONObject();
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if (ylzMedicalRelationDO==null){
            throw new Exception("获取医保结算页面地址:结算信息为空!");
        }
@ -1716,20 +1808,20 @@ public class HealthCareService {
        data.put("medical_type",ylzMedicalRelationDO.getMedicalType());//医疗类别
        data.put("insurance_serial",ylzMedicalRelationDO.getInsuranceSerial());//
        data.put("his_bill_serial",ylzMedicalRelationDO.getHisBillSerial());//his收费单据流水号
        data.put("date",DateUtil.dateToStrFormatLong(ylzMedicalRelationDO.getDate()));//实际就诊日期
        data.put("date",DateUtil.dateToStrFormatShort(ylzMedicalRelationDO.getDate()));//实际就诊日期
        data.put("leave_method","09");//离院方式
        data.put("pre_count",ylzMedicalRelationDO.getPreCount());//处方项目数
        data.put("total_amount",ylzMedicalRelationDO.getTotalAmount());//医疗费总金额
        data.put("person_cash",ylzMedicalRelationDO.getPersonCash());//个人现金支付金额(实付现金)
        data.put("person_account",ylzMedicalRelationDO.getPersonAccount());//个人账户支付金额
        data.put("fund_price",ylzMedicalRelationDO.getFundPrice());//基金支付总额
        data.put("fund_price",ylzMedicalRelationDO.getMedicalPrice());//基金支付总额
        data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
        data.put("his_serial",ylzMedicalRelationDO.getHisSerial());//his流水号
        data.put("doctor_level",ylzMedicalRelationDO.getDoctorLevel());//医师诊查费等级
        data.put("redirect_url",wlyyHospitalSysDictDO.getDictValue());//回调地址
        String result = requestYlz(data,funid,"获取医保结算结果");
        String result = requestYlz(data,funid,"获取医保结算页面地址");
        if (result==null){
            throw new Exception("获取医保结算结果失败!");
            throw new Exception("获取医保结算页面地址失败!");
        }
        return result;
    }
@ -1740,14 +1832,14 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 挂号号
     * @return
     * @throws Exception
     */
    public String getSettlementResultUrlBase64ToEntrance(String registerNo) throws Exception{
    public String getSettlementResultUrlBase64ToEntrance(String outpatientId) throws Exception{
        String result = "";
        String response="";
        String url = entranceHealthCareUrl+"getSettlementResultUrlBase64?registerNo="+registerNo;
        String url = entranceHealthCareUrl+"getSettlementResultUrlBase64?outpatientId="+outpatientId;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
@ -1777,6 +1869,19 @@ public class HealthCareService {
        if (result==null){
            throw new Exception("获取医保结算结果失败!");
        }
        com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
        if (object.getString("flag").equalsIgnoreCase("1")){
            JSONObject jsonObject = object.getJSONObject("encrypt_data");
            String insuranceSerial = jsonObject.getString("insurance_serial");
            String billSerial = jsonObject.getString("bill_serial");
            YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByInsuranceSerial(insuranceSerial);
            if (ylzMedicalRelationDO!=null){
                ylzMedicalRelationDO.setStatus(1);
                ylzMedicalRelationDO.setBillSerial(billSerial);
                ylzMedicalRelationDO.setPayDate(DateUtil.strToDate(jsonObject.getString("pay_date")+jsonObject.getString("pay_time")));
                ylzMedicailRelationDao.save(ylzMedicalRelationDO);
            }
        }
        return result;
    }

+ 5 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/healthCare/YlzMedicailRelationDao.java

@ -15,9 +15,12 @@ import java.util.List;
 */
public interface YlzMedicailRelationDao extends PagingAndSortingRepository<YlzMedicalRelationDO, String>, JpaSpecificationExecutor<YlzMedicalRelationDO> {
    @Query("from YlzMedicalRelationDO a where a.relationCode = ?1 ")
    YlzMedicalRelationDO findByOutpatient(String relationCode);
    @Query("from YlzMedicalRelationDO a where   a.relationCode = ?1 ")
    YlzMedicalRelationDO findByOutpatient(String outpatientId);
    @Query("from YlzMedicalRelationDO a where a.logNo = ?1 ")
    YlzMedicalRelationDO findByLog_no(String logNo);
    @Query("from YlzMedicalRelationDO a where a.insuranceSerial = ?1 ")
    YlzMedicalRelationDO findByInsuranceSerial(String insuranceSerial);
}

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

@ -599,6 +599,7 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti
            if(isContainEndRoutInfo){
                //修改处方状态为完成
                prescriptionDao.updateStatusByOutPatientId( 100,new Date(),sfexpress.getOutpatientId());
                prescriptionService.electronicPrescriptionReceiving(sfexpress.getOutpatientId());
                /*List<WlyyPrescriptionDO> wlyyPrescriptionDOs = prescriptionDao.findByOutpatientId(sfexpress.getOutpatientId());
                if (wlyyPrescriptionDOs.size()>0){
                    WlyyPrescriptionDO wlyyPrescriptionDO=wlyyPrescriptionDOs.get(0);

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

@ -41,6 +41,8 @@ import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorOnlineTimeDO;
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalIcdDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalMxDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
@ -61,6 +63,8 @@ import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao;
import com.yihu.jw.hospital.doctor.dao.WlyyDoctorOnlineTimeDao;
import com.yihu.jw.hospital.drugstore.dao.BaseDrugStoreDao;
import com.yihu.jw.hospital.family.dao.WlyyNatPatientFamilyMemberDao;
import com.yihu.jw.hospital.healthCare.YlzMedicailMxDao;
import com.yihu.jw.hospital.healthCare.YlzMedicailRelationDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.httplog.service.BaseOperateLogService;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
@ -326,8 +330,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    @Autowired
    private HcyyPrescriptionService hcyyPrescriptionService;
    @Autowired
    private YlzMedicailRelationDao ylzMedicailRelationDao;
    @Autowired
    private YlzMedicailMxDao ylzMedicailMxDao;
    @Autowired
    private WlyyNatPatientFamilyMemberDao natPatientFamilyMemberDao;
    @Autowired
    private PrescriptionLogDao prescriptionLogDao;
    public static String entranceUrl = "http://172.16.100.240:10023/xzzx/";
    public static String entranceHealthCareUrl = "http://127.0.0.1:10023/healthCare/";
@ -706,6 +715,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        rs.put("doctorCancelType", outpatientDO.getDoctorCancelType());
        rs.put("doctorCancelValue", outpatientDO.getDoctorCancelValue());
        rs.put("doctorCancelRemark", outpatientDO.getDoctorCancelRemark());
        rs.put("medicalState",outpatientDO.getMedicalState());
        rs.put("payStatus", outpatientDO.getPayStatus());
        rs.put("patientCancelType", outpatientDO.getPatientCancelType());
        rs.put("patientCancelValue", outpatientDO.getPatientCancelValue());
@ -3537,7 +3547,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " e.id AS \"expressageId\" ,"+
                " p.real_order AS \"realOrder\" ,"+
                " p.origin_real_order AS \"originRealOrder\"," +
                " o.patient_name as \"patientName\" "+
                " o.patient_name as \"patientName\", "+
                " p.check_status as \"checkStatus\", "+
                " p.check_reason as \"checkReason\"  "+
                " FROM " +
                " wlyy_outpatient o " +
                " JOIN wlyy_prescription p ON p.outpatient_id = o.id " +
@ -11423,6 +11435,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                logger.info("作废处方开始" + prescriptionDO.getCheckStatus());
                WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
                WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
                List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByOutPatientIdList(prescriptionDO.getOutpatientId());
                DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
                List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId, 1);
                List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId, 1);
@ -11463,8 +11476,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                wlyyHttpLogDO.setCreateTime(new Date());
                wlyyHttpLogDO.setCode(outpatientDO.getId());
                wlyyHttpLogDao.save(wlyyHttpLogDO);
                for (WlyyPrescriptionDO wlyyPrescriptionDO:prescriptionDOList){
                    wlyyPrescriptionDO.setStatus(-4);
                    wlyyPrescriptionDO.setDisableTime(new Date());
                    wlyyPrescriptionDO.setCheckStatus(5);
                    wlyyPrescriptionDO.setCheckReason("已作废");
                    prescriptionDao.save(wlyyPrescriptionDO);
                }
            }
            prescriptionDO.setStatus(-4);
            prescriptionDO.setDisableTime(new Date());
            prescriptionDO.setCheckStatus(5);
@ -13994,30 +14013,29 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if(outpatientDO==null){
            throw new Exception("门诊信息为空");
        }
        String registerNo = outpatientDO.getRegisterNo();
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("ylzConfigOrgCode");
        if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
            xzzxEntranceService.getSettleInfHospital(outpatientDO.getCardNo(),registerNo,sysDictDO.getDictValue());
            xzzxEntranceService.getSettleInfHospital(outpatientDO.getCardNo(),outpatientId,sysDictDO.getDictValue());
            logger.info("获取患者待结算信息结束!");
            logger.info("医保挂号开始!");
            String register = healthCareService.registerToEntrance(registerNo);
            String register = healthCareService.registerToEntrance(outpatientId);
            logger.info("医保挂号结束!");
            logger.info("医保费用明细上传开始!");
            String feeDetailUpload= healthCareService.feeDetailUploadToEntrance(registerNo);
            String feeDetailUpload= healthCareService.feeDetailUploadToEntrance(outpatientId);
            logger.info("医保费用明细上传结束!");
            logger.info("医保预结算信息开始!");
            YlzMedicalRelationDO ylzMedicalRelationDO =  healthCareService.preSettlementToEntrance(registerNo);
            YlzMedicalRelationDO ylzMedicalRelationDO =  healthCareService.preSettlementToEntrance(outpatientId);
            logger.info("医保预结算信息结束!");
            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
            if (flag==1){
                logger.info("获取医保结算页面地址开始!");
                String getSettlementResultUrl = healthCareService.getSettlementResultUrlToEntrance(registerNo);
                String getSettlementResultUrl = healthCareService.getSettlementResultUrlToEntrance(outpatientId);
                logger.info("获取医保结算页面地址结束!");
                object.put("getSettlementResultUrl",getSettlementResultUrl);
            }else if (flag==2){
                logger.info("获取医保结算页面地址开始!");
                String getSettlementResultUrlBase64 = healthCareService.getSettlementResultUrlBase64ToEntrance(registerNo);
                String getSettlementResultUrlBase64 = healthCareService.getSettlementResultUrlBase64ToEntrance(outpatientId);
                logger.info("获取医保结算页面地址结束!");
                object.put("getSettlementResultUrlBase64",getSettlementResultUrlBase64);
            }
@ -14031,45 +14049,107 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }else {
            /*entranceService.BS10108()*/
            /*entrance(outpatientDO.getCardNo(),registerNo,sysDictDO.getDictValue());*/
            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
            logger.info("获取患者待结算信息开始!");
            entranceService.getSettleInfo(outpatientDO.getCardNo(),outpatientDO.getIdcard(),outpatientDO.getId());
            YlzMedicalRelationDO ylzMedicalRelationDO = new YlzMedicalRelationDO();
            ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
            /*if (ylzMedicalRelationDO!=null&&ylzMedicalRelationDO.getStatus()==1){
                List<YlzMedicalMxDO> mxDOList = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
                ylzMedicalRelationDO.setYlzMedicalMxDOList(mxDOList);
                Double totalPirce=Double.parseDouble(ylzMedicalRelationDO.getPersonCash())+Double.parseDouble(ylzMedicalRelationDO.getPersonAccount())+Double.parseDouble(ylzMedicalRelationDO.getMedicalPrice());
                if (totalPirce!=Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())){
                    object.put("code","403");
                    object.put("message","金额不对无法结算!");
                }else {
                    object.put("code","200");
                    object.put("message","核对金额无误!");
                }
                object.put("getSettleInfo",ylzMedicalRelationDO);
                return object;
            }*/
            try {
                ylzMedicalRelationDO = entranceService.getSettleInfo(outpatientDO.getCardNo(),outpatientDO.getIdcard(),outpatientDO.getId());
            }catch (Exception e){
                e.printStackTrace();
            }
            if (ylzMedicalRelationDO==null){
                throw new Exception("无待结算信息");
            }
/*
            if (ylzMedicalRelationDO.getStatus()!=null&&ylzMedicalRelationDO.getStatus()==1){
                object.put("getSettleInfo",ylzMedicalRelationDO);
                return object;
            }*/
            logger.info("获取患者待结算信息结束!");
            logger.info("医保挂号开始!");
            String register = healthCareService.register(registerNo);
            logger.info("医保挂号结束!");
            logger.info("医保费用明细上传开始!");
            String feeDetailUpload= healthCareService.feeDetailUpload(registerNo);
            logger.info("医保费用明细上传结束!");
            if(outpatientDO!=null&&outpatientDO.getMedicalState().equalsIgnoreCase("1")){
                logger.info("医保挂号开始!");
                String register = healthCareService.register(outpatientId);
                logger.info("医保挂号结束!");
                logger.info("医保费用明细上传开始!");
                String feeDetailUpload= healthCareService.feeDetailUpload(outpatientId);
                logger.info("医保费用明细上传结束!");
                logger.info("医保预结算信息开始!");
                ylzMedicalRelationDO =  healthCareService.preSettlement(outpatientId);
                logger.info("医保预结算信息结束!");
                if (flag==1){
                    logger.info("获取医保结算页面地址开始!");
                    String getSettlementResultUrl = healthCareService.getSettlementResultUrl(outpatientId);
                    logger.info("获取医保结算页面地址结束!");
                    object.put("getSettlementResultUrl",getSettlementResultUrl);
                }else if (flag==2){
                    logger.info("获取医保结算页面地址开始!");
                    String getSettlementResultUrlBase64 = healthCareService.getSettlementResultUrlBase64(outpatientId);
                    logger.info("获取医保结算页面地址结束!");
                    object.put("getSettlementResultUrlBase64",getSettlementResultUrlBase64);
                }
                Double totalPirce=Double.parseDouble(ylzMedicalRelationDO.getPersonCash())+Double.parseDouble(ylzMedicalRelationDO.getPersonAccount())+Double.parseDouble(ylzMedicalRelationDO.getMedicalPrice());
                if (totalPirce!=Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())){
                    object.put("code","403");
                    object.put("message","金额不对无法结算!");
                }else {
                    object.put("code","200");
                    object.put("message","核对金额无误!");
                }
                object.put("getSettleInfo",ylzMedicalRelationDO);
                return object;
            }else {
                Double totalPirce=Double.parseDouble(ylzMedicalRelationDO.getPersonCash())+Double.parseDouble(ylzMedicalRelationDO.getPersonAccount())+Double.parseDouble(ylzMedicalRelationDO.getMedicalPrice());
                if (totalPirce!=Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())){
                    object.put("code","403");
                    object.put("message","金额不对无法结算!");
                }else {
                    object.put("code","200");
                    object.put("message","核对金额无误!");
                }
                object.put("getSettleInfo",ylzMedicalRelationDO);
                return object;
            }
        }
            logger.info("医保预结算信息开始!");
            YlzMedicalRelationDO ylzMedicalRelationDO =  healthCareService.preSettlement(registerNo);
            logger.info("医保预结算信息结束!");
            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
            if (flag==1){
                logger.info("获取医保结算页面地址开始!");
                String getSettlementResultUrl = healthCareService.getSettlementResultUrl(registerNo);
                logger.info("获取医保结算页面地址结束!");
                object.put("getSettlementResultUrl",getSettlementResultUrl);
            }else if (flag==2){
                logger.info("获取医保结算页面地址开始!");
                String getSettlementResultUrlBase64 = healthCareService.getSettlementResultUrlBase64(registerNo);
                logger.info("获取医保结算页面地址结束!");
                object.put("getSettlementResultUrlBase64",getSettlementResultUrlBase64);
    }
    public String electronicPrescriptionReceiving(String outpatientId) {
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        if (outpatientDO.getMedicalState()!=null&&outpatientDO.getMedicalState().equalsIgnoreCase("1")){
            try {
                return  healthCareService.electronicPrescriptionReceiving(outpatientId);
            }catch (Exception e){
                e.printStackTrace();
            }
            object.put("register",register);
            object.put("feeDetailUpload",feeDetailUpload);
            object.put("preSettlement",ylzMedicalRelationDO);
            object.put("cardNo",outpatientDO.getCardNo());
            object.put("deptName",outpatientDO.getDeptName());
            return object;
        }
        return null;
    }
    /**
     * 医保结算页面
     * 医保结算结果
     * @param outpatientId
     * @return
     * @throws Exception
@ -14086,15 +14166,184 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            result = healthCareService.getSettlementResult(code);
            logger.info("医保结算结果获取end!");
        }else{
        }/*else{
            logger.info("医保结算页面start!");
            String registerNo = outpatientDO.getRegisterNo();
            result = healthCareService.getSettlementResultUrl(registerNo);
            logger.info("医保结算页面end!");
        }
        }*/
        return result;
    }
    /**
     * 医保结算后确认his结算
     * @param outpatientId
     * @return
     * @throws Exception
     */
    public String confirmSettlementService(String outpatientId) throws Exception {
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        if (outpatientDO==null){
            throw new Exception("未找到待结算记录");
        }
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if (ylzMedicalRelationDO.getState()!=null&&ylzMedicalRelationDO.getState()==1){
            return "已结算";
        }
        //用医保结算直接调用确认结算
        confirmSettlement(outpatientId);
        return "结算成功";
    }
    /**
     * 费用结算
     *
     * @param outpatientId
     * @return
     * @throws Exception
     */
    public String confirmSettlement(String outpatientId) throws Exception {
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        if (outpatientDO==null){
            throw new Exception("未找到待结算记录");
        }
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getAdmNo());
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(ylzMedicalRelationDO.getId());
        String depositType = "";
        String depositAmount = "";
        String outChargeNo = "";
        if (businessOrderDO!=null){
            depositType = businessOrderDO.getDepositType();
            depositAmount = businessOrderDO.getPayPrice()+"";
            outChargeNo = businessOrderDO.getTraceNo();
        }
        JSONArray jsonArray = new JSONArray();
        if (ylzMedicalRelationDO.getMedicalState()==null||(ylzMedicalRelationDO.getMedicalState()!=null&&ylzMedicalRelationDO.getMedicalState()==0)){
            WlyyHisSettleVO wlyyHisSettleVO = new WlyyHisSettleVO();
            wlyyHisSettleVO.setCardNo(ylzMedicalRelationDO.getCardNo());
            wlyyHisSettleVO.setXtgzh0(ylzMedicalRelationDO.getHisSettleNo());
            wlyyHisSettleVO.setDepositType(depositType);
            wlyyHisSettleVO.setDepositAmount(depositAmount);
            wlyyHisSettleVO.setOutChargeNo(outChargeNo);
            wlyyHisSettleVO.setOrgCode("6");
            wlyyHisSettleVO.setXyzf00("0");
            wlyyHisSettleVO.setChannelType("09");
            wlyyHisSettleVO.setDjlsh0("");
            wlyyHisSettleVO.setMzlsh0("");
            wlyyHisSettleVO.setZhzfe0("");
            wlyyHisSettleVO.setGrzfe0("");
            wlyyHisSettleVO.setJjzfe0("");
            wlyyHisSettleVO.setGwybz0("");
            wlyyHisSettleVO.setFybfy0("");
            wlyyHisSettleVO.setCfdxje("");
            wlyyHisSettleVO.setBjjjzf("");
            wlyyHisSettleVO.setSybxzf("");
            wlyyHisSettleVO.setBcbxf0("");
            wlyyHisSettleVO.setSfrq00("");
            wlyyHisSettleVO.setSfsj00("");
            wlyyHisSettleVO.setSfrxm0("");
            wlyyHisSettleVO.setBzjjzf("");
            wlyyHisSettleVO.setGrzhye("");
            wlyyHisSettleVO.setYlzfje("");
            wlyyHisSettleVO.setJkzhye("");
            wlyyHisSettleVO.setJkzhye("");
            wlyyHisSettleVO.setGrzhye("");
            wlyyHisSettleVO.setYbmxls("");
            wlyyHisSettleVO.setBdgjzf("");
            wlyyHisSettleVO.setYdgjzf("");
            wlyyHisSettleVO.setBckbcs("");
            jsonArray = entranceService.BS15039(wlyyHisSettleVO,false);
        }
        if (ylzMedicalRelationDO!=null&&ylzMedicalRelationDO.getStatus()==1){
            WlyyHisSettleVO wlyyHisSettleVO = new WlyyHisSettleVO();
            wlyyHisSettleVO.setCardNo(ylzMedicalRelationDO.getCardNo());
            wlyyHisSettleVO.setXtgzh0(ylzMedicalRelationDO.getHisSettleNo());
            wlyyHisSettleVO.setDepositType(depositType);
            wlyyHisSettleVO.setDepositAmount(depositAmount);
            wlyyHisSettleVO.setOutChargeNo(outChargeNo);
            wlyyHisSettleVO.setOrgCode("6");
            wlyyHisSettleVO.setXyzf00("0");
            wlyyHisSettleVO.setChannelType("09");
            wlyyHisSettleVO.setDjlsh0(ylzMedicalRelationDO.getBillSerial());
            wlyyHisSettleVO.setMzlsh0(ylzMedicalRelationDO.getInsuranceSerial());
            wlyyHisSettleVO.setZhzfe0(ylzMedicalRelationDO.getPersonAccount());
            wlyyHisSettleVO.setGrzfe0(ylzMedicalRelationDO.getPersonCash());
/*
            Double bcbxzg = Double.parseDouble(ylzMedicalRelationDO.getMedicalPrice())+Double.parseDouble(ylzMedicalRelationDO.getPersonAccount());
*/
            wlyyHisSettleVO.setJjzfe0(ylzMedicalRelationDO.getMedicalPrice());
            wlyyHisSettleVO.setGwybz0(ylzMedicalRelationDO.getGwyPay());
            wlyyHisSettleVO.setFybfy0(ylzMedicalRelationDO.getPersonCash());
            wlyyHisSettleVO.setCfdxje("0");
            wlyyHisSettleVO.setBjjjzf("0");
            wlyyHisSettleVO.setSybxzf(ylzMedicalRelationDO.getSbjjPay());
            wlyyHisSettleVO.setBcbxf0(ylzMedicalRelationDO.getTotalAmount());
            wlyyHisSettleVO.setSfrq00(DateUtil.dateToStrLong(ylzMedicalRelationDO.getPayDate()));
            wlyyHisSettleVO.setSfsj00("");
            wlyyHisSettleVO.setSfrxm0("");
            wlyyHisSettleVO.setBzjjzf(ylzMedicalRelationDO.getYljzPay());
            wlyyHisSettleVO.setGrzhye(ylzMedicalRelationDO.getAccountBalance());
            wlyyHisSettleVO.setYlzfje(ylzMedicalRelationDO.getOwnPay());
            wlyyHisSettleVO.setJkzhye(ylzMedicalRelationDO.getJkzhPay());
            wlyyHisSettleVO.setYbmxls(ylzMedicalRelationDO.getDetailSerial());
            wlyyHisSettleVO.setBdgjzf(ylzMedicalRelationDO.getJtgjPay());
            wlyyHisSettleVO.setYdgjzf(ylzMedicalRelationDO.getJtgjPay());
            wlyyHisSettleVO.setBckbcs(ylzMedicalRelationDO.getHospitalizationQty());
            wlyyHisSettleVO.setPsnNo(ylzMedicalRelationDO.getPersonalCode());
            wlyyHisSettleVO.setAab301(ylzMedicalRelationDO.getAdministrativeArea());
            wlyyHisSettleVO.setInsutype(ylzMedicalRelationDO.getInsuranceType());
            jsonArray = entranceService.BS15039(wlyyHisSettleVO,false);
        }
        if (jsonArray!=null&&jsonArray.size()!=0){
            net.sf.json.JSONObject object = jsonArray.getJSONObject(0);
            net.sf.json.JSONObject jsonObject = object.getJSONObject("retInfo");
            net.sf.json.JSONObject msgInfoJson = object.getJSONObject("msgInfo");
            if (jsonObject.getString("retCode").equalsIgnoreCase("00")){
                ylzMedicalRelationDO.setState(1);
                ylzMedicalRelationDO.setHisBillSerial(msgInfoJson.getString("callSn"));
                ylzMedicalRelationDO.setHisDesc(msgInfoJson.getString("jsxxts"));
                ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                logger.info("变更医保结算状态成功");
                String realOrder = "";
                List<WlyyOutpatientDO> wlyyOutpatientDOList = outpatientDao.findByRegisterNoList(ylzMedicalRelationDO.getHisSerial());
                for (WlyyOutpatientDO wlyyOutpatientDO:wlyyOutpatientDOList){
                    List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(wlyyOutpatientDO.getId());
                    for (WlyyPrescriptionDO prescriptionDO:wlyyPrescriptionDOS){
                        WlyyPrescriptionLogDO prescriptionLogDO = new WlyyPrescriptionLogDO();
                        prescriptionLogDO.setCreateTime(new Date());
                        prescriptionLogDO.setStatus(30);
                        prescriptionLogDO.setOutpatientId(prescriptionDO.getOutpatientId());
                        prescriptionLogDO.setPrescriptionCode(prescriptionDO.getId());
                        prescriptionLogDO.setUserCode(prescriptionDO.getPatientCode());
                        prescriptionLogDO.setUserName(prescriptionDO.getPatientName());
                        prescriptionLogDO.setUserType(1);
                        prescriptionLogDO.setDatajson("处方结算");
                        prescriptionLogDao.save(prescriptionLogDO);
                        prescriptionDO.setStatus(30);
                        prescriptionDO.setPayTime(new Date());
                        prescriptionDao.save(prescriptionDO);
                        realOrder = prescriptionDO.getRealOrder();
                        logger.info("变更处方结算状态成功");
                    }
                }
                logger.info("电子发票开具开始");
                try {
                    entranceService.dzpjServer(patientMappingDO.getMappingCode(),realOrder);
                }catch (Exception e){
                    e.printStackTrace();
                }
                logger.info("电子发票开具结束");
            }
        }
        return jsonArray.toString();
    }
    /**
     *

文件差异内容过多而无法显示
+ 257 - 32
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java


+ 7 - 5
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java

@ -2444,7 +2444,7 @@ public class XzzxEntranceService{
     * @return
     * @throws Exception
     */
    public String confirmSettle(String his_serial,String icCardNo,String org_code)throws Exception{
    public String confirmSettle(String his_serial,String icCardNo,String org_code,String outpatientId)throws Exception{
        String api = "confirmSettle";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
@ -2453,7 +2453,7 @@ public class XzzxEntranceService{
                "   <callOperator></callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(his_serial);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        String condition ="";
        JSONObject jsonObject = new JSONObject();
@ -2485,8 +2485,8 @@ public class XzzxEntranceService{
            if (!StringUtils.isEmpty(ylzMedicalRelationDO.getPersonAccount())){
                jsonObject.put("person_account",ylzMedicalRelationDO.getPersonAccount());
            }
            if (!StringUtils.isEmpty(ylzMedicalRelationDO.getFundPrice())){
                jsonObject.put("fund_amount",ylzMedicalRelationDO.getFundPrice());
            if (!StringUtils.isEmpty(ylzMedicalRelationDO.getMedicalPrice())){
                jsonObject.put("fund_amount",ylzMedicalRelationDO.getMedicalPrice());
            }
            if (!StringUtils.isEmpty(ylzMedicalRelationDO.getJkzhPay())){
                jsonObject.put("jkzh_pay",ylzMedicalRelationDO.getJkzhPay());
@ -2749,8 +2749,10 @@ public class XzzxEntranceService{
     * @param org_code 医院编码
     * @return
     */
    public JSONObject getSettleInfHospital(String icCardNo,String his_serial,String org_code){
    public JSONObject getSettleInfHospital(String icCardNo,String outpatientId,String org_code){
        JSONObject jsonObject= new JSONObject();
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
        String his_serial = wlyyOutpatientDO.getRegisterNo();
        String response="";
        String url = entranceUrl+"getSettleInfo?icCardNo="+icCardNo+"&his_serial="+his_serial+"&org_code="+org_code;
        response = httpClientUtil.get(url,"GBK");

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

@ -59,6 +59,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.persistence.criteria.CriteriaBuilder;
import java.io.InputStream;
import java.math.BigDecimal;
import java.rmi.server.ExportException;
import java.util.*;
/**
@ -1760,7 +1761,7 @@ public class YkyyEntranceService {
                "FROM\n" +
                "\tV_ZKSG_BRCX x\n" +
                "WHERE\n" +
                "\t(x.jzkh = '"+ssc+"' or x.MZHM='"+ssc+"') and UPPER(x.sfzh) =UPPER('"+idcard+"')";
                "\t(UPPER(x.jzkh) = UPPER('"+ssc+"') or UPPER(x.MZHM)=UPPER('"+ssc+"')) ";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
@ -1787,9 +1788,67 @@ public class YkyyEntranceService {
            Integer status = rs.getInteger("status");
            if (status==200){
                array = rs.getJSONArray("detailModelList");
                if (array==null||array.size()==0){
                    String sqlSfzh = "SELECT\n" +
                            "\tx.brid AS \"brid\",\n" +
                            "\tx.mzhm AS \"mzhm\",\n" +
                            "\tx.brxm AS \"brxm\",\n" +
                            "\tx.sfzh AS \"sfzh\",\n" +
                            "\tx.brxz AS \"brxz\",\n" +
                            "\tx.brxb AS \"brxb\",\n" +
                            "\tx.csny as \"csny\",\n" +
                            "\tx.jzkh AS \"jzkh\",\n" +
                            "\tx.jdsj AS \"jdsj\",\n" +
                            "\tx.sjhm AS \"sjhm\",\n" +
                            "\tx.fzxmc AS \"fzxmc\",\n" +
                            "\tx.gzztmc AS \"gzztmc\",\n" +
                            "\tx.lxdz AS \"lxdz\"\n" +
                            "FROM\n" +
                            "\tV_ZKSG_BRCX x\n" +
                            "WHERE\n" +
                            " UPPER(x.sfzh) =UPPER('"+idcard+"')";
                    Map<String,Object> paramsSfzh = new HashedMap();
                    paramsSfzh.put("sql",sqlSfzh);
                    HttpResponse response1 = HttpUtils.doGet(url,paramsSfzh);
                    String content1 = response1.getContent();
                    logger.info("response1:"+content1);
                    JSONObject rs1 = JSON.parseObject(content1);
                    Integer status1 = rs1.getInteger("status");
                    if (status1==200){
                        array = rs1.getJSONArray("detailModelList");
                    }
                }else if (array!=null&&array.size()>1){
                    String sqlSfzh = "SELECT\n" +
                            "\tx.brid AS \"brid\",\n" +
                            "\tx.mzhm AS \"mzhm\",\n" +
                            "\tx.brxm AS \"brxm\",\n" +
                            "\tx.sfzh AS \"sfzh\",\n" +
                            "\tx.brxz AS \"brxz\",\n" +
                            "\tx.brxb AS \"brxb\",\n" +
                            "\tx.csny as \"csny\",\n" +
                            "\tx.jzkh AS \"jzkh\",\n" +
                            "\tx.jdsj AS \"jdsj\",\n" +
                            "\tx.sjhm AS \"sjhm\",\n" +
                            "\tx.fzxmc AS \"fzxmc\",\n" +
                            "\tx.gzztmc AS \"gzztmc\",\n" +
                            "\tx.lxdz AS \"lxdz\"\n" +
                            "FROM\n" +
                            "\tV_ZKSG_BRCX x\n" +
                            "WHERE\n" +
                            " UPPER(x.sfzh) =UPPER('"+idcard+"') and (UPPER(x.jzkh) = UPPER('"+ssc+"') or UPPER(x.MZHM)=UPPER('"+ssc+"')) ";
                    Map<String,Object> paramsSfzh = new HashedMap();
                    paramsSfzh.put("sql",sqlSfzh);
                    HttpResponse response1 = HttpUtils.doGet(url,paramsSfzh);
                    String content1 = response1.getContent();
                    logger.info("response1:"+content1);
                    JSONObject rs1 = JSON.parseObject(content1);
                    Integer status1 = rs1.getInteger("status");
                    if (status1==200){
                        array = rs1.getJSONArray("detailModelList");
                    }
                }
            }
        }
        return array;
    }
@ -1817,7 +1876,7 @@ public class YkyyEntranceService {
                "FROM\n" +
                "\tV_ZKSG_BRCX x\n" +
                "WHERE\n" +
                "\tx.sfzh = '"+idcard+"' ";
                "\tUPPER(x.sfzh) = UPPER('"+idcard+"') ";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
@ -1874,11 +1933,11 @@ public class YkyyEntranceService {
                "\tV_ZKSG_BRCX x\n" +
                "WHERE 1=1" ;
        if (StringUtils.isNotBlank(medicare)&&StringUtils.isNotBlank(mzhm)){
            sql+=" and (x.jzkh = '"+medicare+"' or x.mzhm = '"+mzhm+"')";
            sql+=" and (UPPER(x.jzkh) = UPPER('"+medicare+"') or UPPER(x.mzhm) = UPPER('"+mzhm+"'))";
        }else if (StringUtils.isNotBlank(medicare)&&!StringUtils.isNotBlank(mzhm)){
            sql+=" and x.jzkh = '"+medicare+"' ";
            sql+=" and UPPER(x.jzkh) = UPPER('"+medicare+"') ";
        }else if (!StringUtils.isNotBlank(medicare)&&StringUtils.isNotBlank(mzhm)){
            sql+=" and x.mzhm = '"+mzhm+"' ";
            sql+=" and UPPER(x.mzhm) = UPPER('"+mzhm+"') ";
        }else {
            sql+=" and x.brid is null";
        }
@ -2520,12 +2579,31 @@ public class YkyyEntranceService {
        String doctor = wlyyPrescriptionVO.getDoctor();
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        String patient = wlyyPrescriptionVO.getPatientCode();
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
        BasePatientDO patientDO = basePatientDao.findById(patient);
        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
        if (patientMedicareCardDO==null){
            patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_02",patient,"1");
        }
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
        if (patientMappingDO==null){
            JSONArray jsonArray = findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),patientDO.getIdcard(),demoFlag);
            if(jsonArray!=null&&jsonArray.size()>0){
                //获取居民信息
                JSONObject json = jsonArray.getJSONObject(0);
                String brid = json.getString("brid");
                patientMappingDO = new PatientMappingDO();
                patientMappingDO.setCreateTime(new Date());
                patientMappingDO.setIdcard(patientDO.getIdcard());
                patientMappingDO.setMappingCode(brid);
                patientMappingDO.setPatient(patient);
                patientMappingDO.setPatientName(patientDO.getName());
                patientMappingDO.setSource("1");
                patientMappingDao.save(patientMappingDO);
            }else {
                throw new Exception("该名患者,在院信息有误,请告知患者核对(身份证号、社保卡号)!");
            }
        }
        Integer GHXH = 0;
        //挂号明细表HLW_GHMX
        HlwGhmxDO hlwGhmxDO = new HlwGhmxDO();
@ -2761,6 +2839,9 @@ public class YkyyEntranceService {
                hlwCf01DO.setSCDDH(wlyyPrescriptionVO.getOrderNo());
                String patient = wlyyPrescriptionVO.getPatientCode();
                PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
                if (patientMappingDO==null){
                    throw new Exception("该名患者,在院信息有误,请告知患者核对(身份证号、社保卡号)!");
                }
                hlwCf01DO.setBRID(Integer.parseInt(patientMappingDO.getMappingCode()));
                hlwCf01DO.setBRXM(wlyyPrescriptionVO.getPatientName());
                hlwCf01DO.setKSDM(Integer.parseInt(wlyyPrescriptionVO.getDept()));

+ 181 - 2
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -12,6 +12,7 @@ import com.yihu.jw.entity.base.wx.WxPayLogDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.prescription.*;
@ -19,6 +20,7 @@ import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.order.BusinessOrderRefundDO;
import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.healthCare.YlzMedicailRelationDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.prescription.dao.*;
@ -37,6 +39,7 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
import com.yihu.jw.util.common.BeanUtils;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.QrcodeUtil;
import com.yihu.jw.util.common.XMLUtil;
@ -146,6 +149,8 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    private HibenateUtils hibenateUtils;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private YlzMedicailRelationDao ylzMedicailRelationDao;
    /**
@ -186,7 +191,9 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                businessOrderDO.setDoctor(wlyyPrescriptionDO.getDoctor());
                businessOrderDO.setPatient(outpatientDO.getConsumer());
                businessOrderDO.setPatientName(outpatientDO.getConsumerName());
                BigDecimal b = new BigDecimal(String.valueOf(wlyyPrescriptionDO.getDrugFee()==null?0:wlyyPrescriptionDO.getDrugFee()));
                String a = String.valueOf(wlyyPrescriptionDO.getDrugFee()==null?0:String.format("%.2f",wlyyPrescriptionDO.getDrugFee()));
                logger.info("");
                BigDecimal b = new BigDecimal(a);
                BigDecimal c = new BigDecimal(String.valueOf(100));
                BigDecimal bc = b.multiply(c);
                BigDecimal dc = new BigDecimal(0);
@ -257,7 +264,8 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                    }
                }
            }else {
                BigDecimal b = new BigDecimal(String.valueOf(wlyyPrescriptionDO.getDrugFee()==null?0:wlyyPrescriptionDO.getDrugFee()));
                String a = String.valueOf(wlyyPrescriptionDO.getDrugFee()==null?0:String.format("%.2f",wlyyPrescriptionDO.getDrugFee()));
                BigDecimal b = new BigDecimal(a);
                BigDecimal c = new BigDecimal(String.valueOf(100));
                BigDecimal bc = b.multiply(c);
                BigDecimal dc = new BigDecimal(0);
@ -1907,6 +1915,177 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    }
    /**
     * 预交金处方支付
     * @param code
     * @param depositType
     * @param wechatId
     * @return
     * @throws Exception
     */
    public String ylzRechargePre(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){
            throw new Exception("can't find wechat:the wxId is "+wechatId);
        }
        WlyyHospitalSysDictDO hospitalSysDictDO =hospitalSysDictDao.findById("YLZ_NOTIFY_URL");
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(code);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(code);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(ylzMedicalRelationDO.getId());
        Double fee = Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())-Double.parseDouble(ylzMedicalRelationDO.getPersonAccount())-Double.parseDouble(ylzMedicalRelationDO.getMedicalPrice());
        if (businessOrderDO!=null){
            BasePatientDO patientDO = patientDao.findById(businessOrderDO.getPatient());
            String idcard = "";
            if (patientDO!=null){
                idcard = patientDO.getIdcard();
            }
            logger.info("开始1"+idcard);
            String openId = "";
            net.sf.json.JSONObject object1 = entranceService.qutpatientBalance(cardNo, demoFlag);
            Double cardFee = object1.getDouble("ZHYE");
            BigDecimal b = new BigDecimal(String.valueOf(cardFee));
            BigDecimal c = new BigDecimal(String.valueOf(fee));
            if (b.compareTo(c) == 1){
                return "无需线上支付";
            }
            BigDecimal balance = c.subtract(b);
            businessOrderDO.setPayPrice(balance.doubleValue());
            businessOrderDO.setPayType(4);
            businessOrderDO.setHistoryOrder(businessOrderDO.getOrderNo());
            businessOrderDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
            businessOrderDO.setDepositType(depositType);
            businessOrderDao.save(businessOrderDO);
            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
            if (patientWechatDos!=null&&patientWechatDos.size()!=0){
                BasePatientWechatDo patientWechatDo = patientWechatDos.get(0);
                openId = patientWechatDo.getOpenid();
            }
            String price = businessOrderDO.getPayPrice().toString();
            String notifyUrl = hospitalSysDictDO.getDictCode();
            String operatorId =null;
            String operatorName = null;
            if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
                operatorId = "123456";
                operatorName =businessOrderDO.getPatientName();
            }else if(wechatId.equalsIgnoreCase("xm_xzzx_wx")){
                operatorId = "hlwyy";
                operatorName = "互联网医院";
            }else if(wechatId.equalsIgnoreCase("xm_hcyy_wx")){
                operatorId = "hlwyy";
                operatorName = "互联网医院";
            }
            response = ylzPayService.recharge(operatorId,operatorName,cardType,"01",cardNo,idcard,depositType,price,businessOrderDO.getOrderNo(),openId,patientDO.getName(),notifyUrl);
            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 {
                JSONObject object = JSONObject.parseObject(response);
                if (object!=null){
                    JSONObject jsonObject = object.getJSONObject("param");
                    if (object.getString("respCode").equalsIgnoreCase("000000")){
                        String traceNo = jsonObject.getString("traceNo");
                        businessOrderDO.setTraceNo(traceNo);
                        businessOrderDao.save(businessOrderDO);
                    }
                }
            }
        }else {
            businessOrderDO = new BusinessOrderDO();
            BasePatientDO patientDO = patientDao.findById(wlyyOutpatientDO.getPatient());
            String idcard = "";
            if (patientDO!=null){
                idcard = patientDO.getIdcard();
            }
            logger.info("开始1"+idcard);
            String openId = "";
            net.sf.json.JSONObject object1 = entranceService.qutpatientBalance(cardNo, demoFlag);
            Double cardFee = object1.getDouble("ZHYE");
            BigDecimal b = new BigDecimal(String.valueOf(cardFee));
            BigDecimal c = new BigDecimal(String.valueOf(fee));
            BigDecimal balance = c.subtract(b);
            businessOrderDO.setPayPrice(balance.doubleValue());
            businessOrderDO.setPayType(4);
            businessOrderDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
            businessOrderDO.setDepositType(depositType);
            businessOrderDO.setRelationCode(ylzMedicalRelationDO.getId());
            businessOrderDO.setRelationName("费用结算");
            businessOrderDO.setPatientName(patientDO.getName());
            businessOrderDO.setPatient(patientDO.getId());
            businessOrderDO.setDoctor(wlyyOutpatientDO.getDoctor());
            businessOrderDO.setOrderCategory("6");
            businessOrderDO.setOrderType(6);
            businessOrderDO.setStatus(0);
            businessOrderDO.setDescription("费用结算");
            businessOrderDO.setCreateTime(new Date());
            businessOrderDO.setUpdateTime(new Date());
            businessOrderDao.save(businessOrderDO);
            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
            if (patientWechatDos!=null&&patientWechatDos.size()!=0){
                BasePatientWechatDo patientWechatDo = patientWechatDos.get(0);
                openId = patientWechatDo.getOpenid();
            }
            String price = businessOrderDO.getPayPrice().toString();
            String notifyUrl = hospitalSysDictDO.getDictCode();
            String operatorId =null;
            String operatorName = null;
            if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
                operatorId = "123456";
                operatorName =businessOrderDO.getPatientName();
            }else if(wechatId.equalsIgnoreCase("xm_xzzx_wx")){
                operatorId = "hlwyy";
                operatorName = "互联网医院";
            }else if(wechatId.equalsIgnoreCase("xm_hcyy_wx")){
                operatorId = "hlwyy";
                operatorName = "互联网医院";
            }
            response = ylzPayService.recharge(operatorId,operatorName,cardType,"01",cardNo,idcard,depositType,price,businessOrderDO.getOrderNo(),openId,patientDO.getName(),notifyUrl);
            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 {
                JSONObject object = JSONObject.parseObject(response);
                if (object!=null){
                    JSONObject jsonObject = object.getJSONObject("param");
                    if (object.getString("respCode").equalsIgnoreCase("000000")){
                        String traceNo = jsonObject.getString("traceNo");
                        businessOrderDO.setTraceNo(traceNo);
                        businessOrderDao.save(businessOrderDO);
                    }
                }
            }
        }
        return response;
    }
    /**
     * 咨询退费
     * @param consult

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

@ -22,7 +22,6 @@ public interface BusinessOrderDao extends PagingAndSortingRepository<BusinessOrd
    @Query("from BusinessOrderDO w where w.relationCode = ?1 ")
    BusinessOrderDO selectByRelationCode(String relationCode);
    @Query("from BusinessOrderDO w where w.relationCode = ?1 order by createTime desc ")
    List<BusinessOrderDO> selectListByRelationCode(String relationCode);

+ 2 - 2
business/base-service/src/main/java/com/yihu/jw/utils/YkyySMSService.java

@ -38,9 +38,9 @@ import java.util.Map;
@Service
public class YkyySMSService {
    private static final Logger logger = LoggerFactory.getLogger(YkyySMSService.class);
    private final String usrCode ="300643";
    private final String usrCode ="301312";
    private final String pw ="T9IHN69DDF";
    private final String pw ="3PRCADHD2M";
    private final String urlSms ="https://smsapp.wlwx.com";
    private final static String url="http://192.168.20.55:10023/ykyy/createSQLQuery";

+ 4 - 0
business/base-service/src/mqConfig/esbmq-config.xml

@ -97,6 +97,10 @@
				<BS15051_0>EwellQ.S60.BS15051.PUT</BS15051_0>
				<BS15051_1>EwellQ.S60.BS15051.GET</BS15051_1>
				<!--his确认结算接口-->
				<BS15039_0>EwellQ.S60.BS15039.PUT</BS15039_0>
				<BS15039_1>EwellQ.S60.BS15039.GET</BS15039_1>
				<!--检查检验start-->
				<BS20030_0>EwellQ.S60.BS20030.PUT</BS20030_0>
				<BS20030_1>EwellQ.S60.BS20030.GET</BS20030_1>

+ 234 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/healthCare/YlzMedicalRelationDO.java

@ -65,6 +65,96 @@ public class YlzMedicalRelationDO extends UuidIdentityEntity {
    private Date createTime;//创建时间',
    private String detailSerial;//医保明细流水号
    private Integer status;//结算状态
    private String diseaseCode;//病种编码
    private String treatmentType;//人员待遇类别
    private String treatmentTypeName;//人员待遇类别名称
    private String treatmentStatus;//医疗待遇状态
    private String treatmentStatusName;//医疗待遇状态名称
    private String allopatryType;//异地就医类型
    private String allopatryTypeName;//异地就医类型名称
    private String administrativeArea;//参保地行政区划
    private String payStandard;//统筹支付医保费用起付标准
    private String tcjjPay;//其中:统筹基金支付
    private String sbjjPay;//其中:商保基金支付(大额补充)
    private String gwyPay;//其中:公务员医疗补助
    private String jzfpPay;//其中:精准扶贫医疗叠加
    private String yljzPay;//其中:医疗救助基金
    private String otherPay;//其中:其他基金支付
    private String enterpriseSupplement;//其中:企业补充
    private String jtgjPay;//家庭共济账户支付
    private String collector;//收费人
    private String pageCode;//结算code
    private String insuranceType;//险种类型(医保类型)
    private String insuranceTypeName;//险种类型名称
    private Integer state;//his结算状态(1结算0未结算)
    private Integer medicalState;//0自费1医保
    private String hisDesc;//his结算描述
    private String balance;//预交金余额
    private String medicalPrice;//医保基金总额
    public String getMedicalPrice() {
        return medicalPrice;
    }
    public void setMedicalPrice(String medicalPrice) {
        this.medicalPrice = medicalPrice;
    }
    public String getBalance() {
        return balance;
    }
    public void setBalance(String balance) {
        this.balance = balance;
    }
    public String getHisDesc() {
        return hisDesc;
    }
    public void setHisDesc(String hisDesc) {
        this.hisDesc = hisDesc;
    }
    public Integer getMedicalState() {
        return medicalState;
    }
    public void setMedicalState(Integer medicalState) {
        this.medicalState = medicalState;
    }
    public Integer getState() {
        return state;
    }
    public void setState(Integer state) {
        this.state = state;
    }
    public String getInsuranceType() {
        return insuranceType;
    }
    public void setInsuranceType(String insuranceType) {
        this.insuranceType = insuranceType;
    }
    public String getInsuranceTypeName() {
        return insuranceTypeName;
    }
    public void setInsuranceTypeName(String insuranceTypeName) {
        this.insuranceTypeName = insuranceTypeName;
    }
    public String getPageCode() {
        return pageCode;
    }
    public void setPageCode(String pageCode) {
        this.pageCode = pageCode;
    }
    public Integer getStatus() {
        return status;
@ -485,4 +575,148 @@ public class YlzMedicalRelationDO extends UuidIdentityEntity {
    public void setDoctorLevel(String doctorLevel) {
        this.doctorLevel = doctorLevel;
    }
    public String getDiseaseCode() {
        return diseaseCode;
    }
    public void setDiseaseCode(String diseaseCode) {
        this.diseaseCode = diseaseCode;
    }
    public String getTreatmentType() {
        return treatmentType;
    }
    public void setTreatmentType(String treatmentType) {
        this.treatmentType = treatmentType;
    }
    public String getTreatmentTypeName() {
        return treatmentTypeName;
    }
    public void setTreatmentTypeName(String treatmentTypeName) {
        this.treatmentTypeName = treatmentTypeName;
    }
    public String getTreatmentStatus() {
        return treatmentStatus;
    }
    public void setTreatmentStatus(String treatmentStatus) {
        this.treatmentStatus = treatmentStatus;
    }
    public String getTreatmentStatusName() {
        return treatmentStatusName;
    }
    public void setTreatmentStatusName(String treatmentStatusName) {
        this.treatmentStatusName = treatmentStatusName;
    }
    public String getAllopatryType() {
        return allopatryType;
    }
    public void setAllopatryType(String allopatryType) {
        this.allopatryType = allopatryType;
    }
    public String getAllopatryTypeName() {
        return allopatryTypeName;
    }
    public void setAllopatryTypeName(String allopatryTypeName) {
        this.allopatryTypeName = allopatryTypeName;
    }
    public String getAdministrativeArea() {
        return administrativeArea;
    }
    public void setAdministrativeArea(String administrativeArea) {
        this.administrativeArea = administrativeArea;
    }
    public String getPayStandard() {
        return payStandard;
    }
    public void setPayStandard(String payStandard) {
        this.payStandard = payStandard;
    }
    public String getTcjjPay() {
        return tcjjPay;
    }
    public void setTcjjPay(String tcjjPay) {
        this.tcjjPay = tcjjPay;
    }
    public String getSbjjPay() {
        return sbjjPay;
    }
    public void setSbjjPay(String sbjjPay) {
        this.sbjjPay = sbjjPay;
    }
    public String getGwyPay() {
        return gwyPay;
    }
    public void setGwyPay(String gwyPay) {
        this.gwyPay = gwyPay;
    }
    public String getJzfpPay() {
        return jzfpPay;
    }
    public void setJzfpPay(String jzfpPay) {
        this.jzfpPay = jzfpPay;
    }
    public String getYljzPay() {
        return yljzPay;
    }
    public void setYljzPay(String yljzPay) {
        this.yljzPay = yljzPay;
    }
    public String getOtherPay() {
        return otherPay;
    }
    public void setOtherPay(String otherPay) {
        this.otherPay = otherPay;
    }
    public String getEnterpriseSupplement() {
        return enterpriseSupplement;
    }
    public void setEnterpriseSupplement(String enterpriseSupplement) {
        this.enterpriseSupplement = enterpriseSupplement;
    }
    public String getJtgjPay() {
        return jtgjPay;
    }
    public void setJtgjPay(String jtgjPay) {
        this.jtgjPay = jtgjPay;
    }
    public String getCollector() {
        return collector;
    }
    public void setCollector(String collector) {
        this.collector = collector;
    }
}

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

@ -57,6 +57,7 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    private String historyOrder;
    private String depositType; //原充值类型
    @Column(name = "history_order")
    public String getHistoryOrder() {
        return historyOrder;

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

@ -496,6 +496,7 @@ public class BaseHospitalRequestMapping {
        public static final String selectOrderByRelationCode = "/selectOrderByRelationCode";
        public static final String ylzRechargeJson="ylzRechargeJson";
        public static final String ylzRechargePre="ylzRechargePre";
        public static final String yktMedicalCardTopUp="/yktMedicalCardTopUp";

+ 515 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyHisSettleVO.java

@ -0,0 +1,515 @@
package com.yihu.jw.restmodel.hospital.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionEmrDO;
import com.yihu.jw.restmodel.UuidIdentityVOWithOperator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import java.util.List;
/**
 * 
 * 在线结算确认实体VO
 *
 *
 *
 */
@ApiModel(value = "WlyyHisSettleVO", description = "在线结算确认")
public class WlyyHisSettleVO extends UuidIdentityVOWithOperator {
    /**
     * 患者卡号
     */
    @ApiModelProperty(value = "患者卡号", example = "患者卡号")
    private String cardNo;
    /**
     * HIS 系统跟踪号
     */
    @ApiModelProperty(value = "HIS 系统跟踪号",example = "HIS 系统跟踪号")
    private String xtgzh0;
    /**
     * 机构编号(医院编号)
     */
    @ApiModelProperty(value = "机构编号(医院编号)",example = "机构编号(医院编号)")
    private String orgCode;
    /**
     * 充值方式(自费金额支付方式)
     */
    @ApiModelProperty(value = "充值方式(自费金额支付方式)",example = "充值方式(自费金额支付方式)")
    private String depositType;
    /**
     * 充值金额
     */
    @ApiModelProperty(value = "充值金额",example = "充值金额")
    private String depositAmount;
    /**
     * 信用支付 0-否 1-是
     */
    @ApiModelProperty(value = "信用支付 0-否 1-是",example = "信用支付 0-否 1-是")
    private String xyzf00;
    /**
     * 渠道类型
     */
    @ApiModelProperty(value = "渠道类型",example = "渠道类型")
    private String channelType;
    /**
     * 平台结算流水号
     */
    @ApiModelProperty(value = "平台结算流水号",example = "平台结算流水号")
    private String outChargeNo;
    /**
     * 单据流水号(医保收费流水号)
     */
    @ApiModelProperty(value = "单据流水号(医保收费流水号)",example = "单据流水号(医保收费流水号)")
    private String djlsh0;
    /**
     * 门诊流水号(医保挂号流水号)
     */
    @ApiModelProperty(value = "门诊流水号(医保挂号流水号)",example = "门诊流水号(医保挂号流水号)")
    private String mzlsh0;
    /**
     * 帐户支付额
     */
    @ApiModelProperty(value = "帐户支付额",example = "帐户支付额")
    private String zhzfe0;
    /**
     * 个人支付额
     */
    @ApiModelProperty(value = "个人支付额",example = "个人支付额")
    private String grzfe0;
    /**
     * 基金支付额
     */
    @ApiModelProperty(value = "基金支付额",example = "基金支付额")
    private String jjzfe0;
    /**
     * 公务员补助
     */
    @ApiModelProperty(value = "公务员补助",example = "公务员补助")
    private String gwybz0;
    /**
     * 非医保费用
     */
    @ApiModelProperty(value = "非医保费用",example = "非医保费用")
    private String fybfy0;
    /**
     * 超封顶线金额
     */
    @ApiModelProperty(value = "超封顶线金额",example = "超封顶线金额")
    private String cfdxje;
    /**
     * 保健基金支付
     */
    @ApiModelProperty(value = "保健基金支付",example = "保健基金支付")
    private String bjjjzf;
    /**
     * 本次报销总额
     */
    @ApiModelProperty(value = "本次报销总额",example = "本次报销总额")
    private String bcbxf0;
    /**
     * 收费日期
     */
    @ApiModelProperty(value = "收费日期",example = "收费日期")
    private String sfrq00;
    /**
     * 收费时间
     */
    @ApiModelProperty(value = "收费时间",example = "收费时间")
    private String sfsj00;
    /**
     * 收费人姓名
     */
    @ApiModelProperty(value = "收费人姓名",example = "收费人姓名")
    private String sfrxm0;
    /**
     * 医保帐户余额
     */
    @ApiModelProperty(value = "医保帐户余额",example = "医保帐户余额")
    private String grzhye;
    /**
     * 乙类支付额
     */
    @ApiModelProperty(value = "乙类支付额",example = "乙类支付额")
    private String ylzfje;
    /**
     * 健康账户支付
     */
    @ApiModelProperty(value = "健康账户支付",example = "健康账户支付")
    private String jkzhzf;
    /**
     * 健康账户余额
     */
    @ApiModelProperty(value = "健康账户余额",example = "健康账户余额")
    private String jkzhye;
    /**
     * 医保明细上传流水号
     */
    @ApiModelProperty(value = "医保明细上传流水号",example = "医保明细上传流水号")
    private String ybmxls;
    /**
     * 对账数据分类
     */
    @ApiModelProperty(value = "对账数据分类",example = "对账数据分类")
    private String dzsjfl;
    /**
     * 商业保险支付
     */
    @ApiModelProperty(value = "商业保险支付",example = "商业保险支付")
    private String sybxzf;
    /**
     * 本地共计账户支付
     */
    @ApiModelProperty(value = "本地共计账户支付",example = "本地共计账户支付")
    private String bdgjzf;
    /**
     * 异地共计账户支付
     */
    @ApiModelProperty(value = "异地共计账户支付",example = "异地共计账户支付")
    private String ydgjzf;
    /**
     * 本次看病次数
     */
    @ApiModelProperty(value = "本次看病次数",example = "本次看病次数")
    private String bckbcs;
    /**
     * 补助基金支付
     */
    @ApiModelProperty(value = "补助基金支付",example = "补助基金支付")
    private String bzjjzf;
    /**
     * 人员编号
     */
    @ApiModelProperty(value = "人员编号",example = "人员编号")
    private String psnNo;
    /**
     * 参保地行政区号
     */
    @ApiModelProperty(value = "参保地行政区号",example = "参保地行政区号")
    private String aab301;
    /**
     * 险种
     */
    @ApiModelProperty(value = "险种",example = "险种")
    private String insutype;
    public String getPsnNo() {
        return psnNo;
    }
    public void setPsnNo(String psnNo) {
        this.psnNo = psnNo;
    }
    public String getAab301() {
        return aab301;
    }
    public void setAab301(String aab301) {
        this.aab301 = aab301;
    }
    public String getInsutype() {
        return insutype;
    }
    public void setInsutype(String insutype) {
        this.insutype = insutype;
    }
    public String getBzjjzf() {
        return bzjjzf;
    }
    public void setBzjjzf(String bzjjzf) {
        this.bzjjzf = bzjjzf;
    }
    public String getCardNo() {
        return cardNo;
    }
    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }
    public String getXtgzh0() {
        return xtgzh0;
    }
    public void setXtgzh0(String xtgzh0) {
        this.xtgzh0 = xtgzh0;
    }
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    public String getDepositType() {
        return depositType;
    }
    public void setDepositType(String depositType) {
        this.depositType = depositType;
    }
    public String getDepositAmount() {
        return depositAmount;
    }
    public void setDepositAmount(String depositAmount) {
        this.depositAmount = depositAmount;
    }
    public String getXyzf00() {
        return xyzf00;
    }
    public void setXyzf00(String xyzf00) {
        this.xyzf00 = xyzf00;
    }
    public String getChannelType() {
        return channelType;
    }
    public void setChannelType(String channelType) {
        this.channelType = channelType;
    }
    public String getOutChargeNo() {
        return outChargeNo;
    }
    public void setOutChargeNo(String outChargeNo) {
        this.outChargeNo = outChargeNo;
    }
    public String getDjlsh0() {
        return djlsh0;
    }
    public void setDjlsh0(String djlsh0) {
        this.djlsh0 = djlsh0;
    }
    public String getMzlsh0() {
        return mzlsh0;
    }
    public void setMzlsh0(String mzlsh0) {
        this.mzlsh0 = mzlsh0;
    }
    public String getZhzfe0() {
        return zhzfe0;
    }
    public void setZhzfe0(String zhzfe0) {
        this.zhzfe0 = zhzfe0;
    }
    public String getGrzfe0() {
        return grzfe0;
    }
    public void setGrzfe0(String grzfe0) {
        this.grzfe0 = grzfe0;
    }
    public String getJjzfe0() {
        return jjzfe0;
    }
    public void setJjzfe0(String jjzfe0) {
        this.jjzfe0 = jjzfe0;
    }
    public String getGwybz0() {
        return gwybz0;
    }
    public void setGwybz0(String gwybz0) {
        this.gwybz0 = gwybz0;
    }
    public String getFybfy0() {
        return fybfy0;
    }
    public void setFybfy0(String fybfy0) {
        this.fybfy0 = fybfy0;
    }
    public String getCfdxje() {
        return cfdxje;
    }
    public void setCfdxje(String cfdxje) {
        this.cfdxje = cfdxje;
    }
    public String getBjjjzf() {
        return bjjjzf;
    }
    public void setBjjjzf(String bjjjzf) {
        this.bjjjzf = bjjjzf;
    }
    public String getSybxzf() {
        return sybxzf;
    }
    public void setSybxzf(String sybxzf) {
        this.sybxzf = sybxzf;
    }
    public String getBdgjzf() {
        return bdgjzf;
    }
    public void setBdgjzf(String bdgjzf) {
        this.bdgjzf = bdgjzf;
    }
    public String getYdgjzf() {
        return ydgjzf;
    }
    public void setYdgjzf(String ydgjzf) {
        this.ydgjzf = ydgjzf;
    }
    public String getBckbcs() {
        return bckbcs;
    }
    public void setBckbcs(String bckbcs) {
        this.bckbcs = bckbcs;
    }
    public String getBcbxf0() {
        return bcbxf0;
    }
    public void setBcbxf0(String bcbxf0) {
        this.bcbxf0 = bcbxf0;
    }
    public String getSfrq00() {
        return sfrq00;
    }
    public void setSfrq00(String sfrq00) {
        this.sfrq00 = sfrq00;
    }
    public String getSfsj00() {
        return sfsj00;
    }
    public void setSfsj00(String sfsj00) {
        this.sfsj00 = sfsj00;
    }
    public String getSfrxm0() {
        return sfrxm0;
    }
    public void setSfrxm0(String sfrxm0) {
        this.sfrxm0 = sfrxm0;
    }
    public String getGrzhye() {
        return grzhye;
    }
    public void setGrzhye(String grzhye) {
        this.grzhye = grzhye;
    }
    public String getYlzfje() {
        return ylzfje;
    }
    public void setYlzfje(String ylzfje) {
        this.ylzfje = ylzfje;
    }
    public String getJkzhzf() {
        return jkzhzf;
    }
    public void setJkzhzf(String jkzhzf) {
        this.jkzhzf = jkzhzf;
    }
    public String getJkzhye() {
        return jkzhye;
    }
    public void setJkzhye(String jkzhye) {
        this.jkzhye = jkzhye;
    }
    public String getYbmxls() {
        return ybmxls;
    }
    public void setYbmxls(String ybmxls) {
        this.ybmxls = ybmxls;
    }
    public String getDzsjfl() {
        return dzsjfl;
    }
    public void setDzsjfl(String dzsjfl) {
        this.dzsjfl = dzsjfl;
    }
}

+ 4 - 2
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/XzzxCotroller.java

@ -738,9 +738,11 @@ public class XzzxCotroller extends EnvelopRestEndpoint {
                                    @ApiParam(name = "his_serial", value = "HIS挂号号", required = false)
                                    @RequestParam(value = "his_serial",required = false) String his_serial,
                                    @ApiParam(name = "org_code", value = "医院编码", required = false)
                                    @RequestParam(value = "org_code",required = false) String org_code)throws Exception{
                                    @RequestParam(value = "org_code",required = false) String org_code,
                                    @ApiParam(name = "outpatientId", value = "patientId", required = false)
                                        @RequestParam(value = "outpatientId",required = false) String outpatientId)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.confirmSettle(his_serial,icCardNo,org_code));
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.confirmSettle(his_serial,icCardNo,org_code,outpatientId));
    }
    /**

+ 21 - 21
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/healthCare/HealthCareEndPoint.java

@ -152,32 +152,32 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    @GetMapping(value = "/register")
    @ApiOperation(value = "2.5.1医保挂号(N20.17.04.01)", notes = "2.5.1医保挂号(N20.17.04.01)")
    public ObjEnvelop register(@ApiParam(name = "registerNo", value = "挂号号", required = true)
                               @RequestParam(value = "registerNo", required = true)String registerNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.register(registerNo));
    public ObjEnvelop register(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                               @RequestParam(value = "outpatientId", required = true)String outpatientId)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.register(outpatientId));
    }
    @GetMapping(value = "/registerBack")
    @ApiOperation(value = " 2.5.2医保挂号冲销(N20.17.04.02)", notes = " 2.5.2医保挂号冲销(N20.17.04.02)")
    public ObjEnvelop registerBack(@ApiParam(name = "registerNo", value = "挂号号", required = true)
                                   @RequestParam(value = "registerNo", required = true)String registerNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.registerBack(registerNo));
    public ObjEnvelop registerBack(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                   @RequestParam(value = "outpatientId", required = true)String outpatientId)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.registerBack(outpatientId));
    }
    @GetMapping(value = "/feeDetailUpload")
    @ApiOperation(value = " 2.5.3医保费用明细上传(N20.17.04.03)", notes = " 2.5.3医保费用明细上传(N20.17.04.03)")
    public ObjEnvelop feeDetailUpload(@ApiParam(name = "registerNo", value = "挂号号", required = true)
                                      @RequestParam(value = "registerNo", required = true)String registerNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.feeDetailUpload(registerNo));
    public ObjEnvelop feeDetailUpload(@ApiParam(name = "outpatientId", value = "挂号号", required = true)
                                      @RequestParam(value = "outpatientId", required = true)String outpatientId)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.feeDetailUpload(outpatientId));
    }
    @GetMapping(value = "/feeDetailRefund")
    @ApiOperation(value = " 2.5.4医保费用明细上传冲销(N20.17.04.04)", notes = " 2.5.4医保费用明细上传冲销(N20.17.04.04)")
    public ObjEnvelop feeDetailRefund(@ApiParam(name = "registerNo", value = "挂号号", required = true)
                                      @RequestParam(value = "registerNo", required = false)String registerNo,
    public ObjEnvelop feeDetailRefund(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                      @RequestParam(value = "outpatientId", required = false)String outpatientId,
                                      @ApiParam(name = "remark", value = "作废原因", required = false)
                                      @RequestParam(value = "remark", required = true)String remark)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.feeDetailRefund(registerNo,remark));
        return ObjEnvelop.getSuccess("ok",healthCareService.feeDetailRefund(outpatientId,remark));
    }
    @GetMapping(value = "/preSettlement")
@ -189,23 +189,23 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    @GetMapping(value = "/preSettlementRefund")
    @ApiOperation(value = " 2.5.6医保结算冲销服务(N20.17.04.06)", notes = " 2.5.6医保结算冲销服务(N20.17.04.06)")
    public ObjEnvelop preSettlementRefund(@ApiParam(name = "registerNo", value = "门诊id", required = true)
                                          @RequestParam(value = "registerNo", required = false)String registerNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.preSettlementRefund(registerNo));
    public ObjEnvelop preSettlementRefund(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                          @RequestParam(value = "outpatientId", required = false)String outpatientId)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.preSettlementRefund(outpatientId));
    }
    @GetMapping(value = "/getSettlementResultUrl")
    @ApiOperation(value = " 2.5.7获取医保结算页面地址(N20.17.04.07)", notes = " 2.5.7获取医保结算页面地址(N20.17.04.07)")
    public ObjEnvelop getSettlementResultUrl(@ApiParam(name = "registerNo", value = "门诊id", required = true)
                                             @RequestParam(value = "registerNo", required = false)String registerNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.getSettlementResultUrl(registerNo));
    public ObjEnvelop getSettlementResultUrl(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                             @RequestParam(value = "outpatientId", required = false)String outpatientId)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.getSettlementResultUrl(outpatientId));
    }
    @GetMapping(value = "/getSettlementResultUrlBase64")
    @ApiOperation(value = " 2.5.7获取医保结算页面地址(N20.17.04.08)", notes = " 2.5.7获取医保结算页面地址(N20.17.04.08)")
    public ObjEnvelop getSettlementResultUrlBase64(@ApiParam(name = "registerNo", value = "门诊id", required = true)
                                             @RequestParam(value = "registerNo", required = false)String registerNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.getSettlementResultUrlBase64(registerNo));
    public ObjEnvelop getSettlementResultUrlBase64(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                             @RequestParam(value = "outpatientId", required = false)String outpatientId)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.getSettlementResultUrlBase64(outpatientId));
    }
    @GetMapping(value = "/getSettlementResult")

+ 1 - 1
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/UnSettledHISPrescriptionService.java

@ -283,7 +283,7 @@ public class UnSettledHISPrescriptionService {
                                wxPushLogDao.save(wxPushLogDO);
                                WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
                                wlyyPrescriptionDO.setPrescribeTime(new Date());
                                wlyyPrescriptionDO.setCheckStatus(0);
                                wlyyPrescriptionDO.setCheckStatus(2);
                                wlyyPrescriptionDO.setCheckReason("审核通过");
                                prescriptionDao.save(wlyyPrescriptionDO);
                                JSONObject object = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDO);

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

@ -20,6 +20,7 @@ import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.*;
@ -31,6 +32,7 @@ import com.yihu.jw.es.service.yqfk.YqfkService;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleUserDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.healthCare.YlzMedicailRelationDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.httplog.service.WlyyHttpLogService;
import com.yihu.jw.hospital.message.service.BaseBannerDoctorService;
@ -94,6 +96,7 @@ import org.apache.poi.util.IOUtils;
import org.apache.tomcat.util.http.fileupload.FileItem;
import org.apache.tomcat.util.http.fileupload.FileItemFactory;
import org.apache.tomcat.util.http.fileupload.disk.DiskFileItemFactory;
import org.hibernate.validator.constraints.SafeHtml;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -246,6 +249,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private String remote_inner_url;
    @Autowired
    private WechatInfoService wechatInfoService;
    @Autowired
    private YlzMedicailRelationDao ylzMedicailRelationDao;
@ -729,6 +734,9 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                            systemMessageDO.setSender(businessOrderDO.getPatient());
                            //发送IM消息
                            hospitalSystemMessageService.sendImMessage(systemMessageDO);
                        }else if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("6")){
                            YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findOne(businessOrderDO.getRelationCode());
                            prescriptionService.confirmSettlementService(ylzMedicalRelationDO.getRelationCode());
                        }
                    }
                    businessOrderService.updatePayStatus(traceNo);
@ -1158,7 +1166,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                //判断处方
                                List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByRealOrderList(waitPayDetailVO.getRecipeNo());
                                for (WlyyPrescriptionDO prescriptionDO:prescriptionDOList){
                                    if (prescriptionDO.getStatus()!=30){
                                    if (prescriptionDO.getStatus()!=30&&prescriptionDO.getStatus()>=20){
                                        String fee=null;
                                        String title = null;
                                        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
@ -1190,6 +1198,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                        prescriptionLogDO.setUserType(1);
                                        prescriptionLogDO.setDatajson("处方结算");
                                        prescriptionLogDao.save(prescriptionLogDO);
                                        prescriptionService.electronicPrescriptionReceiving(wlyyOutpatientDO.getId());
                                        BusinessOrderDO orderDO = businessOrderDao.selectByRelationCode(prescriptionDO.getId());
                                        orderDO.setStatus(1);
                                        businessOrderDao.save(orderDO);
@ -1289,6 +1298,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                                logger.info("更新门诊结算状态");
                                            }
                                        }
                                        prescriptionService.electronicPrescriptionReceiving(wlyyOutpatientDO.getId());
                                    }else {
                                        WlyyOutpatientDO wlyyOutpatientDO1 = outpatientDao.findByRealOrder(waitPayDetailVO.getRecipeNo());
                                        if (wlyyOutpatientDO1!=null){
@ -1299,6 +1309,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                    }
                                }
                                prescriptionDao.updateStatusByRealOrder(waitPayDetailVO.getRecipeNo(),30,new Date());
                            }
                            logger.info("更新系统处方支付状态");
                        }

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

@ -2131,6 +2131,31 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        }
    }
    /**
     * 结算预交金充值
     *
     * @param relationCode
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.ylzRechargePre)
    @ApiOperation("统一支付--预交金支付")
    public ObjEnvelop ylzRechargePre(
            @ApiParam(name = "relationCode", value = "relationCode", required = true)
            @RequestParam(required = true) String relationCode,
            @ApiParam(name = "depositType", value = "depositType", required = true)
            @RequestParam(required = true) String depositType,
            @ApiParam(name = "cardType", value = "cardType", required = true)
            @RequestParam(required = true) String cardType,
            @ApiParam(name = "cardNo", value = "cardNo", required = true)
            @RequestParam(required = true) String cardNo) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok", businessOrderService.ylzRechargePre(relationCode, depositType, wxId, cardType, cardNo, demoFlag));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 充值卡一支付
@ -3618,5 +3643,30 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping("/confirmSettlement")
    @ApiOperation(value = "确认费用结算", notes = "确认费用结算")
    public Envelop confirmSettlement(
            @ApiParam(name = "outpatientId", value = "outpatientId")
            @RequestParam(value = "outpatientId", required = false) String outpatientId) throws Exception {
        try {
            return success("操作成功", prescriptionService.confirmSettlement(outpatientId));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping("/confirmSettlementService")
    @ApiOperation(value = "确认费用结算", notes = "确认费用结算")
    public Envelop confirmSettlementService(
            @ApiParam(name = "outpatientId", value = "outpatientId")
            @RequestParam(value = "outpatientId", required = false) String outpatientId) throws Exception {
        try {
            return success("操作成功", prescriptionService.confirmSettlementService(outpatientId));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
    }
}