Prechádzať zdrojové kódy

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

humingfen 5 rokov pred
rodič
commit
3de7f7e08a
51 zmenil súbory, kde vykonal 2303 pridanie a 323 odobranie
  1. 5 0
      business/base-service/src/main/java/com/yihu/jw/dict/dao/DictDoctorDutyDao.java
  2. 81 38
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  3. 21 4
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  4. 317 165
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java
  5. 44 17
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  6. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java
  7. 248 9
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  8. 8 0
      business/base-service/src/main/java/com/yihu/jw/order/dao/BusinessOrderDao.java
  9. 1 1
      business/base-service/src/main/java/com/yihu/jw/order/dao/BusinessOrderRefundDao.java
  10. 28 0
      business/base-service/src/main/java/com/yihu/jw/order/dao/ConsultTeamOrderDao.java
  11. 17 0
      business/base-service/src/main/java/com/yihu/jw/order/dao/PayLogDao.java
  12. 52 0
      business/base-service/src/main/java/com/yihu/jw/order/pay/utils/PayLogService.java
  13. 228 0
      business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java
  14. 72 0
      business/base-service/src/main/java/com/yihu/jw/utils/ByteToInputStream.java
  15. 127 0
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java
  16. 48 12
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  17. 3 3
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  18. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/DoctorSpecialDiseaseDo.java
  19. 9 9
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/message/IotMessageDO.java
  20. 12 2
      common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java
  21. 182 0
      common/common-entity/src/main/java/com/yihu/jw/entity/order/PayLog.java
  22. 11 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  23. 11 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionVO.java
  24. 76 8
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  25. 125 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyYkyyEndpoint.java
  26. 10 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/YkyyService.java
  27. 93 5
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/XzzxCotroller.java
  28. 40 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/ykyy/UpdateStatusByPayTimeJob.java
  29. 14 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java
  30. 1 1
      svr/svr-internet-hospital-job/src/main/resources/application.yml
  31. 1 0
      svr/svr-internet-hospital-job/src/main/resources/system.properties
  32. 21 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/Xzyy/XzyyController.java
  33. 4 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  34. 3 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  35. 67 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  36. 96 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  37. 13 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java
  38. 4 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ykyy/YkyyController.java
  39. 167 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ylz/YlzNotifyController.java
  40. 3 3
      svr/svr-internet-hospital/src/main/resources/application.yml
  41. 3 3
      svr/svr-iot-job/src/main/java/com/yihu/jw/service/device/DeviceQualityPlanService.java
  42. 6 6
      svr/svr-iot-job/src/main/java/com/yihu/jw/service/device/SimBalanceService.java
  43. 3 3
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceSimController.java
  44. 1 2
      svr/svr-iot/src/main/java/com/yihu/iot/controller/IotMessageService/IotMessageController.java
  45. 3 3
      svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceAuditController.java
  46. 6 6
      svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java
  47. 4 4
      svr/svr-iot/src/main/java/com/yihu/iot/controller/workType/IotWorkTypeController.java
  48. 0 2
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceQualityInspectionPlanService.java
  49. 2 2
      svr/svr-iot/src/main/java/com/yihu/iot/service/message/IotMessageService.java
  50. 5 2
      svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotCompanyAppInterfaceService.java
  51. 4 2
      svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotInterfaceAuditService.java

+ 5 - 0
business/base-service/src/main/java/com/yihu/jw/dict/dao/DictDoctorDutyDao.java

@ -1,9 +1,12 @@
package com.yihu.jw.dict.dao;
package com.yihu.jw.dict.dao;
import com.yihu.jw.entity.base.dict.DictDoctorDutyDO;
import com.yihu.jw.entity.base.dict.DictDoctorDutyDO;
import org.hibernate.validator.constraints.EAN;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
/**
 * 
 * 
@ -22,4 +25,6 @@ public interface DictDoctorDutyDao extends PagingAndSortingRepository<DictDoctor
    boolean existsByCode(String code);
    boolean existsByCode(String code);
    DictDoctorDutyDO findByCode(String code);
    DictDoctorDutyDO findByCode(String code);
    List<DictDoctorDutyDO> findByName(String name);
}
}

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

@ -71,6 +71,7 @@ import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.JSONObject;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -176,6 +177,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private BusinessOrderService businessOrderService;
    private BusinessOrderService businessOrderService;
    @Autowired
    @Autowired
    private YkyyService ykyyService;
    private YkyyService ykyyService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Value("${demo.flag}")
    @Value("${demo.flag}")
@ -342,9 +345,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " o.adm_date AS \"admDate\", " +
                " o.adm_date AS \"admDate\", " +
                " o.con_date AS \"conDate\", " +
                " o.con_date AS \"conDate\", " +
                " o.description AS \"description\", " +
                " o.description AS \"description\", " +
                " o.disease_img AS \"diseaseImg\", " +
                " o.create_time AS \"createTime\", " +
                " o.status AS \"status\"," +
                " o.disease_img AS \"diseaseImg\", ";
        if("xm_ykyy_wx".equals(wechatId)){
            sql= sql +"to_char(o.create_time ,'yyyy-MM-dd hh24:mi:ss' ) AS \"createTime\"," ;
        }else{
            sql= sql +  "date_format(o.create_time ,'%Y-%m-%d %H:%i:%S' ) AS createTime," ;
        }
        sql= sql+    " o.status AS \"status\"," +
                condition+
                condition+
              /*  " o.register_date AS \"registerDate\"," +*/
              /*  " o.register_date AS \"registerDate\"," +*/
                " o.evaluate_status AS \"evaluateStatus\"," +
                " o.evaluate_status AS \"evaluateStatus\"," +
@ -434,15 +441,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }else{
        }else{
            rs.put("expressage",null);
            rs.put("expressage",null);
        }
        }
/*
      /*  //物流配送新
        //物流配送新
        List<WlyyPrescriptionExpressageLogDO>  expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(outpatientId);
        List<WlyyPrescriptionExpressageLogDO>  expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(outpatientId);
        List<WlyyPrescriptionExpressageLogVO> expressageLogVOs = new ArrayList<>();
        List<WlyyPrescriptionExpressageLogVO> expressageLogVOs = new ArrayList<>();
        if(expressageLogDOs!=null&&expressageLogDOs.size()>0){
        if(expressageLogDOs!=null&&expressageLogDOs.size()>0){
            rs.put("expressageLogs",convertToModels(expressageLogDOs,expressageLogVOs, WlyyPrescriptionExpressageLogVO.class));
            rs.put("expressageLogs",convertToModels(expressageLogDOs,expressageLogVOs, WlyyPrescriptionExpressageLogVO.class));
        }else{
        }else{
            rs.put("expressageLogs",null);
            rs.put("expressageLogs",null);
        }*/
        }
*/
        //预约记录
        //预约记录
        List<WlyyPatientRegisterTimeDO> timeDOs = patientRegisterTimeDao.findByOutpatientId(outpatientId);
        List<WlyyPatientRegisterTimeDO> timeDOs = patientRegisterTimeDao.findByOutpatientId(outpatientId);
@ -627,6 +636,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        outpatientDO.setIdcard(patientDO.getIdcard());
        outpatientDO.setIdcard(patientDO.getIdcard());
        outpatientDO.setOutpatientType("1");
        outpatientDO.setOutpatientType("1");
        outpatientDO.setCreateTime(new Date());
        outpatientDO.setCreateTime(new Date());
        outpatientDO.setPayStatus(0);
        if(outpatientDO.getRegisterDate()==null){
        if(outpatientDO.getRegisterDate()==null){
            outpatientDO.setRegisterDate(new Date());
            outpatientDO.setRegisterDate(new Date());
@ -634,6 +644,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        Double price = 0.01;
        businessOrderService.recharge(outpatient.getId(),"复诊-诊查费","2","复诊-诊查费",patientDO.getId(),patientDO.getName(),outpatient.getDoctor(),price);
        WlyyPatientRegisterTimeDO registerTimeDO = null;
        WlyyPatientRegisterTimeDO registerTimeDO = null;
        try {
        try {
@ -1655,7 +1669,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public JSONArray getICD10(String pyKey) throws Exception {
    public JSONArray getICD10(String pyKey) throws Exception {
        return entranceService.MS25001(pyKey, demoFlag);
        return entranceService.MS25001(pyKey, demoFlag);
    }
    }
    /**
    /**
     * 获取药品
     * 获取药品
     *
     *
@ -1812,6 +1825,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        prescriptionDO.setPatientName(outpatientDO.getPatientName());
        prescriptionDO.setPatientName(outpatientDO.getPatientName());
        prescriptionDO.setDoctor(outpatientDO.getDoctor());
        prescriptionDO.setDoctor(outpatientDO.getDoctor());
        prescriptionDO.setDoctorName(outpatientDO.getDoctorName());
        prescriptionDO.setDoctorName(outpatientDO.getDoctorName());
        prescriptionDO.setPayStatus(0);
        if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
        if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
            prescriptionDO.setAdmNo(outpatientDO.getAdmNo());
            prescriptionDO.setAdmNo(outpatientDO.getAdmNo());
        }
        }
@ -1929,22 +1943,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
            if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                outpatientDO.setStatus("2");
                outpatientDO.setStatus("2");
                outpatientDao.save(outpatientDO);
                outpatientDao.save(outpatientDO);
                BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                BusinessOrderDO businessOrderDO1 = businessOrderDao.selectByRelationCode(prescription.getId());
                //先下单
                businessOrderService.savePrescriptionOrder(prescription.getId());
                //同步his
                ykyyEntranceService.findByRealOrder(prescription.getId());
                ykyyEntranceService.findByRealOrder(prescription.getId());
                List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findById(prescription.getId());
                List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findById(prescription.getId());
                businessOrderService.savePrescriptionOrder(prescription.getId());
                if(prescriptionDOList!=null&&prescriptionDOList.size()!=0){
                if(prescriptionDOList!=null&&prescriptionDOList.size()!=0){
                    WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDOList.get(0);
                    WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDOList.get(0);
                    ykyyService.updateDrugorderInfo(businessOrderDO.getOrderNo(),businessOrderDO1.getYkOrderId(),wlyyPrescriptionDO.getRealOrder());
                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                    logger.info("cfsb",wlyyPrescriptionDO.getRealOrder());
                    ykyyService.updateDrugorderInfo(businessOrderDO.getOrderNo(),wlyyPrescriptionDO.getOrderId(),wlyyPrescriptionDO.getRealOrder());
                }
                }
                result.put("code", 1);
                result.put("code", 1);
                result.put("mes", "诊断完成");
                result.put("mes", "诊断完成");
                return result;
                return result;
            }else{
            }else if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
                Double price = 0.01;
                businessOrderService.recharge(prescription.getId(),"处方收费","4","处方收费",prescription.getPatientCode(),prescription.getPatientName(),prescription.getDoctor(),price);
                //上传his开方
                //上传his开方
                return sendHisDiagnosis(jsonData, outpatientDO, prescription);
                return sendHisDiagnosis(jsonData, outpatientDO, prescription);
            }else {
                result.put("code", 1);
                result.put("mes", "诊断完成");
                return result;
            }
            }
        } else {
        } else {
@ -3006,8 +3028,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                rs.put("roles",null);
                rs.put("roles",null);
            }
            }
            //密码过期
            rs.put("authPw",baseDoctorService.findDoctorPwlimitDate(doctor));
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("pwOverDue");
            if (wlyyHospitalSysDictDO.getPyCode().equalsIgnoreCase("open")){
                //密码过期
                rs.put("authPw",baseDoctorService.findDoctorPwlimitDate(doctor));
            }
        }
        }
        return rs;
        return rs;
@ -3897,7 +3923,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param general_doctor
     * @param general_doctor
     * @return
     * @return
     */
     */
    public List<Map<String,Object>> getVideoPrescriptionByDoctor(String doctor,String general_doctor) {
    public List<Map<String,Object>> getVideoPrescriptionByDoctor(String doctor,String general_doctor,String wxId) {
        String condition = "";
        if("xm_ykyy_wx".equals(wxId)){
            condition+= "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
        }else{
            condition += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS \"time\",";
        }
        String sql ="SELECT " +
        String sql ="SELECT " +
                "room.outpatient_id AS id," +
                "room.outpatient_id AS id," +
                "room.patient_id AS patient_id," +
                "room.patient_id AS patient_id," +
@ -3907,8 +3939,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "patient.photo AS photo," +
                "patient.photo AS photo," +
                "patient.birthday AS birthday," +
                "patient.birthday AS birthday," +
                "patient.mobile AS mobile," +
                "patient.mobile AS mobile," +
                "room.consult_type AS consult_type," +
                "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS time," +
                "room.consult_type AS consult_type," +condition +
                "room.reservation_type AS reservation_type," +
                "room.reservation_type AS reservation_type," +
                "outpatient.disease_img AS disease_img," +
                "outpatient.disease_img AS disease_img," +
                "outpatient.description AS description," +
                "outpatient.description AS description," +
@ -3956,26 +3987,31 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return list;
        return list;
    }
    }
    
    
    public com.alibaba.fastjson.JSONArray getWaitingForVisitVideoPrescriptionByDoctor(String doctor) {
        
    public com.alibaba.fastjson.JSONArray getWaitingForVisitVideoPrescriptionByDoctor(String doctor,String wxId) {
        String condition = "";
        if("xm_ykyy_wx".equals(wxId)){
            condition+= "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
            condition+= "to_char(room.reservation_time,'YYYY-MM-DD')  AS \"group_date\",";
        }else{
            condition += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS \"time\",";
            condition += "date_format(room.reservation_time ,'%Y-%m-%d' ) AS \"group_date\",";
        }
        String sql ="SELECT " +
        String sql ="SELECT " +
                "room.outpatient_id AS id," +
                "room.patient_id AS patient_id," +
                "room.patient_name AS name," +
                "patient.sex AS sex," +
                "patient.idcard AS idcard," +
                "patient.photo AS photo," +
                "patient.birthday AS birthday," +
                "patient.mobile AS mobile," +
                "outpatient.mobile AS outpatient_mobile," +
                "room.consult_type AS consult_type," +
                "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS time," +
                "date_format(room.reservation_time ,'%Y-%m-%d' ) AS group_date," +
                "room.reservation_type AS reservation_type," +
                "outpatient.disease_img AS disease_img," +
                "outpatient.description AS description," +
                "outpatient.origin_con_no AS origin_con_no, " +
                "room.reservation_type AS reservation_type " +
                "room.outpatient_id AS \"id\"," +
                "room.patient_id AS \"patient_id\"," +
                "room.patient_name AS \"name\"," +
                "patient.sex AS \"sex\"," +
                "patient.idcard AS \"idcard\"," +
                "patient.photo AS \"photo\"," +
                "patient.birthday AS \"birthday\"," +
                "patient.mobile AS \"mobile\"," +
                "outpatient.mobile AS \"outpatient_mobile\"," +
                "room.consult_type AS \"consult_type\"," +condition+
                "room.reservation_type AS \"reservation_type\"," +
                "outpatient.disease_img AS \"disease_img\"," +
                "outpatient.description AS \"description\"," +
                "outpatient.origin_con_no AS \"origin_con_no\", " +
                "room.reservation_type AS \"reservation_type\" " +
                "FROM " +
                "FROM " +
                "wlyy_hospital_waiting_room room," +
                "wlyy_hospital_waiting_room room," +
                "base_patient patient," +
                "base_patient patient," +
@ -3986,9 +4022,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "AND outpatient.status = 0 " +
                "AND outpatient.status = 0 " +
                "AND room.doctor='"+doctor+"' " +
                "AND room.doctor='"+doctor+"' " +
                "AND room.reservation_time is not null " +
                "AND room.reservation_time is not null " +
                "AND room.consult_type= 2 AND room.reservation_time >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' order by room.reservation_time ASC ";
//                "AND room.reservation_time>='"+DateUtil.getStringDate("yyyy-MM-dd")+" 00:00:00"+"' ";
    
                "AND room.consult_type= 2 ";/* +
                "AND room.reservation_time >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' order by room.reservation_time ASC ";
//                "AND room.reservation_time>='"+DateUtil.getStringDate("yyyy-MM-dd")+" 00:00:00"+"' ";*/
        if("xm_ykyy_wx".equals(wxId)){
            sql+=" AND room.reservation_time >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
        }else {
            sql +=" AND room.reservation_time >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
        }
        sql+=" order by room.reservation_time ASC ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        
        
        Set<String> datelist = new HashSet<>();
        Set<String> datelist = new HashSet<>();

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

@ -149,7 +149,7 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            businessOrderDO.setOrderCategory("2");
            businessOrderDO.setOrderCategory("2");
        } else if (outpatientDO.getType().equalsIgnoreCase("2")) {
        } else if (outpatientDO.getType().equalsIgnoreCase("2")) {
            businessOrderDO.setOrderType(3);
            businessOrderDO.setOrderType(3);
            businessOrderDO.setOrderCategory("3");
            businessOrderDO.setOrderCategory("2");
        }
        }
        businessOrderService.saveOrder(businessOrderDO);
        businessOrderService.saveOrder(businessOrderDO);
@ -427,7 +427,7 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    public JSONArray synYkICD10() throws Exception {
    public JSONArray synYkICD10() throws Exception {
        JSONArray jsonArray = ykyyEntranceService.findIcd10();
        JSONArray jsonArray = ykyyEntranceService.synYkICD10();
        return jsonArray;
        return jsonArray;
    }
    }
@ -440,7 +440,7 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    public Map<String,Object> savePrescriptionOrder(String code,Double price,String wechatId) throws Exception {
    public Map<String,Object> savePrescriptionOrder(String code,Double price,String tradeType,String wechatId) throws Exception {
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        Map<String,Object> map = new HashedMap();
        Map<String,Object> map = new HashedMap();
        if(wxWechatDO==null){
        if(wxWechatDO==null){
@ -453,12 +453,29 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            if (patientWechatDos!=null&&patientWechatDos.size()!=0){
            if (patientWechatDos!=null&&patientWechatDos.size()!=0){
                openId = patientWechatDos.get(0).getOpenid();
                openId = patientWechatDos.get(0).getOpenid();
            }
            }
            if (!StringUtils.isNoneBlank(tradeType)){
                tradeType=WeChatConfig.TRADE_TYPE_JSAPI;
            }
            String url = wxWechatDO.getBaseUrl();
            String url = wxWechatDO.getBaseUrl();
            String notifyUrl =url;
            String notifyUrl =url;
            String totalFee =businessOrderDO.getPayPrice().intValue()+"";
            String totalFee =businessOrderDO.getPayPrice().intValue()+"";
            map = businessOrderService.unifiedorder(wechatId,businessOrderDO.getDescription(),totalFee, WeChatConfig.TRADE_TYPE_JSAPI,openId,businessOrderDO.getOrderNo(),notifyUrl);
            map = businessOrderService.unifiedorder(wechatId,businessOrderDO.getDescription(),totalFee, tradeType,openId,businessOrderDO.getOrderNo(),notifyUrl);
        }
        }
        return map;
        return map;
    }
    }
    /**
     * 获取诊断
     *
     * @param pyKey
     * @return
     * @throws Exception
     */
    public JSONArray getICD10(String pyKey) throws Exception {
        JSONArray array = ykyyEntranceService.findIcd10(pyKey);
        return array;
    }
}
}

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

@ -537,7 +537,7 @@ public class XzzxEntranceService{
                "</root>";
                "</root>";
        String condition ="";
        String condition ="";
        if (StringUtils.isNoneBlank(idCard)){
        if (StringUtils.isNoneBlank(idCard)){
            condition = "<Idcard>"+idCard+"</Idcard>";
            condition = "<identity_no>"+idCard+"</identity_no>";
        }
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
                "<root>"+condition+"</root>";
@ -547,7 +547,7 @@ public class XzzxEntranceService{
        params.put("msgBody",msgBody);
        params.put("msgBody",msgBody);
        logger.info("findPatientCard params:"+params.toString());
        logger.info("findPatientCard params:"+params.toString());
        String xml = getXzzxWebServiceInfo("FindPatientCard",params,getSelectUrl());
        String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        String json = xmlSerializer.read(xml).toString();
@ -586,7 +586,7 @@ public class XzzxEntranceService{
        params.put("msgBody",msgBody);
        params.put("msgBody",msgBody);
        logger.info("getCardInfo params:"+params.toString());
        logger.info("getCardInfo params:"+params.toString());
        String xml = getXzzxWebServiceInfo("GetCardInfo",params,getSelectUrl());
        String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        String json = xmlSerializer.read(xml).toString();
@ -626,7 +626,7 @@ public class XzzxEntranceService{
        params.put("msgBody",msgBody);
        params.put("msgBody",msgBody);
        logger.info("FindOutpatientInfo params:"+params.toString());
        logger.info("FindOutpatientInfo params:"+params.toString());
        String xml = getXzzxWebServiceInfo("FindOutpatientInfo",params,getSelectUrl());
        String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        String json = xmlSerializer.read(xml).toString();
@ -645,7 +645,7 @@ public class XzzxEntranceService{
     * @throws Exception
     * @throws Exception
     */
     */
    //获取门诊下所有处方信息
    //获取门诊下所有处方信息
    public String getOriginPrescriptionList(String registerSn,String patNo,String admNo,String realOrder)throws Exception{
    public String getOriginPrescriptionList(String registerSn,String patNo,String admNo,String realOrder,String startTime,String endTime)throws Exception{
        String api = "GetOriginPrescriptionList";
        String api = "GetOriginPrescriptionList";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "<root> " +
@ -667,6 +667,14 @@ public class XzzxEntranceService{
        if (StringUtils.isNoneBlank(realOrder)){
        if (StringUtils.isNoneBlank(realOrder)){
            condition += "<realOrder>"+realOrder+"</realOrder>";
            condition += "<realOrder>"+realOrder+"</realOrder>";
        }
        }
        if (StringUtils.isNoneBlank(startTime)){
            condition += "<startTime>"+startTime+"</startTime>";
        }
        if (StringUtils.isNoneBlank(endTime)){
            condition += "<endTime>"+endTime+"</endTime>";
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
                "<root>"+condition+"</root>";
@ -674,13 +682,171 @@ public class XzzxEntranceService{
        params.put("msgHeader",msgHeader);
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        params.put("msgBody",msgBody);
        logger.info("getOriginPrescriptionList params:"+params.toString());
        logger.info("getOriginPrescriptionList params:"+params.toString());
        String xml = getXzzxWebServiceInfo("GetOriginPrescriptionList",params,getSelectUrl());
        String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        String json = xmlSerializer.read(xml).toString();
        logger.info("getOriginPrescriptionList json:"+json);
        logger.info("getOriginPrescriptionList json:"+json);
        return json;
        return json;
    }
    }
    /**
     * 获取门诊病人诊断
     * @param registerSn
     * @param patNo
     * @param admNo
     * @param realOrder
     * @param startTime
     * @param endTime
     * @return
     * @throws Exception
     */
    public String getOutpatientDiagnosis(String registerSn,String patNo,String admNo,String realOrder,String startTime,String endTime)throws Exception{
        String api = "GetOutpatientDiagnosis";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (StringUtils.isNoneBlank(registerSn)){
            condition += "<registerSn>"+registerSn+"</registerSn>";
        }
        if (StringUtils.isNoneBlank(patNo)){
            condition += "<patNo>"+patNo+"</patNo>";
        }
        if (StringUtils.isNoneBlank(admNo)){
            condition += "<admNo>"+admNo+"</admNo>";
        }
        if (StringUtils.isNoneBlank(realOrder)){
            condition += "<realOrder>"+realOrder+"</realOrder>";
        }
        if (StringUtils.isNoneBlank(startTime)){
            condition += "<startTime>"+startTime+"</startTime>";
        }
        if (StringUtils.isNoneBlank(endTime)){
            condition += "<endTime>"+endTime+"</endTime>";
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
        Map<String,String> params = new HashedMap();
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        logger.info("getOutpatientDiagnosis params:"+params.toString());
        String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        logger.info("getOutpatientDiagnosis json:"+json);
        return json;
    }
    /**
     * 获取门诊病人处方药品信息
     *
     * @param registerSn
     * @param patNo
     * @param admNo
     * @param realOrder
     * @param startTime
     * @param endTime
     * @return
     * @throws Exception
     */
    public String getOutpatientDrugInfo(String registerSn,String patNo,String admNo,String realOrder,String startTime,String endTime)throws Exception{
        String api = "GetOutpatientDrugInfo";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (StringUtils.isNoneBlank(registerSn)){
            condition += "<registerSn>"+registerSn+"</registerSn>";
        }
        if (StringUtils.isNoneBlank(patNo)){
            condition += "<patNo>"+patNo+"</patNo>";
        }
        if (StringUtils.isNoneBlank(admNo)){
            condition += "<admNo>"+admNo+"</admNo>";
        }
        if (StringUtils.isNoneBlank(realOrder)){
            condition += "<realOrder>"+realOrder+"</realOrder>";
        }
        if (StringUtils.isNoneBlank(startTime)){
            condition += "<startTime>"+startTime+"</startTime>";
        }
        if (StringUtils.isNoneBlank(endTime)){
            condition += "<endTime>"+endTime+"</endTime>";
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
        Map<String,String> params = new HashedMap();
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        logger.info("getOutpatientDrugInfo params:"+params.toString());
        String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        logger.info("getOutpatientDrugInfo json:"+json);
        return json;
    }
    public String getOutpatientCheckTestInfo(String registerSn,String patNo,String admNo,String realOrder,String startTime,String endTime)throws Exception{
        String api = "GetOutpatientCheckTestInfo";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (StringUtils.isNoneBlank(registerSn)){
            condition += "<registerSn>"+registerSn+"</registerSn>";
        }
        if (StringUtils.isNoneBlank(patNo)){
            condition += "<patNo>"+patNo+"</patNo>";
        }
        if (StringUtils.isNoneBlank(admNo)){
            condition += "<admNo>"+admNo+"</admNo>";
        }
        if (StringUtils.isNoneBlank(realOrder)){
            condition += "<realOrder>"+realOrder+"</realOrder>";
        }
        if (StringUtils.isNoneBlank(startTime)){
            condition += "<startTime>"+startTime+"</startTime>";
        }
        if (StringUtils.isNoneBlank(endTime)){
            condition += "<endTime>"+endTime+"</endTime>";
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
        Map<String,String> params = new HashedMap();
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        logger.info("getOutpatientCheckTestInfo params:"+params.toString());
        String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        logger.info("getOutpatientCheckTestInfo json:"+json);
        return json;
    }
    /**
    /**
     * 挂号(调his后台包)
     * 挂号(调his后台包)
     * @param doctor 医生ID(必填)
     * @param doctor 医生ID(必填)
@ -721,7 +887,7 @@ public class XzzxEntranceService{
        params.put("msgHeader",msgHeader);
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        params.put("msgBody",msgBody);
        logger.info("registered params:"+params.toString());
        logger.info("registered params:"+params.toString());
        String xml = getXzzxWebServiceInfo("Registered",params,getOperateUrl());
        String xml = getXzzxWebServiceInfo("CallInterface",params,getOperateUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        String json = xmlSerializer.read(xml).toString();
        logger.info("registered json:"+json);
        logger.info("registered json:"+json);
@ -1010,173 +1176,162 @@ public class XzzxEntranceService{
     */
     */
    public List<WlyyPrescriptionVO> selectOriginPrescriptionList(String registerSn,String patNo,String admNo,String realOrder){
    public List<WlyyPrescriptionVO> selectOriginPrescriptionList(String registerSn,String patNo,String admNo,String realOrder){
        List<WlyyPrescriptionVO> prescriptionVOList = new ArrayList<>();
        List<WlyyPrescriptionVO> prescriptionVOList = new ArrayList<>();
        JSONArray array = new JSONArray();
        String response="";
        String response="";
        String params = "";
        String params = "";
        if (StringUtils.isNoneBlank(realOrder)){
        if (StringUtils.isNoneBlank(realOrder)){
            params +="&realOrder="+realOrder;
            params +="&realOrder="+realOrder;
        }
        }
        logger.info("处方request:"+registerSn+"=="+patNo+"==="+admNo+"===="+realOrder);
        String url = entranceUrl+"getOriginPrescriptionList?registerSn="+registerSn+"&patNo="+patNo+"&admNo="+admNo+params;
        String url = entranceUrl+"getOriginPrescriptionList?registerSn="+registerSn+"&patNo="+patNo+"&admNo="+admNo+params;
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        logger.info("处方response:"+response+"===="+url);
        JSONObject object = JSONObject.parseObject(response);
        JSONObject object = JSONObject.parseObject(response);
        if (object.getInteger("status")==200){
        if (object.getInteger("status")==200){
            JSONArray array = new JSONArray();
            array = JSONArray.parseArray(object.getString("obj")).getJSONArray(0);
            array = JSONArray.parseArray(object.getString("obj")).getJSONArray(0);
            for (int i=0;i<array.size();i++){
            for (int i=0;i<array.size();i++){
                WlyyPrescriptionVO wlyyPrescriptionVO = new WlyyPrescriptionVO();
                WlyyPrescriptionVO wlyyPrescriptionVO = new WlyyPrescriptionVO();
                JSONObject jsonObject = array.getJSONObject(i);
                JSONObject jsonObject = array.getJSONObject(i);
                wlyyPrescriptionVO.setId(isEmty(jsonObject.getString("id")));
                wlyyPrescriptionVO.setCreateTime(DateUtil.strToDate(isEmty(jsonObject.getString("createTime"))));
                wlyyPrescriptionVO.setCreateUser(isEmty(jsonObject.getString("createUser")));
                wlyyPrescriptionVO.setCreateUserName(isEmty(jsonObject.getString("createUserName")));
                wlyyPrescriptionVO.setUpdateTime(DateUtil.strToDate(isEmty(jsonObject.getString("updateTime"))));
                wlyyPrescriptionVO.setUpdateUser(isEmty(jsonObject.getString("updateUser")));
                wlyyPrescriptionVO.setUpdateUserName(isEmty(jsonObject.getString("updateUserName")));
                wlyyPrescriptionVO.setRealOrder(isEmty(jsonObject.getString("realOrder")));
                wlyyPrescriptionVO.setOriginRealOrder(isEmty(jsonObject.getString("originRealOrder")));
                wlyyPrescriptionVO.setAdmNo(isEmty(jsonObject.getString("admNo")));
                wlyyPrescriptionVO.setOriginAdmNo(isEmty(jsonObject.getString("originAdmNo")));
                wlyyPrescriptionVO.setSerialNo(isEmty(jsonObject.getString("serialNo")));
                wlyyPrescriptionVO.setOriginSerialNo(isEmty(jsonObject.getString("originSerialNo")));
                wlyyPrescriptionVO.setType(jsonObject.getInteger("type"));
                wlyyPrescriptionVO.setPatientCode(isEmty(jsonObject.getString("patientCode")));
                wlyyPrescriptionVO.setPatientName(isEmty(jsonObject.getString("patientName")));
                wlyyPrescriptionVO.setIdcard(isEmty(jsonObject.getString("idcard")));
                wlyyPrescriptionVO.setCardNo(isEmty(jsonObject.getString("cardNo")));
                wlyyPrescriptionVO.setSsc(isEmty(jsonObject.getString("ssc")));
                wlyyPrescriptionVO.setDoctor(isEmty(jsonObject.getString("doctor")));
                wlyyPrescriptionVO.setDoctorName(isEmty(jsonObject.getString("doctorName")));
                wlyyPrescriptionVO.setStatus(jsonObject.getInteger("status"));
                wlyyPrescriptionVO.setMkFailReason(isEmty(jsonObject.getString("mkFailReason")));
                wlyyPrescriptionVO.setMkTime(DateUtil.strToDate(isEmty(jsonObject.getString("mkTime"))));
                wlyyPrescriptionVO.setPrescribeTime(DateUtil.strToDate(isEmty(jsonObject.getString("prescribeTime"))));
                wlyyPrescriptionVO.setPrescribeReason(isEmty(jsonObject.getString("prescribeReason")));
                wlyyPrescriptionVO.setPayTime(DateUtil.strToDate(isEmty(jsonObject.getString("payTime"))));
                wlyyPrescriptionVO.setDosageTime(DateUtil.strToDate(isEmty(jsonObject.getString("dosageTime"))));
                wlyyPrescriptionVO.setFinishTime(DateUtil.strToDate(isEmty(jsonObject.getString(""))));
                wlyyPrescriptionVO.setDept(isEmty(jsonObject.getString("dept")));
                wlyyPrescriptionVO.setDeptName(isEmty(jsonObject.getString("deptName")));
                wlyyPrescriptionVO.setHospital(isEmty(jsonObject.getString("hospital")));
                wlyyPrescriptionVO.setHospitalName(isEmty(jsonObject.getString("hospitalName")));
                wlyyPrescriptionVO.setConsult(isEmty(jsonObject.getString("consult")));
                wlyyPrescriptionVO.setDispensaryType(jsonObject.getInteger("dispensaryType"));
                wlyyPrescriptionVO.setReason(isEmty(jsonObject.getString("reason")));
                wlyyPrescriptionVO.setDiseaseImg(isEmty(jsonObject.getString("diseaseImg")));
                wlyyPrescriptionVO.setRemark(isEmty(jsonObject.getString("remark")));
                wlyyPrescriptionVO.setCancelReason(isEmty(jsonObject.getString("cancelReason")));
                wlyyPrescriptionVO.setCaCertData(isEmty(jsonObject.getString("caCertData")));
                wlyyPrescriptionVO.setCaMessage(isEmty(jsonObject.getString("caMessage")));
                wlyyPrescriptionVO.setDigitalSignNo(isEmty(jsonObject.getString("digitalSignNo")));
                wlyyPrescriptionVO.setOriginalDataAbstract(isEmty(jsonObject.getString("originalDataAbstract")));
                wlyyPrescriptionVO.setStrOriginalData(isEmty(jsonObject.getString("strOriginalData")));
                wlyyPrescriptionVO.setHisDeptCode(isEmty(jsonObject.getString("hisDeptCode")));
                wlyyPrescriptionVO.setHisDoctorCode(isEmty(jsonObject.getString("hisDoctorCode")));
                wlyyPrescriptionVO.setHisGisterTypeCode(isEmty(jsonObject.getString("hisGisterTypeCode")));
                wlyyPrescriptionVO.setHisRateTypeCode(isEmty(jsonObject.getString("hisRateTypeCode")));
                wlyyPrescriptionVO.setHisHospital(isEmty(jsonObject.getString("hisHospital")));
                wlyyPrescriptionVO.setHisRegisterFee(jsonObject.getInteger("hisRegisterFee"));
                wlyyPrescriptionVO.setPayStatus(jsonObject.getInteger("payStatus"));
                wlyyPrescriptionVO.setCreateTime(DateUtil.strToDate(isEmty(jsonObject.getString("CREATETIME"))));
                wlyyPrescriptionVO.setCreateUser(isEmty(jsonObject.getString("CREATEUSER")));
                wlyyPrescriptionVO.setCreateUserName(isEmty(jsonObject.getString("CREATENAME")));
                wlyyPrescriptionVO.setUpdateTime(DateUtil.strToDate(isEmty(jsonObject.getString("UPDATETIME"))));
                wlyyPrescriptionVO.setUpdateUser(isEmty(jsonObject.getString("UPDATEUSER")));
                wlyyPrescriptionVO.setUpdateUserName(isEmty(jsonObject.getString("UPDATEUSERNAME")));
                wlyyPrescriptionVO.setRealOrder(isEmty(jsonObject.getString("REALORDER")));
                wlyyPrescriptionVO.setOriginRealOrder(isEmty(jsonObject.getString("ORIGINREALORDER")));
                wlyyPrescriptionVO.setAdmNo(isEmty(jsonObject.getString("ADMNO")));
                wlyyPrescriptionVO.setOriginAdmNo(isEmty(jsonObject.getString("ORIGINADMNO")));
                wlyyPrescriptionVO.setSerialNo(isEmty(jsonObject.getString("SERIALNO")));
                wlyyPrescriptionVO.setOriginSerialNo(isEmty(jsonObject.getString("ORIGINSERIALNO")));
                wlyyPrescriptionVO.setType(jsonObject.getInteger("TYPE"));
                wlyyPrescriptionVO.setPatientCode(isEmty(jsonObject.getString("PATIENTCODE")));
                wlyyPrescriptionVO.setPatientName(isEmty(jsonObject.getString("PATEINTNAME")));
                wlyyPrescriptionVO.setIdcard(isEmty(jsonObject.getString("IDCARD")));
                wlyyPrescriptionVO.setCardNo(isEmty(jsonObject.getString("CARDNO")));
                wlyyPrescriptionVO.setSsc(isEmty(jsonObject.getString("SSC")));
                wlyyPrescriptionVO.setDoctor(isEmty(jsonObject.getString("DOCTOR")));
                wlyyPrescriptionVO.setDoctorName(isEmty(jsonObject.getString("DOCTORNAME")));
                wlyyPrescriptionVO.setStatus(jsonObject.getInteger("STATUS"));
                wlyyPrescriptionVO.setMkFailReason(isEmty(jsonObject.getString("MKFAILREASON")));
                wlyyPrescriptionVO.setMkTime(DateUtil.strToDate(isEmty(jsonObject.getString("MKTIME"))));
                wlyyPrescriptionVO.setPrescribeTime(DateUtil.strToDate(isEmty(jsonObject.getString("PRESCRIBETIME"))));
                wlyyPrescriptionVO.setPrescribeReason(isEmty(jsonObject.getString("PRESCRIBEREASON")));
                wlyyPrescriptionVO.setPayTime(DateUtil.strToDate(isEmty(jsonObject.getString("PAYTIME"))));
                wlyyPrescriptionVO.setDosageTime(DateUtil.strToDate(isEmty(jsonObject.getString("DOSAGETIME"))));
                wlyyPrescriptionVO.setFinishTime(DateUtil.strToDate(isEmty(jsonObject.getString("FINISHTIME"))));
                wlyyPrescriptionVO.setDept(isEmty(jsonObject.getString("DEPT")));
                wlyyPrescriptionVO.setDeptName(isEmty(jsonObject.getString("DEPTNAME")));
                wlyyPrescriptionVO.setHospital(isEmty(jsonObject.getString("HOSPITAL")));
                wlyyPrescriptionVO.setHospitalName(isEmty(jsonObject.getString("HOSPITALNAME")));
                wlyyPrescriptionVO.setConsult(isEmty(jsonObject.getString("CONSULT")));
                wlyyPrescriptionVO.setDispensaryType(isEmty(jsonObject.getString("DISPENSARYTYPE"))!=null?Integer.parseInt(isEmty(jsonObject.getString("DISPENSARYTYPE"))):null);
                wlyyPrescriptionVO.setReason(isEmty(jsonObject.getString("REASON")));
                wlyyPrescriptionVO.setDiseaseImg(isEmty(jsonObject.getString("DISEASEIMG")));
                wlyyPrescriptionVO.setRemark(isEmty(jsonObject.getString("REMARK")));
                wlyyPrescriptionVO.setCancelReason(isEmty(jsonObject.getString("CANCELREASON")));
                wlyyPrescriptionVO.setCaCertData(isEmty(jsonObject.getString("CACERTDATA")));
                wlyyPrescriptionVO.setCaMessage(isEmty(jsonObject.getString("CAMESSAGE")));
                wlyyPrescriptionVO.setDigitalSignNo(isEmty(jsonObject.getString("DIGITALSIGNNO")));
                wlyyPrescriptionVO.setOriginalDataAbstract(isEmty(jsonObject.getString("ORIGINALDATAABSTRACT")));
                wlyyPrescriptionVO.setStrOriginalData(isEmty(jsonObject.getString("STRORIGINALDATA")));
                wlyyPrescriptionVO.setHisDeptCode(isEmty(jsonObject.getString("HISDEPTCODE")));
                wlyyPrescriptionVO.setHisDoctorCode(isEmty(jsonObject.getString("HISDOCTORCODE")));
                wlyyPrescriptionVO.setHisGisterTypeCode(isEmty(jsonObject.getString("HISGISTERTYPECODE")));
                wlyyPrescriptionVO.setHisRateTypeCode(isEmty(jsonObject.getString("HISRATETYPECODE")));
                wlyyPrescriptionVO.setHisHospital(isEmty(jsonObject.getString("HISHOSPITAL")));
                wlyyPrescriptionVO.setHisRegisterFee(isEmty(jsonObject.getString("HISREGISTERFEE"))!=null?Integer.parseInt(isEmty(jsonObject.getString("HISREGISTERFEE"))):null);
                wlyyPrescriptionVO.setPayStatus(isEmty(jsonObject.getString("PAYSTATUS"))!=null?Integer.parseInt(isEmty(jsonObject.getString("PAYSTATUS"))):null);
                //TODO 快递数据
                //TODO 快递数据
                wlyyPrescriptionVO.setDispUser(isEmty(jsonObject.getString("dispUser")));
                wlyyPrescriptionVO.setDispUserName(isEmty(jsonObject.getString("dispUserName")));
                wlyyPrescriptionVO.setDispDate(DateUtil.strToDate(isEmty(jsonObject.getString("dispDate"))));
                wlyyPrescriptionVO.setDispUser(isEmty(jsonObject.getString("DISPUSER")));
                wlyyPrescriptionVO.setDispUserName(isEmty(jsonObject.getString("DISPUSERNAME")));
                wlyyPrescriptionVO.setDispDate(DateUtil.strToDate(isEmty(jsonObject.getString("DISPDATE"))));
                //诊断
                //诊断
                List<WlyyPrescriptionDiagnosisVO> prescriptionDiagnosisVOS = new ArrayList<>();
                JSONArray jsonArray = jsonObject.getJSONArray("diagnosisVOs");
                for (int j=0;j<jsonArray.size();j++){
                    JSONObject disagnosisJson = jsonArray.getJSONObject(j);
                    WlyyPrescriptionDiagnosisVO prescriptionDiagnosisVO = new WlyyPrescriptionDiagnosisVO();
                    prescriptionDiagnosisVO.setId(isEmty(disagnosisJson.getString("id")));
                    prescriptionDiagnosisVO.setCreateTime(DateUtil.strToDate(isEmty(disagnosisJson.getString("createTime"))));
                    prescriptionDiagnosisVO.setCreateUser(isEmty(disagnosisJson.getString("createUser")));
                    prescriptionDiagnosisVO.setCreateUserName(isEmty(disagnosisJson.getString("createUserName")));
                    prescriptionDiagnosisVO.setUpdateTime(DateUtil.strToDate(isEmty(disagnosisJson.getString("updateTime"))));
                    prescriptionDiagnosisVO.setUpdateUser(isEmty(disagnosisJson.getString("updateUser")));
                    prescriptionDiagnosisVO.setUpdateUserName(isEmty(disagnosisJson.getString("updateUserName")));
                    prescriptionDiagnosisVO.setPrescriptionId(isEmty(disagnosisJson.getString("prescriptionId")));
                    prescriptionDiagnosisVO.setCode(isEmty(disagnosisJson.getString("code")));
                    prescriptionDiagnosisVO.setName(isEmty(disagnosisJson.getString("name")));
                    prescriptionDiagnosisVO.setType(disagnosisJson.getInteger("type"));
                    prescriptionDiagnosisVOS.add(prescriptionDiagnosisVO);
                String disagnosisUrl = entranceUrl+"getOutpatientDiagnosis?registerSn="+registerSn+"&patNo="+patNo+"&admNo="+admNo+"&realOrder="+jsonObject.getString("REALORDER");
                String disagnosisResponse = httpClientUtil.get(disagnosisUrl,"GBK");
                logger.info("诊断disagnosisResponse:"+disagnosisResponse);
                JSONObject object1 = JSONObject.parseObject(disagnosisResponse);
                if (object1.getString("status").equalsIgnoreCase("200")){
                    JSONArray jsonArray = object1.getJSONArray("obj").getJSONArray(0);
                    List<WlyyPrescriptionDiagnosisVO> prescriptionDiagnosisVOS = new ArrayList<>();
                    for (int j=0;j<jsonArray.size();j++){
                        JSONObject disagnosisJson = jsonArray.getJSONObject(j);
                        WlyyPrescriptionDiagnosisVO prescriptionDiagnosisVO = new WlyyPrescriptionDiagnosisVO();
                        prescriptionDiagnosisVO.setCode(isEmty(disagnosisJson.getString("DIAGNOSECODE")));
                        prescriptionDiagnosisVO.setName(isEmty(disagnosisJson.getString("DIAGNOSENAME")));
                        prescriptionDiagnosisVO.setType(isEmty(disagnosisJson.getString("DIAGNOSETYPE"))==null?null:Integer.parseInt(disagnosisJson.getString("DIAGNOSETYPE")));
                        prescriptionDiagnosisVOS.add(prescriptionDiagnosisVO);
                    }
                    wlyyPrescriptionVO.setDiagnosisVOs(prescriptionDiagnosisVOS);
                }
                }
                wlyyPrescriptionVO.setDiagnosisVOs(prescriptionDiagnosisVOS);
                //药品
                List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOList = new ArrayList<>();
                JSONArray infoArray = jsonObject.getJSONArray("infoVOs");
                for (int j=0;j<infoArray.size();j++){
                    WlyyPrescriptionInfoVO prescriptionInfoVO = new WlyyPrescriptionInfoVO();
                    JSONObject infoJson = infoArray.getJSONObject(j);
                    prescriptionInfoVO.setId(isEmty(infoJson.getString("id")));
                    prescriptionInfoVO.setCreateTime(DateUtil.strToDate(isEmty(infoJson.getString("createTime"))));
                    prescriptionInfoVO.setCreateUser(isEmty(infoJson.getString("createUser")));
                    prescriptionInfoVO.setCreateUserName(infoJson.getString("createUserName"));
                    prescriptionInfoVO.setUpdateTime(DateUtil.strToDate(isEmty(infoJson.getString("updateTime"))));
                    prescriptionInfoVO.setUpdateUser(isEmty(infoJson.getString("updateUser")));
                    prescriptionInfoVO.setUpdateUserName(isEmty(infoJson.getString("updateUserName")));
                    prescriptionInfoVO.setPrescriptionId(isEmty(infoJson.getString("prescriptionId")));
                    prescriptionInfoVO.setDrugNo(isEmty(infoJson.getString("drugNo")));
                    prescriptionInfoVO.setDrugName(isEmty(infoJson.getString("drugName")));
                    prescriptionInfoVO.setDispDeposite(isEmty(infoJson.getString("dispDeposite")));
                    prescriptionInfoVO.setDosage(isEmty(infoJson.getString("dosage")));
                    prescriptionInfoVO.setQuantity(isEmty(infoJson.getString("quantity")));
                    prescriptionInfoVO.setUnit(isEmty(infoJson.getString("unit")));
                    prescriptionInfoVO.setUnitName(isEmty(infoJson.getString("unitName")));
                    prescriptionInfoVO.setPackUnitName(isEmty(infoJson.getString("packUnitName")));
                    prescriptionInfoVO.setPackUnit(isEmty(infoJson.getString("packUnit")));
                    prescriptionInfoVO.setUsageCode(isEmty(infoJson.getString("usageCode")));
                    prescriptionInfoVO.setUsageName(isEmty(infoJson.getString("usageName")));
                    prescriptionInfoVO.setSupplyCode(isEmty(infoJson.getString("supplyCode")));
                    prescriptionInfoVO.setSupplyName(isEmty(infoJson.getString("supplyName")));
                    prescriptionInfoVO.setDays(isEmty(infoJson.getString("days")));
                    prescriptionInfoVO.setFrequency(isEmty(infoJson.getString("frequency")));
                    prescriptionInfoVO.setSerial(isEmty(infoJson.getString("serial")));
                    prescriptionInfoVO.setGroupNo(isEmty(infoJson.getString("groupNo")));
                    prescriptionInfoVO.setSpecification(isEmty(infoJson.getString("specification")));
                    prescriptionInfoVO.setPackRetprice(infoJson.getDouble("packRetprice"));
                    prescriptionInfoVO.setHerbalCount(isEmty(infoJson.getString("herbalCount")));
                    prescriptionInfoVO.setPostCount(isEmty(infoJson.getString("postCount")));
                    prescriptionInfoVO.setDel(infoJson.getInteger("del"));
                    prescriptionInfoVO.setComm(infoJson.getString("comm"));
                    wlyyPrescriptionInfoVOList.add(prescriptionInfoVO);
                String infoUrl = entranceUrl+"getOutpatientDrugInfo?registerSn="+registerSn+"&patNo="+patNo+"&admNo="+admNo+"&realOrder="+jsonObject.getString("REALORDER");
                String infoResponse = httpClientUtil.get(infoUrl,"GBK");
                logger.info("药品infoResponse:"+infoResponse);
                JSONObject infoObject = JSONObject.parseObject(infoResponse);
                if (infoObject.getString("status").equalsIgnoreCase("200")) {
                    JSONArray infoArray = infoObject.getJSONArray("obj").getJSONArray(0);
                    //药品
                    List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOList = new ArrayList<>();
                    for (int j=0;j<infoArray.size();j++){
                        WlyyPrescriptionInfoVO prescriptionInfoVO = new WlyyPrescriptionInfoVO();
                        JSONObject infoJson = infoArray.getJSONObject(j);
                        prescriptionInfoVO.setDrugNo(isEmty(infoJson.getString("DRUGNO")));
                        prescriptionInfoVO.setDrugName(isEmty(infoJson.getString("DRUGNAME")));
                        prescriptionInfoVO.setDispDeposite(isEmty(infoJson.getString("DISPDEPOSITE")));
                        prescriptionInfoVO.setDosage(isEmty(infoJson.getString("DOSAGE")));
                        prescriptionInfoVO.setQuantity(isEmty(infoJson.getString("QUANTITY")));
                        prescriptionInfoVO.setUnit(isEmty(infoJson.getString("UNIT")));
                        prescriptionInfoVO.setUnitName(isEmty(infoJson.getString("UNITNAME")));
                        prescriptionInfoVO.setPackUnitName(isEmty(infoJson.getString("PACKUNITNAME")));
                        prescriptionInfoVO.setPackUnit(isEmty(infoJson.getString("PACKUNIT")));
                        prescriptionInfoVO.setUsageCode(isEmty(infoJson.getString("USAGECODE")));
                        prescriptionInfoVO.setUsageName(isEmty(infoJson.getString("USAGENAME")));
                        prescriptionInfoVO.setSupplyCode(isEmty(infoJson.getString("SUPPLYCODE")));
                        prescriptionInfoVO.setSupplyName(isEmty(infoJson.getString("SUPPLYNAME")));
                        prescriptionInfoVO.setDays(isEmty(infoJson.getString("DAYS")));
                        prescriptionInfoVO.setFrequency(isEmty(infoJson.getString("FREQUENCY")));
                        prescriptionInfoVO.setSerial(isEmty(infoJson.getString("SERIAL")));
                    /*    prescriptionInfoVO.setGroupNo(isEmty(infoJson.getString("groupNo")));*/
                        prescriptionInfoVO.setSpecification(isEmty(infoJson.getString("SPECIFICATION")));
                        prescriptionInfoVO.setPackRetprice(infoJson.getDouble("PACKRETPRICE"));
                        prescriptionInfoVO.setHerbalCount(isEmty(infoJson.getString("HERBALCOUNT")));
                        prescriptionInfoVO.setPostCount(isEmty(infoJson.getString("POSTCOUNT")));
                        prescriptionInfoVO.setDel(infoJson.getInteger("DEL"));
                        prescriptionInfoVO.setComm(infoJson.getString("COMM"));
                        wlyyPrescriptionInfoVOList.add(prescriptionInfoVO);
                        wlyyPrescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOList);
                    }
                }
                }
                wlyyPrescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOList);
                //检查检验内容
                //检查检验内容
                List<WlyyInspectionVO> wlyyInspectionVOList = new ArrayList<>();
                JSONArray inspectionArray = jsonObject.getJSONArray("inspectionVOs");
                for (int j=0;j<inspectionArray.size();j++){
                    WlyyInspectionVO inspectionVO = new WlyyInspectionVO();
                    JSONObject inspectionJson = inspectionArray.getJSONObject(j);
                    inspectionVO.setId(isEmty(inspectionJson.getString("id")));
                    inspectionVO.setOutpatientId(isEmty(inspectionJson.getString("outpatientId")));
                    inspectionVO.setDept(isEmty(inspectionJson.getString("dept")));
                    inspectionVO.setDeptName(isEmty(inspectionJson.getString("deptName")));
                    inspectionVO.setGroupName(isEmty(inspectionJson.getString("groupName")));
                    inspectionVO.setQuantity(inspectionJson.getInteger("quantity"));
                    inspectionVO.setFrequency(isEmty(inspectionJson.getString("frequency")));
                    inspectionVO.setParentCode(isEmty(inspectionJson.getString("parentCode")));
                    inspectionVO.setParentName(isEmty(inspectionJson.getString("parentName")));
                    inspectionVO.setCode(isEmty(inspectionJson.getString("code")));
                    inspectionVO.setName(isEmty(inspectionJson.getString("name")));
                    inspectionVO.setInformation(isEmty(inspectionJson.getString("information")));
                    inspectionVO.setCheckEquip(isEmty(inspectionJson.getString("checkEquip")));
                    inspectionVO.setCheckPartName(isEmty(inspectionJson.getString("checkPartName")));
                    inspectionVO.setCheckPart(isEmty(inspectionJson.getString("checkPart")));
                    inspectionVO.setAdresult(isEmty(inspectionJson.getString("adresult")));
                    inspectionVO.setGoal(isEmty(inspectionJson.getString("goal")));
                    inspectionVO.setOpview(isEmty(inspectionJson.getString("opview")));
                    inspectionVO.setSpecimenName(isEmty(inspectionJson.getString("specimenName")));
                    inspectionVO.setSpecimenNum(isEmty(inspectionJson.getString("specimenNum")));
                    inspectionVO.setYwjcResult(isEmty(inspectionJson.getString("ywjcResult")));
                    inspectionVO.setYwjcDate(isEmty(inspectionJson.getString("ywjcDate")));
                    inspectionVO.setBlzd(isEmty(inspectionJson.getString("blzd")));
                    inspectionVO.setFixationfluid(isEmty(inspectionJson.getString("fixationfluid")));
                    inspectionVO.setCreateTime(DateUtil.strToDate(isEmty(inspectionJson.getString("createTime"))));
                    inspectionVO.setCheckbox(isEmty(inspectionJson.getString("checkbox")));
                    inspectionVO.setMzpg(isEmty(inspectionJson.getString("mzpg")));
                    inspectionVO.setSfzg(isEmty(inspectionJson.getString("sfzg")));
                    wlyyInspectionVOList.add(inspectionVO);
                String inspectionUrl = entranceUrl+"getOutpatientCheckTestInfo?registerSn="+registerSn+"&patNo="+patNo+"&admNo="+admNo+"&realOrder="+jsonObject.getString("REALORDER");
                String inspectionResponse = httpClientUtil.get(inspectionUrl,"GBK");
                logger.info("检查检验内容inspectionResponse:"+inspectionResponse);
                JSONObject inspectionObject = JSONObject.parseObject(inspectionResponse);
                if (inspectionObject.getString("status").equalsIgnoreCase("200")) {
                    List<WlyyInspectionVO> wlyyInspectionVOList = new ArrayList<>();
                    JSONArray inspectionArray = inspectionObject.getJSONArray("obj").getJSONArray(0);
                    for (int j=0;j<inspectionArray.size();j++){
                        WlyyInspectionVO inspectionVO = new WlyyInspectionVO();
                        JSONObject inspectionJson = inspectionArray.getJSONObject(j);
                        inspectionVO.setGroupName(isEmty(inspectionJson.getString("GROUPNAME")));
                        inspectionVO.setQuantity(isEmty(inspectionJson.getString("QUANTITYS"))!=null?Integer.parseInt(isEmty(inspectionJson.getString("QUANTITYS"))):null);
                        inspectionVO.setFrequency(isEmty(inspectionJson.getString("FREQUENCYS")));
                        inspectionVO.setParentCode(isEmty(inspectionJson.getString("PARENTCODE")));
                        inspectionVO.setParentName(isEmty(inspectionJson.getString("PARENTCODENAME")));
                        inspectionVO.setCode(isEmty(inspectionJson.getString("CODES")));
                        inspectionVO.setName(isEmty(inspectionJson.getString("NAMES")));
                        inspectionVO.setInformation(isEmty(inspectionJson.getString("INFORMATION")));
                        inspectionVO.setCheckEquip(isEmty(inspectionJson.getString("CHECKEQUIP")));
                        inspectionVO.setCheckPartName(isEmty(inspectionJson.getString("CHECKPARTNAME")));
                        inspectionVO.setCheckPart(isEmty(inspectionJson.getString("CHECKPART")));
                        wlyyInspectionVOList.add(inspectionVO);
                    }
                    wlyyPrescriptionVO.setInspectionVOs(wlyyInspectionVOList);
                }
                }
                wlyyPrescriptionVO.setInspectionVOs(wlyyInspectionVOList);
                prescriptionVOList.add(wlyyPrescriptionVO);
            }
            }
        }
        }
        return prescriptionVOList;
        return prescriptionVOList;
@ -1299,10 +1454,10 @@ public class XzzxEntranceService{
    }
    }
/*    public Map<String,Object> updatePreStatus(String admNo,String realOrder,String status) throws Exception {
    public Map<String,Object> updatePreStatus(String admNo,String realOrder,String status) throws Exception {
        Map<String,Object> map = new HashedMap();
        Map<String,Object> map = new HashedMap();
        List<WlyyOutpatientDO> wlyyOutpatientDOList = outpatientDao.findByAdmNo(admNo);
        List<WlyyOutpatientDO> wlyyOutpatientDOList = outpatientDao.findByAdmNo(admNo);
        if (wlyyOutpatientDOList!=null&&wlyyOutpatientDOList.size()!=0){
        if (wlyyOutpatientDOList==null||wlyyOutpatientDOList.size()==0){
            throw new Exception("该就诊号查不到!");
            throw new Exception("该就诊号查不到!");
        }
        }
        for (WlyyOutpatientDO wlyyOutpatientDO:wlyyOutpatientDOList){
        for (WlyyOutpatientDO wlyyOutpatientDO:wlyyOutpatientDOList){
@ -1315,8 +1470,7 @@ public class XzzxEntranceService{
            if (prescriptionDOList==null||prescriptionDOList.size()==0){
            if (prescriptionDOList==null||prescriptionDOList.size()==0){
                List<WlyyPrescriptionVO> prescriptionVOList = selectOriginPrescriptionList(registerNo,patientMappingDO.getMappingCode(),admNo,realOrder);
                List<WlyyPrescriptionVO> prescriptionVOList = selectOriginPrescriptionList(registerNo,patientMappingDO.getMappingCode(),admNo,realOrder);
                for (WlyyPrescriptionVO prescriptionVO:prescriptionVOList){
                for (WlyyPrescriptionVO prescriptionVO:prescriptionVOList){
                    WlyyPrescriptionDO prescriptionDO = new WlyyPrescriptionDO();
                    BeanUtils.copyProperties(prescriptionVO, prescriptionDO);
                    WlyyPrescriptionDO prescriptionDO =JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(prescriptionVO)),WlyyPrescriptionDO.class);
                    prescriptionDO.setOutpatientId(wlyyOutpatientDO.getId());
                    prescriptionDO.setOutpatientId(wlyyOutpatientDO.getId());
                    if (status.equalsIgnoreCase("3")){
                    if (status.equalsIgnoreCase("3")){
                        prescriptionDO.setStatus(30);
                        prescriptionDO.setStatus(30);
@ -1325,23 +1479,21 @@ public class XzzxEntranceService{
                    //处方诊断表vo
                    //处方诊断表vo
                    List<WlyyPrescriptionDiagnosisVO> diagnosisVOS = prescriptionVO.getDiagnosisVOs();
                    List<WlyyPrescriptionDiagnosisVO> diagnosisVOS = prescriptionVO.getDiagnosisVOs();
                    for (WlyyPrescriptionDiagnosisVO diagnosisVO:diagnosisVOS){
                    for (WlyyPrescriptionDiagnosisVO diagnosisVO:diagnosisVOS){
                        WlyyPrescriptionDiagnosisDO prescriptionDiagnosisDO = new WlyyPrescriptionDiagnosisDO();
                        BeanUtils.copyProperties(diagnosisVO,prescriptionDiagnosisDO);
                        WlyyPrescriptionDiagnosisDO prescriptionDiagnosisDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(diagnosisVO)),WlyyPrescriptionDiagnosisDO.class);
                        prescriptionDiagnosisDO.setPrescriptionId(prescriptionDO.getId());
                        prescriptionDiagnosisDO.setPrescriptionId(prescriptionDO.getId());
                        diagnosisDao.save(prescriptionDiagnosisDO);
                        diagnosisDao.save(prescriptionDiagnosisDO);
                    }
                    }
                    //药品表
                    //药品表
                    List<WlyyPrescriptionInfoVO> infoVOList = prescriptionVO.getInfoVOs();
                    List<WlyyPrescriptionInfoVO> infoVOList = prescriptionVO.getInfoVOs();
                    for (WlyyPrescriptionInfoVO infoVO:infoVOList){
                    for (WlyyPrescriptionInfoVO infoVO:infoVOList){
                        WlyyPrescriptionInfoDO infoDO = new WlyyPrescriptionInfoDO();
                        BeanUtils.copyProperties(infoVO,infoDO);
                        WlyyPrescriptionInfoDO infoDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(infoVO)),WlyyPrescriptionInfoDO.class);
                        infoDO.setPrescriptionId(prescriptionDO.getId());
                        infoDO.setPrescriptionId(prescriptionDO.getId());
                        prescriptionInfoDao.save(infoDO);
                        prescriptionInfoDao.save(infoDO);
                    }
                    }
                    List<WlyyInspectionVO> inspectionVOList = prescriptionVO.getInspectionVOs();
                    List<WlyyInspectionVO> inspectionVOList = prescriptionVO.getInspectionVOs();
                    for (WlyyInspectionVO inspectionVO:inspectionVOList){
                    for (WlyyInspectionVO inspectionVO:inspectionVOList){
                        WlyyInspectionDO inspectionDO = new WlyyInspectionDO();
                        WlyyInspectionDO inspectionDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(inspectionVO)),WlyyInspectionDO.class);
                        BeanUtils.copyProperties(inspectionVO,inspectionDO);
                        BeanUtils.copyProperties(inspectionVO,inspectionDO);
                        inspectionDO.setPrescriptionId(prescriptionDO.getId());
                        inspectionDO.setPrescriptionId(prescriptionDO.getId());
                        wlyyInspectionDao.save(inspectionDO);
                        wlyyInspectionDao.save(inspectionDO);
@ -1350,7 +1502,7 @@ public class XzzxEntranceService{
            }
            }
        }
        }
        return map;
        return map;
    }*/
    }

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

@ -3,10 +3,14 @@ package com.yihu.jw.hospital.prescription.service.entrance;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.sun.webkit.dom.CSSStyleRuleImpl;
import com.yihu.jw.dict.dao.DictDoctorDutyDao;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
import com.yihu.jw.entity.base.dict.DictDoctorDutyDO;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.dict.DictIcd10DO;
import com.yihu.jw.entity.base.dict.DictIcd10DO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
@ -123,7 +127,9 @@ public class YkyyEntranceService {
    private PrescriptionInfoDao prescriptionInfoDao;
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    @Autowired
    private JdbcTemplate jdbcTemplate;
    private JdbcTemplate jdbcTemplate;
    
    @Autowired
    private DictDoctorDutyDao dictDoctorDutyDao;
    @Autowired
    @Autowired
    private YkyyService ykyyService;
    private YkyyService ykyyService;
@ -914,7 +920,7 @@ public class YkyyEntranceService {
     * @return
     * @return
     */
     */
    public JSONArray findYpyf(String pydm) throws Exception {
    public JSONArray findYpyf(String pydm) throws Exception {
        String sql = "select y.ypyf as \"ypyf\",y.pydm as \"pydm\",y.xmmc as \"xmmc\" from v_hlw_ypyf y where 1=1 ";
        String sql = "select y.ypyf as \"ypyf\",y.pydm as \"pydm\",y.xmmc as \"xmmc\" from v_hlw_ypyf y where 1=1  and y.pydm is not null";
        if (StringUtils.isNoneBlank(pydm)){
        if (StringUtils.isNoneBlank(pydm)){
            sql+=" and y.pydm='"+pydm+"' ";
            sql+=" and y.pydm='"+pydm+"' ";
        }
        }
@ -1001,9 +1007,12 @@ public class YkyyEntranceService {
    }
    }
    public JSONArray findIcd10() throws Exception {
    public JSONArray findIcd10(String pyCode) throws Exception {
        String sql = "select i.code as \"code\",i.name as \"name\",i.disea_reason as \"disea_reason\",i.death_reason as \"death_reason\",i.py_code as \"py_code\",i.flag as \"flag\",i.add_code as \"add_code\",i.emr as \"emr\" from v_hlw_icd10 i";
        String sql = "select i.code as \"code\",i.name as \"name\",i.disea_reason as \"disea_reason\",i.death_reason as \"death_reason\",i.py_code as \"py_code\",i.flag as \"flag\",i.add_code as \"add_code\",i.emr as \"emr\" from v_hlw_icd10 i";
        JSONArray array = new JSONArray();
        JSONArray array = new JSONArray();
        if (StringUtils.isNoneBlank(pyCode)){
            sql +="  where i.py_code like '%"+pyCode+"%'";
        }
        Map<String,Object> params = new HashedMap();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        params.put("sql",sql);
        logger.info("ICD10:"+sql);
        logger.info("ICD10:"+sql);
@ -1014,14 +1023,6 @@ public class YkyyEntranceService {
        Integer status = rs.getInteger("status");
        Integer status = rs.getInteger("status");
        if (status==200){
        if (status==200){
            array = rs.getJSONArray("detailModelList");
            array = rs.getJSONArray("detailModelList");
            ykDictIcd10Dao.deleteAll();
            for (int i=0;i<array.size();i++){
                JSONObject object = array.getJSONObject(i);
                DictIcd10DO dictIcd10DO = new DictIcd10DO();
                dictIcd10DO.setCode(object.getString("code"));
                dictIcd10DO.setName(object.getString("name"));
                ykDictIcd10Dao.save(dictIcd10DO);
            }
        }
        }
        return array;
        return array;
    }
    }
@ -1077,6 +1078,32 @@ public class YkyyEntranceService {
        return array;
        return array;
    }
    }
    public JSONArray synYkICD10() throws Exception {
        String sql = "select i.code as \"code\",i.name as \"name\",i.disea_reason as \"disea_reason\",i.death_reason as \"death_reason\",i.py_code as \"py_code\",i.flag as \"flag\",i.add_code as \"add_code\",i.emr as \"emr\" from v_hlw_icd10 i";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("ICD10:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            array = rs.getJSONArray("detailModelList");
            ykDictIcd10Dao.deleteAll();
            for (int i=0;i<array.size();i++){
                JSONObject object = array.getJSONObject(i);
                DictIcd10DO dictIcd10DO = new DictIcd10DO();
                dictIcd10DO.setCode(object.getString("code"));
                dictIcd10DO.setName(object.getString("name"));
                dictIcd10DO.setDescription(object.getString("py_code"));
                ykDictIcd10Dao.save(dictIcd10DO);
            }
        }
        return array;
    }
    /**
    /**
     * 根据his Icd10
     * 根据his Icd10
     * @param code
     * @param code
@ -1519,7 +1546,7 @@ public class YkyyEntranceService {
        }
        }
        return response1.getContent();
        return response1.getContent();
    }
    }
    
    /**
    /**
     * 眼科通App消息推送接口
     * 眼科通App消息推送接口
     * @param doctor
     * @param doctor
@ -1528,7 +1555,7 @@ public class YkyyEntranceService {
     * @return
     * @return
     */
     */
    public String sendMesToYkt(String doctor, String patient, String orderType) throws Exception {
    public String sendMesToYkt(String doctor, String patient, String orderType) throws Exception {
    
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        String yktDoctor ="";
        String yktDoctor ="";
        if (doctorMappingDO!=null&&StringUtils.isNoneBlank(doctorMappingDO.getMappingCode())){
        if (doctorMappingDO!=null&&StringUtils.isNoneBlank(doctorMappingDO.getMappingCode())){
@ -1543,19 +1570,19 @@ public class YkyyEntranceService {
        }else {
        }else {
            throw new Exception("医生映射表不存在!");
            throw new Exception("医生映射表不存在!");
        }
        }
        
        BasePatientDO basePatientDO = basePatientDao.findById(patient);
        BasePatientDO basePatientDO = basePatientDao.findById(patient);
        
        if(basePatientDO!=null){
        if(basePatientDO!=null){
            patient = basePatientDO.getUserId();
            patient = basePatientDO.getUserId();
        }
        }
        
        Map<String,Object> params = new HashedMap();
        Map<String,Object> params = new HashedMap();
        params.put("doctorId",yktDoctor);
        params.put("doctorId",yktDoctor);
        params.put("patientId",patient);
        params.put("patientId",patient);
        params.put("orderType",orderType);
        params.put("orderType",orderType);
        HttpResponse response = HttpUtils.doPost("http://www.yanketong.com:90/api/share/PushNotificationToDoctor",params);
        HttpResponse response = HttpUtils.doPost("http://www.yanketong.com:90/api/share/PushNotificationToDoctor",params);
    
        String content = response.getContent();
        String content = response.getContent();
        logger.info("response:"+content);
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        JSONObject rs = JSON.parseObject(content);

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

@ -308,7 +308,7 @@ public class YkyyService {
     */
     */
    public String updateDrugorderInfo(String orderNo,String drugorder,String cfsb){
    public String updateDrugorderInfo(String orderNo,String drugorder,String cfsb){
        String response="";
        String response="";
        String url = yktUrl+"doc_jkzl/update_drugorder_infor?order_no="+orderNo+"&drugorder="+drugorder+"$cfsb="+cfsb;
        String url = yktUrl+"doc_jkzl/update_drugorder_infor?order_no="+orderNo+"&drugorder="+drugorder+"&cfsb="+cfsb;
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("更新药品订单信息:"+response);
        logger.info("更新药品订单信息:"+response);
        return response;
        return response;

+ 248 - 9
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -3,6 +3,9 @@ package com.yihu.jw.order;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPObject;
import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
@ -26,14 +29,19 @@ import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.dao.BusinessOrderRefundDao;
import com.yihu.jw.order.dao.BusinessOrderRefundDao;
import com.yihu.jw.order.dao.ConsultOrderDao;
import com.yihu.jw.order.dao.ConsultOrderDao;
import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.order.pay.ylz.YlzPayService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.common.BeanUtils;
import com.yihu.jw.util.common.QrcodeUtil;
import com.yihu.jw.util.common.XMLUtil;
import com.yihu.jw.util.common.XMLUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.WeiXinPayUtils;
import com.yihu.jw.util.wechat.WeiXinPayUtils;
import com.yihu.jw.utils.ByteToInputStream;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxPayLogDao;
import com.yihu.jw.wechat.dao.WxPayLogDao;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.Logger;
@ -42,6 +50,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Transactional;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.net.UnknownHostException;
import java.util.*;
import java.util.*;
@ -51,7 +60,7 @@ import java.util.*;
 * 业务订单
 * 业务订单
 */
 */
@Service
@Service
public class BusinessOrderService {
public class BusinessOrderService extends BaseJpaService {
    private Logger logger = LoggerFactory.getLogger(BusinessOrderService.class);
    private Logger logger = LoggerFactory.getLogger(BusinessOrderService.class);
@ -83,6 +92,8 @@ public class BusinessOrderService {
    private YkyyEntranceService ykyyEntranceService;
    private YkyyEntranceService ykyyEntranceService;
    @Autowired
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private YlzPayService ylzPayService;
@ -115,7 +126,7 @@ public class BusinessOrderService {
                businessOrderDO.setCreateTime(new Date());
                businessOrderDO.setCreateTime(new Date());
                businessOrderDO.setUpdateTime(new Date());
                businessOrderDO.setUpdateTime(new Date());
                businessOrderDO.setStatus(0);
                businessOrderDO.setStatus(0);
                businessOrderDO.setOrderNo("HLWLYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
                businessOrderDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
                businessOrderDO.setUploadStatus(0);
                businessOrderDO.setUploadStatus(0);
                businessOrderDO.setPayType(1);
                businessOrderDO.setPayType(1);
                businessOrderDO.setRelationCode(code);
                businessOrderDO.setRelationCode(code);
@ -130,7 +141,8 @@ public class BusinessOrderService {
                businessOrderDO = businessOrderDao.save(businessOrderDO);
                businessOrderDO = businessOrderDao.save(businessOrderDO);
                businessOrderDOS.add(businessOrderDO);
                businessOrderDOS.add(businessOrderDO);
                wlyyPrescriptionDO.setOrderNo(businessOrderDO.getOrderNo());
                wlyyPrescriptionDO.setOrderNo(businessOrderDO.getOrderNo());
                prescriptionDao.save(wlyyPrescriptionDO);
                wlyyPrescriptionDO.setOrderId(getCode());
                wlyyPrescriptionDO = prescriptionDao.save(wlyyPrescriptionDO);
                JSONArray array = new JSONArray();
                JSONArray array = new JSONArray();
                List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(code);
                List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(code);
                for (WlyyPrescriptionInfoDO prescriptionInfoDO:wlyyPrescriptionInfoDOS){
                for (WlyyPrescriptionInfoDO prescriptionInfoDO:wlyyPrescriptionInfoDOS){
@ -188,7 +200,7 @@ public class BusinessOrderService {
        businessOrderDO.setCreateTime(new Date());
        businessOrderDO.setCreateTime(new Date());
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setStatus(0);
        businessOrderDO.setStatus(0);
        businessOrderDO.setOrderNo("HLWLYY"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100);
        businessOrderDO.setOrderNo("HLWYY"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100);
        businessOrderDO.setUploadStatus(0);
        businessOrderDO.setUploadStatus(0);
        businessOrderDO.setPayType(1);
        businessOrderDO.setPayType(1);
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
@ -259,7 +271,7 @@ public class BusinessOrderService {
        businessOrderDO.setStatus(0);
        businessOrderDO.setStatus(0);
        businessOrderDO.setCreateTime(new Date());
        businessOrderDO.setCreateTime(new Date());
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setOrderNo("VAS"+businessOrderDO.getOrderType()+System.currentTimeMillis());
        businessOrderDO.setOrderNo("HLWYY"+businessOrderDO.getOrderType()+System.currentTimeMillis());
        businessOrderDO = businessOrderDao.save(businessOrderDO);
        businessOrderDO = businessOrderDao.save(businessOrderDO);
        List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
        List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
        String openId = "";
        String openId = "";
@ -326,7 +338,7 @@ public class BusinessOrderService {
    }
    }
    public Map<String,Object> selectOrderByRelationCode(String relationCode,String wechatId) throws Exception {
    public Map<String,Object> selectOrderByRelationCode(String relationCode,String tradeType,String wechatId) throws Exception {
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
        String body = businessOrderDO.getDescription();
        String body = businessOrderDO.getDescription();
@ -340,10 +352,13 @@ public class BusinessOrderService {
            }
            }
        }
        }
        String ourTradeNo = businessOrderDO.getOrderNo();
        String ourTradeNo = businessOrderDO.getOrderNo();
        if (!StringUtils.isNoneBlank(tradeType)){
            tradeType=WeChatConfig.TRADE_TYPE_JSAPI;
        }
        String url = wxWechatDO.getBaseUrl();
        String url = wxWechatDO.getBaseUrl();
        String notifyUrl =url;
        String notifyUrl =url;
        Map<String,Object> map = unifiedorder(wechatId,body,totalFee,WeChatConfig.TRADE_TYPE_JSAPI,openid,ourTradeNo,notifyUrl);
        Map<String,Object> map = unifiedorder(wechatId,body,totalFee,tradeType,openid,ourTradeNo,notifyUrl);
        return map;
        return map;
    }
    }
@ -406,12 +421,29 @@ public class BusinessOrderService {
        Map<String, Object> pay = unifiedorder(map, wxWechatDO.getAppKey());
        Map<String, Object> pay = unifiedorder(map, wxWechatDO.getAppKey());
        String returnCode = pay.get("return_code").toString();
        String returnCode = pay.get("return_code").toString();
        String resultCode = pay.get("result_code").toString();
        if (returnCode.equalsIgnoreCase("SUCCESS")){
        if (returnCode.equalsIgnoreCase("SUCCESS")){
            String appid = pay.get("appid").toString();
            String appid = pay.get("appid").toString();
            String mchId = pay.get("mch_id").toString();
            String mchId = pay.get("mch_id").toString();
            String nonceStr = pay.get("nonce_str").toString();
            String nonceStr = pay.get("nonce_str").toString();
            String prepayId = pay.get("prepay_id").toString();
            String prepayId = pay.get("prepay_id").toString();
            String trade = pay.get("trade_type").toString();
            if (trade.equalsIgnoreCase("Native")){
                Map<String,String> param = new HashedMap();
                param.put("appId",appid);
                param.put("package","prepay_id="+prepayId);
                param.put("nonceStr",nonceStr);
                param.put("signType","MD5");
                param.put("timeStamp",getTimeStamp());
                param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
                InputStream qrcode = QrcodeUtil.createQrcode(pay.get("code_url").toString(),300,"jpg");
                ByteToInputStream byteToInputStream = new ByteToInputStream();
                String QRCodeImg = byteToInputStream.getBase64FromInputStream(qrcode);
                param.put("qrcode","data:image/png;base64,"+ QRCodeImg);
                pay.put("native",param);
            }
            Map<String,String> param = new HashedMap();
            Map<String,String> param = new HashedMap();
            param.put("appId",appid);
            param.put("appId",appid);
            param.put("package","prepay_id="+prepayId);
            param.put("package","prepay_id="+prepayId);
@ -457,7 +489,7 @@ public class BusinessOrderService {
        orderRefundDO.setRefundPrice(refundPrice);
        orderRefundDO.setRefundPrice(refundPrice);
        orderRefundDO.setAppId(wxWechatDO.getAppId());
        orderRefundDO.setAppId(wxWechatDO.getAppId());
        orderRefundDO.setMchId(wxWechatDO.getMchId());
        orderRefundDO.setMchId(wxWechatDO.getMchId());
        orderRefundDO.setOutRefundNo("VAS"+businessOrderDO.getOrderType()+System.currentTimeMillis());
        orderRefundDO.setOutRefundNo("HLWYY"+businessOrderDO.getOrderType()+System.currentTimeMillis());
        orderRefundDO.setPatient(patient);
        orderRefundDO.setPatient(patient);
        orderRefundDO.setPatientName(patientDO.getName());
        orderRefundDO.setPatientName(patientDO.getName());
        orderRefundDO.setRefundDesc(description);
        orderRefundDO.setRefundDesc(description);
@ -566,7 +598,7 @@ public class BusinessOrderService {
    public Map<String,String> getWxPayResultNotify(String result) {
    public Map<String,String> getWxPayResultNotify(String result) {
        Map<String,String> rs = new HashedMap();
        Map<String,String> rs = new HashedMap();
        Map<String,Object> wxrs =  XMLUtil.xmltoMap(result);
        Map<String,Object> wxrs =  XMLUtil.xmltoMap(result);
        logger.info("回调参数");
        logger.info("回调参数"+wxrs+"==============="+result);
        if("SUCCESS".equals(wxrs.get("return_code").toString())){
        if("SUCCESS".equals(wxrs.get("return_code").toString())){
            // 我方 订单号+时间差
            // 我方 订单号+时间差
            String seqNo = wxrs.get("out_trade_no")+"";
            String seqNo = wxrs.get("out_trade_no")+"";
@ -579,6 +611,7 @@ public class BusinessOrderService {
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(seqNo);
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(seqNo);
            businessOrderDO.setPayTime(DateUtil.strToDate(timeEnd,DateUtil.YYYY_MM_DD_HH_MM_SS));
            businessOrderDO.setPayTime(DateUtil.strToDate(timeEnd,DateUtil.YYYY_MM_DD_HH_MM_SS));
            businessOrderDO.setStatus(1);
            businessOrderDO.setStatus(1);
            businessOrderDao.save(businessOrderDO);
            if (businessOrderDO!=null){
            if (businessOrderDO!=null){
                if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
                if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
                    ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
                    ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
@ -665,4 +698,210 @@ public class BusinessOrderService {
    public void setPrescriptionDao(PrescriptionDao prescriptionDao) {
    public void setPrescriptionDao(PrescriptionDao prescriptionDao) {
        this.prescriptionDao = prescriptionDao;
        this.prescriptionDao = prescriptionDao;
    }
    }
    /**
     *
     * 中山医院统一支付
     *
     * @param relationCode
     * @param relationName
     * @param orderCategory 1专家咨询2复诊4处方
     * @param remark
     * @param patient
     * @param patientName
     * @param doctor
     * @return
     */
    public BusinessOrderDO recharge(String relationCode,String relationName,String orderCategory,String remark,String patient,String patientName,String doctor,Double payPrice){
        logger.info("参数========="+relationCode+"=="+orderCategory+"=="+patient+"=="+doctor+"==="+payPrice);
        BusinessOrderDO businessOrderDO = new BusinessOrderDO();
        if (orderCategory.equalsIgnoreCase("4")){
             businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
             if (businessOrderDO==null){
                 businessOrderDO = new BusinessOrderDO();
             }
        }
        businessOrderDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
        businessOrderDO.setCreateTime(new Date());
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setUploadStatus(0);
        businessOrderDO.setRelationCode(relationCode);
        businessOrderDO.setRelationName(relationName);
        businessOrderDO.setOrderCategory(orderCategory);
        businessOrderDO.setOrderType(1);
        businessOrderDO.setRematk(remark);
        businessOrderDO.setPatient(patient);
        businessOrderDO.setPatientName(patientName);
        businessOrderDO.setPayType(3);
        businessOrderDO.setStatus(0);
        businessOrderDO.setPayPrice(payPrice);
        businessOrderDO.setDoctor(doctor);
        businessOrderDO = businessOrderDao.save(businessOrderDO);
        return businessOrderDO;
    }
    /**
     * 调取支付参数
     *
     *
     * @param code
     * @param depositType WX_MIN 微信小程序,WX_PUB 微信公众号 ,ALI_WAP 支付宝生活号 WX_QR pc扫码,ALI_QR支付宝扫码
     * @param wechatId
     * @return
     * @throws Exception
     */
    public String reChargeJSON(String code,String depositType,String wechatId) 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");
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(code);
        if (businessOrderDO!=null){
            BasePatientDO patientDO = patientDao.findById(businessOrderDO.getPatient());
            String idcard = "";
            String ssc = "";
            if (patientDO!=null){
                idcard = patientDO.getIdcard();
            }
            String openId = "";
            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();
            response = ylzPayService.rechargeConsume("123456",businessOrderDO.getPatientName(),"01",ssc,"01",idcard,depositType,
                    price,price,businessOrderDO.getOrderNo(),idcard,"0",businessOrderDO.getPatientName(),businessOrderDO.getRematk(),openId,notifyUrl,notifyUrl,null);
            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 {
            return "找不到订单!";
        }
        return response;
    }
    public BusinessOrderDO selectStatus(String relationCode){
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
        return businessOrderDO;
    }
    /**
     * 易联众退款
     * @param wechatId
     * @param patient
     * @param orderNo
     * @param refundPrice
     * @param description
     * @return
     * @throws Exception
     */
    public Map<String,Object> ylzOrderRefund(String wechatId,String patient,String orderNo,Double refundPrice,String description) throws Exception {
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        if (wxWechatDO==null){
            throw new Exception("this wechatId is null");
        }
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(orderNo);
        if (businessOrderDO==null){
            throw new Exception("this orderId not exit");
        }
        BasePatientDO patientDO = patientDao.findById(patient);
        if (patientDO==null){
            throw new Exception("this patient not exit");
        }
        BusinessOrderRefundDO orderRefundDO = new BusinessOrderRefundDO();
        orderRefundDO = orderRefundDao.selectByOrderNo(orderNo);
        if (orderRefundDO==null){
            orderRefundDO = new BusinessOrderRefundDO();
        }
        orderRefundDO.setCreateTime(new Date());
        orderRefundDO.setUpdateTime(new Date());
        orderRefundDO.setStatus(1);
        orderRefundDO.setOrderNo(orderNo);
        orderRefundDO.setOrderPrice(businessOrderDO.getPayPrice());
        orderRefundDO.setRefundPrice(refundPrice);
        orderRefundDO.setAppId(wxWechatDO.getAppId());
        orderRefundDO.setMchId(wxWechatDO.getMchId());
        orderRefundDO.setOutRefundNo("HLWYY"+businessOrderDO.getOrderCategory()+System.currentTimeMillis());
        orderRefundDO.setPatient(patient);
        orderRefundDO.setPatientName(patientDO.getName());
        orderRefundDO.setRefundDesc(description);
        orderRefundDO = orderRefundDao.save(orderRefundDO);
        String map = ylzPayService.refund(patientDO.getIdcard(),"123456",patientDO.getName(),"01",patientDO.getIdcard(),"01",orderRefundDO.getRefundPrice().toString(),"1",orderRefundDO.getOrderNo(),orderRefundDO.getOutRefundNo(),patientDO.getIdcard());
        JSONObject object = JSONObject.parseObject(map);
        if (object.get("respCode").toString().equalsIgnoreCase("000000")){
            orderRefundDO.setStatus(2);
            orderRefundDO.setRefundTime(new Date());
            orderRefundDao.save(orderRefundDO);
        }
        return object;
    }
    /**
     * 易联众查询交易订单
     *
     * @param orderNo
     * @param tradeType
     * @return
     */
    public JSONObject tradeQuery(String orderNo,String tradeType){
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(orderNo);
        String response = ylzPayService.tradeQuery(null,null,businessOrderDO.getPatientName(),orderNo,tradeType,businessOrderDO.getRematk());
        JSONObject object = JSONObject.parseObject(response);
        return object;
    }
    /**
     *
     * @param traceNo
     * @return
     */
    public BusinessOrderDO updatePayStatus(String traceNo) throws Exception {
        logger.info("入参:"+traceNo);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByTraceNo(traceNo);
        if (businessOrderDO==null){
            throw new Exception("查不到订单!");
        }
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
           ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
           consultDo.setPayStatus(1);
           consultOrderDao.save(consultDo);
        }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")){
           WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
           wlyyOutpatientDO.setPayStatus(1);
           outpatientDao.save(wlyyOutpatientDO);
        } else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("4")) {
           List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(businessOrderDO.getRelationCode());
           if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
               WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
               wlyyPrescriptionDO.setPayStatus(1);
               prescriptionDao.save(wlyyPrescriptionDO);
           }
        }
        return businessOrderDO;
    }
}
}

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

@ -6,6 +6,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
import java.util.List;
import java.util.List;
@ -20,4 +21,11 @@ public interface BusinessOrderDao extends PagingAndSortingRepository<BusinessOrd
    @Query("from BusinessOrderDO w where w.relationCode = ?1 ")
    @Query("from BusinessOrderDO w where w.relationCode = ?1 ")
    BusinessOrderDO selectByRelationCode(String relationCode);
    BusinessOrderDO selectByRelationCode(String relationCode);
    @Query("from BusinessOrderDO w where w.traceNo = ?1 ")
    BusinessOrderDO selectByTraceNo(String traceNo);
    @Query("from BusinessOrderDO w where w.status = ?1 and w.orderCategory <>4")
    List<BusinessOrderDO> selectByStatus(Integer status);
}
}

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

@ -11,7 +11,7 @@ public interface BusinessOrderRefundDao extends PagingAndSortingRepository<Busin
    @Query("from BusinessOrderDO w where w.orderNo = ?1 ")
    @Query("from BusinessOrderRefundDO w where w.orderNo = ?1 ")
    BusinessOrderRefundDO selectByOrderNo(String orderNo);
    BusinessOrderRefundDO selectByOrderNo(String orderNo);
}
}

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

@ -0,0 +1,28 @@
package com.yihu.jw.order.dao;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
/**
 * 咨询扩展表DAO类
 * @author huangwenjie
 */
public interface ConsultTeamOrderDao extends PagingAndSortingRepository<ConsultTeamDo, String>, JpaSpecificationExecutor<ConsultTeamDo> {
	// 根據consult查詢咨询记录
	ConsultTeamDo findByConsult(String consult);
	
//	// 关闭咨询
//	@Modifying
//	@Query("update ConsultTeam a set a.status = 1 where a.consult = ?1")
//	int updateStatusByConsult(String consult);
//
//	@Query("select a from ConsultTeamDo a,ConsultTeamDoctor b where a.consult = b.consult and a.patient = ?1 and b.to = ?2 and a.del = '1' and a.type<>8 and a.status = 0")
//	List<ConsultTeamDo> findUnfinishedConsultType(String patient,String doctor);
	@Query("select count(id) from  ConsultTeamDo a where a.type = ?1 and a.doctor = ?2 and a.czrq >=?3 and a.czrq <=?4")
	Integer  countByTime(int type, String doctor, Date startTime, Date endTime);
}

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

@ -0,0 +1,17 @@
package com.yihu.jw.order.dao;
import com.yihu.jw.entity.order.PayLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Reece on 2017/9/20.
 */
public interface PayLogDao extends PagingAndSortingRepository<PayLog, Long>,JpaSpecificationExecutor<PayLog> {
	
	@Query("select p from PayLog p where p.operateCode=?1 ORDER BY createTime desc ")
	List<PayLog> getPayLogsByPrescriptionCode(String prescriptionCode);
}

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

@ -0,0 +1,52 @@
package com.yihu.jw.order.pay.utils;
import com.yihu.jw.entity.order.PayLog;
import com.yihu.jw.order.dao.PayLogDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
 * Created by Reece on 2017/9/20.
 * 日志服务
 */
@Service
public class PayLogService {
    @Autowired
    private PayLogDao payLogDao;
    public String onepayType = "0"; //诊断支付
    public String onepayRecipeType = "1";     //1续方支付
    public String shoppatType="2";//商城支付
    /**
     * 保存http调用日志  type 1续方支付
     */
    public void saveHttpLog(Boolean isSuccess,String url,String content,String method,String header,String params,String response,String error,String type)
    {
        try {
                //新增日志
                PayLog log = new PayLog();
                log.setType(type);
                log.setApi(url);
                log.setContent(content);
                log.setMethod(method);
                log.setHeader(header);
                log.setParams(params);
                log.setCreateTime(new Date());
                log.setResponse(response);
                log.setError(error);
                log.setStatus(isSuccess?"1":"0");
                payLogDao.save(log);
        }
        catch (Exception ex)
        {
            ex.printStackTrace();
        }
    }
}

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

@ -0,0 +1,228 @@
package com.yihu.jw.order.pay.ylz;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.hospital.prescription.dao.OauthDzqmConfigDao;
import com.yihu.jw.hospital.prescription.dao.OauthYlzConfigDao;
import com.yihu.jw.order.pay.utils.PayLogService;
import com.yihu.jw.utils.StringUtil;
import com.ylzinfo.onepay.sdk.HisOnepayClient;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.domain.ext.*;
import com.ylzinfo.onepay.sdk.utils.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.Map;
/**
 * Created by wangzhinan on 2020/5/9.
 */
@Service
public class YlzPayService {
    @Autowired
    private OauthYlzConfigDao oauthYlzConfigDao;
    @Autowired
    private PayLogService logService;
    /**
     private String termNo;
     private String operatorId; 操作人员id
     private String operatorName;操作人员型
     private String cardType;卡类型 ---01 社保卡 06 临时卡
     private String cardNo;---卡号
     private String accountType;---帐户类型
     private String idNo;--身份证号
     private String depositType;---充值方式WX_MIN 微信小程序 WX_PUB 微信公众号 ALI_WAP 支付宝生活号
     private String rechargeAmount;--单位:元充值金额(自费金额)
     private String consumeAmount;---消费金额
     private String outTradeNo;---商户扣费流水号
     private String tradeKind;----消费种类门诊自费结算 长处方自费结算 互联网医院自费结算
     private String hisCustId;---HIS 患者唯一 ID若无,请传卡号
     private String rechargeHis;---是否往 HIS 充值0:不往 HIS 充值 1:往 HIS 充值 默认为 0
     private String userName;----用户姓名
     private String notes;---备注
     openId---openid
     * @return
     */
    public String rechargeConsume(String operatorId,String operatorName,String cardType,String cardNo,String accountType,String idNo,String depositType,String rechargeAmount,
                                  String consumeAmount,String outTradeNo,String hisCustId,String rechargeHis,String userName,String notes,String openid,String returnUrl,String notifyUrl,String wxMinId){
        String object  = null;
        Boolean isSuccess = true;
        String error = null;
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_pay_config");
        if(oauthYlzConfigDO==null){
            return "未找到支付配置文件";
        }
        String appId = oauthYlzConfigDO.getAppId();
        String appSecret = oauthYlzConfigDO.getAppKey();
        String onepayUrl = oauthYlzConfigDO.getUrl();
        String signType=oauthYlzConfigDO.getSignType();
        String encryptType = oauthYlzConfigDO.getEncType();
        HisOnepayClient onepayClient = new HisOnepayClient(onepayUrl, appId, appSecret, signType, encryptType);
        RechargeConsumeParams param = new RechargeConsumeParams();
        try {
            param.setRechargeHis(rechargeHis);//HIS 充值
            param.setAccountType(accountType);
            param.setOutTradeNo(outTradeNo);
            param.setCardNo(cardNo);
            param.setCardType(cardType);
            param.setAccountType(accountType);
            param.setDepositType(depositType);
            param.setRechargeAmount(rechargeAmount);
            param.setConsumeAmount(consumeAmount);
            param.setIdNo(idNo);
            param.setHisCustId(hisCustId);
            param.setUserName(userName);
            param.setTermNo("123456");
            param.setNotes(notes);
            param.setOperatorId(operatorId);
            param.setOperatorName(operatorName);
            Map<String,String> extra = new HashMap<String,String>();
            extra.put("openId", openid);
            extra.put("returnUrl",returnUrl);
            extra.put("notifyUrl",notifyUrl);
            if (StringUtils.isNoneBlank(wxMinId)){
                extra.put("wxMinId",wxMinId);
            }
            param.setExtra(extra);
            ResponseParams<RechargeConsumeResult> respnse = onepayClient.rechargeConsume(param);
            if (respnse.getRespCode().equals("000000")){
                object = JSON.toJSONString(respnse);
            }else {
                isSuccess = false;
                object = JSON.toJSONString(respnse);
                error = "请求失败,返回结果:" + respnse.getRespCode() + "," + respnse.getRespMsg();
            }
        } catch (Exception e) {
            e.printStackTrace();
            isSuccess = false;
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            error = sw.toString();
        }
        logService.saveHttpLog(isSuccess, "hop.trade.recharge", "互联网医院充值", "POST", null,JSON.toJSONString(param), object, error,logService.onepayType);
        return object;
    }
    /**
     * termNo 终端编号 String(50) Y
     * operatorId 操作员编号 String(30) N
     * operatorName 操作员姓名 String(50) N
     * cardType 卡类型 String(2) N
     * cardNo 卡号 String(32) N
     * accountType 帐户类型 String(2) N 01:门诊,02:住院
     * amount 退款金额 String(12) N
     * withdrawMode 退款方式 String(1) N 0 现金退回 1 原路退回 2 银企转账 3 医保自费退回
     * outChargeNo 商户原充值订单号 String(30) N 二选一,两者同时存在 时,
     * traceNo>outCharge No,两者不能同时为空
     * traceNo 平台交易跟踪号(调 用平台充值接口后返 回的 traceNo) String(30)
     * outRefundNo 商户退款订单号 String(30) N
     * idNo 身份证号 String(32) Y
     * hisCustId HIS 系统唯一性 患者 String(30) N 没有则传卡号
     ID userName 用户姓名 String(30) Y extra 扩展参数 JSON Y checkCash String 当 withdrawMode=0 时,checkCash=1 校验 现金充值流水号及可退 金额是否合法,放空或 其他值不校验
     * @return
     */
    public String refund(String hisCustId,String operatorId,String operatorName,String cardType,String cardNo,String accountType,String amount,
                         String withdrawMode,String outChargeNo,String outRefundNo,String idNo){
        String object  = null;
        Boolean isSuccess = true;
        String error = null;
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_pay_config");
        if(oauthYlzConfigDO==null){
            return "未找到支付配置文件";
        }
        String appId = oauthYlzConfigDO.getAppId();
        String appSecret = oauthYlzConfigDO.getAppKey();
        String onepayUrl = oauthYlzConfigDO.getUrl();
        String signType=oauthYlzConfigDO.getSignType();
        String encryptType = oauthYlzConfigDO.getEncType();
        HisOnepayClient onepayClient = new HisOnepayClient(onepayUrl, appId, appSecret, signType, encryptType);
        RefundParams param = new RefundParams();
        try {
            param.setTermNo("123456");
            param.setHisCustId(hisCustId);
            param.setOperatorId(operatorId);
            param.setOperatorName(operatorName);
            param.setCardType(cardType);
            param.setCardNo(cardNo);
            param.setAccountType(accountType);
            param.setAmount(amount);
            param.setWithdrawMode(withdrawMode);
            param.setOutChargeNo(outChargeNo);
            param.setOutRefundNo(outRefundNo);
            param.setIdNo(idNo);
            ResponseParams<RefundResult> response = onepayClient.refund(param);
            if (response.getRespCode().equals("000000")){
                object = JSON.toJSONString(response);
            }else {
                isSuccess = false;
                object = JSON.toJSONString(response);
                error = "请求失败,返回结果:" + response.getRespCode() + "," + response.getRespMsg();
            }
        } catch (Exception e) {
            e.printStackTrace();
            isSuccess = false;
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            error = sw.toString();
        }
        logService.saveHttpLog(isSuccess, "hop.trade.refund", "互联网医院退款", "POST", null,JSON.toJSONString(param), object, error,logService.onepayType);
        return object;
    }
    public String tradeQuery(String termNo,String operatorId,String operatorName,String outTradeNo,String tradeType,String notes){
        String object  = null;
        Boolean isSuccess = true;
        String error = null;
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_pay_config");
        if(oauthYlzConfigDO==null){
            return "未找到支付配置文件";
        }
        String appId = oauthYlzConfigDO.getAppId();
        String appSecret = oauthYlzConfigDO.getAppKey();
        String onepayUrl = oauthYlzConfigDO.getUrl();
        String signType=oauthYlzConfigDO.getSignType();
        String encryptType = oauthYlzConfigDO.getEncType();
        HisOnepayClient onepayClient = new HisOnepayClient(onepayUrl, appId, appSecret, signType, encryptType);
        TradeQueryParams param = new TradeQueryParams();
        try {
            param.setTermNo("123456");
            param.setOperatorId("123456");
            param.setOperatorName(operatorName);
            param.setTradeType(tradeType);
            param.setOutTradeNo(outTradeNo);
            param.setNotes(notes);
            ResponseParams<TradeQueryResult> response = onepayClient.tradeQuery(param);
            if (response.getRespCode().equals("000000")){
                object = JSON.toJSONString(response);
            }else {
                isSuccess = false;
                object = JSON.toJSONString(response);
                error = "请求失败,返回结果:" + response.getRespCode() + "," + response.getRespMsg();
            }
        } catch (Exception e) {
            e.printStackTrace();
            isSuccess = false;
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            error = sw.toString();
        }
        logService.saveHttpLog(isSuccess, "hop.trade.tradeQuery", "互联网医院查询订单", "POST", null,JSON.toJSONString(param), object, error,logService.onepayType);
        return object;
    }
}

+ 72 - 0
business/base-service/src/main/java/com/yihu/jw/utils/ByteToInputStream.java

@ -0,0 +1,72 @@
package com.yihu.jw.utils;
import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
/**
 * Created by Trick on 2019/8/26.
 */
public class ByteToInputStream {
    private static final Logger logger = LoggerFactory.getLogger(ByteToInputStream.class);
    public InputStream byte2Input(byte[] buf) {
        return new ByteArrayInputStream(buf);
    }
    public byte[] input2byte(InputStream inStream)
            throws IOException {
        ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
        byte[] in2b = null;
        try {
            byte[] buff = new byte[100];
            int rc = 0;
            while ((rc = inStream.read(buff, 0, 100)) > 0) {
                swapStream.write(buff, 0, rc);
            }
            in2b = swapStream.toByteArray();
        }catch (Exception e){
            logger.error(e.toString());
        }finally {
            inStream.close();
            swapStream.close();
        }
        return in2b;
    }
    public String getBase64FromInputStream(InputStream in) {
        // 将图片文件转化为字节数组字符串,并对其进行Base64编码处理
        byte[] data = null;
        // 读取图片字节数组
        ByteArrayOutputStream swapStream = null;
        try {
            swapStream = new ByteArrayOutputStream();
            byte[] buff = new byte[100];
            int rc = 0;
            while ((rc = in.read(buff, 0, 100)) > 0) {
                swapStream.write(buff, 0, rc);
            }
            data = swapStream.toByteArray();
        } catch (IOException e) {
            logger.error("ByteToInputStream.getBase64FromInputStream:"+e.toString());
        } finally {
            if (in != null) {
                try {
                    swapStream.close();
                    in.close();
                } catch (IOException e) {
                    logger.error(e.toString());
                }
            }
        }
        return new String(Base64.encodeBase64(data));
    }
}

+ 127 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java

@ -3,11 +3,23 @@ package com.yihu.jw.wechat.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.*;
import com.yihu.jw.entity.base.wx.*;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.oauth.OauthSsoService;
import com.yihu.jw.oauth.OauthSsoService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.dao.ConsultOrderDao;
import com.yihu.jw.order.dao.ConsultTeamOrderDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.base.BaseRequestMapping;
@ -75,6 +87,18 @@ public class WxTemplateService {
    private WxPushLogDao wxPushLogDao;
    private WxPushLogDao wxPushLogDao;
    @Autowired
    @Autowired
    private HibenateUtils hibenateUtils;
    private HibenateUtils hibenateUtils;
    @Autowired
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    @Autowired
    private ConsultOrderDao consultOrderDao;
    @Autowired
    private BusinessOrderDao businessOrderDao;
    @Autowired
    private ConsultTeamOrderDao consultTeamOrderDao;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    
    
    
    
    /**
    /**
@ -196,6 +220,109 @@ public class WxTemplateService {
        }
        }
    }
    }
    public void updateStatusByPayTime() throws Exception{
        if("xm_ykyy_wx".equals(wechatId)){
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("PAY_TIME");
            if (wlyyHospitalSysDictDO!=null){
                String remind = wlyyHospitalSysDictDO.getDictValue();
                String close = wlyyHospitalSysDictDO.getDictCode();
                List<BusinessOrderDO> businessOrderDOS = businessOrderDao.selectByStatus(0);
                //关闭处理
                for (BusinessOrderDO businessOrderDO:businessOrderDOS){
                    long nd = 1000 * 24 * 60 * 60;
                    long nh = 1000 * 60 * 60;
                    long nm = 1000 * 60;
                    Long diff = businessOrderDO.getCreateTime().getTime()- new Date().getTime();
                    Long min = diff % nd % nh / nm;
                    if (min==Long.parseLong(close)){
                        String orderCategory = businessOrderDO.getOrderCategory();
                        String relationCode = businessOrderDO.getRelationCode();
                        if (orderCategory.equalsIgnoreCase("1")){
                            ConsultTeamDo consultTeamDo = consultTeamOrderDao.findByConsult(relationCode);
                            consultTeamDo.setStatus(-1);
                            consultTeamOrderDao.save(consultTeamDo);
                        }else if (orderCategory.equalsIgnoreCase("2")){
                            WlyyOutpatientDO outpatientDO = outpatientDao.findById(relationCode);
                            outpatientDO.setStatus("-1");
                            outpatientDao.save(outpatientDO);
                        }
                    }
                }
                //提醒处理
                for (BusinessOrderDO businessOrderDO:businessOrderDOS){
                    String orderCategory = businessOrderDO.getOrderCategory();
                    String relationCode = businessOrderDO.getRelationCode();
                    String orderType =businessOrderDO.getOrderType()+"";
                    String doctor = businessOrderDO.getDoctor();
                    String patient= businessOrderDO.getPatient();
                    long nd = 1000 * 24 * 60 * 60;
                    long nh = 1000 * 60 * 60;
                    long nm = 1000 * 60;
                    Long diff = businessOrderDO.getCreateTime().getTime()- new Date().getTime();
                    Long min = diff % nd % nh / nm;
                    if (min==Long.parseLong(remind)){
                        //判断是否发送过
                        String countSql = "SELECT id from WX_PUSH_LOG w WHERE w.RECEIVER = '"+patient
                                +"' and w.OPENID = '"+relationCode+"' and w.scene = 'zxzfts' and w.WECHAT_ID='"+wechatId+"'";
                        List<Map<String, Object>> count = hibenateUtils.createSQLQuery(countSql);
                        if(count==null || count.size() == 0){
                            BasePatientDO patientDO = basePatientDao.findById(patient);
                            BaseDoctorDO doctorDO = doctorDao.findById(doctor);
                            List<BasePatientWechatDo> ps = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,patient);
                            if(ps.isEmpty()){
                                logger.info("该用户"+patientDO.getName()+"没有openid,无法推送模版消息,用户ID:"+patientDO.getId()+"wechatId:"+wechatId);
                            }else{
                                ps.stream().forEach(one->{
                                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_unsettled_notice","zxzfts",1);
                                    WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
                                    BeanUtils.copyProperties(config,newConfig);
                                    String name = "";
                                    String condition="";
                                    if (orderCategory.equalsIgnoreCase("1")){
                                        if (orderType.equalsIgnoreCase("1")){
                                            name="图文咨询";
                                        }else if (orderType.equalsIgnoreCase("3")){
                                            name="视频咨询";
                                        }
                                        condition = "&consultCode="+relationCode;
                                    }else if (orderCategory.equalsIgnoreCase("2")){
                                        if (orderType.equalsIgnoreCase("1")){
                                            name="图文咨询";
                                        }else if (orderType.equalsIgnoreCase("3")){
                                            name="视频咨询";
                                        }
                                        condition = "&outpatientId="+relationCode;
                                    }
                                    newConfig.setFirst(config.getFirst().replace("key1",patientDO.getName()).replace("key2",name));
                                    newConfig.setUrl(config.getUrl()+""+condition);
                                    newConfig.setKeyword3(doctorDO.getName());
                                    newConfig.setKeyword1(name);
                                    WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
                                    logger.info("=======setUrl========"+newConfig.getUrl());
                                    weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(),one.getOpenid(),newConfig);
                                });
                                //保存发送模板记录,
                                WxPushLogDO wxPushLogDO = new WxPushLogDO();
                                wxPushLogDO.setCreateTime(new Date());
                                wxPushLogDO.setOpenid(relationCode);
                                wxPushLogDO.setReceiver(patientDO.getId());
                                wxPushLogDO.setWechatId(wechatId);
                                wxPushLogDO.setReceiverName(patientDO.getName());
                                wxPushLogDO.setScene("zxzfts");
                                wxPushLogDao.save(wxPushLogDO);
                            }
                        }
                    }
                }
            }
        }
    }
    
    
    public String sendWeTempMesTest(String wechatId,String openid)throws Exception{
    public String sendWeTempMesTest(String wechatId,String openid)throws Exception{
        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_survey","test",1);
        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_survey","test",1);

+ 48 - 12
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -1766,15 +1766,25 @@ public class ImService {
		
		
		if(!StringUtils.isEmpty(title)){
		if(!StringUtils.isEmpty(title)){
			title="%"+title+"%";
			title="%"+title+"%";
			sql +=" and a.title like '"+title+"'";
			sql +=" and a.symptoms like '"+title+"'";
		}
		}
		
		
		if(!StringUtils.isEmpty(start_time)){
		if(!StringUtils.isEmpty(start_time)){
			sql +=" and a.czrq >= '"+start_time+"'";
			if("xm_ykyy_wx".equals(wxId)){
				sql +=" and a.czrq >= to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
			}else {
				sql +=" and a.czrq >= '"+start_time+"'";
			}
		}
		}
		
		
		if(!StringUtils.isEmpty(end_time)){
		if(!StringUtils.isEmpty(end_time)){
			sql +=" and a.czrq <= '"+end_time+"'";
			if("xm_ykyy_wx".equals(wxId)){
				sql +=" and a.czrq <= to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
			}else {
				sql +=" and a.czrq <= '"+end_time+"'";
			}
		}
		}
		
		
		
		
@ -1790,7 +1800,7 @@ public class ImService {
		}
		}
		
		
		//咨询类型
		//咨询类型
		if(!StringUtils.isEmpty(type)){
		if(!StringUtils.isEmpty(type)&&!type.equalsIgnoreCase("0")){
				sql +=" AND a.type in ("+type+")" ;
				sql +=" AND a.type in ("+type+")" ;
		}
		}
		
		
@ -1827,15 +1837,24 @@ public class ImService {
		
		
		if(!StringUtils.isEmpty(title)){
		if(!StringUtils.isEmpty(title)){
			title="%"+title+"%";
			title="%"+title+"%";
			sql +=" and a.title like '"+title+"'";
			sql +=" and a.symptoms like '"+title+"'";
		}
		}
		
		
		if(!StringUtils.isEmpty(start_time)){
		if(!StringUtils.isEmpty(start_time)){
			sql +=" and a.czrq >= '"+start_time+"'";
			if("xm_ykyy_wx".equals(wxId)){
				sql +=" and a.czrq >= to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
			}else {
				sql +=" and a.czrq >= '"+start_time+"'";
			}
			/*sql +=" and a.czrq >= '"+start_time+"'";*/
		}
		}
		
		
		if(!StringUtils.isEmpty(end_time)){
		if(!StringUtils.isEmpty(end_time)){
			sql +=" and a.czrq <= '"+end_time+"'";
			if("xm_ykyy_wx".equals(wxId)){
				sql +=" and a.czrq <= to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
			}else {
				sql +=" and a.czrq <= '"+end_time+"'";
			}
		}
		}
		
		
		//咨询状态
		//咨询状态
@ -1851,7 +1870,7 @@ public class ImService {
		
		
		
		
		//咨询类型
		//咨询类型
		if(!StringUtils.isEmpty(type)){
		if(!StringUtils.isEmpty(type)&&!type.equalsIgnoreCase("0")){
			sql +=" AND a.type in ("+type+")";
			sql +=" AND a.type in ("+type+")";
		}
		}
		
		
@ -2130,11 +2149,20 @@ public class ImService {
		}
		}
		
		
		if(!StringUtils.isEmpty(start_time)){
		if(!StringUtils.isEmpty(start_time)){
			sql +=" and a.czrq >= '"+start_time+"'";
			if("xm_ykyy_wx".equals(wxId)){
				sql +=" and a.czrq >= to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
			}else {
				sql +=" and a.czrq >= '"+start_time+"'";
			}
		}
		}
		
		
		if(!StringUtils.isEmpty(end_time)){
		if(!StringUtils.isEmpty(end_time)){
			sql +=" and a.czrq <= '"+end_time+"'";
			if("xm_ykyy_wx".equals(wxId)){
				sql +=" and a.czrq <= to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
			}else {
				sql +=" and a.czrq <= '"+end_time+"'";
			}
		}
		}
		
		
		
		
@ -2195,11 +2223,19 @@ public class ImService {
		}
		}
		
		
		if(!StringUtils.isEmpty(start_time)){
		if(!StringUtils.isEmpty(start_time)){
			sql +=" and a.czrq >= '"+start_time+"'";
			if("xm_ykyy_wx".equals(wxId)){
				sql +=" and a.czrq >= to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
			}else {
				sql +=" and a.czrq >= '"+start_time+"'";
			}
		}
		}
		
		
		if(!StringUtils.isEmpty(end_time)){
		if(!StringUtils.isEmpty(end_time)){
			sql +=" and a.czrq <= '"+end_time+"'";
			if("xm_ykyy_wx".equals(wxId)){
				sql +=" and a.czrq <= to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
			}else {
				sql +=" and a.czrq <= '"+end_time+"'";
			}
		}
		}
		
		
		//咨询状态
		//咨询状态

+ 3 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java

@ -19,13 +19,13 @@ public abstract class IntegerIdentityEntity implements Serializable {
    @Id
    @Id
//==========mysql 环境 id策略======================================================
//==========mysql 环境 id策略======================================================
    @GeneratedValue(generator = "generator")
/*    @GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "identity")
    @GenericGenerator(name = "generator", strategy = "identity")
    @Column(name = "id", unique = true, nullable = false)
    @Column(name = "id", unique = true, nullable = false)*/
//==========mysql 环境 id策略 end======================================================
//==========mysql 环境 id策略 end======================================================
//==========Oracle 环境id策略 =========================================================
//==========Oracle 环境id策略 =========================================================
//    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
//==========Oracle 环境id策略 =========================================================
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
    public Integer getId() {
        return id;
        return id;

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/DoctorSpecialDiseaseDo.java

@ -1,6 +1,7 @@
package com.yihu.jw.entity.base.doctor;
package com.yihu.jw.entity.base.doctor;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Entity;
@ -14,8 +15,7 @@ import javax.persistence.Table;
 */
 */
@Entity
@Entity
@Table(name = "wlyy_doctor_special_disease")
@Table(name = "wlyy_doctor_special_disease")
@SequenceGenerator(name="id_generated", sequenceName="WLYY_DOCTOR_SPECIAL_DISEASE_SEQ")
public class DoctorSpecialDiseaseDo extends IntegerIdentityEntity {
public class DoctorSpecialDiseaseDo extends UuidIdentityEntity {
    /**
    /**
     * 医生id
     * 医生id

+ 9 - 9
common/common-entity/src/main/java/com/yihu/jw/entity/iot/message/IotMessageDO.java

@ -21,11 +21,11 @@ public class IotMessageDO extends UuidIdentityEntityWithOperator implements Seri
    @Column(name = "content")
    @Column(name = "content")
    private String content;//消息内容
    private String content;//消息内容
    @Column(name = "type")
    @Column(name = "type")
    private String type;//消息类型 1:SIM卡续费通知 2:库存预警提醒 3:定期检修提醒 4:设备质检提醒',
    private Integer type;//消息类型 1:SIM卡续费通知 2:库存预警提醒 3:定期检修提醒 4:设备质检提醒',
    @Column(name = "read_msg")
    @Column(name = "read_msg")
    private String readMsg;//消息状态,1:已读  0:未读',
    private Integer readMsg;//消息状态,1:已读  0:未读',
    @Column(name = "del")
    @Column(name = "del")
    private String del;//删除标志  1:删除  0:不删除',
    private Integer del;//删除标志  1:删除  0:不删除',
    @Column(name = "relation_code")
    @Column(name = "relation_code")
    private String relationCode;//业务关联id
    private String relationCode;//业务关联id
@ -46,27 +46,27 @@ public class IotMessageDO extends UuidIdentityEntityWithOperator implements Seri
        this.content = content;
        this.content = content;
    }
    }
    public String getType() {
    public Integer getType() {
        return type;
        return type;
    }
    }
    public void setType(String type) {
    public void setType(Integer type) {
        this.type = type;
        this.type = type;
    }
    }
    public String getReadMsg() {
    public Integer getReadMsg() {
        return readMsg;
        return readMsg;
    }
    }
    public void setReadMsg(String readMsg) {
    public void setReadMsg(Integer readMsg) {
        this.readMsg = readMsg;
        this.readMsg = readMsg;
    }
    }
    public String getDel() {
    public Integer getDel() {
        return del;
        return del;
    }
    }
    public void setDel(String del) {
    public void setDel(Integer del) {
        this.del = del;
        this.del = del;
    }
    }

+ 12 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java

@ -23,13 +23,13 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    private String patient;//居民code
    private String patient;//居民code
    private String patientName;//居民名字
    private String patientName;//居民名字
    private String orderNo;//订单号
    private String orderNo;//订单号
    private Integer orderType;//订单类型
    private Integer orderType;//订单类型订单类型:目前只能1表示图文,3表示视频大类细分如下:专家咨询:1图文咨询 |2电话咨询|3视频咨询|4免费义诊图文诊室:1图文复诊视频诊室:3视频复诊| 5社区协同
    private String orderCategory;//1:专家咨询|2:图文诊室|3:视频诊室|)
    private String orderCategory;//1:专家咨询|2:图文诊室|3:视频诊室|)
    private String relationCode;//业务关联code
    private String relationCode;//业务关联code
    private String relationName;//业务关联名称
    private String relationName;//业务关联名称
    private String description;//支付备注
    private String description;//支付备注
    private String rematk;//病人描述
    private String rematk;//病人描述
    private Integer payType;//支付类型1微信2支付宝
    private Integer payType;//支付类型1微信2支付宝3易联众支付
    private Double payPrice;//支付金额
    private Double payPrice;//支付金额
    private Date payTime;//支付时间
    private Date payTime;//支付时间
    private String doctor;//医生code
    private String doctor;//医生code
@ -45,6 +45,7 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    private String updateUserName;
    private String updateUserName;
    private String ykOrderNo;
    private String ykOrderNo;
    private String ykOrderId;
    private String ykOrderId;
    private String traceNo;//支付平台的订单号
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time", nullable = false, length = 0,updatable = false)
    @Column(name = "create_time", nullable = false, length = 0,updatable = false)
@ -276,4 +277,13 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    public void setYkOrderId(String ykOrderId) {
    public void setYkOrderId(String ykOrderId) {
        this.ykOrderId = ykOrderId;
        this.ykOrderId = ykOrderId;
    }
    }
    @Column(name = "trace_no")
    public String getTraceNo() {
        return traceNo;
    }
    public void setTraceNo(String traceNo) {
        this.traceNo = traceNo;
    }
}
}

+ 182 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/order/PayLog.java

@ -0,0 +1,182 @@
package com.yihu.jw.entity.order;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 易联众相关支付log表
 * Created by Reece on 2017/9/20.
 */
@Entity
@Table(name = "ylz_pay_log")
public class PayLog extends UuidIdentityEntity {
    // 接口类型 0家庭签约支付 1续方支付
    private String type;
    // 业务内容
    private String content;
    // 调用接口
    private String api;
    // 调用方式
    private String method;
    // 调用参数
    private String params;
    // 调用头部信息
    private String header;
    // 返回结果
    private String response;
    // 状态 0失败 1成功 2已重试
    private String status;
    // 重试次数
    private Integer retryTimes;
    // 创建时间
    private Date createTime;
    //异常信息
    private String error;
    //居民CODE
    private String patientCode;
    //业务CODE
    private String operateCode;
    //缴费人身份证
    private String idcard;
    //缴费人社保卡
    private String ssc;
    
    @Column(name = "type")
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    @Column(name = "content")
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    @Column(name = "api")
    public String getApi() {
        return api;
    }
    public void setApi(String api) {
        this.api = api;
    }
    @Column(name = "method")
    public String getMethod() {
        return method;
    }
    public void setMethod(String method) {
        this.method = method;
    }
    @Column(name = "params")
    public String getParams() {
        return params;
    }
    public void setParams(String params) {
        this.params = params;
    }
    @Column(name = "header")
    public String getHeader() {
        return header;
    }
    public void setHeader(String header) {
        this.header = header;
    }
    @Column(name = "response")
    public String getResponse() {
        return response;
    }
    public void setResponse(String response) {
        this.response = response;
    }
    @Column(name = "status")
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    @Column(name = "retry_times")
    public Integer getRetryTimes() {
        return retryTimes;
    }
    public void setRetryTimes(Integer retryTimes) {
        this.retryTimes = retryTimes;
    }
    @Column(name = "create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "error")
    public String getError() {
        return error;
    }
    public void setError(String error) {
        this.error = error;
    }
    
    public String getPatientCode() {
        return patientCode;
    }
    
    public void setPatientCode(String patientCode) {
        this.patientCode = patientCode;
    }
    
    public String getOperateCode() {
        return operateCode;
    }
    
    public void setOperateCode(String operateCode) {
        this.operateCode = operateCode;
    }
    
    public String getIdcard() {
        return idcard;
    }
    
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    
    public String getSsc() {
        return ssc;
    }
    
    public void setSsc(String ssc) {
        this.ssc = ssc;
    }
}

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

@ -378,6 +378,17 @@ public class BaseHospitalRequestMapping {
        public static final String importDoctorWork = "/importDoctorWork";
        public static final String importDoctorWork = "/importDoctorWork";
        public static final String selectOrderByRelationCode = "/selectOrderByRelationCode";
        public static final String ylzRefund = "/ylzRefund";
        public static final String tradeQuery= "/tradeQuery";
        public static final String selectOrderStatus="/selectOrderStatus";
    }
    }
    public static class YkyyPrescription extends BaseHospitalRequestMapping.Basic {
    public static class YkyyPrescription extends BaseHospitalRequestMapping.Basic {

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

@ -296,6 +296,9 @@ public class WlyyPrescriptionVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "订单号",example = "订单号")
    @ApiModelProperty(value = "订单号",example = "订单号")
    private String orderNo;
    private String orderNo;
    @ApiModelProperty(value = "订单id",example = "订单号")
    private String orderId;
    /**
    /**
     * 处方结算状态,0为未结算,1为结算成功,默认为0
     * 处方结算状态,0为未结算,1为结算成功,默认为0
     */
     */
@ -713,4 +716,12 @@ public class WlyyPrescriptionVO extends UuidIdentityVOWithOperator {
    public void setOrderNo(String orderNo) {
    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
        this.orderNo = orderNo;
    }
    }
    public String getOrderId() {
        return orderId;
    }
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
}
}

+ 76 - 8
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -1,18 +1,19 @@
package com.yihu.jw.security.oauth2.provider.endpoint;
package com.yihu.jw.security.oauth2.provider.endpoint;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.google.code.kaptcha.util.Config;
import com.google.code.kaptcha.util.Config;
import com.yihu.jw.entity.auth.OauthRsaKeyDO;
import com.yihu.jw.entity.base.login.BaseLoginLogDO;
import com.yihu.jw.entity.base.login.BaseLoginLogDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.restmodel.ResultStatus;
import com.yihu.jw.restmodel.ResultStatus;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.security.core.userdetails.jdbc.WlyyUserDetailsService;
import com.yihu.jw.security.core.userdetails.jdbc.WlyyUserDetailsService;
import com.yihu.jw.security.dao.OauthKeypairDao;
import com.yihu.jw.security.dao.OauthKeypairDao;
import com.yihu.jw.security.dao.patient.BasePatientDao;
import com.yihu.jw.security.exception.ImgCaptchaException;
import com.yihu.jw.security.exception.ImgCaptchaException;
import com.yihu.jw.security.login.service.BaseLoginLogService;
import com.yihu.jw.security.login.service.BaseLoginLogService;
import com.yihu.jw.security.model.*;
import com.yihu.jw.security.model.*;
@ -22,16 +23,16 @@ import com.yihu.jw.security.oauth2.provider.error.WlyyOAuth2ExceptionTranslator;
import com.yihu.jw.security.service.*;
import com.yihu.jw.security.service.*;
import com.yihu.jw.security.utils.AES;
import com.yihu.jw.security.utils.AES;
import com.yihu.jw.security.utils.DateUtil;
import com.yihu.jw.security.utils.DateUtil;
import com.yihu.jw.security.utils.IdCardUtil;
import com.yihu.jw.security.utils.SerializeUtil;
import com.yihu.jw.security.utils.SerializeUtil;
import com.yihu.jw.sms.service.YkyySMSService;
import com.yihu.jw.sms.service.YkyySMSService;
import com.yihu.jw.sms.service.ZhongShanSMSService;
import com.yihu.jw.sms.service.ZhongShanSMSService;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
import com.yihu.utils.security.MD5;
import com.yihu.utils.security.RSAUtils;
import com.yihu.utils.security.RSAUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.*;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -68,14 +69,11 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.IOException;
import java.net.URLDecoder;
import java.net.URLDecoder;
import java.security.KeyPair;
import java.security.KeyPair;
import java.security.PrivateKey;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.interfaces.RSAPublicKey;
import java.text.SimpleDateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeUnit;
import com.alibaba.fastjson.JSON;
import sun.misc.BASE64Encoder;
import sun.misc.BASE64Encoder;
/**
/**
@ -136,6 +134,8 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    private RegisterService registerService;
    private RegisterService registerService;
    @Autowired
    @Autowired
    private YkyyService ykyyService;
    private YkyyService ykyyService;
    @Autowired
    private BasePatientDao basePatientDao;
    @PostConstruct
    @PostConstruct
    private void init() {
    private void init() {
@ -1411,6 +1411,74 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                    JSONObject object = JSONObject.parseObject(response);
                    JSONObject object = JSONObject.parseObject(response);
                    if (!object.getString("code").equalsIgnoreCase("200")){
                    if (!object.getString("code").equalsIgnoreCase("200")){
                        throw new Exception(object.getString("msg"));
                        throw new Exception(object.getString("msg"));
                    }else {
                        JSONObject jsonObject = object.getJSONObject("data");
                        if (jsonObject!=null){
                            String userId= jsonObject.getString("ID");
                            String tel = jsonObject.getString("LOGINID");
                            List<BasePatientDO> basePatientDOS = basePatientDao.findByMobile(tel);
                            BasePatientDO basePatientDO = new BasePatientDO();
                            if (basePatientDOS==null||basePatientDOS.size()==0){
                                String familyList = ykyyService.getFamilyList(null,userId);
                                JSONObject familyJson = JSONObject.parseObject(familyList);
                                if (familyJson.getString("code").equalsIgnoreCase("200")){
                                    JSONObject object1 = familyJson.getJSONObject("data");
                                    JSONArray list = object1.getJSONArray("list");
                                    if (list!=null&&list.size()!=0){
                                        for (int i=0;i<list.size();i++){
                                            JSONObject family = list.getJSONObject(i);
                                            if (family.getString("ILLNESS").equalsIgnoreCase("本人")){
                                                basePatientDO.setDel("1");
                                                basePatientDO.setName(family.getString("NAME"));
                                                basePatientDO.setCreateTime(new Date());
                                                basePatientDO.setUpdateTime(new Date());
                                                basePatientDO.setYktId(family.getString("ID"));
                                                basePatientDO.setUserId(userId);
                                                basePatientDO.setIdcard(family.getString("IDCARD"));
                                                String idcard = family.getString("IDCARD");
                                                Integer age = IdCardUtil.getAgeForIdcard(idcard);
                                                String sex = IdCardUtil.getSexForIdcard_new(idcard);
                                                Integer sexx = null;
                                                if (org.apache.commons.lang3.StringUtils.isNoneBlank(sex)){
                                                    sexx = Integer.parseInt(sex);
                                                }
                                                String birthDay = family.getString("BIRTHDAY");
                                                Date birthday = null;
                                                if (org.apache.commons.lang3.StringUtils.isNoneBlank(birthDay)){
                                                    birthday = DateUtil.strToDate(birthDay+" 00:00:00");;
                                                }
                                                basePatientDO.setBirthday(birthday);
                                                basePatientDO.setSex(sexx);
                                                basePatientDO.setMobile(tel);
                                                String salt = UUID.randomUUID().toString().substring(0,5);
                                                String pw = idcard.substring(idcard.length()-6,idcard.length());
                                                basePatientDO.setIdcard(idcard);
                                                basePatientDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                                                basePatientDO.setSalt(salt);
                                                basePatientDO.setLocked(0);
                                                basePatientDO.setEnabled(1);
                                                basePatientDO.setPatientStatus("1");
                                                basePatientDao.save(basePatientDO);
                                            }
                                        }
                                    }else {
                                        basePatientDO.setDel("1");
                                        basePatientDO.setCreateTime(new Date());
                                        basePatientDO.setUpdateTime(new Date());
                                        basePatientDO.setUserId(userId);
                                        basePatientDO.setMobile(tel);
                                        String salt = UUID.randomUUID().toString().substring(0,5);
                                        String pw = tel.substring(tel.length()-6,tel.length());
                                        basePatientDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                                        basePatientDO.setSalt(salt);
                                        basePatientDO.setLocked(0);
                                        basePatientDO.setEnabled(1);
                                        basePatientDO.setPatientStatus("1");
                                        basePatientDao.save(basePatientDO);
                                    }
                                }
                            }
                        }
                    }
                    }
                }
                }
                parameters.remove("password");
                parameters.remove("password");

+ 125 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyYkyyEndpoint.java

@ -7,10 +7,14 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.security.core.userdetails.jdbc.WlyyUserDetailsService;
import com.yihu.jw.security.core.userdetails.jdbc.WlyyUserDetailsService;
import com.yihu.jw.security.dao.doctor.BaseDoctorDao;
import com.yihu.jw.security.dao.doctor.BaseDoctorDao;
import com.yihu.jw.security.dao.patient.BasePatientDao;
import com.yihu.jw.security.login.service.BaseLoginLogService;
import com.yihu.jw.security.login.service.BaseLoginLogService;
import com.yihu.jw.security.model.WlyyUserSimple;
import com.yihu.jw.security.model.WlyyUserSimple;
import com.yihu.jw.security.oauth2.provider.WlyyTokenGranter;
import com.yihu.jw.security.oauth2.provider.WlyyTokenGranter;
import com.yihu.jw.security.service.YkyyService;
import com.yihu.jw.security.service.YkyyService;
import com.yihu.jw.security.utils.DateUtil;
import com.yihu.jw.security.utils.IdCardUtil;
import com.yihu.utils.security.MD5;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections.map.HashedMap;
import org.slf4j.Logger;
import org.slf4j.Logger;
@ -34,7 +38,9 @@ import org.springframework.web.client.RestTemplate;
import javax.annotation.PostConstruct;
import javax.annotation.PostConstruct;
import java.util.Date;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Map;
import java.util.UUID;
/**
/**
 * Created by yeshijie on 2020/4/24.
 * Created by yeshijie on 2020/4/24.
@ -67,6 +73,8 @@ public class WlyyYkyyEndpoint extends AbstractEndpoint {
    private AuthenticationManager authenticationManager;
    private AuthenticationManager authenticationManager;
    @Autowired
    @Autowired
    private WlyyTokenGranter tokenGranter;
    private WlyyTokenGranter tokenGranter;
    @Autowired
    private BasePatientDao basePatientDao;
    @PostConstruct
    @PostConstruct
@ -156,6 +164,123 @@ public class WlyyYkyyEndpoint extends AbstractEndpoint {
        return ObjEnvelop.getError("登录失败!");
        return ObjEnvelop.getError("登录失败!");
    }
    }
    /**
     * 眼科居民登录
     * @param verifyCode
     * @param client_id
     * @param login_type 用户类型 1或默认为user,2:居民登录
     * @return
     */
    @RequestMapping(value = "/oauth/ykyyPatientLogin", method = RequestMethod.POST)
    public ObjEnvelop ykyyPatientLogin(String verifyCode, String client_id,String login_type) {
        if (StringUtils.isEmpty(client_id)) {
            throw new InvalidRequestException("client_id is null");
        }
        if (StringUtils.isEmpty(login_type)) {
            throw new InvalidRequestException("login_type is null");
        }
        try {
            logger.info("verifyCode :"+verifyCode);
            String data = ykyyService.getPatientInfoByVerifycode(verifyCode);
            JSONObject jsonObject = JSONObject.parseObject(data);
            if(!jsonObject.getString("code").equalsIgnoreCase("10000")){
                logger.info(jsonObject.getString("message"));
                return ObjEnvelop.getError("授权登录失败!");
            }
            JSONObject value = jsonObject.getJSONObject("value");
            String userId = value.getString("userId");
            String tel = value.getString("tel");
            String idCard = value.getString("Idcard");
            String yktId = value.getString("yktId");
            String name = value.getString("name");
            List<BasePatientDO> basePatientDOS = basePatientDao.findByMobile(tel);
//            String idCard = "352103197207090030";
            if(basePatientDOS == null||basePatientDOS.size()==0){
                BasePatientDO basePatientDO = new BasePatientDO();
                basePatientDO.setDel("1");
                basePatientDO.setName(name);
                basePatientDO.setCreateTime(new Date());
                basePatientDO.setUpdateTime(new Date());
                basePatientDO.setYktId(yktId);
                basePatientDO.setUserId(userId);
                basePatientDO.setIdcard(idCard);
                if (org.apache.commons.lang3.StringUtils.isNoneBlank(idCard)){
                    Integer age = IdCardUtil.getAgeForIdcard(idCard);
                    String sex = IdCardUtil.getSexForIdcard_new(idCard);
                    Integer sexx = null;
                    if (org.apache.commons.lang3.StringUtils.isNoneBlank(sex)){
                        sexx = Integer.parseInt(sex);
                    }
                    basePatientDO.setSex(sexx);
                    String birthday = IdCardUtil.getBirthdayForIdcardStr(idCard);
                    Date birthDay = null;
                    if (org.apache.commons.lang3.StringUtils.isNoneBlank(birthday)){
                        birthDay = DateUtil.strToDate(birthday+" 00:00:00");;
                    }
                    basePatientDO.setBirthday(birthDay);
                }
                basePatientDO.setMobile(tel);
                String salt = UUID.randomUUID().toString().substring(0,5);
                String pw = tel.substring(tel.length()-6,tel.length());
                basePatientDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                basePatientDO.setSalt(salt);
                basePatientDO.setLocked(0);
                basePatientDO.setEnabled(1);
                basePatientDO.setPatientStatus("1");
                basePatientDao.save(basePatientDO);
            }
            ClientDetails authenticatedClient = clientDetailsService.loadClientByClientId(client_id);
            Map<String, String> parameters = new HashedMap();
            parameters.put("username", tel);
            parameters.put("grant_type", "ihealthCode");
            TokenRequest tokenRequest = oAuth2RequestFactory.createTokenRequest(parameters, authenticatedClient);
            if (authenticatedClient != null) {
                oAuth2RequestValidator.validateScope(tokenRequest, authenticatedClient);
            }
            OAuth2AccessToken token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
            if (token == null) {
                throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
            }
            WlyyUserSimple wlyyUserSimple = userDetailsService.authSuccess(parameters.get("username"));
            wlyyUserSimple.setAccessToken(token.getValue());
            wlyyUserSimple.setTokenType(token.getTokenType());
            wlyyUserSimple.setExpiresIn(token.getExpiresIn());
            wlyyUserSimple.setRefreshToken(token.getRefreshToken().getValue());
            wlyyUserSimple.setUser(parameters.get("username"));
            String loginType = parameters.get("login_type");
            BaseLoginLogDO baseLoginLogDO = new BaseLoginLogDO();
            userDetailsService.setRolePhth(loginType, token, wlyyUserSimple.getId(), redisTemplate);
            baseLoginLogDO.setUserId(wlyyUserSimple.getId());
            baseLoginLogDO.setCreateTime(new Date());
            String userAgent = JSONObject.toJSONString(wlyyUserSimple);
            baseLoginLogDO.setUserAgent(userAgent);
            baseLoginLogDO.setLoginType(loginType);
            baseLoginLogService.save(baseLoginLogDO);
            return ObjEnvelop.getSuccess("success",wlyyUserSimple);
        }catch (Exception e){
            logger.error(e);
        }
        return ObjEnvelop.getError("登录失败!");
    }
    @Override
    @Override
    protected TokenGranter getTokenGranter() {
    protected TokenGranter getTokenGranter() {
        return this.tokenGranter;
        return this.tokenGranter;

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

@ -46,6 +46,16 @@ public class YkyyService {
        return httpClientUtil.get(yktUrl1+url+"?verifyCode="+verifyCode,"GBK");
        return httpClientUtil.get(yktUrl1+url+"?verifyCode="+verifyCode,"GBK");
    }
    }
    /**
     * 眼科医院单点登录接口
     * @return
     */
    public String getPatientInfoByVerifycode(String verifyCode){
        String url = "/api/patient/GetPatientInfoByVerifycode";
        return httpClientUtil.get(yktUrl1+url+"?verifyCode="+verifyCode,"GBK");
    }
    /**
    /**
     *获取家庭成员信息
     *获取家庭成员信息
     *
     *

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

@ -106,12 +106,100 @@ public class XzzxCotroller extends EnvelopRestEndpoint {
                                         @ApiParam(name = "patNo", value = "病人id", required = false)
                                         @ApiParam(name = "patNo", value = "病人id", required = false)
                                         @RequestParam(value = "patNo",required = false)String patNo,
                                         @RequestParam(value = "patNo",required = false)String patNo,
                                         @ApiParam(name = "admNo", value = "住院唯一号", required = false)
                                         @ApiParam(name = "admNo", value = "住院唯一号", required = false)
                                             @RequestParam(value = "admNo",required = false)String admNo,
                                          @RequestParam(value = "admNo",required = false)String admNo,
                                         @ApiParam(name = "realOrder", value = "处方号", required = false)
                                         @ApiParam(name = "realOrder", value = "处方号", required = false)
                                             @RequestParam(value = "realOrder",required = false)String realOrder)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.getOriginPrescriptionList(registerSn,patNo,admNo,realOrder));
                                          @RequestParam(value = "realOrder",required = false)String realOrder,
                                         @ApiParam(name = "startTime", value = "开始时间", required = false)
                                         @RequestParam(value = "startTime",required = false)String startTime,
                                         @ApiParam(name = "endTime", value = "结束时间", required = false)
                                         @RequestParam(value = "endTime",required = false)String endTime)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.getOriginPrescriptionList(registerSn,patNo,admNo,realOrder,startTime,endTime));
    }
    /**
     * 获取门诊病人诊断
     * @param registerSn 流水号(必传)
     * @param patNo 病人id(必传)
     * @param admNo 住院唯一号(必传)
     * @param realOrder 处方号(非必传,传相当于查单条处方)
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/getOutpatientDiagnosis")
    @ApiOperation(value = "获取门诊病人诊断", notes = "获取门诊病人诊断")
    public ObjEnvelop getOutpatientDiagnosis(@ApiParam(name = "registerSn", value = "流水号", required = false)
                                             @RequestParam(value = "registerSn",required = false)String registerSn,
                                             @ApiParam(name = "patNo", value = "病人id", required = false)
                                             @RequestParam(value = "patNo",required = false)String patNo,
                                             @ApiParam(name = "admNo", value = "住院唯一号", required = false)
                                             @RequestParam(value = "admNo",required = false)String admNo,
                                             @ApiParam(name = "realOrder", value = "处方号", required = false)
                                             @RequestParam(value = "realOrder",required = false)String realOrder,
                                             @ApiParam(name = "startTime", value = "开始时间", required = false)
                                             @RequestParam(value = "startTime",required = false)String startTime,
                                             @ApiParam(name = "endTime", value = "结束时间", required = false)
                                             @RequestParam(value = "endTime",required = false)String endTime)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.getOutpatientDiagnosis(registerSn,patNo,admNo,realOrder,startTime,endTime));
    }
    /**
     * 获取门诊病人处方药品信息
     * @param registerSn 流水号(必传)
     * @param patNo 病人id(必传)
     * @param admNo 住院唯一号(必传)
     * @param realOrder 处方号(非必传,传相当于查单条处方)
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/getOutpatientDrugInfo")
    @ApiOperation(value = "获取门诊病人处方药品信息", notes = "获取门诊病人处方药品信息")
    public ObjEnvelop getOutpatientDrugInfo(@ApiParam(name = "registerSn", value = "流水号", required = false)
                                             @RequestParam(value = "registerSn",required = false)String registerSn,
                                             @ApiParam(name = "patNo", value = "病人id", required = false)
                                             @RequestParam(value = "patNo",required = false)String patNo,
                                             @ApiParam(name = "admNo", value = "住院唯一号", required = false)
                                             @RequestParam(value = "admNo",required = false)String admNo,
                                             @ApiParam(name = "realOrder", value = "处方号", required = false)
                                             @RequestParam(value = "realOrder",required = false)String realOrder,
                                             @ApiParam(name = "startTime", value = "开始时间", required = false)
                                             @RequestParam(value = "startTime",required = false)String startTime,
                                             @ApiParam(name = "endTime", value = "结束时间", required = false)
                                             @RequestParam(value = "endTime",required = false)String endTime)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.getOutpatientDrugInfo(registerSn,patNo,admNo,realOrder,startTime,endTime));
    }
    /**
     * 获取门诊病人检查检验信息
     * @param registerSn 流水号(必传)
     * @param patNo 病人id(必传)
     * @param admNo 住院唯一号(必传)
     * @param realOrder 处方号(非必传,传相当于查单条处方)
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/getOutpatientCheckTestInfo")
    @ApiOperation(value = "获取门诊病人检查检验信息", notes = "获取门诊病人检查检验信息")
    public ObjEnvelop getOutpatientCheckTestInfo(@ApiParam(name = "registerSn", value = "流水号", required = false)
                                            @RequestParam(value = "registerSn",required = false)String registerSn,
                                            @ApiParam(name = "patNo", value = "病人id", required = false)
                                            @RequestParam(value = "patNo",required = false)String patNo,
                                            @ApiParam(name = "admNo", value = "住院唯一号", required = false)
                                            @RequestParam(value = "admNo",required = false)String admNo,
                                            @ApiParam(name = "realOrder", value = "处方号", required = false)
                                            @RequestParam(value = "realOrder",required = false)String realOrder,
                                            @ApiParam(name = "startTime", value = "开始时间", required = false)
                                            @RequestParam(value = "startTime",required = false)String startTime,
                                            @ApiParam(name = "endTime", value = "结束时间", required = false)
                                            @RequestParam(value = "endTime",required = false)String endTime)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.getOutpatientCheckTestInfo(registerSn,patNo,admNo,realOrder,startTime,endTime));
    }
    }
    /**
    /**
     * 挂号(调his后台包)
     * 挂号(调his后台包)
     * @param doctor 医生ID(必填)
     * @param doctor 医生ID(必填)
@ -143,14 +231,14 @@ public class XzzxCotroller extends EnvelopRestEndpoint {
             * @throws Exception
             * @throws Exception
     */
     */
    @GetMapping(value = "/updatePreStatus")
    @GetMapping(value = "/updatePreStatus")
    @ApiOperation(value = "获取单条门诊就诊记录", notes = "获取单条门诊就诊记录")
    @ApiOperation(value = "处方状态变更", notes = "处方状态变更")
    public ObjEnvelop updatePreStatus(@ApiParam(name = "admNo", value = "就诊唯一号", required = false)
    public ObjEnvelop updatePreStatus(@ApiParam(name = "admNo", value = "就诊唯一号", required = false)
                                      @RequestParam(value = "admNo",required = false)String admNo,
                                      @RequestParam(value = "admNo",required = false)String admNo,
                                      @ApiParam(name = "realOrder", value = "处方号", required = false)
                                      @ApiParam(name = "realOrder", value = "处方号", required = false)
                                      @RequestParam(value = "realOrder",required = false)String realOrder,
                                      @RequestParam(value = "realOrder",required = false)String realOrder,
                                      @ApiParam(name = "status", value = "处方状态:3结算完成", required = false)
                                      @ApiParam(name = "status", value = "处方状态:3结算完成", required = false)
                                      @RequestParam(value = "status",required = false)String status)throws Exception{
                                      @RequestParam(value = "status",required = false)String status)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.updatePrescriptionStatus(admNo,realOrder,status));
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.updatePreStatus(admNo,realOrder,status));
    }
    }

+ 40 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/ykyy/UpdateStatusByPayTimeJob.java

@ -0,0 +1,40 @@
package com.yihu.jw.job.ykyy;
import com.yihu.jw.wechat.service.WxTemplateService;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
 * 1、发起咨询、复诊时需增加支付时限,时限需支持按分钟设置,目前设置为15分钟。
 2、如果长时间未支付,需要提醒患者。需要支持配置提前n分钟进行提醒推送。
 * Created by yeshijie on 2020/4/26.
 *
 * @author wangzhinan.
 */
@DisallowConcurrentExecution
public class UpdateStatusByPayTimeJob implements Job{
    private static final Logger logger = LoggerFactory.getLogger(UpdateStatusByPayTimeJob.class);
    @Autowired
    private WxTemplateService wxTemplateService;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        logger.info("START========UpdateStatusByPayTimeJob========");
        try {
            wxTemplateService.updateStatusByPayTime();
            logger.info("END========UpdateStatusByPayTimeJob 执行结束========");
        }catch (Exception e){
            e.printStackTrace();
            logger.error("END===ERROE===UpdateStatusByPayTimeJob,message:"+e.getMessage());
        }
    }
}

+ 14 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java

@ -8,6 +8,7 @@ import com.yihu.jw.internet.service.InternetService;
import com.yihu.jw.internet.service.ykyy.YkyyInternetService;
import com.yihu.jw.internet.service.ykyy.YkyyInternetService;
import com.yihu.jw.job.*;
import com.yihu.jw.job.*;
import com.yihu.jw.job.ykyy.UnSettledHISPrescriptionJob;
import com.yihu.jw.job.ykyy.UnSettledHISPrescriptionJob;
import com.yihu.jw.job.ykyy.UpdateStatusByPayTimeJob;
import com.yihu.jw.job.ykyy.YkyyDataUploadJob;
import com.yihu.jw.job.ykyy.YkyyDataUploadJob;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.service.quota.JobService;
import com.yihu.jw.service.quota.JobService;
@ -175,6 +176,17 @@ public class JobController extends BaseController {
                        logger.info("unsettled_prescription_notice_job  job exist");
                        logger.info("unsettled_prescription_notice_job  job exist");
                    }
                    }
                    break;
                case "pay_status_notice_job" :
                    //互联网医院 待结算消息推送
                    if (!quartzHelper.isExistJob("pay_status_notice_job")) {
                        String trigger = SystemConf.getInstance().getSystemProperties().getProperty("pay_status_notice_job");
                        quartzHelper.addJob(UpdateStatusByPayTimeJob.class, trigger, "pay_status_notice_job", new HashMap<String, Object>());
                        logger.info("pay_status_notice_job  job success");
                    } else {
                        logger.info("pay_status_notice_job  job exist");
                    }
                    break;
                    break;
                default :
                default :
            }
            }
@ -580,4 +592,6 @@ public class JobController extends BaseController {
    public String testImg(String path) {
    public String testImg(String path) {
      return write(200, ykyyInternetService.testImg(path));
      return write(200, ykyyInternetService.testImg(path));
    }
    }
}
}

+ 1 - 1
svr/svr-internet-hospital-job/src/main/resources/application.yml

@ -118,7 +118,7 @@ fastDFS:
wlyy:
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
  url: http://www.xmtyw.cn/wlyytest/
wechat:
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
---
---

+ 1 - 0
svr/svr-internet-hospital-job/src/main/resources/system.properties

@ -13,6 +13,7 @@ data_upload_job=0 0 2 * * ?
data_ykupload_job=0 0 0 * * ?
data_ykupload_job=0 0 0 * * ?
#每间隔1分钟触发
#每间隔1分钟触发
unsettled_prescription_notice_job=0 */1 * * * ?
unsettled_prescription_notice_job=0 */1 * * * ?
pay_status_notice_job=0 */1 * * * ?
#-------------------------眼科医院end-----------------------------#
#-------------------------眼科医院end-----------------------------#
#-------------------------监管平台通用医院-----------------------------#
#-------------------------监管平台通用医院-----------------------------#
data_common_upload_job=0 0 0 * * ?
data_common_upload_job=0 0 0 * * ?

+ 21 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/Xzyy/XzyyController.java

@ -92,4 +92,25 @@ public class XzyyController extends EnvelopRestEndpoint {
    }
    }
    /**
     * 处方状态变更
     * @param admNo 就诊唯一号(必填)
     * @param realOrder 处方号(必填)
     * @param status 处方状态:3结算完成(必填)
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/updatePreStatus")
    @ApiOperation(value = "处方状态变更", notes = "处方状态变更")
    public ObjEnvelop updatePreStatus(@ApiParam(name = "admNo", value = "就诊唯一号", required = false)
                                      @RequestParam(value = "admNo",required = false)String admNo,
                                      @ApiParam(name = "realOrder", value = "处方号", required = false)
                                      @RequestParam(value = "realOrder",required = false)String realOrder,
                                      @ApiParam(name = "status", value = "处方状态:3结算完成", required = false)
                                      @RequestParam(value = "status",required = false)String status)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.updatePreStatus(admNo,realOrder,status));
    }
}
}

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

@ -194,6 +194,8 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
						net.sf.json.JSONObject res = prescriptionService.registerOutPatient(outpatientCode,doctorCode);
						net.sf.json.JSONObject res = prescriptionService.registerOutPatient(outpatientCode,doctorCode);
						rsCode = (String)res.get("@RESULT");
						rsCode = (String)res.get("@RESULT");
						mes = (String)res.get("@MSG");
						mes = (String)res.get("@MSG");
					/*	rsCode="0";
						mes="已挂号";*/
					}
					}
					if("0".equals(rsCode)||"-2".equals(rsCode)){
					if("0".equals(rsCode)||"-2".equals(rsCode)){
@ -312,7 +314,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "doctor",required = false) String doctor,
			@RequestParam(value = "doctor",required = false) String doctor,
			@ApiParam(name = "general_doctor", value = "全科医生CODE")
			@ApiParam(name = "general_doctor", value = "全科医生CODE")
			@RequestParam(value = "general_doctor",required = false) String general_doctor)throws Exception{
			@RequestParam(value = "general_doctor",required = false) String general_doctor)throws Exception{
		return success("请求成功",prescriptionService.getVideoPrescriptionByDoctor(doctor,general_doctor));
		return success("请求成功",prescriptionService.getVideoPrescriptionByDoctor(doctor,general_doctor,wxId));
	}
	}
	
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.getWaitingForVisitVideoPrescriptionByDoctor)
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.getWaitingForVisitVideoPrescriptionByDoctor)
@ -320,7 +322,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	public ListEnvelop getWaitingForVisitVideoPrescriptionByDoctor(
	public ListEnvelop getWaitingForVisitVideoPrescriptionByDoctor(
			@ApiParam(name = "doctor", value = "医生CODE")
			@ApiParam(name = "doctor", value = "医生CODE")
			@RequestParam(value = "doctor",required = true) String doctor)throws Exception{
			@RequestParam(value = "doctor",required = true) String doctor)throws Exception{
		return success("请求成功",prescriptionService.getWaitingForVisitVideoPrescriptionByDoctor(doctor));
		return success("请求成功",prescriptionService.getWaitingForVisitVideoPrescriptionByDoctor(doctor,wxId));
	}
	}
	
	
	@PostMapping(value = BaseHospitalRequestMapping.DodtorIM.pickVideoPrescripitonWaitingPeople)
	@PostMapping(value = BaseHospitalRequestMapping.DodtorIM.pickVideoPrescripitonWaitingPeople)

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

@ -442,6 +442,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
						businessOrderDO.setRelationName("新增专家咨询");
						businessOrderDO.setRelationName("新增专家咨询");
					}
					}
					businessOrderService.saveOrder(businessOrderDO);
					businessOrderService.saveOrder(businessOrderDO);
				}else if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
					Double price = 0.01;
					businessOrderService.recharge(re.getString("consult"),"新增专家咨询","1","专家咨询费",patient,re.getString("patientName"),doctor,price);
				}
				}
			}catch (Exception e){
			}catch (Exception e){
			    logger.info("支付订单失败:"+e.getMessage());
			    logger.info("支付订单失败:"+e.getMessage());

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

@ -1,10 +1,13 @@
package com.yihu.jw.hospital.endpoint.patient;
package com.yihu.jw.hospital.endpoint.patient;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.dict.service.BaseDictJobTitleService;
import com.yihu.jw.dict.service.BaseDictJobTitleService;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.hospital.prescription.dao.OauthYlzConfigDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.service.consult.SysDictService;
import com.yihu.jw.hospital.service.consult.SysDictService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.im.service.ImService;
@ -17,7 +20,9 @@ import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.patient.PatientRequestMapping;
import com.yihu.jw.rm.patient.PatientRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wechat.service.WechatInfoService;
import com.yihu.jw.wechat.service.WechatInfoService;
import com.yihu.jw.wechat.service.WxUrlConfigService;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.exception.PayException;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
@ -28,11 +33,14 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.util.StreamUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.Date;
import java.util.Date;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
@ -70,6 +78,9 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private String wxId;
    private String wxId;
    @Autowired
    @Autowired
    private StringRedisTemplate redisTemplate;
    private StringRedisTemplate redisTemplate;
    @Autowired
    private OauthYlzConfigDao oauthYlzConfigDao;
@ -297,4 +308,59 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        return map;
        return map;
    }
    }
    /**
     * 商户回调通知
     * @param request
     * @param response
     * @throws IOException
     * @throws PayException
     */
    @RequestMapping(value = "/ylzReceiveNotify")
    public String mmpReceiveNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, PayException {
        response.setContentType("text/html;charset=utf-8");
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_pay_config");
        if(oauthYlzConfigDO==null){
            return "未找到支付配置文件";
        }
        String appId = oauthYlzConfigDO.getAppId();
        String appSecret = oauthYlzConfigDO.getAppKey();
        InputStream inputStream = request.getInputStream();
        String params = StreamUtils.copyToString(inputStream, Charset.forName("UTF-8"));
        logger.info("回调参数:{}", params);
        if (StringUtil.isEmpty(params)) {
            response.getWriter().write("empty");
            return appId;
        }
        // 参数转换
        ResponseParams<?> encryptRes = JSON.parseObject(params, ResponseParams.class);
        OnepayDefaultClient client = new OnepayDefaultClient("", appId, appSecret, encryptRes.getSignType(), encryptRes.getEncryptType());
        try {
            logger.info("解密前:{}", JSON.toJSONString(encryptRes));
            ResponseParams<?> decryptRes = client.decryptNotifyResponse(encryptRes);
            logger.info("解密后:{}",JSON.toJSONString(decryptRes) );
            boolean isDecrypt = ("-1".equals(decryptRes.getRespCode()) ? false : true); // 是否解密失败
            if (!isDecrypt) {
                response.getWriter().write("DECRYPT FAILURE");
            } else {
                boolean isVerify = client.verifyResponseSign(decryptRes);
                logger.info("验签结果:{}", isVerify);
                if (!isVerify) {
                    response.getWriter().write("FAILURE");
                } else {
                    JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(decryptRes));
                    JSONObject param = jsonObject.getJSONObject("param");
                    String traceNo = param.getString("traceNo");
                    businessOrderService.updatePayStatus(traceNo);
                    response.getWriter().write("SUCCESS");
                }
            }
        } catch (Exception e) {
            response.getWriter().write(e.getMessage());
        }
        return appId;
    }
}
}

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

@ -15,6 +15,7 @@ import com.yihu.jw.hospital.prescription.service.entrance.DoctorPreSignService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.im.ConsultVO;
import com.yihu.jw.restmodel.im.ConsultVO;
@ -79,9 +80,15 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @Autowired
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    private XzzxEntranceService xzzxEntranceService;
    @Autowired
    private BusinessOrderService businessOrderService;
    @Value("${demo.flag}")
    @Value("${demo.flag}")
    private boolean demoFlag;
    private boolean demoFlag;
    @Value("${wechat.id}")
    private String wxId;
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOutpatientList)
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOutpatientList)
    @ApiOperation(value = " 查询某个时间段的患者门诊就诊记录")
    @ApiOperation(value = " 查询某个时间段的患者门诊就诊记录")
    public ListEnvelop findOutpatientList(@ApiParam(name = "patient", value = "居民id")
    public ListEnvelop findOutpatientList(@ApiParam(name = "patient", value = "居民id")
@ -959,7 +966,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        if (data != null) {
        if (data != null) {
            for (Map<String,Object> consult : data) {
            for (Map<String,Object> consult : data) {
                
                
                Integer consultType =  Integer.parseInt((String)consult.get("type"));
                Integer consultType =  Integer.parseInt(consult.get("type").toString());
                
                
                if("1,15".equals(consultType)){//专家咨询
                if("1,15".equals(consultType)){//专家咨询
@ -1102,4 +1109,92 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        envelop.setDetailModelList(error);
        envelop.setDetailModelList(error);
        return envelop;
        return envelop;
    }
    }
    /**
     * 易联众统一支付
     * @param relationCode
     * @return
     * @throws Exception
     */
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.selectOrderByRelationCode)
    @ApiOperation("统一支付")
    public ObjEnvelop selectOrderByRelationCode(
            @ApiParam(name = "relationCode", value = "relationCode", required = true)
            @RequestParam(required = true)String relationCode,
            @ApiParam(name = "depositType", value = "depositType", required = true)
            @RequestParam(required = true)String depositType) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.reChargeJSON(relationCode,depositType,wxId));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 查询支付状态
     * @param relationCode
     * @return
     * @throws Exception
     */
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.selectOrderStatus)
    @ApiOperation("查询支付状态")
    public ObjEnvelop selectOrderStatus(
            @ApiParam(name = "relationCode", value = "relationCode", required = true)
            @RequestParam(required = true)String relationCode) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.selectStatus(relationCode));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 易联众统一退款
     *
     *
     * @throws Exception
     */
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.ylzRefund)
    @ApiOperation("易联众统一退款")
    public ObjEnvelop ylzRefund(
            @ApiParam(name = "patient", value = "patient", required = true)
            @RequestParam(required = true)String patient,
            @ApiParam(name = "orderNo", value = "orderNo", required = true)
            @RequestParam(required = true)String orderNo,
            @ApiParam(name = "refundPrice", value = "refundPrice", required = true)
            @RequestParam(required = true)Double refundPrice,
            @ApiParam(name = "description", value = "description", required = true)
            @RequestParam(required = true)String description) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.ylzOrderRefund(wxId,patient,orderNo,refundPrice,description));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 易联众统一订单查询
     *
     * @param tradeType
     * @param orderNo
     * @return
     * @throws Exception
     */
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.tradeQuery)
    @ApiOperation("易联众统一订单查询")
    public ObjEnvelop tradeQuery(
            @ApiParam(name = "tradeType", value = "tradeType", required = true)
            @RequestParam(required = true)String tradeType,
            @ApiParam(name = "orderNo", value = "orderNo", required = true)
            @RequestParam(required = true)String orderNo) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.tradeQuery(orderNo,tradeType));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
}
}

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

@ -155,11 +155,22 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
    public ObjEnvelop findPatientCard(@ApiParam(name = "code", value = "处方code")
    public ObjEnvelop findPatientCard(@ApiParam(name = "code", value = "处方code")
                                       @RequestParam(value = "code", required = true)String code,
                                       @RequestParam(value = "code", required = true)String code,
                                       @ApiParam(name = "price", value = "支付费用")
                                       @ApiParam(name = "price", value = "支付费用")
                                       @RequestParam(value = "price", required = false)Double price)throws Exception {
                                       @RequestParam(value = "price", required = false)Double price,
                                      @ApiParam(name = "tradeType", value = "支付方式")
                                          @RequestParam(value = "tradeType", required = false)String tradeType)throws Exception {
        try {
        try {
            return success("ok",prescriptionService.savePrescriptionOrder(code,price,wxId));
            return success("ok",prescriptionService.savePrescriptionOrder(code,price,tradeType,wxId));
        } catch (Exception e) {
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return ObjEnvelop.getError(e.getMessage());
        }
        }
    }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getICD10)
    @ApiOperation(value = "获取ICD10诊断编码", notes = "获取ICD10诊断编码")
    public ListEnvelop getICD10(@ApiParam(name = "pyKey", value = "拼音关键字")
                                @RequestParam(value = "pyKey", required = false)String pyKey)throws Exception {
        return success(prescriptionService.getICD10(pyKey));
    }
}
}

+ 4 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ykyy/YkyyController.java

@ -321,9 +321,11 @@ public class YkyyController extends EnvelopRestEndpoint {
    @ApiOperation("获取微信支付参数")
    @ApiOperation("获取微信支付参数")
    public ObjEnvelop selectOrderByRelationCode(
    public ObjEnvelop selectOrderByRelationCode(
            @ApiParam(name = "relationCode", value = "relationCode", required = true)
            @ApiParam(name = "relationCode", value = "relationCode", required = true)
            @RequestParam(required = true)String relationCode) throws Exception {
            @RequestParam(required = true)String relationCode,
            @ApiParam(name = "tradeType", value = "tradeType", required = false)
            @RequestParam(required = false)String tradeType) throws Exception {
        try {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.selectOrderByRelationCode(relationCode,wxId));
            return ObjEnvelop.getSuccess("ok",businessOrderService.selectOrderByRelationCode(relationCode,tradeType,wxId));
        } catch (Exception e) {
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return ObjEnvelop.getError(e.getMessage());
        }
        }

+ 167 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ylz/YlzNotifyController.java

@ -0,0 +1,167 @@
/**
 * 软件著作权:易联众
 * 系统名称:支付平台
 */
package com.yihu.jw.hospital.endpoint.ylz;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.util.StreamUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import com.alibaba.fastjson.JSON;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.exception.PayException;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
/**
 * 医保移动支付商户端模拟测试
 * 
 * @date 2015年10月21日
 * @author sunzhiwei
 * @version 1.0.0
 * @param <T>
 */
@Controller
public class YlzNotifyController<T> {
	private static final Logger LOGGER = LoggerFactory.getLogger(YlzNotifyController.class);
	/**
	 * 商户页面跳转(模拟测试)
	 * @param request
	 * @param response
	 * @throws IOException
	 * @throws PayException
	 */
	@RequestMapping(value = "/mmp/returnUrl")
	public void testReturnUrl(HttpServletRequest request, HttpServletResponse response) throws IOException, PayException {
		response.setContentType("text/html;charset=utf-8");
		LOGGER.info("跳转参数:{}", request.getQueryString());
		response.getWriter().write("返回结果:\n" + request.getQueryString() +"\n");
		String onepayUrl = request.getParameter("onepayUrl");
		String appId = "1BHEOI11C00J7B2CA8C0000071FA53E1";
		String appSecret = "1BHEOH8HB0006E0A0A0A00002DB28BC5";
		String signType = "MD5";
		String encryptType = "DES";
		try {
			OnepayDefaultClient client = new OnepayDefaultClient(onepayUrl, appId, appSecret, signType, encryptType);
			Map<String, String> returnParams = getRequestMap(request.getQueryString());
			boolean isVerify = client.verifyReturnSign(returnParams, returnParams.get("sign"));
			LOGGER.info("验签结果:{}", isVerify);
			if (isVerify) {
				response.getWriter().write("签名结果:\nSIGN SUCCESS.\n");
				// TODO 继续处理业务
				//		如:查询显示订单信息
			} else {
				response.getWriter().write("签名结果:\nSIGN ERROR !!!\n");
			}
		} catch (Exception e) {
			response.getWriter().write(e.getMessage());
		}
	}
	/**
	 * 转换URL参数中为Map
	 * @param reqQueryString
	 * @return
	 * @throws PayException
	 */
	private Map<String, String> getRequestMap(String reqQueryString) throws PayException {
		if (StringUtil.isEmpty(reqQueryString)) {
			throw new PayException("跳转参数为空");
		}
		Map<String, String> targetMap = null;
		try {
			reqQueryString = URLDecoder.decode(reqQueryString, "utf-8");
			targetMap = resolveFormContext(reqQueryString, "=", "&");
			LOGGER.info("targetMap=={}", targetMap);
		} catch (Exception e) {
			throw new PayException("跳转参数处理异常," + reqQueryString);
		}
		return targetMap;
	}
	/**
	 * 解析URL参数串
	 * @param formContext
	 * @param wordFirstsplitRegex
	 * @param wordSecondsplitRegex
	 * @return
	 */
	public static Map<String, String> resolveFormContext(String formContext, String wordFirstsplitRegex, String wordSecondsplitRegex) {
		if (StringUtil.isEmpty(formContext)) {
			return null;
		}
		Map<String, String> targetMap = new HashMap<String, String>();
		String[] wordSeconds = formContext.split(wordSecondsplitRegex);
		for (String wordSecond : wordSeconds) {
			if (StringUtil.isEmpty(wordSecond)) {
				continue;
			}
			int idx = wordSecond.indexOf(wordFirstsplitRegex);
			targetMap.put(wordSecond.substring(0, idx), wordSecond.substring(idx + 1, wordSecond.length()));
		}
		return targetMap;
	}
	
	/**
	 * 商户回调通知(模拟测试)
	 * @param request
	 * @param response
	 * @throws IOException
	 * @throws PayException
	 */
	@RequestMapping(value = "/mmp/receiveNotify")
	public void mmpReceiveNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, PayException {
		response.setContentType("text/html;charset=utf-8");
		String appId = "1BHEOI11C00J7B2CA8C0000071FA53E1";
		String appSecret = "1BHEOH8HB0006E0A0A0A00002DB28BC5";
		InputStream inputStream = request.getInputStream();
		String params = StreamUtils.copyToString(inputStream, Charset.forName("UTF-8"));
		LOGGER.info("回调参数:{}", params);
		if (StringUtil.isEmpty(params)) {
			response.getWriter().write("empty");
			return;
		}
		// 参数转换
		ResponseParams<?> encryptRes = JSON.parseObject(params, ResponseParams.class);
		OnepayDefaultClient client = new OnepayDefaultClient("", appId, appSecret, encryptRes.getSignType(), encryptRes.getEncryptType());
		try {
			LOGGER.info("解密前:{}", JSON.toJSONString(encryptRes));
			ResponseParams<?> decryptRes = client.decryptNotifyResponse(encryptRes);
			LOGGER.info("解密后:{}", JSON.toJSONString(decryptRes));
			boolean isDecrypt = ("-1".equals(decryptRes.getRespCode()) ? false : true); // 是否解密失败
			if (!isDecrypt) {
				response.getWriter().write("DECRYPT FAILURE");
			} else {
				boolean isVerify = client.verifyResponseSign(decryptRes);
				LOGGER.info("验签结果:{}", isVerify);
				if (!isVerify) {
					response.getWriter().write("FAILURE");
				} else {
					response.getWriter().write("SUCCESS");
				}
			}
		} catch (Exception e) {
			response.getWriter().write(e.getMessage());
		}
	}
}

+ 3 - 3
svr/svr-internet-hospital/src/main/resources/application.yml

@ -115,7 +115,7 @@ jw:
myFamily:
myFamily:
  qrCodeFailurTime: 2
  qrCodeFailurTime: 2
wechat:
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段
# 短信验证码发送的客户端标识,居民端
# 短信验证码发送的客户端标识,居民端
sms:
sms:
  clientId: EwC0iRSrcP
  clientId: EwC0iRSrcP
@ -182,7 +182,7 @@ fastDFS:
fast-dfs:
fast-dfs:
  tracker-server: 172.26.0.110:22122 #服务器地址
  tracker-server: 172.26.0.110:22122 #服务器地址
wechat:
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段
# 短信验证码发送的客户端标识,居民端
# 短信验证码发送的客户端标识,居民端
sms:
sms:
  clientId: EwC0iRSrcP
  clientId: EwC0iRSrcP
@ -257,7 +257,7 @@ fastDFS:
fast-dfs:
fast-dfs:
  tracker-server: 192.0.33.26:22122 #服务器地址
  tracker-server: 192.0.33.26:22122 #服务器地址
wechat:
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段  # todo 待配置
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段  # todo 待配置
# 短信验证码发送的客户端标识,居民端
# 短信验证码发送的客户端标识,居民端
sms:
sms:
  clientId: EwC0iRSrcP #todo 待配置
  clientId: EwC0iRSrcP #todo 待配置

+ 3 - 3
svr/svr-iot-job/src/main/java/com/yihu/jw/service/device/DeviceQualityPlanService.java

@ -45,9 +45,9 @@ public class DeviceQualityPlanService {
                IotMessageDO iotMessageDO = new IotMessageDO();
                IotMessageDO iotMessageDO = new IotMessageDO();
                iotMessageDO.setTitle("设备质检提醒");
                iotMessageDO.setTitle("设备质检提醒");
                iotMessageDO.setContent("订单:"+one.getOrderNo()+"将于:"+one.getPlanTime()+"进行质检,请及时维护");
                iotMessageDO.setContent("订单:"+one.getOrderNo()+"将于:"+one.getPlanTime()+"进行质检,请及时维护");
                iotMessageDO.setReadMsg("0");
                iotMessageDO.setDel("0");
                iotMessageDO.setType("4");
                iotMessageDO.setReadMsg(0);
                iotMessageDO.setDel(0);
                iotMessageDO.setType(4);
                iotMessageDao.save(iotMessageDO);
                iotMessageDao.save(iotMessageDO);
        });
        });

+ 6 - 6
svr/svr-iot-job/src/main/java/com/yihu/jw/service/device/SimBalanceService.java

@ -46,9 +46,9 @@ public class SimBalanceService {
           IotMessageDO iotMessageDO = new IotMessageDO();
           IotMessageDO iotMessageDO = new IotMessageDO();
           iotMessageDO.setTitle("SIM卡续费通知");
           iotMessageDO.setTitle("SIM卡续费通知");
           iotMessageDO.setContent("您的:"+one.getDeviceName()+"设备绑定的SIM卡:"+one.getSim()+"余额不足"+simBalanceRemind.getCode()+"元,请及时充值,避免设备离线");
           iotMessageDO.setContent("您的:"+one.getDeviceName()+"设备绑定的SIM卡:"+one.getSim()+"余额不足"+simBalanceRemind.getCode()+"元,请及时充值,避免设备离线");
           iotMessageDO.setReadMsg("0");
           iotMessageDO.setDel("0");
           iotMessageDO.setType("1");
           iotMessageDO.setReadMsg(0);
           iotMessageDO.setDel(0);
           iotMessageDO.setType(1);
           iotMessageDao.save(iotMessageDO);
           iotMessageDao.save(iotMessageDO);
       });
       });
@ -64,9 +64,9 @@ public class SimBalanceService {
                IotMessageDO iotMessageDO = new IotMessageDO();
                IotMessageDO iotMessageDO = new IotMessageDO();
                iotMessageDO.setTitle("SIM卡续费通知");
                iotMessageDO.setTitle("SIM卡续费通知");
                iotMessageDO.setContent("您的:"+one.getDeviceName()+"设备绑定的SIM卡:"+one.getSim()+"已欠费"+arrears+"元,请及时充值,避免设备离线");
                iotMessageDO.setContent("您的:"+one.getDeviceName()+"设备绑定的SIM卡:"+one.getSim()+"已欠费"+arrears+"元,请及时充值,避免设备离线");
                iotMessageDO.setReadMsg("0");
                iotMessageDO.setDel("0");
                iotMessageDO.setType("1");
                iotMessageDO.setReadMsg(0);
                iotMessageDO.setDel(0);
                iotMessageDO.setType(1);
                iotMessageDao.save(iotMessageDO);
                iotMessageDao.save(iotMessageDO);
            });
            });
        }
        }

+ 3 - 3
svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceSimController.java

@ -54,11 +54,11 @@ public class IotDeviceSimController extends EnvelopRestEndpoint {
    @PostMapping(value = IotRequestMapping.DeviceSim.addSIM)
    @PostMapping(value = IotRequestMapping.DeviceSim.addSIM)
    @ApiOperation(value = "添加SIM卡", notes = "添加SIM卡")
    @ApiOperation(value = "添加SIM卡", notes = "添加SIM卡")
    public MixEnvelop<IotOrderVO, IotOrderVO> addSIM(@ApiParam(name = "json", value = "json", defaultValue = "")
                                                      @RequestParam(value = "json",required = true) String json) {
    public MixEnvelop<IotOrderVO, IotOrderVO> addSIM(@ApiParam(name = "jsonData", value = "jsonData", defaultValue = "")
                                                      @RequestParam(value = "jsonData",required = true) String jsonData) {
        try {
        try {
            return iotDeviceSimService.addSIM(json);
            return iotDeviceSimService.addSIM(jsonData);
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
            return MixEnvelop.getError(e.getMessage());

+ 1 - 2
svr/svr-iot/src/main/java/com/yihu/iot/controller/IotMessageService/IotMessageController.java

@ -1,4 +1,4 @@
package com.yihu.iot.controller.IotMessageService;
package com.yihu.iot.controller.iotMessage;
import com.yihu.iot.service.message.IotMessageService;
import com.yihu.iot.service.message.IotMessageService;
import com.yihu.jw.entity.iot.message.IotMessageDO;
import com.yihu.jw.entity.iot.message.IotMessageDO;
@ -8,7 +8,6 @@ import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMapping;

+ 3 - 3
svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceAuditController.java

@ -32,11 +32,11 @@ public class IotInterfaceAuditController extends EnvelopRestEndpoint {
    @PostMapping(value = IotRequestMapping.InterfaceAudit.addInterfaceApplyFor)
    @PostMapping(value = IotRequestMapping.InterfaceAudit.addInterfaceApplyFor)
    @ApiOperation(value = "新增应用接口权限申请",notes = "新增应用接口权限申请")
    @ApiOperation(value = "新增应用接口权限申请",notes = "新增应用接口权限申请")
    public MixEnvelop<IotInterfaceAuditDO,IotInterfaceAuditDO> addInterfaceApplyFor(@ApiParam(name = "JSON",value = "接口JSON串") @RequestParam(value = "JSON",required = true)String json,
                                                                                 @ApiParam(name = "ids",value = "共享接口IDS") @RequestBody List<String> ids){
    public MixEnvelop<IotInterfaceAuditDO,IotInterfaceAuditDO> addInterfaceApplyFor(@ApiParam(name = "jsonData",value = "接口jsonDataN串") @RequestParam(value = "jsonData",required = true)String jsonData,
                                                                                 @ApiParam(name = "ids",value = "共享接口IDS") @RequestParam String ids){
        try {
        try {
            iotInterfaceAuditService.addInterfaceApplyFor(json,ids);
            iotInterfaceAuditService.addInterfaceApplyFor(jsonData,ids);
            return MixEnvelop.getSuccess(IotRequestMapping.InterfaceAudit.message_success_apply_for);
            return MixEnvelop.getSuccess(IotRequestMapping.InterfaceAudit.message_success_apply_for);
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();

+ 6 - 6
svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java

@ -46,10 +46,10 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
    @PostMapping(value = IotRequestMapping.Platform.addInterface)
    @PostMapping(value = IotRequestMapping.Platform.addInterface)
    @ApiOperation(value = "新增共享接口",notes = "新增共享接口")
    @ApiOperation(value = "新增共享接口",notes = "新增共享接口")
    public MixEnvelop<IotShareInterfaceDO,IotShareInterfaceDO> addInterface(@ApiParam(name = "JSON",value = "接口JSON串") @RequestParam(value = "JSON",required = true)String json){
    public MixEnvelop<IotShareInterfaceDO,IotShareInterfaceDO> addInterface(@ApiParam(name = "jsonData",value = "接口JSON串") @RequestParam(value = "jsonData",required = true)String jsonData){
        try {
        try {
            iotShareInterfaceService.addInterface(json);
            iotShareInterfaceService.addInterface(jsonData);
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_add);
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_add);
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
@ -60,10 +60,10 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
    @PostMapping(value = IotRequestMapping.Platform.editInterface)
    @PostMapping(value = IotRequestMapping.Platform.editInterface)
    @ApiOperation(value = "编辑共享接口",notes = "编辑共享接口")
    @ApiOperation(value = "编辑共享接口",notes = "编辑共享接口")
    public MixEnvelop<IotShareInterfaceDO,IotShareInterfaceDO> editInterface(@ApiParam(name = "JSON",value = "接口JSON串") @RequestParam(value = "JSON",required = true)String json){
    public MixEnvelop<IotShareInterfaceDO,IotShareInterfaceDO> editInterface(@ApiParam(name = "jsonData",value = "接口JSON串") @RequestParam(value = "jsonData",required = true)String jsonData){
        try {
        try {
            iotShareInterfaceService.editInterface(json);
            iotShareInterfaceService.editInterface(jsonData);
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_edit);
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_edit);
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
@ -251,10 +251,10 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
    @PostMapping(value = IotRequestMapping.Platform.allotInterface)
    @PostMapping(value = IotRequestMapping.Platform.allotInterface)
    @ApiOperation(value = "分配接口", notes = "分配接口")
    @ApiOperation(value = "分配接口", notes = "分配接口")
    public MixEnvelop<IotCompanyAppInterfaceDO, IotCompanyAppInterfaceDO> allotInterface(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
    public MixEnvelop<IotCompanyAppInterfaceDO, IotCompanyAppInterfaceDO> allotInterface(@ApiParam(name = "jsonData", value = "jsonData", defaultValue = "")
                                                             @RequestParam(value = "jsonData", required = true)String jsonData,
                                                             @RequestParam(value = "jsonData", required = true)String jsonData,
                                                                             @ApiParam(name = "ids", value = "IDS", defaultValue = "")
                                                                             @ApiParam(name = "ids", value = "IDS", defaultValue = "")
                                                             @RequestBody List<String> ids) {
                                                             @RequestParam(value = "ids",required = true) String ids) {
        try {
        try {
            iotCompanyAppInterfaceService.allotInterface(jsonData,ids);
            iotCompanyAppInterfaceService.allotInterface(jsonData,ids);

+ 4 - 4
svr/svr-iot/src/main/java/com/yihu/iot/controller/workType/IotWorkTypeController.java

@ -28,8 +28,8 @@ public class IotWorkTypeController extends EnvelopRestEndpoint {
    @PostMapping(value = IotRequestMapping.WorkType.addType)
    @PostMapping(value = IotRequestMapping.WorkType.addType)
    @ApiOperation(value = "添加业务类型",notes = "添加业务类型")
    @ApiOperation(value = "添加业务类型",notes = "添加业务类型")
    public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> addType(@ApiParam(name = "JSON",value = "JSON串")
                                                           @RequestParam(value = "JSON",required = true)String json){
    public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> addType(@ApiParam(name = "jsonData",value = "jsonData")
                                                           @RequestParam(value = "jsonData",required = true)String json){
        try {
        try {
            iotWorkTypeService.addType(json);
            iotWorkTypeService.addType(json);
@ -44,8 +44,8 @@ public class IotWorkTypeController extends EnvelopRestEndpoint {
    @PostMapping(value = IotRequestMapping.WorkType.editType)
    @PostMapping(value = IotRequestMapping.WorkType.editType)
    @ApiOperation(value = "编辑业务类型",notes = "编辑业务类型")
    @ApiOperation(value = "编辑业务类型",notes = "编辑业务类型")
    public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> editType(@ApiParam(name = "JSON",value = "JSON串")
                                                            @RequestParam(value = "JSON",required = true)String json){
    public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> editType(@ApiParam(name = "jsonData",value = "jsonData串")
                                                            @RequestParam(value = "jsonData",required = true)String json){
        try {
        try {
            iotWorkTypeService.editType(json);
            iotWorkTypeService.editType(json);

+ 0 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceQualityInspectionPlanService.java

@ -229,7 +229,6 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
     * @return
     * @return
     */
     */
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> queryPage(String status, String orderNo, String startTime, String endTime, Integer page, Integer size){
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> queryPage(String status, String orderNo, String startTime, String endTime, Integer page, Integer size){
//        SELECT  b.* FROM (SELECT  c.* from iot_device_quality_inspection_plan c  WHERE c.del=1 ORDER BY c.plan_time DESC ) b GROUP BY b.order_no;
        StringBuffer sql = new StringBuffer("SELECT  c.* from iot_device_quality_inspection_plan c  WHERE c.del=1 ");
        StringBuffer sql = new StringBuffer("SELECT  c.* from iot_device_quality_inspection_plan c  WHERE c.del=1 ");
        List<Object> args = new ArrayList<>();
        List<Object> args = new ArrayList<>();
@ -250,7 +249,6 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
            args.add(endTime);
            args.add(endTime);
        }
        }
        sql.append(" ORDER BY c.plan_time DESC ");
        sql.append(" ORDER BY c.plan_time DESC ");
//    "SELECT  b.* FROM ("+sql+")"+" b GROUP BY b.order_no limit ";
        StringBuffer sql1= new StringBuffer("SELECT  b.* FROM (");
        StringBuffer sql1= new StringBuffer("SELECT  b.* FROM (");
        sql1.append(sql).append(") b GROUP BY b.order_no limit ").append((page-1)*size).append(",").append(size);
        sql1.append(sql).append(") b GROUP BY b.order_no limit ").append((page-1)*size).append(",").append(size);

+ 2 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/message/IotMessageService.java

@ -73,10 +73,10 @@ public class IotMessageService  extends BaseJpaService<IotMessageDO, IotMessageD
     */
     */
    public MixEnvelop<IotMessageDO, IotMessageDO> markRead(String id) {
    public MixEnvelop<IotMessageDO, IotMessageDO> markRead(String id) {
        IotMessageDO messageDO = iotMessageDao.findOne(id);
        IotMessageDO messageDO = iotMessageDao.findOne(id);
        if(messageDO.getReadMsg().equalsIgnoreCase("1")){
        if(messageDO.getReadMsg()==1){
            return MixEnvelop.getError("消息已标记已读,请勿重复操作");
            return MixEnvelop.getError("消息已标记已读,请勿重复操作");
        }
        }
        messageDO.setReadMsg("1");
        messageDO.setReadMsg(1);
        iotMessageDao.save(messageDO);
        iotMessageDao.save(messageDO);
        return MixEnvelop.getSuccess(IotRequestMapping.Message.message_success_update);
        return MixEnvelop.getSuccess(IotRequestMapping.Message.message_success_update);
    }
    }

+ 5 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotCompanyAppInterfaceService.java

@ -36,9 +36,12 @@ public class IotCompanyAppInterfaceService extends BaseJpaService<IotCompanyAppI
     * 分配接口
     * 分配接口
     * @param jsonData
     * @param jsonData
     */
     */
    public void allotInterface(String jsonData, List<String> ids) {
    public void allotInterface(String jsonData, String ids) {
        ids.forEach(one->{
        List<String> list = JSONObject.parseObject(ids, List.class);
        list.forEach(one->{
            IotCompanyAppInterfaceDO iotCompanyAppInterfaceDO = JSONObject.parseObject(jsonData, IotCompanyAppInterfaceDO.class);
            IotCompanyAppInterfaceDO iotCompanyAppInterfaceDO = JSONObject.parseObject(jsonData, IotCompanyAppInterfaceDO.class);
            iotCompanyAppInterfaceDO.setShareInterfaceId(one);
            iotCompanyAppInterfaceDO.setShareInterfaceId(one);
            iotCompanyAppInterfaceDO.setDel("0");
            iotCompanyAppInterfaceDO.setDel("0");

+ 4 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotInterfaceAuditService.java

@ -59,12 +59,14 @@ public class IotInterfaceAuditService  extends BaseJpaService<IotInterfaceAuditD
     * 应用接口申请
     * 应用接口申请
     * @param json
     * @param json
     */
     */
    public void addInterfaceApplyFor(String json, List<String> ids) {
    public void addInterfaceApplyFor(String json, String ids) {
        IotInterfaceAuditDO iotInterfaceAuditDO = JSONObject.parseObject(json, IotInterfaceAuditDO.class);
        IotInterfaceAuditDO iotInterfaceAuditDO = JSONObject.parseObject(json, IotInterfaceAuditDO.class);
        iotInterfaceAuditDO.setTime(DateUtil.getNowDate());
        iotInterfaceAuditDO.setTime(DateUtil.getNowDate());
        iotInterfaceAuditDao.save(iotInterfaceAuditDO);
        iotInterfaceAuditDao.save(iotInterfaceAuditDO);
        ids.forEach(one->{
        List<String> list = JSONObject.parseObject(ids, List.class);
        list.forEach(one->{
            IotInterfaceAuditDetailDO iotInterfaceAuditDetailDO = new IotInterfaceAuditDetailDO();
            IotInterfaceAuditDetailDO iotInterfaceAuditDetailDO = new IotInterfaceAuditDetailDO();
            iotInterfaceAuditDetailDO.setInterfaceId(iotInterfaceAuditDO.getId());
            iotInterfaceAuditDetailDO.setInterfaceId(iotInterfaceAuditDO.getId());