Quellcode durchsuchen

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

humingfen vor 4 Jahren
Ursprung
Commit
06720890a3
35 geänderte Dateien mit 1262 neuen und 145 gelöschten Zeilen
  1. 6 2
      business/base-service/src/main/java/com/yihu/jw/hospital/mapping/service/PatientMappingService.java
  2. 8 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionEmrDao.java
  3. 166 15
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  4. 61 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  5. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java
  6. 48 12
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  7. 7 0
      business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java
  8. 4 2
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  9. 1 0
      business/base-service/src/main/java/com/yihu/jw/utils/hibernate/HibenateUtils.java
  10. 1 0
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WechatInfoService.java
  11. 4 0
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java
  12. 8 0
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  13. 3 1
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  14. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/module/ModuleDO.java
  15. 7 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  16. 1 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
  17. 12 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionVO.java
  18. 3 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  19. 9 6
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java
  20. 79 11
      svr/svr-base/src/main/java/com/yihu/jw/base/service/sync/BaseSyncDataService.java
  21. 18 18
      svr/svr-base/src/main/java/com/yihu/jw/base/service/team/BaseTeamService.java
  22. 15 15
      svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java
  23. 32 29
      svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WechatService.java
  24. 33 1
      svr/svr-base/src/main/resources/application.yml
  25. 25 2
      svr/svr-internet-hospital-entrance/src/main/resources/application.yml
  26. 3 2
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/ykyy/UnSettledHISPrescriptionJob.java
  27. 3 3
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/ykyy/UpdateStatusByPayTimeJob.java
  28. 474 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/UnSettledHISPrescriptionService.java
  29. 28 7
      svr/svr-internet-hospital-job/src/main/resources/application.yml
  30. 65 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  31. 106 13
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  32. 13 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java
  33. 3 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/IotShareInterfaceDao.java
  34. 12 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotShareInterfaceService.java
  35. 2 2
      svr/svr-iot/src/main/resources/application.yml

+ 6 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/mapping/service/PatientMappingService.java

@ -1,9 +1,11 @@
package com.yihu.jw.hospital.mapping.service;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import net.sf.json.JSONArray;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
@ -34,6 +36,8 @@ public class PatientMappingService {
    private YkyyEntranceService ykyyEntranceService;
    @Autowired
    private EntranceService entranceService;
    @Autowired
    private BasePatientMedicareCardDao patientMedicareCardDao;
    @Value("${demo.flag}")
    private boolean demoFlag;
@ -78,11 +82,11 @@ public class PatientMappingService {
        BasePatientDO patientDO = basePatientDao.findById(patient);
        logger.info("patientDO:"+patientDO.toString());
        PatientMappingDO patientMappingDO = patientMappingDao.findByIdcardAndSource(patientDO.getIdcard(),"1");
        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
        if(patientMappingDO!=null){
            return patientMappingDO.getMappingCode();
        }
        com.alibaba.fastjson.JSONArray rs = ykyyEntranceService.findHisPatient(patientDO.getIdcard());
        com.alibaba.fastjson.JSONArray rs = ykyyEntranceService.findHisPatient(patientMedicareCardDO.getCode());
        if(rs!=null&&rs.size()>0){
            //获取居民信息

+ 8 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionEmrDao.java

@ -18,5 +18,13 @@ public interface PrescriptionEmrDao extends PagingAndSortingRepository<WlyyPresc
    @Query("select a from WlyyPrescriptionEmrDO a where a.prescriptionId = ?1 and a.del=1 ")
    List<WlyyPrescriptionEmrDO> findByPrescriptionId(String prescriptionId);
    @Query("select a from WlyyPrescriptionEmrDO a where a.prescriptionId = ?1 and a.del=1 ")
    WlyyPrescriptionEmrDO findEmrByPrescriptionId(String prescriptionId);
    @Modifying
    @Query("update WlyyPrescriptionEmrDO p set p.del=0 where p.prescriptionId=?1")
    void deleteByPrescriptionId(String prescriptionId);
}

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

@ -187,6 +187,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private PrescriptionEmrDao prescriptionEmrDao;
    @Autowired
    private WlyyConsultAdviceDao wlyyConsultAdviceDao;
    @Autowired
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    @Value("${demo.flag}")
@ -438,6 +440,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                //检查检验信息
                List<WlyyInspectionVO> inspectionVOs = new ArrayList<>();
                vo.setInspectionVOs(convertToModels(wlyyInspectionDao.findByPrescriptionId(vo.getId(),1),inspectionVOs,WlyyInspectionVO.class));
                //电子病历
                vo.setWlyyPrescriptionEmrDO(prescriptionEmrDao.findEmrByPrescriptionId(vo.getId()));
            }
        }
        rs.put("prescriptions",prescriptionVOs);
@ -1819,7 +1824,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param diagnosisJson
     * @return
     */
    public Map<String, Object> makeDiagnosis(String outPatientId, String advice, String type, String infoJsons, String diagnosisJson, String inspectionJson) throws Exception {
    public Map<String, Object> makeDiagnosis(String outPatientId, String advice, String type, String infoJsons, String diagnosisJson, String inspectionJson,String emrJson) throws Exception {
        Map<String, Object> result = new HashedMap();
@ -1888,6 +1893,27 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        outpatientDao.save(outpatientDO);
        //============================下诊断end==============================================================
        //=====================电子病历=================================================start
        prescriptionEmrDao.deleteByPrescriptionId(prescription.getId());
        if (StringUtils.isNotBlank(emrJson)) {
            WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO = com.alibaba.fastjson.JSONObject.parseObject(emrJson,WlyyPrescriptionEmrDO.class);
            wlyyPrescriptionEmrDO.setDel(1);
            wlyyPrescriptionEmrDO.setPrescriptionId(prescription.getId());
            prescriptionEmrDao.save(wlyyPrescriptionEmrDO);
        }
        //=====================电子病历=================================================end
        //=====================保存日志 start=========================================================
        List<WlyyPrescriptionCheckDO> prescriptionCheckDOS = prescriptionCheckDao.findByStatus(prescription.getId(),5);
        if (prescriptionCheckDOS==null || prescriptionCheckDOS.size() ==0){
            savePrescriptionCheck(prescription.getDoctor(),"开具处方",5,prescription.getId());
        }
        if (prescriptionDOs != null && prescriptionDOs.size() > 0) {
            savePrescriptionCheck(prescription.getDoctor(),"处方修改",3,prescription.getId());
        }
        //=====================保存日志 end=========================================================
        //判断是否有检查检验或药品开方
        if ("1".equals(type)) {
@ -1955,19 +1981,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
            //=====================检查检验=======================================================================
            //保存挂号费用
            prescription.setRegFee(getChargeFee(outpatientDO.getDoctor()));
            //=====================保存日志 start=========================================================
            List<WlyyPrescriptionCheckDO> prescriptionCheckDOS = prescriptionCheckDao.findByStatus(prescription.getId(),5);
            if (prescriptionCheckDOS==null || prescriptionCheckDOS.size() ==0){
                savePrescriptionCheck(prescription.getDoctor(),"开具处方",5,prescription.getId());
            }
            if (prescriptionDOs != null && prescriptionDOs.size() > 0) {
                savePrescriptionCheck(prescription.getDoctor(),"处方修改",3,prescription.getId());
            }
            //=====================保存日志 end=========================================================
            //保存费用
            prescriptionDao.save(prescription);
            if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
@ -3261,6 +3278,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "WHERE " +
                "room.patient_id=patient.id " +
                "AND room.outpatient_id=outpatient.id " +
                "AND outpatient.pay_status = 1 " +
                "AND outpatient.status = 0 ";
        //视频复诊,协同门诊 医生抢单
        if(type == 2 ){
@ -3925,6 +3943,47 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public Map<String,Object> findPatientInfo(String patient){
        Map<String,Object> rs = new HashedMap();
        BasePatientDO basePatientDO = basePatientDao.findById(patient);
        PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
        rs.put("id",patient);
        rs.put("name",basePatientDO.getName());
        rs.put("sex",basePatientDO.getSex());
        rs.put("provinceCode",basePatientDO.getProvinceCode());
        rs.put("provinceName",basePatientDO.getProvinceName());
        rs.put("cityCode",basePatientDO.getCityCode());
        rs.put("cityName",basePatientDO.getCityName());
        rs.put("townCode",basePatientDO.getTownCode());
        rs.put("townName",basePatientDO.getTownName());
        rs.put("idcard",basePatientDO.getIdcard());
        rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
        rs.put("mobile",basePatientDO.getMobile());
        if (patientMedicareCardDO!=null){
            rs.put("ssc",patientMedicareCardDO.getCode());
        }else {
            rs.put("ssc","");
        }
        return rs;
    }
    public Map<String,Object> updatePatientInfo(String patient,String name,String idcard,String ssc){
        Map<String,Object> rs = new HashedMap();
        BasePatientDO basePatientDO = basePatientDao.findById(patient);
        PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
        basePatientDO.setName(name);
        basePatientDO.setIdcard(idcard);
        basePatientDO = basePatientDao.save(basePatientDO);
        if (patientMedicareCardDO!=null){
            patientMedicareCardDO.setCode(ssc);
            patientMedicareCardDO=basePatientMedicareCardDao.save(patientMedicareCardDO);
        }else {
            patientMedicareCardDO = new PatientMedicareCardDO();
            patientMedicareCardDO.setCode(ssc);
            patientMedicareCardDO.setType("A_01");
            patientMedicareCardDO.setParentType("A");
            patientMedicareCardDO.setDel("1");
            patientMedicareCardDO.setPatientCode(patient);
            patientMedicareCardDO=basePatientMedicareCardDao.save(patientMedicareCardDO);
        }
        rs.put("id",patient);
        rs.put("name",basePatientDO.getName());
        rs.put("sex",basePatientDO.getSex());
@ -3937,6 +3996,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        rs.put("idcard",basePatientDO.getIdcard());
        rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
        rs.put("mobile",basePatientDO.getMobile());
        if (patientMedicareCardDO!=null){
            rs.put("ssc",patientMedicareCardDO.getCode());
        }else {
            rs.put("ssc","");
        }
        return rs;
    }
@ -4024,6 +4088,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "room.patient_id=patient.id " +
                "AND room.outpatient_id=outpatient.id " +
                "AND consult.relation_code=outpatient.id " +
                "AND outpatient.pay_status=1 " +
                "AND consult.status = 0 ";
        if(StringUtils.isNoneBlank(doctor)){
            sql = sql +"AND room.doctor='"+doctor+"' " +
@ -4090,6 +4155,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "room.patient_id=patient.id " +
                "AND room.outpatient_id=outpatient.id " +
                "AND outpatient.status = 0 " +
                "AND outpatient.pay_status = 1 " +
                "AND room.doctor='"+doctor+"' " +
                "AND room.reservation_time is not null " +
                "AND room.consult_type= 2 ";/* +
@ -4237,7 +4303,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
        //根据门诊唯一号取就诊记录
//        List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByAdmNo(admNo);
        
        WlyyPrescriptionDO wlyyPrescriptionDOS = prescriptionDao.findByAdmNoAndRealOrder(admNo,realOrder);
        
        Object result = "";
@ -4340,6 +4406,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "outpatient.patient=patient.id " +
                "AND outpatient.status in (0,1) " +
                "AND outpatient.doctor='"+doctor+"' " +
                "AND outpatient.pay_status = 1 " +
                "AND outpatient.outpatient_type= '"+outpatient_type+"' ";
        if("1".equals(outpatient_type)){//复诊
            sql =  sql + " AND outpatient.type= '"+type+"' ";
@ -5532,6 +5599,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                age = IdCardUtil.getAgeForIdcard(prescriptionDO.getIdcard());
                gender=IdCardUtil.getSexForIdcard(prescriptionDO.getIdcard());
            }
            BasePatientDO patientDO = basePatientDao.findById(prescriptionDO.getPatientCode());
            data.put("name",prescriptionDO.getPatientName());
            data.put("age",age);
            data.put("gender",gender);
@ -5542,6 +5610,27 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                systemMessageDO.setTitle("审方通过");
                data.put("message","审方通过");
                data.put("message","您为"+prescriptionDO.getPatientName()+"("+age+"岁 "+gender+")开具的处方已审核通过。");
                /**
                 *  * @param userName      推送人姓名
                 * @param idCard        推送人身份证
                 * @param phone         推送人手机号
                 * @param title         推送标题
                 * @param url           跳转链接
                 * @param content       内容简介
                 * @param contentString 内容明细串
                 */
               /* String idCard = "";
                String phone = "";
                String title="";
                String url = "https://hlwyy.xmzsh.com/ims-wx/#/returnVisit/record?outpatientId="+prescriptionDO.getOutpatientId();
                String content = "";
                String contentString = "";
                if (patientDO!=null){
                    idCard = patientDO.getIdcard();
                    phone = patientDO.getMobile();
                    title = patientDO.getName()+",您好!医生已为您开具处方,请及时支付";
                }
                entranceService.ehospitalNotice(prescriptionDO.getPatientName())*/
            } else if (status==1) {
                systemMessageDO.setType("8");
                systemMessageDO.setTitle("审方退回");
@ -5669,8 +5758,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public List<WlyyPrescriptionEmrDO> findByPrescriptionId(String  prescriptionId){
        return prescriptionEmrDao.findByPrescriptionId(prescriptionId);
    }
    
    
    /**
     * 保存排班规则
     * @param workRoleJsons
@ -5681,7 +5770,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        wlyyConsultAdviceDao.save(advices);
        return true;
    }
    
    /**
     * 获取咨询建议
     * @param consultcode
@ -5690,4 +5779,66 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public List<WlyyConsultAdvice> getConsultSuggest(String consultcode) {
        return wlyyConsultAdviceDao.getByConsult(consultcode);
    }
    public String readOutPatient(String registerSn) throws Exception {
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("HAI_TAI_URL");
        if (wlyyHospitalSysDictDO!=null){
            url = wlyyHospitalSysDictDO.getDictCode();
        }
        String xmlStr = "<?xml version=\"1.0\" encoding=\"GBK\"?>\n" +
                "<HtRequest>\n";
        xmlStr+="<REGISTER_SN>"+registerSn+"</REGISTER_SN>";
        String reqTime = DateUtil.dateToStr(new Date(),"yyyyMMddHHmmssSSS");
        xmlStr+="<REQ_TIME>"+reqTime+"</REQ_TIME>";
        xmlStr+="</HtRequest>";
        String returnValue = "";
        Map<String, String> params = new HashedMap();
        params.put("type","readOutPatient");
        params.put("xmlStr",xmlStr);
        returnValue = com.yihu.jw.utils.WebserviceUtil.post(url,
                "http://business.htemr.haitaiinc.com",
                "manageOutRegister",
                params);
        logger.info("调用电子病历查询接口请求成功,返回值xmlstr:" + returnValue);
        return returnValue;
    }
    public String writeOutPatient(String registerSn,String chiefComplaint,String hpi,String elapsemhis,String bodycheck,String assistanTcheck) throws Exception {
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("HAI_TAI_URL");
        if (wlyyHospitalSysDictDO!=null){
            url = wlyyHospitalSysDictDO.getDictCode();
        }
        String xmlStr = "<?xml version=\"1.0\" encoding=\"GBK\"?>\n" +
                "<HtRequest>\n";
        xmlStr+="<REGISTER_SN>"+registerSn+"</REGISTER_SN>";
        String reqTime = DateUtil.dateToStr(new Date(),"yyyyMMddHHmmssSSS");
        xmlStr+="<REQ_TIME>"+reqTime+"</REQ_TIME>";
        xmlStr+="<OUTPATIENT_INFO>";
        xmlStr+="<CHIEF_COMPLAINT>"+chiefComplaint+"</CHIEF_COMPLAINT>";
        xmlStr+="<HPI>"+hpi+"</HPI>";
        xmlStr+="<ELAPSEMHIS>"+elapsemhis+"</ELAPSEMHIS>";
        xmlStr+="<BODYCHECK>"+bodycheck+"</BODYCHECK>";
        xmlStr+="<ASSISTANTCHECK>"+assistanTcheck+"</ASSISTANTCHECK>";
        xmlStr+="</OUTPATIENT_INFO>";
        xmlStr+="</HtRequest>";
        String returnValue = "";
        Map<String, String> params = new HashedMap();
        params.put("type","writeOutPatient");
        params.put("xmlStr",xmlStr);
        returnValue = com.yihu.jw.utils.WebserviceUtil.post(url,
                "http://business.htemr.haitaiinc.com",
                "manageOutRegister",
                params);
        logger.info("调用电子病历写入接口请求成功,返回值xmlstr:" + returnValue);
        return returnValue;
    }
}

+ 61 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java

@ -9,16 +9,22 @@ import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.entity.hospital.doctor.BaseDoctorZsInfoDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionEmrDO;
import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.prescription.dao.DoctorZsInfoDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionEmrDao;
import com.yihu.jw.hospital.prescription.service.entrance.util.ConvertUtil;
import com.yihu.jw.hospital.prescription.service.entrance.util.MqSdkUtil;
import com.yihu.jw.hospital.prescription.service.entrance.util.WebserviceUtil;
@ -31,6 +37,8 @@ import com.yihu.jw.util.idcard.IdCardUtil;
import net.sf.json.JSON;
import net.sf.json.JSONArray;
import net.sf.json.xml.XMLSerializer;
import org.apache.axis.client.Call;
import org.apache.axis.encoding.XMLType;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
@ -43,7 +51,12 @@ import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.ServiceException;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
@ -116,6 +129,12 @@ public class EntranceService {
    private PrescriptionDao prescriptionDao;
    @Autowired
    private DoctorZsInfoDao doctorZsInfoDao;
    @Autowired
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    @Autowired
    private PrescriptionEmrDao prescriptionEmrDao;
    @Autowired
    private OutpatientDao outpatientDao;
    private static String entranceUrl="http://172.16.100.240:10023/mqsdk/";
//    private static String entranceUrl="http://localhost:10023/mqsdk/";
@ -2645,4 +2664,46 @@ public class EntranceService {
//=====================hospital应用调用entrance应用============end=================
/*
    *
     * 请求海康接口方法
     * @param method
     * @param type
     * @param xmlStr
     * @return
     * @throws Exception
    public String sendHaiTaiMethod(String method,String type,String xmlStr) throws Exception {
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("HAI_TAI_URL");
        if (wlyyHospitalSysDictDO!=null){
            url = wlyyHospitalSysDictDO.getDictCode();
        }
        if (!StringUtils.isNoneBlank(url)){
            throw new Exception("url 不存在!");
        }
        logger.info("请求参数:method"+method+"==type"+type+"==="+xmlStr);
        String result = null;
        try {
            org.apache.axis.client.Service service = new org.apache.axis.client.Service();
            Call call = (Call) service.createCall();
            call.setTargetEndpointAddress(new URL(url));
            call.setOperationName(new QName(url, method)); // 设置要调用哪个方法
            call.addParameter("type", XMLType.XSD_STRING, ParameterMode.IN);
            call.addParameter("xmlStr",XMLType.XSD_STRING, ParameterMode.IN);
            call.setReturnType(XMLType.XSD_STRING);
            String xml = (String)call.invoke(new Object[]{type,xmlStr});
            logger.info("返回值:"+xml);
            XMLSerializer xmlSerializer = new XMLSerializer();
            result = xmlSerializer.read(xml).toString();
        }catch (Exception e){
            e.printStackTrace();
        }
        return result;
    }
*/
}

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

@ -883,7 +883,7 @@ public class XzzxEntranceService{
            condition +="<dept>"+dept+"</dept>";
        }
        if (!StringUtils.isEmpty(sickId)&&!sickId.equalsIgnoreCase("null")){
            condition += "<sickId>"+sickId+"</sickId>";
            condition += "<sickid>"+sickId+"</sickid>";
        }
        if (!StringUtils.isEmpty(clinicclass)&&!clinicclass.equalsIgnoreCase("null")){

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

@ -15,6 +15,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.score.BaseEvaluateDO;
import com.yihu.jw.entity.base.score.BaseEvaluateScoreDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
@ -31,6 +32,7 @@ import com.yihu.jw.hospital.prescription.dao.PrescriptionDiagnosisDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
@ -131,6 +133,8 @@ public class YkyyEntranceService {
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private DictDoctorDutyDao dictDoctorDutyDao;
    @Autowired
    private BasePatientMedicareCardDao patientMedicareCardDao;
    @Autowired
    private YkyyService ykyyService;
@ -1101,17 +1105,17 @@ public class YkyyEntranceService {
                "yp.pzwh as \"pzwh\""+  " FROM " +
                "V_ZKSG_MZ_YPXX yp where 1=1 ";
        if (StringUtils.isNoneBlank(ypdm)){
            sql+=" and yp.ypdm like '%"+ypdm+"%' ";
            sql+=" and lower(yp.ypdm) like '%"+ypdm.toLowerCase()+"%' ";
        }
        if (StringUtils.isNoneBlank(ypmc)){
            sql+=" and yp.ypmc like '%"+ypmc+"%' ";
            sql+=" and lower(yp.ypmc) like '%"+ypmc.toLowerCase()+"%' ";
        }
        if (StringUtils.isNoneBlank(kusl)){
            sql+=" and yp.kusl like '%"+kusl+"%' ";
            sql+=" and lower(yp.kusl) like '%"+kusl.toLowerCase()+"%' ";
        }
        if (StringUtils.isNoneBlank(pydm)){
            sql+=" and yp.pydm like '%"+pydm+"%' ";
            sql+=" and lower(yp.pydm) like '%"+pydm.toLowerCase()+"%' ";
        }
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
@ -1175,7 +1179,7 @@ public class YkyyEntranceService {
                "FROM\n" +
                "\tV_ZKSG_JCXM_MZ mz where 1=1 ";
        if (StringUtils.isNoneBlank(pydm)){
            sql+=" and pydm = '%"+pydm+"%'";
            sql+=" and lower(pydm) = '%"+pydm.toLowerCase()+"%'";
        }
        /*List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);*/
        JSONArray array = new JSONArray();
@ -1201,7 +1205,7 @@ public class YkyyEntranceService {
    public JSONArray findSypc(String pcbm) throws Exception {
        String sql = "select s.pcbm as \"pcbm\",s.pcmc as \"pcmc\",s.pcmc1 as \"pcmc1\" from v_hlw_sypc s where 1=1 ";
        if (StringUtils.isNoneBlank(pcbm)){
            sql+=" and s.pcbm='"+pcbm+"' ";
            sql+=" and lower(s.pcbm)='"+pcbm.toLowerCase()+"' ";
        }
        /*List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        return list;*/
@ -1227,7 +1231,7 @@ public class YkyyEntranceService {
    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  and y.pydm is not null";
        if (StringUtils.isNoneBlank(pydm)){
            sql+=" and y.pydm='"+pydm+"' ";
            sql+=" and lower(y.pydm)='"+pydm.toLowerCase()+"' ";
        }
        /*List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        return list;*/
@ -1249,11 +1253,11 @@ public class YkyyEntranceService {
    /**
     * 获取his病人信息
     * @param idcard
     * @param ssc
     * @return
     * @throws Exception
     */
    public JSONArray findHisPatient(String idcard) throws Exception {
    public JSONArray findHisPatient(String ssc) throws Exception {
        String sql = "SELECT\n" +
                "\tx.brid AS \"brid\",\n" +
                "\tx.mzhm AS \"mzhm\",\n" +
@ -1271,7 +1275,7 @@ public class YkyyEntranceService {
                "FROM\n" +
                "\tV_ZKSG_BRCX x\n" +
                "WHERE\n" +
                "\tx.sfzh = '"+idcard+"' ";
                "\tx.jzkh = '"+ssc+"' ";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
@ -1316,7 +1320,7 @@ public class YkyyEntranceService {
        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();
        if (StringUtils.isNoneBlank(pyCode)){
            sql +="  where i.py_code like '%"+pyCode+"%'";
            sql +="  where lower(i.py_code) like '%"+pyCode.toLowerCase()+"%'";
        }
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
@ -1467,6 +1471,9 @@ public class YkyyEntranceService {
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        String patient = wlyyPrescriptionVO.getPatientCode();
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
        BasePatientDO patientDO = basePatientDao.findById(patient);
        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
        Integer GHXH = 0;
        //挂号明细表HLW_GHMX
@ -1496,7 +1503,7 @@ public class YkyyEntranceService {
        hlwGhmxDO.setYSDM(doctorMappingDO.getMappingCode());//医生代码
        hlwGhmxDO.setJZYS(doctorMappingDO.getMappingCode());//接诊医生
        //病人性质
        JSONArray jsonArray = findHisPatient(patientMappingDO.getIdcard());
        JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode());
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
            JSONObject json = jsonArray.getJSONObject(0);
@ -1554,6 +1561,16 @@ public class YkyyEntranceService {
        }
        Integer icd10Flag = 0;
        //诊断删除v_hlwys_mz_jzls
        if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
            String deleteSql = "delete from v_hlwys_mz_jzls where jzxh = '"+wlyyPrescriptionVO.getAdmNo()+"'";
            Map<String,Object> params = new HashedMap();
            params.put("sql",deleteSql);
            HttpResponse response = HttpUtils.doGet(updateUrl,params);
            if (response.getStatus()==200){
                logger.info("表v_hlwys_mz_jzls删除成功!");
            }
        }
        List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(code,1);
        if(diagnosisDOs!=null&&diagnosisDOs.size()>0){
            WlyyPrescriptionDiagnosisDO diagnosisDO = diagnosisDOs.get(0);
@ -1610,6 +1627,16 @@ public class YkyyEntranceService {
                logger.info("表hlwYsMzJzLsDO同步成功!");
            }
            //删除疾病诊断表HLWYS_MZ_JBZD
            if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
                String deleteSql = "delete from v_hlwys_mz_jbzd where jzxh = '"+wlyyPrescriptionVO.getAdmNo()+"'";
                Map<String,Object> params = new HashedMap();
                params.put("sql",deleteSql);
                HttpResponse response = HttpUtils.doGet(updateUrl,params);
                if (response.getStatus()==200){
                    logger.info("表v_hlwys_mz_jbzd删除成功!");
                }
            }
            //疾病诊断表HLWYS_MZ_JBZD
            HlwYsMzJbzdDO hlwYsMzJbzdDO = new HlwYsMzJbzdDO();
            //hlwYsMzJbzdDO.setJLBH(0);
@ -1748,6 +1775,15 @@ public class YkyyEntranceService {
                if (StringUtils.isEmpty(cfsb)){
                    throw new Exception("添加失败");
                }
                if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getRealOrder())){
                    String deleteSql = "delete from v_ms_dd02 where cfsb = '"+wlyyPrescriptionVO.getRealOrder()+"'";
                    Map<String,Object> params1 = new HashedMap();
                    params1.put("sql",deleteSql);
                    HttpResponse response = HttpUtils.doGet(updateUrl,params1);
                    if (response.getStatus()==200){
                        logger.info("表v_ms_dd02删除成功!");
                    }
                }
                List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS =wlyyPrescriptionVO.getInfoVOs();
                for (WlyyPrescriptionInfoVO wlyyPrescriptionInfoVO:wlyyPrescriptionInfoVOS){
                    try {

+ 7 - 0
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java

@ -834,6 +834,13 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                String msg = "";
                String msgType = "";
                if (map.get("content_type").toString().equalsIgnoreCase("2")){
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("sender","系统");
                    jsonObject.put("msg","病情描述");
                    jsonObject.put("msg_type","0");
                    jsonObject.put("receiver","系统");
                    jsonObject.put("send_time",DateUtil.dateToStr(DateUtil.strToDate(map.get("timestamp").toString(),"yyyy-MM-dd HH:mm:ss"),"yyyy-MM-dd HH:mm:ss"));
                    array.add(jsonObject);
                    msg = consultUpNsOnlineImg(map.get("content").toString(),map.get("id").toString());
                    msgType = "1";
                }else if (map.get("content_type").toString().equalsIgnoreCase("1")){

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

@ -392,8 +392,10 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        if(!StringUtils.isNoneBlank(tradeType)){
            throw new Exception("tradeType is null :the tradeType is "+tradeType);
        }
        if(!StringUtils.isNoneBlank(openId)){
            throw new Exception("openId is null :the openId is "+openId);
        if (tradeType.equalsIgnoreCase("JSAPI")){
            if(!StringUtils.isNoneBlank(openId)){
                throw new Exception("openId is null :the openId is "+openId);
            }
        }
        if(!StringUtils.isNoneBlank(ourTradeNo)){
            throw new Exception("ourTradeNo is null :the ourTradeNo is "+ourTradeNo);

+ 1 - 0
business/base-service/src/main/java/com/yihu/jw/utils/hibernate/HibenateUtils.java

@ -185,4 +185,5 @@ public class HibenateUtils {
    }
}

+ 1 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/service/WechatInfoService.java

@ -98,6 +98,7 @@ public class WechatInfoService {
                String token_url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket";
                String params = "access_token=" + token + "&type=jsapi";
                String result = HttpUtil.sendGet(token_url, params);
                System.out.println("result:"+result);
                JSONObject json = new JSONObject(result);
                System.out.println("getticket:"+result);
                if (json.has("ticket")) {

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

@ -99,6 +99,8 @@ public class WxTemplateService {
    private BaseDoctorDao doctorDao;
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    
    
    /**
@ -195,6 +197,8 @@ public class WxTemplateService {
                            String prescriptionId = pre.get(0).get("ID").toString();
                            String doctorName = pre.get(0).get("DOCTOR_NAME").toString();
                            //判断是否发送过
                            String countSql = "SELECT id from WX_PUSH_LOG w WHERE w.RECEIVER = '"+patientDO.getId()
                                    +"' and w.OPENID = '"+prescriptionId+"' and w.scene = 'djsxxtz' and w.WECHAT_ID='"+wechatId+"'";

+ 8 - 0
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -40,6 +40,7 @@ import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.im.ConsultVO;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.common.FileUtil;
import com.yihu.jw.util.common.IdCardUtil;
@ -791,6 +792,13 @@ public class ImService {
				//中山医院互联网医院
				if("xm_zsyy_wx".equals(wechat_appid)){
					accessToken = entranceService.getAccessToken("100033");
					
					net.sf.json.JSONObject object1 = net.sf.json.JSONObject.fromObject(accessToken);
					if (null != object1&&null!=object1.get("respCode") && "00".equals(object1.get("respCode"))) {
						accessToken  = object1.getJSONObject("respEntity").getString("access_token");
					} else {
						throw new Exception("获取ACCESSTOKEN失败");
					}
				}else{
					wxAccessTokenService.deleteByWechatId(wechat_appid);
					accessToken = wxAccessTokenService.updateAccessToken(wechat_appid);

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

@ -25,7 +25,9 @@ public abstract class IntegerIdentityEntity implements Serializable {
//==========mysql 环境 id策略 end======================================================
//==========Oracle 环境id策略 =========================================================
/*    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")*/
/*
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
*/
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
        return id;

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/module/ModuleDO.java

@ -237,7 +237,7 @@ public class ModuleDO extends UuidIdentityEntityWithOperator {
		this.isMust = isMust;
	}
	@Column(name = "level")
	@Column(name = "module_level")
	public Integer getLevel() {
		return level;
	}

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

@ -237,6 +237,11 @@ public class BaseHospitalRequestMapping {
         */
        public static final String findPatientInfo = "/findPatientInfo";
        /**
         * 获取居民基础信息
         */
        public static final String updatePatientInfo = "/updatePatientInfo";
        /**
         * 保存医生在线排班
         */
@ -412,6 +417,8 @@ public class BaseHospitalRequestMapping {
        public static final String findEmrByPrescriptionId="/findEmrByPrescriptionId";
        public static final String findHisEmr="/findHisEmr";
    }

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

@ -380,6 +380,7 @@ public class IotRequestMapping {
        public static final String addInterface ="addInterface";
        public static final String editInterface ="editInterface";
        public static final String findInterfaceById ="findInterfaceById";
        public static final String parameterDescription = "parameterDescription";
        public static final String findAll ="findAll";
        public static final String findAllApp ="findAllApp";
        public static final String findAllLog ="findAllLog";

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

@ -1,6 +1,7 @@
package com.yihu.jw.restmodel.hospital.prescription;
import com.yihu.jw.entity.hospital.prescription.WlyyInspectionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionEmrDO;
import com.yihu.jw.restmodel.UuidIdentityVOWithOperator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -370,6 +371,9 @@ public class WlyyPrescriptionVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "检查检验", example = "模块1")
    private List<WlyyInspectionVO> inspectionVOs;
    @ApiModelProperty(value = "电子病历", example = "模块1")
    private WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO;
    public String getOutpatientId() {
        return outpatientId;
    }
@ -823,4 +827,12 @@ public class WlyyPrescriptionVO extends UuidIdentityVOWithOperator {
    public void setPayType(Integer payType) {
        this.payType = payType;
    }
    public WlyyPrescriptionEmrDO getWlyyPrescriptionEmrDO() {
        return wlyyPrescriptionEmrDO;
    }
    public void setWlyyPrescriptionEmrDO(WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO) {
        this.wlyyPrescriptionEmrDO = wlyyPrescriptionEmrDO;
    }
}

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

@ -226,10 +226,13 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        String wechatId = parameters.get("wechatId");
        //更新患者openId
        BaseLoginLogDO baseLoginLogDO = new BaseLoginLogDO();
        logger.info("gengxin开始");
        if (!StringUtils.isEmpty(openid) && !"undefined".equalsIgnoreCase(openid) && ("3".equals(loginType)||"4".equalsIgnoreCase(loginType))) {
            baseLoginLogDO.setOpenid(openid);
            logger.info("gengxin进入"+openid);
            userDetailsService.updateOpenId(openid, wlyyUserSimple.getId());
            if (!StringUtils.isEmpty(wechatId)&& !"undefined".equalsIgnoreCase(wechatId)){
                logger.info("gengxin进入"+wechatId);
                userDetailsService.updateOpenIdAndWechatId(openid,wlyyUserSimple.getId(),wechatId);
            }
        }

+ 9 - 6
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java

@ -14,6 +14,7 @@ import com.yihu.jw.entity.base.org.BaseOrgSaasDO;
import com.yihu.jw.entity.base.org.BaseOrgUserDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -65,6 +66,9 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private HibenateUtils hibenateUtils;
    /**
     * 机构基础信息列表
@ -77,7 +81,7 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : page * size;
        String codeOrNameValue = null == codeOrName ? "" : codeOrName;
        String sql = "select id,code,name,case del when 1 then '有效' else '失效' end as status,concat(province_name,city_name,town_name,address) as address " +
        String sql = "select id as \"id\",code as \"code\",name as \"name\",case del when 1 then '有效' else '失效' end as status as \"del\",concat(province_name,city_name,town_name,address) as \"address\" " +
                " from base_org " +
                " where " +
                " ((code like '{code}' or ''='{code}')  and (del = '{orgStatus}' or ''='{orgStatus}'))" +
@ -85,13 +89,12 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
                " ((name like '{name}' or ''='{name}') and (del = '{orgStatus}' or ''='{orgStatus}'))" +
                " and" +
                " (del = '{orgStatus}' or ''='{orgStatus}')" +
                "  order by create_time desc limit {start},{end}";
                "  order by create_time desc ";
        String finalSql = sql
                .replace("{code}", "%" + codeOrNameValue + "%")
                .replace("{name}", "%" + codeOrNameValue + "%")
                .replace("{orgStatus}", null == orgStatus ? "" : orgStatus).replace("{start}", String.valueOf(start))
                .replace("{end}", String.valueOf(end));
                .replace("{orgStatus}", null == orgStatus ? "" : orgStatus);
        String countSql = "SELECT count(id)" +
                " FROM base_org " +
@ -105,7 +108,7 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
                .replace("{code}", "%" + codeOrNameValue + "%")
                .replace("{name}", "%" + codeOrNameValue + "%")
                .replace("{orgStatus}", null == orgStatus ? "" : orgStatus);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(finalSql);
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(finalSql,page,size);
        Integer count = jdbcTemplate.queryForObject(finalCountSql, Integer.class);
        result.put("count", count);
        result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
@ -267,7 +270,7 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
    public String getOrgAreaTree(String saasId){
        StringBuffer sql = new StringBuffer("SELECT t.* from base_org b,org_tree t,base_org_saas o ")
                .append("WHERE o.saasid='").append(saasId).append("' AND o.org_code = b.`code` AND ")
                .append("(b.`code`= t.`code` or b.city_code=t.`code` or b.province_code = t.`code` or b.town_code=t.`code`)");
                .append("(b.code= t.code or b.city_code=t.code or b.province_code = t.code or b.town_code=t.code)");
        List<TreeNode> treeNodes = new ArrayList<>();
        treeNodes.addAll(jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(OrgTree.class)));

+ 79 - 11
svr/svr-base/src/main/java/com/yihu/jw/base/service/sync/BaseSyncDataService.java

@ -11,12 +11,16 @@ import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
 * @author HZY
@ -54,7 +58,7 @@ public class BaseSyncDataService extends BaseJpaService<BaseSyncDataDO, BaseSync
//
//        return PageEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find,list,page,size,count);
//    }
        private static Logger logger = LoggerFactory.getLogger(BaseSyncDataService.class);
    /**
     * 根据时间查询
     * @param startTime
@ -64,15 +68,19 @@ public class BaseSyncDataService extends BaseJpaService<BaseSyncDataDO, BaseSync
    public PageEnvelop findAllSyncData(String startTime, String endTime,Integer page,Integer size) {
        StringBuffer sql= new StringBuffer("SELECT c.* FROM wlyy_data_sync c WHERE 1=1 ");
        StringBuffer sqlCount= new StringBuffer("SELECT COUNT(c.id) count FROM wlyy_data_sync c WHERE 1=1  ");
        if (StringUtils.isNotBlank(startTime)&&StringUtils.isNotBlank(endTime)){
            sql.append(" and c.complete_time BETWEEN ").append("'").append(startTime).append("'").append(" AND ").append("'").append(endTime).append("'");
            sqlCount.append(" and c.complete_time BETWEEN ").append("'").append(startTime).append("'").append(" AND ").append("'").append(endTime).append("'");
        }
        sql.append(" ORDER BY c.complete_time DESC LIMIT ").append((page-1)*size).append(",").append(size);
        sql.append(" ORDER BY c.create_time DESC LIMIT ").append((page-1)*size).append(",").append(size);
        List<BaseSyncDataDO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(BaseSyncDataDO.class));
        long count =list.size();
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sqlCount.toString());
        long count = Long.parseLong(mapList.get(0).get("count").toString());
        return PageEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find,list,page,size,count);
    }
@ -83,49 +91,108 @@ public class BaseSyncDataService extends BaseJpaService<BaseSyncDataDO, BaseSync
     * @return
     */
    public void complete (String wxId) {
        logger.info("======================同步开始========================");
        BaseSyncDataDO syncDataDO = new BaseSyncDataDO();
        syncDataDO.setUpdateTime(DateUtil.getNowDate());
        syncDataDO.setStyle(1);
        try {
            syncDataDO.setSyncResult("进行中");
            //眼科中心
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                logger.info("======================眼科中心同步开始========================");
                String result = ykyyEntranceService.updateYkyyDept();
                if (result.equalsIgnoreCase("success")){
                    logger.info("======================同步科室信息成功========================");
                }else {
                    logger.info("======================同步科室信息失败========================");
                }
                String re = ykyyEntranceService.updateYkyyDoctor();
                if (re.equalsIgnoreCase("success")){
                    logger.info("======================同步医生信息成功========================");
                }else {
                    logger.info("======================同步医生信息失败========================");
                }
                if (result.equalsIgnoreCase("success")&&re.equalsIgnoreCase("success")){
                    syncDataDO.setSyncResult("同步成功");
                    logger.info("======================眼科中心同步成功========================");
                }else {
                    syncDataDO.setSyncResult("同步失败");
                    logger.info("======================眼科中心同步失败========================");
                }
                syncDataDO.setCompleteTime(DateUtil.getNowDate());
            }
            //心脏中心
            if ("xm_xzzx_wx".equalsIgnoreCase(wxId)){
                logger.info("======================眼科中心同步结束========================");
            }else if ("xm_xzzx_wx".equalsIgnoreCase(wxId)){
                logger.info("======================心脏中心同步开始========================");
                Integer doctorInfo = xzzxEntranceService.syncDoctorInfo();
                if (doctorInfo==200){
                    logger.info("======================同步医生信息成功========================");
                }else {
                    logger.info("======================同步医生信息失败========================");
                }
                Integer deptInfo = xzzxEntranceService.syncDeptInfo();
                if (deptInfo==200){
                    logger.info("======================同步部门信息成功========================");
                }else {
                    logger.info("======================同步部门信息失败========================");
                }
                Integer jobTitle = xzzxEntranceService.syncJobTitle();
                if (jobTitle==200){
                    logger.info("======================同步职称信息成功========================");
                }else {
                    logger.info("======================同步职称信息失败========================");
                }
                Integer chargeDict = xzzxEntranceService.syncChargeDict();
                if (chargeDict==200){
                    logger.info("======================同步号别信息成功========================");
                }else {
                    logger.info("======================同步号别信息失败========================");
                }
                if (deptInfo==200&&doctorInfo==200&&jobTitle==200&&chargeDict==200){
                    syncDataDO.setSyncResult("同步成功");
                    logger.info("======================心脏中心同步成功========================");
                }else {
                    syncDataDO.setSyncResult("同步失败");
                    logger.info("======================心脏中心同步失败========================");
                }
                syncDataDO.setCompleteTime(DateUtil.getNowDate());
            }
            if("xm_zsyy_wx".equalsIgnoreCase(wxId)){
                logger.info("======================心脏中心同步结束========================");
            } else if("xm_zsyy_wx".equalsIgnoreCase(wxId)){
                logger.info("======================中山医院信息同步开始========================");
                Integer syncMS02003 = entranceService.syncMS02003();
                if (syncMS02003==200){
                    logger.info("======================同步医生信息成功========================");
                }else {
                    logger.info("======================同步医生信息失败========================");
                }
                Integer syncBS16010 = entranceService.syncBS16010();
                if (syncBS16010==200){
                    logger.info("======================同步医生简介信息成功========================");
                }else {
                    logger.info("======================同步医生简介信息失败========================");
                }
                Integer syncBS16011 = entranceService.syncBS16011();
                if (syncBS16011==200){
                    logger.info("======================同步科室简介信息成功========================");
                }else {
                    logger.info("======================同步科室简介信息失败========================");
                }
                Integer integer1 = entranceService.syncDoctorInfo();
                if (syncMS02003==200&&syncBS16010==200&&syncBS16011==200&&integer1==200){
                    syncDataDO.setSyncResult("同步成功");
                    logger.info("======================中山医院信息同步成功========================");
                }else {
                    syncDataDO.setSyncResult("同步失败");
                    logger.info("======================中山医院信息同步失败========================");
                }
                syncDataDO.setCompleteTime(DateUtil.getNowDate());
                logger.info("======================中山医院信息同步结束========================");
            }else {
                syncDataDO.setSyncResult("同步失败");
                syncDataDO.setCompleteTime(DateUtil.getNowDate());
                logger.info("======================同步信息失败========================");
            }
        } catch (Exception e) {
@ -135,6 +202,7 @@ public class BaseSyncDataService extends BaseJpaService<BaseSyncDataDO, BaseSync
        }
        syncDataDO.setCreateUserName(userAgent.getUNAME());
        baseSyncDataDao.save(syncDataDO);
        logger.info("======================同步结束========================");
    }
}

+ 18 - 18
svr/svr-base/src/main/java/com/yihu/jw/base/service/team/BaseTeamService.java

@ -19,6 +19,7 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.team.BaseTeamMemberDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -62,6 +63,8 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
    @Autowired
    private OrgTreeService orgTreeService;
    @Autowired
    private HibenateUtils hibenateUtils;
    /**
     * 新增团队
@ -239,12 +242,12 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
        //获取该机构下的医生列表
        String sql = " SELECT " +
                "  hos.doctor_code AS doctorCode," +
                "  doc.name AS doctorName," +
                "  org.code  AS orgCode," +
                "  org.name     AS orgName," +
                "  dept.code    AS deptCode," +
                "  dept.name    AS deptName" +
                "  hos.doctor_code AS \"doctorCode\"," +
                "  doc.name AS \"doctorName\"," +
                "  org.code  AS \"orgCode\"," +
                "  org.name     AS \"orgName\"," +
                "  dept.code    AS \"deptCode\"," +
                "  dept.name    AS \"deptName\"" +
                " FROM " +
                "  base_doctor_hospital hos," +
                "  dict_hospital_dept dept," +
@ -302,18 +305,18 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
     */
    public JSONObject getTeamInfoList(String teamName,String orgCode,String status,int page,int size,JSONObject userAgent) throws Exception {
        JSONObject result = new JSONObject();
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : page * size;
      /*  int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : page * size;*/
        String teamNameValue = null == teamName ? "" : teamName;
        String orgCodeValue = null == orgCode ? "" : orgCode;
        String statusValue = null == status ? "" : status;
        String sql = " " +
                "SELECT " +
                "  team.id as teamId, " +
                "  team.name as name, " +
                "  case team.del when 0 then '已失效' when 1 then '生效中' end status, " +
                "  org.name as orgName " +
                "  team.id as \"teamId\", " +
                "  team.name as \"name\", " +
                "  case team.del when 0 then '已失效' when 1 then '生效中' end status as \"del\", " +
                "  org.name as \"orgName\" " +
                "FROM " +
                "  base_team team, " +
                "  base_org org " +
@ -322,15 +325,12 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
                "  and (team.name like '{teamName}' or '' ='{teamName}') " +
                "  and (team.org_code = '{orgCode}' or '' = '{orgCode}') " +
                "  and ( team.del = '{status}' or '' = '{status}') " +
                " ORDER BY team.create_time DESC " +
                " limit {start},{end} ";
                " ORDER BY team.create_time DESC " ;
        String finalSql = sql
                .replace("{teamName}","%" + teamNameValue + "%")
                .replace("{orgCode}",orgCodeValue)
                .replace("{status}",statusValue)
                .replace("{start}", String.valueOf(start))
                .replace("{end}", String.valueOf(end));
                .replace("{status}",statusValue);
        String countSql = "SELECT " +
                "  count(team.id) " +
@ -347,7 +347,7 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
                .replace("{orgCode}",orgCodeValue)
                .replace("{status}",statusValue);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(finalSql);
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(finalSql,page,size);
        int count = jdbcTemplate.queryForObject(finalCountSql,Integer.class);
        result.put("count", count);
        result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));

+ 15 - 15
svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java

@ -21,6 +21,7 @@ import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import org.apache.commons.collections.map.HashedMap;
@ -69,6 +70,8 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
    
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Value("${configDefault.saasId}")
    private String defaultSaasId;
@ -622,20 +625,20 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
     */
    public JSONObject userInfoList(String name,String saasid,String roleId,int page,int size) throws Exception {
        JSONObject result = new JSONObject();
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : page * size;
   /*     int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : page * size;*/
        String realName = null == name ? "" : name;
        String saasidValue = null == saasid ? "" : saasid;
        String roleIdValue = null == roleId ? "" : roleId;
        String sql = "SELECT " +
                "  user.id as id, " +
                "  user.name as realName, " +
                "  user.username as username, " +
                "  case user.enabled when 0 then '已失效' when 1 then '生效中' end status, " +
                "  user.mobile, " +
                "  saas.name as saasName, " +
                "  role.name as roleName " +
                "  user.id as \"id\", " +
                "  user.name as \"realName\", " +
                "  user.username as \"username\", " +
                "  case user.enabled when 0 then '已失效' when 1 then '生效中' end status as \"enabled\", " +
                "  user.mobile as \"mobile\", " +
                "  saas.name as \"saasName\", " +
                "  role.name as \"roleName\" " +
                " FROM " +
                "  base_user user, " +
                "  base_saas saas, " +
@ -647,14 +650,11 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
                " and (user.name like '{realName}' or '' ='{realName}') " +
                "  and (saas.id = '{saasid}' or '' = '{saasid}') " +
                "  and ( user.role_id = '{roleId}' or '' = '{roleId}') " +
                " ORDER BY user.create_time DESC" +
                "  limit {start},{end} ";
                " ORDER BY user.create_time DESC";
        String finalSql = sql
                .replace("{realName}","%" + realName + "%")
                .replace("{saasid}",saasidValue)
                .replace("{roleId}",roleIdValue)
                .replace("{start}",String.valueOf(start))
                .replace("{end}",String.valueOf(end));
                .replace("{roleId}",roleIdValue);
        String countSql = "SELECT " +
                "  count(user.id) " +
@ -674,7 +674,7 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
                .replace("{saasid}",  saasidValue )
                .replace("{roleId}",  roleIdValue );
        List<Map<String, Object>> list = jdbcTemplate.queryForList(finalSql);
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(finalSql,page,size);
        Integer count = jdbcTemplate.queryForObject(finalCountSql, Integer.class);
        result.put("count", count);
        result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));

+ 32 - 29
svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WechatService.java

@ -11,6 +11,7 @@ import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.wechat.WeiXinMessageUtils;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
import com.yihu.jw.wechat.dao.WxTemplateDao;
@ -56,33 +57,35 @@ public class WechatService {
    private WxAccessTokenService wxAccessTokenService;
    @Autowired
    private UserAgent userAgent;
    @Autowired
    private HibenateUtils hibenateUtils;
    //====================微信与租户管理=======================
    public MixEnvelop getWxWechatList(String name,String saasName,Integer status,Integer publicType,Integer page,Integer size){
        String sql = "SELECT " +
                " w.id, " +
                " w.name, " +
                " w.`status`, " +
                " w.type, " +
                " w.public_type AS publicType," +
                " w.token," +
                " w.enc_type AS encType," +
                " w.type," +
                " w.app_id AS appId," +
                " w.app_secret AS appSecret," +
                " w.app_origin_id AS appOriginId," +
                " w.base_url AS baseUrl," +
                " w.user_name AS userName," +
                " w.password," +
                " w.remark," +
                " w.create_time AS createTime," +
                " w.create_user AS createUser," +
                " w.create_user_name AS createUserName," +
                " w.update_time AS updateTime," +
                " w.update_user AS updateUser," +
                " w.update_user_name AS updateUserName" +
                " w.id AS \"id\", " +
                " w.name as \"name\", " +
                " w.status AS \"status\", " +
                " w.type as \"type\", " +
                " w.public_type AS \"publicType\"," +
                " w.token AS \"token\"," +
                " w.enc_type AS \"encType\"," +
                " w.type as \"type\"," +
                " w.app_id AS \"appId\"," +
                " w.app_secret AS \"appSecret\"," +
                " w.app_origin_id AS \"appOriginId\"," +
                " w.base_url AS \"baseUrl\"," +
                " w.user_name AS \"userName\"," +
                " w.password AS \"password\"," +
                " w.remark AS \"remark\"," +
                " w.create_time AS \"createTime\"," +
                " w.create_user AS \"createUser\"," +
                " w.create_user_name AS \"createUserName\"," +
                " w.update_time AS \"updateTime\"," +
                " w.update_user AS \"updateUser\"," +
                " w.update_user_name AS \"updateUserName\"" +
                " FROM " +
                " wx_wechat w ";
        if (StringUtils.isNotBlank(saasName)) {
@ -135,7 +138,7 @@ public class WechatService {
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(countSql);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
            count = Long.parseLong(rstotal.get(0).get("total").toString()) ;
        }
        return MixEnvelop.getSuccessListWithPage(BaseRequestMapping.WeChat.api_success, list, page, size, count);
@ -143,8 +146,8 @@ public class WechatService {
    public List<WxSaasVO> getWxSaasVOs(String id){
        String sql ="SELECT " +
                " bs.`name` AS saasName, " +
                " bs.id AS saasid" +
                " bs.`name` AS \"saasName\", " +
                " bs.id AS \"saasid\"" +
                " FROM " +
                " wx_wechat_saas s " +
                " JOIN base_saas bs ON bs.id = s.saas_id " +
@ -248,7 +251,7 @@ public class WechatService {
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
            count = Long.parseLong(rstotal.get(0).get("total").toString());
        }
        String sql = "SELECT " +
@ -343,7 +346,7 @@ public class WechatService {
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sqlTotal);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
            count = Long.parseLong(rstotal.get(0).get("total").toString()) ;
        }
        String sql = "SELECT " +
@ -481,7 +484,7 @@ public class WechatService {
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
            count =Long.parseLong(rstotal.get(0).get("total").toString()) ;
        }
        String sql = "SELECT " +
@ -576,7 +579,7 @@ public class WechatService {
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
            count = Long.parseLong(rstotal.get(0).get("total").toString()) ;
        }
        String sql = "SELECT " +
@ -635,7 +638,7 @@ public class WechatService {
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
            count = Long.parseLong(rstotal.get(0).get("total").toString());
        }
        String sql ="SELECT " +

+ 33 - 1
svr/svr-base/src/main/resources/application.yml

@ -390,4 +390,36 @@ wechat:
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 1
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
---
##==心脏中心外 ===============================================================================
spring:
  profiles: xzprod
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.16.100.240:7306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
    username: jkzl
    password: jkzl@2020
  elasticsearch:
    cluster-name: jkzl #集群名 默认elasticsearch
    cluster-nodes: 172.16.100.240:9200 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    client-transport-sniff: false
    jest:
      uris: http://172.16.100.240:9300
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
    broker-url: tcp://59.61.92.90:9103
    user: jkzl
    password: jkzlehr
  redis:
    host: 172.16.100.240 # Redis server host.
    port: 6380 # Redis server port.
    password: q4YaQemf
fastDFS:
  fastdfs_file_url: http://172.16.100.240:8888/
fast-dfs:
  tracker-server: 172.16.100.240:22122 #服务器地址
wechat:
  id: xm_xzzx_wx  # base库中,wx_wechat 的id字段  # todo 待配置

+ 25 - 2
svr/svr-internet-hospital-entrance/src/main/resources/application.yml

@ -93,6 +93,12 @@ testPattern:
  sign: 0
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
---
spring:
  profiles: jwtest
@ -127,6 +133,11 @@ wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段  # todo 待配置
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
---
spring:
  profiles: jwprod
@ -163,7 +174,6 @@ express:
  sf_code: WH000102
  sf_check_word: TGUQASFNAZyjt9112
---
# 眼科医院前置机
spring:
@ -205,6 +215,10 @@ wlyy:
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段  # todo 待配置
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code:
  sf_check_word:
---
# 眼科医院前置机
spring:
@ -246,6 +260,10 @@ wlyy:
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code:
  sf_check_word:
---
#心脏中心前置机配置
spring:
@ -278,4 +296,9 @@ testPattern:
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: xm_xzzx_wx  # base库中,wx_wechat 的id字段
  id: xm_xzzx_wx  # base库中,wx_wechat 的id字段
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code:
  sf_check_word:

+ 3 - 2
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/ykyy/UnSettledHISPrescriptionJob.java

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.job.DataUploadJob;
import com.yihu.jw.service.channel.UnSettledHISPrescriptionService;
import com.yihu.jw.util.wechat.WeiXinMessageUtils;
import com.yihu.jw.wechat.service.WxTemplateService;
import org.quartz.DisallowConcurrentExecution;
@ -27,13 +28,13 @@ public class UnSettledHISPrescriptionJob implements Job{
    private static final Logger logger = LoggerFactory.getLogger(UnSettledHISPrescriptionJob.class);
    @Autowired
    private WxTemplateService wxTemplateService;
    private UnSettledHISPrescriptionService unSettledHISPrescription;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        logger.info("START========UnSettledHISPrescriptionJob========");
        try {
            wxTemplateService.unSettledHISPrescription();
            unSettledHISPrescription.unSettledHISPrescription();
            logger.info("END========UnSettledHISPrescriptionJob 执行结束========");
        }catch (Exception e){

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

@ -1,6 +1,6 @@
package com.yihu.jw.job.ykyy;
import com.yihu.jw.wechat.service.WxTemplateService;
import com.yihu.jw.service.channel.UnSettledHISPrescriptionService;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
@ -23,13 +23,13 @@ public class UpdateStatusByPayTimeJob implements Job{
    private static final Logger logger = LoggerFactory.getLogger(UpdateStatusByPayTimeJob.class);
    @Autowired
    private WxTemplateService wxTemplateService;
    private UnSettledHISPrescriptionService unSettledHISPrescriptionService;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        logger.info("START========UpdateStatusByPayTimeJob========");
        try {
            wxTemplateService.updateStatusByPayTime();
            unSettledHISPrescriptionService.updateStatusByPayTime();
            logger.info("END========UpdateStatusByPayTimeJob 执行结束========");
        }catch (Exception e){

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

@ -0,0 +1,474 @@
package com.yihu.jw.service.channel;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
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.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
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.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDiagnosisDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
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.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDiagnosisDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.im.service.ImService;
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.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.utils.RSAEncrypt;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WxPushLogDao;
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
import com.yihu.jw.wechat.dao.WxTemplateDao;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.net.URLEncoder;
import java.util.*;
/**
 * Created by Administrator on 2017/5/19 0019.
 */
@Service
public class UnSettledHISPrescriptionService {
    private Logger logger= LoggerFactory.getLogger(UnSettledHISPrescriptionService.class);
    @Autowired
    private WxTemplateConfigDao wxTemplateConfigDao;
    @Autowired
    private WxTemplateDao wxTemplateDao;
    @Autowired
    private WxAccessTokenService wxAccessTokenService;
    @Autowired
    private WeixinMessagePushUtils weixinMessagePushUtils;
    @Value("${wechat.id}")
    private String wechatId;
    
    @Autowired
    private BasePatientDao basePatientDao;
    
    @Autowired
    private BasePatientWechatDao basePatientWechatDao;
    
    @Autowired
    private OauthSsoService oauthSsoService;
    
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    @Autowired
    private YkyyEntranceService ykyyEntranceService;
    @Autowired
    private WxPushLogDao wxPushLogDao;
    @Autowired
    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;
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    @Autowired
    private ImService imService;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    
    
    /**
     * 发送微信模版消息-小程序视频
     * @param sender_id 发送者ID
     * @param sender_name 发送者姓名
     * @param reciver_id 接收者ID
     * @param reciver_name 接收者姓名
     * @param session_id 会话ID
     */
    public String sendWeTempMesMiniProgram(String sender_id, String sender_name, String reciver_id, String reciver_name,String session_id)throws Exception {
        BasePatientDO basePatientDO = basePatientDao.findById(reciver_id);
        if(basePatientDO!=null){
            List<BasePatientWechatDo> ps = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,reciver_id);
            if(ps.isEmpty()){
                logger.info("该用户"+reciver_name+"没有openid,无法推送模版消息,用户ID:"+reciver_id+"wechatId:"+wechatId);
            }else{
                for (BasePatientWechatDo basePatientWechatDo:ps){
                    if("xm_xzzx_wx".equals(wechatId)){
                        String getAuthCode = oauthSsoService.getSsoPublic(wechatId,basePatientDO.getId());
    
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("name",basePatientDO.getName());
                        jsonObject.put("idcard",basePatientDO.getIdcard());
                        jsonObject.put("mobile",basePatientDO.getMobile());
                        jsonObject.put("openid",basePatientWechatDo.getOpenid());
                        String authCode = jsonObject.toJSONString();
                        String jm = URLEncoder.encode(RSAEncrypt.encrypt(authCode,getAuthCode),"utf-8");
                        String miniprogramUrl = "pages/room/room?patientCode="+reciver_id+"&doctorName="+sender_name+"&role=patient&roomID="+session_id+"&template=1v1&debugMode=false&cloudenv=PRO&authCode="+jm+"&code="+wechatId+"&appId="+basePatientDO.getId();
                        //心脏中心模版消息推送接口
                        logger.info("心脏中心小程序跳转URL:"+miniprogramUrl);
                        xzzxEntranceService.sendXCXMes(wechatId,
                                basePatientDO.getId(),
                                basePatientDO.getIdcard(),
                                sender_name+"主任医生已向您发起视频通话邀请,请点击详情进入视频诊室。",
                                "点击消息进入视频诊室接听视频通话,开始视频咨询",
                                "",miniprogramUrl,"wx53f6bb4ac081d840");
                    }else{
                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_consult_notice","spthtx",1);
                        config.setFirst(config.getFirst().replace("key1",sender_name));
                        config.setPagepath(config.getPagepath()+""+reciver_id+"&doctorName="+sender_name+"&role=patient&roomID="+session_id+"&template=1v1&debugMode=false&cloudenv=PRO");
                        weixinMessagePushUtils.putWxMsg(wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken(),basePatientWechatDo.getOpenid(),config);
                    }
                }
            }
        }else{
            throw new Exception("接收者ID错误,无法找到该账号");
        }
        return "success";
    }
    /**
     * 查询HIS的01表中的审方状态,如果已审方,且未结算,则推送一条模板消息给居民,让居民进行支付结算。
     */
    public void unSettledHISPrescription() throws Exception{
        if("xm_ykyy_wx".equals(wechatId)){
            //获取审核失败
            JSONArray jsonArray = ykyyEntranceService.getNoUnsettledPrescription();
            if(jsonArray!=null&&jsonArray.size()>0) {
                for (int i = 0; i<jsonArray.size(); i++){
                    JSONObject json = jsonArray.getJSONObject(i);
                    String cfsb = json.getString("CFSB");
                    //查找对应的处方
                    String sql = "SELECT w.OUTPATIENT_ID,w.ID,w.DOCTOR_NAME from WLYY_PRESCRIPTION w WHERE REAL_ORDER = '"+cfsb+"' ORDER BY w.CREATE_TIME desc";
                    List<Map<String, Object>> pre = hibenateUtils.createSQLQuery(sql);
                    if(pre!=null && pre.size()>0){
                        String prescriptionId = pre.get(0).get("ID").toString();
                        //修改处方状态
                        String updateSql = "update WLYY_PRESCRIPTION set status = 11 where id = '"+prescriptionId+"'";
                        hibenateUtils.updateBySql(updateSql);
                    }
                }
            }
            //获取已审核未结算的处方
            JSONArray array = ykyyEntranceService.getUnsettledPrescription();
            //发送模板
            if(array!=null&&array.size()>0) {
                for (int i = 0; i<array.size(); i++){
                    JSONObject json = array.getJSONObject(i);
                    String brid = json.getString("BRID");
                    String cfsb = json.getString("CFSB");
                    //查找居民信息
                    BasePatientDO patientDO = ykyyEntranceService.findPatientByMapingCode(brid);
                    if(patientDO!=null){
                        //查找对应的处方
                        String sql = "SELECT w.OUTPATIENT_ID,w.ID,w.DOCTOR_NAME from WLYY_PRESCRIPTION w WHERE REAL_ORDER = '"+cfsb+"' ORDER BY w.CREATE_TIME desc";
                        List<Map<String, Object>> pre = hibenateUtils.createSQLQuery(sql);
                        if(pre!=null && pre.size()>0){
                            String outpatientId = pre.get(0).get("OUTPATIENT_ID").toString();
                            String prescriptionId = pre.get(0).get("ID").toString();
                            String doctorName = pre.get(0).get("DOCTOR_NAME").toString();
                            //判断是否发送过
                            String countSql = "SELECT id from WX_PUSH_LOG w WHERE w.RECEIVER = '"+patientDO.getId()
                                    +"' and w.OPENID = '"+prescriptionId+"' and w.scene = 'djsxxtz' and w.WECHAT_ID='"+wechatId+"'";
                            List<Map<String, Object>> count = hibenateUtils.createSQLQuery(countSql);
                            if(count==null || count.size() == 0){
                                List<BasePatientWechatDo> ps = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,patientDO.getId());
                                if(ps.isEmpty()){
                                    logger.info("该用户"+patientDO.getName()+"没有openid,无法推送模版消息,用户ID:"+patientDO.getId()+"wechatId:"+wechatId);
                                }else{
                                    //修改处方状态
                                    String updateSql = "update WLYY_PRESCRIPTION set status = 20 where id = '"+prescriptionId+"' and status = 10";
                                    hibenateUtils.updateBySql(updateSql);
                                    prescriptionLogService.addPrescriptionLog(prescriptionId,20,2,"system","system","",new Date());
                                    ps.stream().forEach(one->{
                                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_unsettled_notice","djsxxtz",1);
                                        WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
                                        BeanUtils.copyProperties(config,newConfig);
                                        newConfig.setFirst(config.getFirst().replace("key1",patientDO.getName()));
                                        newConfig.setUrl(config.getUrl()+""+outpatientId);
                                        newConfig.setKeyword3(doctorName);
                                        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(prescriptionId);
                                    wxPushLogDO.setReceiver(patientDO.getId());
                                    wxPushLogDO.setWechatId(wechatId);
                                    wxPushLogDO.setReceiverName(patientDO.getName());
                                    wxPushLogDO.setScene("djsxxtz");
                                    wxPushLogDao.save(wxPushLogDO);
                                }
                                WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
                                JSONObject object = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDO);
                                logger.info("wlyyPrescriptionDO参数入参"+object.toJSONString());
                                WlyyPrescriptionVO prescriptionVO = JSONObject.toJavaObject(object,WlyyPrescriptionVO.class);
                                List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                                List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS = new ArrayList<>();
                                for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:wlyyPrescriptionInfoDOS){
                                    JSONObject jsonObject = (JSONObject) JSONObject.toJSON(wlyyPrescriptionInfoDO);
                                    logger.info("wlyyPrescriptionInfoDO参数入参"+jsonObject.toJSONString());
                                    WlyyPrescriptionInfoVO prescriptionInfoVO = JSONObject.toJavaObject(jsonObject,WlyyPrescriptionInfoVO.class);
                                    wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
                                }
                                prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
                                List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                                List<WlyyPrescriptionDiagnosisVO> wlyyPrescriptionDiagnosisVOS = new ArrayList<>();
                                for (WlyyPrescriptionDiagnosisDO wlyyPrescriptionDiagnosisDO:wlyyPrescriptionDiagnosisDOS){
                                    JSONObject jsonObject = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDiagnosisDO);
                                    logger.info("wlyyPrescriptionDiagnosisDO参数入参"+jsonObject.toJSONString());
                                    WlyyPrescriptionDiagnosisVO prescriptionDiagnosisVO = JSONObject.toJavaObject(jsonObject,WlyyPrescriptionDiagnosisVO.class);
                                    wlyyPrescriptionDiagnosisVOS.add(prescriptionDiagnosisVO);
                                }
                                prescriptionVO.setDiagnosisVOs(wlyyPrescriptionDiagnosisVOS);
                                imService.pushPrescriptionImMessage(prescriptionVO);
                            }
                        }
                    }
                }
            }
        }
    }
    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){
                    Calendar cal= Calendar.getInstance();
                    cal.setTime(businessOrderDO.getCreateTime());
                    cal.add(Calendar.MINUTE,Integer.parseInt(close));
                    Long now = new Date().getTime();
                    Long min = cal.getTime().getTime();
                    logger.info("关闭处理cal="+cal);
                    if (min==now){
                        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();
                    Calendar cal= Calendar.getInstance();
                    cal.setTime(businessOrderDO.getCreateTime());
                    cal.add(Calendar.MINUTE,Integer.parseInt(remind));
                    Long now = new Date().getTime();
                    Long min = cal.getTime().getTime();
                    logger.info("提醒处理cal="+cal);
                    if (min==now){
                        //判断是否发送过
                        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{
        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_survey","test",1);
        config.setFirst(config.getFirst().replace("key1","小明"));
        config.setKeyword2("2018-08-21");
        weixinMessagePushUtils.putWxMsg(wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken(),openid,config);
        return "success";
    }
    
    public Envelop getAllTemp(String wechatId){
        String url ="https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token="+wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken();
        String result = HttpUtil.sendGet(url);
        JSONObject tempJsons = JSON.parseObject(result);
        //获取所有本地模板
        List<String> localTemps = findAllTempDos(wechatId);
        //解析公众号模板
        JSONArray temps = tempJsons.getJSONArray("template_list");
        List<WxTemplateDO> savelist = new ArrayList<>();
        if(temps!=null&&!temps.isEmpty()){
            for(int i=0;i<temps.size();i++){
                JSONObject tp = (JSONObject) temps.get(i);
                String tpid = tp.getString("template_id");
                if(!localTemps.contains(tpid)){
                    WxTemplateDO wxTemplateDO = new WxTemplateDO();
                    wxTemplateDO.setWechatId(wechatId);
                    wxTemplateDO.setTemplateId(tpid);
                    wxTemplateDO.setTitle(tp.getString("title"));
                    wxTemplateDO.setContent(tp.getString("content"));
                    wxTemplateDO.setStatus(1);
                    wxTemplateDO.setCreateTime(new Date());
                    savelist.add(wxTemplateDO);
                }
            }
            wxTemplateDao.save(savelist);
        }
        return Envelop.getSuccess(BaseRequestMapping.WeChat.api_success);
    }
    public List<String> findAllTempDos(String wechatId){
        List<WxTemplateDO> list =  wxTemplateDao.findByWxId(wechatId);
        List<String> rs = new ArrayList<>();
        if(list!=null&&list.size()>0){
            for(WxTemplateDO wxTemplateDO:list){
                rs.add(wxTemplateDO.getTemplateId());
            }
        }
        return rs;
    }
    
    /**
     * 发送微信模版消息
     * @param userName
     * @param senderName
     * @param idCard
     * @param phone
     * @param title
     * @param content
     * @param contentString
     * @param url
     */
    public String sendWxTemple(String userName, String senderName,
                             String idCard, String phone, String title,
                             String content, String contentString,
                             String url) throws Exception{
        BasePatientDO basePatientDO = basePatientDao.findByIdcard(idCard);
        if(basePatientDO!=null){
            List<BasePatientWechatDo> ps = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,basePatientDO.getId());
            if(ps.isEmpty()){
                logger.info("该用户"+basePatientDO.getName()+"没有openid,无法推送模版消息,用户ID:"+basePatientDO.getId()+"wechatId:"+wechatId);
            }else{
                for (BasePatientWechatDo basePatientWechatDo:ps){
                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_im_notice","zxtx",1);
                        config.setFirst(config.getFirst().replace("key1",userName));
                        config.setKeyword1(contentString);
                        config.setKeyword2(DateUtil.dateToStrLong(new Date()));
                        config.setUrl(url);
                        weixinMessagePushUtils.putWxMsg(wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken(),basePatientWechatDo.getOpenid(),config);
                }
            }
        }else{
            throw new Exception("接收者ID错误,无法找到该账号");
        }
        return "success";
    }
}

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

@ -89,7 +89,10 @@ fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
---
spring:
@ -119,7 +122,10 @@ wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
---
spring:
@ -157,7 +163,10 @@ wlyy:
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
---
spring:
  profiles: jwOracleProd
@ -193,7 +202,10 @@ wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
---
spring:
@ -223,7 +235,10 @@ wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
---
@ -254,7 +269,10 @@ wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
---
spring:
@ -284,4 +302,7 @@ wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk

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

@ -8,18 +8,27 @@ import com.yihu.jw.doctor.service.BaseDoctorInfoService;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.hospital.prescription.dao.OauthYlzConfigDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.service.consult.SysDictService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.patient.PatientRequestMapping;
import com.yihu.jw.util.common.XMLUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wechat.service.WechatInfoService;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
@ -43,6 +52,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -84,6 +94,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private OauthYlzConfigDao oauthYlzConfigDao;
    @Autowired
    private HospitalDeptService hospitalDeptService;
    @Autowired
    private BusinessOrderDao businessOrderDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
@ -320,13 +336,39 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @ResponseBody
    @ApiOperation("微信支付结果通知")
    @RequestMapping(value = "/notify", method = {RequestMethod.GET, RequestMethod.POST})
    public Map<String, String> wxPayNotify(HttpServletRequest request, HttpServletResponse response) throws IOException {
    public Map<String, String> wxPayNotify(HttpServletRequest request, HttpServletResponse response) throws Exception {
        String result = "";
        String inputLine;
        while ((inputLine = request.getReader().readLine()) != null) {
            result += inputLine;
        }
        request.getReader().close();
        //im处方发消息
        Map<String,Object> wxrs =  XMLUtil.xmltoMap(result);
        if("SUCCESS".equals(wxrs.get("return_code").toString())){
            // 我方 订单号+时间差
            String seqNo = wxrs.get("out_trade_no")+"";
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(seqNo);
            if (businessOrderDO.getStatus()!=1){
                if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("4")){
                    WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(businessOrderDO.getRelationCode());
                    JSONObject object = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDO);
                    logger.info("wlyyPrescriptionDO参数入参"+object.toJSONString());
                    WlyyPrescriptionVO prescriptionVO = JSONObject.toJavaObject(object,WlyyPrescriptionVO.class);
                    List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                    List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS = new ArrayList<>();
                    for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:wlyyPrescriptionInfoDOS){
                        JSONObject jsonObject1 = (JSONObject) JSONObject.toJSON(wlyyPrescriptionInfoDO);
                        logger.info("wlyyPrescriptionInfoDO参数入参"+jsonObject1.toJSONString());
                        WlyyPrescriptionInfoVO prescriptionInfoVO = JSONObject.toJavaObject(jsonObject1,WlyyPrescriptionInfoVO.class);
                        wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
                    }
                    prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
                    prescriptionVO.setPayStatus(1);
                    imService.pushPrescriptionImMessage(prescriptionVO);
                }
            }
        }
        Map<String, String> map = businessOrderService.getWxPayResultNotify(result);
        return map;
@ -377,7 +419,29 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                    JSONObject param = jsonObject.getJSONObject("param");
                    logger.info("param"+params);
                    String traceNo = param.getString("outChargeNo");
                    //im处方发消息
                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(traceNo);
                    if (businessOrderDO.getStatus()!=1){
                        if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("4")){
                            WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(businessOrderDO.getRelationCode());
                            JSONObject object = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDO);
                            logger.info("wlyyPrescriptionDO参数入参"+object.toJSONString());
                            WlyyPrescriptionVO prescriptionVO = JSONObject.toJavaObject(object,WlyyPrescriptionVO.class);
                            List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                            List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS = new ArrayList<>();
                            for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:wlyyPrescriptionInfoDOS){
                                JSONObject jsonObject1 = (JSONObject) JSONObject.toJSON(wlyyPrescriptionInfoDO);
                                logger.info("wlyyPrescriptionInfoDO参数入参"+jsonObject1.toJSONString());
                                WlyyPrescriptionInfoVO prescriptionInfoVO = JSONObject.toJavaObject(jsonObject1,WlyyPrescriptionInfoVO.class);
                                wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
                            }
                            prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
                            prescriptionVO.setPayStatus(1);
                            imService.pushPrescriptionImMessage(prescriptionVO);
                        }
                    }
                    businessOrderService.updatePayStatus(traceNo);
                    response.getWriter().write("SUCCESS");
                }
            }

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

@ -7,6 +7,8 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDiagnosisDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.InspectionService;
import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
@ -17,6 +19,8 @@ import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
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.WlyyPrescriptionDiagnosisVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.im.ConsultVO;
import com.yihu.jw.restmodel.web.Envelop;
@ -39,6 +43,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -82,6 +87,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    
    @Autowired
    private BusinessOrderService businessOrderService;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    
    @Value("${demo.flag}")
    private boolean demoFlag;
@ -355,8 +364,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                    @ApiParam(name = "diagnosisJson", value = "诊断json")
                                    @RequestParam(value = "diagnosisJson", required = true)String diagnosisJson,
                                    @ApiParam(name = "inspectionJson", value = "检查检验")
                                    @RequestParam(value = "inspectionJson", required = false)String inspectionJson)throws Exception {
        Map<String,Object> result = prescriptionService.makeDiagnosis(outPatientId,advice,type,infoJsons,diagnosisJson,inspectionJson);
                                    @RequestParam(value = "inspectionJson", required = false)String inspectionJson,
                                    @ApiParam(name = "emrJson", value = "电子病历")
                                        @RequestParam(value = "emrJson", required = false)String emrJson)throws Exception {
        Map<String,Object> result = prescriptionService.makeDiagnosis(outPatientId,advice,type,infoJsons,diagnosisJson,inspectionJson,emrJson);
        try {
            
            com.alibaba.fastjson.JSONObject msgObj = new com.alibaba.fastjson.JSONObject();
@ -681,6 +692,20 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        return success(prescriptionService.findPatientInfo(patient));
        
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.updatePatientInfo)
    @ApiOperation(value = "修改居民信息", notes = "修改居民信息")
    public ObjEnvelop findPatientInfo(@ApiParam(name = "patient", value = "居民ID")
                                      @RequestParam(value = "patient", required = true)String patient,
                                      @ApiParam(name = "name", value = "居民名称")
                                      @RequestParam(value = "name", required = true)String name,
                                      @ApiParam(name = "ssc", value = "社保卡")
                                      @RequestParam(value = "ssc", required = true)String ssc,
                                      @ApiParam(name = "idcard", value = "居民身份证")
                                       @RequestParam(value = "idcard", required = true)String idcard){
        return success(prescriptionService.updatePatientInfo(patient,name,idcard,ssc));
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.saveDoctorOnlineWork)
    @ApiOperation(value = "保存在线排班", notes = "保存在线排班")
@ -978,13 +1003,13 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                        consult.put("session_id", consult.get("patientId").toString()+"_"+ consult.get("generalDoctor").toString()+"_"+ consult.get("doctorCode").toString()+"_15");
                    }else{}
                }else if("9".equals(type)){//图文复诊
                    consult.put("session_id", consult.get("patientId")!=null?consult.get("patientId").toString():null+"_"+consult.get("outpatientid")!=null?consult.get("outpatientid").toString():null+"_9");
                    consult.put("session_id", consult.get("patientId")!=null?consult.get("patientId").toString():null+"_"+consult.get("outpatientId")!=null?consult.get("outpatientId").toString():null+"_9");
                    consult.put("type",type);
                }else if("16".equals(type)){//视频复诊
                    consult.put("session_id", consult.get("patientId")!=null?consult.get("patientId").toString():null+"_"+consult.get("outpatientid")!=null?consult.get("outpatientid").toString():null+"_16");
                    consult.put("session_id", consult.get("patientId")!=null?consult.get("patientId").toString():null+"_"+consult.get("outpatientId")!=null?consult.get("outpatientId").toString():null+"_16");
                    consult.put("type",type);
                }else if("12".equals(type)){//协同门诊
                    consult.put("session_id", consult.get("patientId")!=null?consult.get("patientId").toString():null+"_"+consult.get("outpatientid")!=null?consult.get("outpatientid").toString():null+"_12");
                    consult.put("session_id", consult.get("patientId")!=null?consult.get("patientId").toString():null+"_"+consult.get("outpatientId")!=null?consult.get("outpatientId").toString():null+"_12");
                    consult.put("type",type);
                }else{}
                
@ -1288,12 +1313,38 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        try {
            WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionService.findPrescriptionDo(prescriptionId);
            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(wlyyPrescriptionDO.getOutpatientId());
            com.alibaba.fastjson.JSONObject msgObj = new com.alibaba.fastjson.JSONObject();
            msgObj.put("outpatientid",wlyyPrescriptionDO.getOutpatientId());
            msgObj.put("prescriptionId",prescriptionId);
            msgObj.put("reason",reason);
            String immsg = imService.pushPrescriptionBackMsg(msgObj,operate,operateName,wlyyPrescriptionDO.getOutpatientId(),wlyyOutpatientDO.getPatient(),wlyyOutpatientDO.getOutpatientType());
            System.out.println("发送诊断消息成功:"+immsg);
            if (status==1){
                com.alibaba.fastjson.JSONObject msgObj = new com.alibaba.fastjson.JSONObject();
                msgObj.put("outpatientid",wlyyPrescriptionDO.getOutpatientId());
                msgObj.put("prescriptionId",prescriptionId);
                msgObj.put("reason",reason);
                String immsg = imService.pushPrescriptionBackMsg(msgObj,operate,operateName,wlyyPrescriptionDO.getOutpatientId(),wlyyOutpatientDO.getPatient(),wlyyOutpatientDO.getOutpatientType());
                System.out.println("发送诊断消息成功:"+immsg);
            }else if (status==2){
                JSONObject object = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDO);
                System.out.println("wlyyPrescriptionDO参数入参"+object.toJSONString());
                WlyyPrescriptionVO prescriptionVO = JSONObject.toJavaObject(object,WlyyPrescriptionVO.class);
                List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS = new ArrayList<>();
                for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:wlyyPrescriptionInfoDOS){
                    JSONObject jsonObject = (JSONObject) JSONObject.toJSON(wlyyPrescriptionInfoDO);
                    System.out.println("wlyyPrescriptionInfoDO参数入参"+jsonObject.toJSONString());
                    WlyyPrescriptionInfoVO prescriptionInfoVO = JSONObject.toJavaObject(jsonObject,WlyyPrescriptionInfoVO.class);
                    wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
                }
                prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
                List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                List<WlyyPrescriptionDiagnosisVO> wlyyPrescriptionDiagnosisVOS = new ArrayList<>();
                for (WlyyPrescriptionDiagnosisDO wlyyPrescriptionDiagnosisDO:wlyyPrescriptionDiagnosisDOS){
                    JSONObject jsonObject = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDiagnosisDO);
                    System.out.println("wlyyPrescriptionDiagnosisDO参数入参"+jsonObject.toJSONString());
                    WlyyPrescriptionDiagnosisVO prescriptionDiagnosisVO = JSONObject.toJavaObject(jsonObject,WlyyPrescriptionDiagnosisVO.class);
                    wlyyPrescriptionDiagnosisVOS.add(prescriptionDiagnosisVO);
                }
                prescriptionVO.setDiagnosisVOs(wlyyPrescriptionDiagnosisVOS);
                imService.pushPrescriptionImMessage(prescriptionVO);
            }
        }catch (Exception e){
            System.out.println("发送诊断消息失败:"+e.getMessage());
//            e.printStackTrace();
@ -1410,7 +1461,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
     * @return
     * @throws Exception
     */
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.saveEmr)
   /* @PostMapping(value= BaseHospitalRequestMapping.Prescription.saveEmr)
    @ApiOperation("创建电子病历")
    public ObjEnvelop saveEmr(
            @ApiParam(name = "emrJson", value = "emrJson", required = true)
@ -1421,7 +1472,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    }*/
    /**
@ -1441,5 +1492,47 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 查询his电子病历
     * @param registerSn
     * @return
     * @throws Exception
     */
    @GetMapping(value= BaseHospitalRequestMapping.Prescription.findHisEmr)
    @ApiOperation("查询电子病历")
    public ObjEnvelop findHisEmr(
            @ApiParam(name = "registerSn", value = "registerSn", required = true)
            @RequestParam(required = true)String registerSn) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok",prescriptionService.readOutPatient(registerSn));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.saveEmr)
    @ApiOperation("写入his电子病历")
    public ObjEnvelop findHisEmr(
            @ApiParam(name = "registerSn", value = "registerSn", required = true)
            @RequestParam(required = true)String registerSn,
            @ApiParam(name = "chiefComplaint", value = "chiefComplaint", required = true)
            @RequestParam(required = true)String chiefComplaint,
            @ApiParam(name = "hpi", value = "hpi", required = true)
            @RequestParam(required = true)String hpi,
            @ApiParam(name = "elapsemhis", value = "elapsemhis", required = true)
            @RequestParam(required = true)String elapsemhis,
            @ApiParam(name = "bodycheck", value = "bodycheck", required = true)
            @RequestParam(required = true)String bodycheck,
            @ApiParam(name = "assistanTcheck", value = "assistanTcheck", required = true)
            @RequestParam(required = true)String assistanTcheck) throws Exception {
        //String registerSn,String chiefComplaint,String hpi,String elapsemhis,String bodycheck,String assistanTcheck
        try {
            return ObjEnvelop.getSuccess("ok",prescriptionService.writeOutPatient(registerSn,chiefComplaint,hpi,elapsemhis,bodycheck,assistanTcheck));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
}

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

@ -89,6 +89,19 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
    }
    @GetMapping(value = IotRequestMapping.Platform.parameterDescription)
    @ApiOperation(value = "查找公共参数说明",notes = "查找公共参数说明")
    public MixEnvelop parameterDescription(){
        try {
            IotShareInterfaceDO iotShareInterfaceDO = iotShareInterfaceService.findByIdNew("0");
            return MixEnvelop.getSuccess("获取成功",iotShareInterfaceDO.getDocUrl());
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Platform.findAll)
    @ApiOperation(value = "分页查询所有共享接口",notes = "分页查询所有共享接口")

+ 3 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/IotShareInterfaceDao.java

@ -14,4 +14,7 @@ public interface IotShareInterfaceDao extends PagingAndSortingRepository<IotShar
    @Query("from IotShareInterfaceDO w where w.id =?1 and w.del=0")
    IotShareInterfaceDO findById(String id);
    @Query("from IotShareInterfaceDO w where w.id =?1 ")
    IotShareInterfaceDO findByIdNew(String id);
}

+ 12 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotShareInterfaceService.java

@ -76,7 +76,7 @@ public class IotShareInterfaceService extends BaseJpaService<IotShareInterfaceDO
        oldInterface.setExplanation(newInterface.getExplanation());
        oldInterface.setMethodName(newInterface.getMethodName());
        oldInterface.setInterfaceName(newInterface.getInterfaceName());
        oldInterface.setId(newInterface.getId());
        oldInterface.setDocUrl(newInterface.getDocUrl());
        oldInterface.setDel("0");
        iotShareInterfaceDao.save(oldInterface);
    }
@ -92,6 +92,17 @@ public class IotShareInterfaceService extends BaseJpaService<IotShareInterfaceDO
        return iotShareInterfaceDO;
    }
    /**
     * 根据ID查询接口
     * @param id
     * @return
     */
    public IotShareInterfaceDO findByIdNew(String id) {
        IotShareInterfaceDO iotShareInterfaceDO = iotShareInterfaceDao.findByIdNew(id);
        return iotShareInterfaceDO;
    }
    /**
     * 分页查询所有

+ 2 - 2
svr/svr-iot/src/main/resources/application.yml

@ -109,9 +109,9 @@ spring:
    password: ssgg@jkzl2019
  elasticsearch:
    cluster-name: jkzl #默认即为elasticsearch  集群名
    cluster-nodes: 172.19.103.45:9300,172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    cluster-nodes: 172.26.0.112:9300,172.26.0.112:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    jest:
      uris: http://172.19.103.45:9200,http://172.19.103.68:9200
      uris: http://172.26.0.112:9200,http://172.26.0.112:9200
  wlyy:
    url: http://ehr.yihu.com/wlyy/
    appid: 915d0345-5b1d-11e6-8344-fa163e8aee62