Ver código fonte

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

yeshijie 5 anos atrás
pai
commit
3c0ddaf9ca
85 arquivos alterados com 6376 adições e 633 exclusões
  1. 19 0
      business/base-service/src/main/java/com/yihu/jw/hospital/doctor/dao/BaseDoctorBackgroundDao.java
  2. 72 0
      business/base-service/src/main/java/com/yihu/jw/hospital/doctor/dao/service/BaseDoctorBGService.java
  3. 33 0
      business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/BaseBannerDao.java
  4. 22 0
      business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/BaseBannerDoctorDao.java
  5. 24 0
      business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/BaseUserMessageDao.java
  6. 14 0
      business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/BaseUserMsgContentDao.java
  7. 11 0
      business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/MsgContentDao.java
  8. 95 0
      business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseBannerDoctorService.java
  9. 233 0
      business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseBannerService.java
  10. 357 0
      business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseUserMsgService.java
  11. 125 0
      business/base-service/src/main/java/com/yihu/jw/hospital/message/service/UserMsgContentService.java
  12. 15 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/BaseSensitiveDao.java
  13. 105 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionExpressageService.java
  14. 716 159
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  15. 89 42
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  16. 42 6
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java
  17. 155 53
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  18. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java
  19. 15 0
      business/base-service/src/main/java/com/yihu/jw/message/service/UserMessageService.java
  20. 50 11
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  21. 16 0
      business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientBusinessDao.java
  22. 2 2
      business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java
  23. 143 0
      business/base-service/src/main/java/com/yihu/jw/utils/SensitiveWordInit.java
  24. 165 0
      business/base-service/src/main/java/com/yihu/jw/utils/SensitivewordFilter.java
  25. 56 0
      business/base-service/src/main/java/com/yihu/jw/wechat/service/BaseSensitiveFilterWordsService.java
  26. 47 28
      business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java
  27. 212 64
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  28. 59 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorBackgroundDO.java
  29. 99 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java
  30. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultTeamDo.java
  31. 219 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientBusinessDO.java
  32. 1 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/score/BaseEvaluateScoreDO.java
  33. 61 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/words/BaseImportSensitiveDO.java
  34. 86 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/words/BaseSensitiveDO.java
  35. 93 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeArticleDO.java
  36. 130 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeArticleUserDO.java
  37. 102 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/BaseBannerDO.java
  38. 128 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/BaseBannerDoctorDO.java
  39. 157 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/BaseUserMessageDO.java
  40. 130 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/BaseUserMsgContentDO.java
  41. 11 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java
  42. 14 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionExpressageDO.java
  43. 14 1
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java
  44. 77 12
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  45. 22 0
      common/common-util/src/main/java/com/yihu/jw/util/date/DateUtil.java
  46. 3 3
      server/svr-authentication/pom.xml
  47. 21 20
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  48. 2 0
      server/svr-authentication/src/main/resources/application.yml
  49. 14 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/word/BaseImportSensitiveDao.java
  50. 16 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/word/BaseSensitiveWordDao.java
  51. 1 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/excel/AExcelReader.java
  52. 8 3
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/saas/SaasEndpoint.java
  53. 171 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/word/BaseSensitiveEndpoint.java
  54. 37 20
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  55. 29 18
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java
  56. 2 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/OrgTree.java
  57. 29 19
      svr/svr-base/src/main/java/com/yihu/jw/base/service/team/BaseTeamService.java
  58. 30 19
      svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java
  59. 56 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/word/BaseSensitiveExcelReader.java
  60. 300 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/word/BaseSensitiveService.java
  61. 64 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/word/excelImport/BaseSensitiveExcelDO.java
  62. 29 17
      svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WechatService.java
  63. 2 0
      svr/svr-base/src/main/resources/application.yml
  64. 12 12
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java
  65. 88 0
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/third/PrescriptionUpdateController.java
  66. 18 2
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/third/SfRoutePushController.java
  67. 29 45
      svr/svr-internet-hospital-entrance/src/main/resources/application.yml
  68. 4 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionStatusUpdateService.java
  69. 29 0
      svr/svr-internet-hospital-job/src/main/resources/application.yml
  70. 4 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/dao/consult/KnowledgeArticleDao.java
  71. 17 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/dao/consult/KnowledgeArticleUserDao.java
  72. 176 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/article/ArticleEndpoint.java
  73. 46 8
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  74. 33 37
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  75. 91 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/BaseDoctorBGController.java
  76. 55 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/BannerDoctorController.java
  77. 147 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/BaseBannerController.java
  78. 135 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/BaseUserMsgController.java
  79. 74 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  80. 28 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  81. 3 3
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java
  82. 156 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/BasePatientBusinessService.java
  83. 115 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeArticleService.java
  84. 20 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeArticleUserService.java
  85. 43 19
      svr/svr-internet-hospital/src/main/resources/application.yml

+ 19 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/doctor/dao/BaseDoctorBackgroundDao.java

@ -0,0 +1,19 @@
package com.yihu.jw.hospital.doctor.dao;
import com.yihu.jw.entity.base.doctor.BaseDoctorBackgroundDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 *
 */
public interface BaseDoctorBackgroundDao extends PagingAndSortingRepository<BaseDoctorBackgroundDO, String>, JpaSpecificationExecutor<BaseDoctorBackgroundDO> {
    @Query(value = "select * from base_doctor_background t where t,doctor = ?1 ",nativeQuery = true)
    List<BaseDoctorBackgroundDO> getBackroundByDoctor(String doctor);
    @Query(value = "select * from base_doctor_background t limit ?1,?2",nativeQuery = true)
    List<BaseDoctorBackgroundDO> getBackroundAll(Integer page,Integer pageSize);
}

+ 72 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/doctor/dao/service/BaseDoctorBGService.java

@ -0,0 +1,72 @@
package com.yihu.jw.hospital.doctor.dao.service;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorBackgroundDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.hospital.message.BaseBannerDoctorDO;
import com.yihu.jw.hospital.doctor.dao.BaseDoctorBackgroundDao;
import com.yihu.jw.hospital.message.dao.BaseBannerDoctorDao;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.List;
@Service
public class BaseDoctorBGService extends BaseJpaService<BaseDoctorBackgroundDO, BaseDoctorBackgroundDao> {
    @Autowired
    private BaseDoctorBackgroundDao baseDoctorBackgroundDao;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    //查询背景
    public List<BaseDoctorBackgroundDO> getBackground(Integer page,Integer pageSize){
        return baseDoctorBackgroundDao.getBackroundAll(page,pageSize);
    }
    //医生选定背景
    @Transactional
    public BaseDoctorDO setDoctorBackground(String doctor,String id){
        BaseDoctorBackgroundDO baseDoctorBackgroundDO = baseDoctorBackgroundDao.findOne(id);
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
        if(null!=baseDoctorBackgroundDO&&null!=baseDoctorDO){
            baseDoctorDO.setBackgroundId(baseDoctorBackgroundDO.getId());
            baseDoctorDO.setBackground(baseDoctorBackgroundDO.getBackground());
            baseDoctorDO = baseDoctorDao.save(baseDoctorDO);
        }
        return baseDoctorDO;
    }
    //新增背景
    public BaseDoctorBackgroundDO createBackground(String bgName,String bgUrl){
        BaseDoctorBackgroundDO baseDoctorBackgroundDO = new BaseDoctorBackgroundDO();
        if(StringUtils.isNotEmpty(bgName)){
            baseDoctorBackgroundDO.setTitle(bgName);
        }if(StringUtils.isNotEmpty(bgUrl)){
            baseDoctorBackgroundDO.setBackground(bgUrl);
        }
        baseDoctorBackgroundDO =  baseDoctorBackgroundDao.save(baseDoctorBackgroundDO);
        return baseDoctorBackgroundDO;
    }
    //删除背景
    public void deleteBg(String bgId){
        BaseDoctorBackgroundDO baseDoctorBackgroundDO = baseDoctorBackgroundDao.findOne(bgId);
        if(null!=baseDoctorBackgroundDO){
            baseDoctorBackgroundDao.delete(bgId);
        }
    }
    //修改
    public BaseDoctorBackgroundDO updateBackground(String id,String bgUrl,String bgName){
        BaseDoctorBackgroundDO baseDoctorBackgroundDO =baseDoctorBackgroundDao.findOne(id);
        if(null!=baseDoctorBackgroundDO){
            if (StringUtils.isNotEmpty(bgName)){
                baseDoctorBackgroundDO.setTitle(bgName);
            }if (StringUtils.isNotEmpty(bgUrl)){
                baseDoctorBackgroundDO.setBackground(bgUrl);
            }
        }
        baseDoctorBackgroundDO = baseDoctorBackgroundDao.save(baseDoctorBackgroundDO);
        return  baseDoctorBackgroundDO;
    }
}

+ 33 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/BaseBannerDao.java

@ -0,0 +1,33 @@
package com.yihu.jw.hospital.message.dao;
import com.yihu.jw.entity.hospital.message.BaseBannerDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import org.hibernate.annotations.SQLInsert;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Map;
/**
 * @author wangzhinan
 * @vsrsion 2.0
 * Created at 2020.07.08
 */
public interface BaseBannerDao extends PagingAndSortingRepository<BaseBannerDO, String>, JpaSpecificationExecutor<BaseBannerDO> {
    @Query(value = "select * from base_banner p where p.name like %?1% and p.status = ?2 order by  p.sort desc limit ?3,?4 ",nativeQuery = true)
    List<BaseBannerDO> queryByNameAndStatus(String name,Integer status,Integer pageNo,Integer pageSize);
    @Query(value = "select * from base_banner p where p.name like %?1% order by  p.sort desc limit ?2,?3 ",nativeQuery = true)
    List<BaseBannerDO> queryByName(String name,Integer pageNo,Integer pageSize);
    @Query( value = "select max(t.sort) from base_banner t",nativeQuery = true)
    Integer getMaxSort();
    @Query( value = "select min(t.sort) from base_banner t",nativeQuery = true)
    Integer getMinSort();
    @Query(value = "select * from base_banner where id = ( select id from base_banner where sort > ?1 order by sort desc limit 0,1)",nativeQuery = true)
    BaseBannerDO upBanner(Integer sort);
    @Query(value = "select * from base_banner where id = ( select id from base_banner where sort < ?1 order by sort desc limit 0,1)",nativeQuery = true)
    BaseBannerDO downBanner(Integer sort);
}

+ 22 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/BaseBannerDoctorDao.java

@ -0,0 +1,22 @@
package com.yihu.jw.hospital.message.dao;
import com.yihu.jw.entity.hospital.message.BaseBannerDO;
import com.yihu.jw.entity.hospital.message.BaseBannerDoctorDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Map;
/**
 * @author wangzhinan
 * @vsrsion 2.0
 * Created at 2020.07.08
 */
public interface BaseBannerDoctorDao extends PagingAndSortingRepository<BaseBannerDoctorDO, String>, JpaSpecificationExecutor<BaseBannerDoctorDO> {
    //获取医生获得锦旗总量的接口
    @Query( value = "SELECT COUNT(1) AS \"total\"  FROM base_banner_doctor a LEFT JOIN base_banner b on a.banner_id= b.id where a.doctor = ?1",nativeQuery = true)
    Integer getTotalBannerCount(String doctor);
}

+ 24 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/BaseUserMessageDao.java

@ -0,0 +1,24 @@
package com.yihu.jw.hospital.message.dao;
import com.yihu.jw.entity.hospital.message.BaseBannerDO;
import com.yihu.jw.entity.hospital.message.BaseUserMessageDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author wangzhinan
 * @vsrsion 2.0
 * Created at 2020.07.08
 */
public interface BaseUserMessageDao extends PagingAndSortingRepository<BaseUserMessageDO, String>, JpaSpecificationExecutor<BaseUserMessageDO> {
    @Query(value = "select * from base_user_message t where  t.status = 1 and t.id = ?1 order by t.update_time asc limit 0,1",nativeQuery = true)
    List<BaseUserMessageDO> getMessageByCode(String Id);
    @Query(value = "select * from base_user_message t where t.relation_code = ?1 order by t.update_time asc ",nativeQuery = true)
    List<BaseUserMessageDO> getAllMessageByCode(String relationCode);
}

+ 14 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/BaseUserMsgContentDao.java

@ -0,0 +1,14 @@
package com.yihu.jw.hospital.message.dao;
import com.yihu.jw.entity.hospital.message.BaseUserMessageDO;
import com.yihu.jw.entity.hospital.message.BaseUserMsgContentDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface BaseUserMsgContentDao extends PagingAndSortingRepository<BaseUserMsgContentDO, String>, JpaSpecificationExecutor<BaseUserMsgContentDO> {
    @Query(value = "select * from base_user_msg_content t where t.base_user_msg_id = ?1 order by t.update_time asc ",nativeQuery = true)
    List<BaseUserMsgContentDO> getContentListByID(String base_user_msg_id);
}

+ 11 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/MsgContentDao.java

@ -0,0 +1,11 @@
package com.yihu.jw.hospital.message.dao;
import com.yihu.jw.entity.hospital.message.BaseUserMessageDO;
import com.yihu.jw.entity.hospital.message.BaseUserMsgContentDO;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface MsgContentDao extends JpaRepository<BaseUserMessageDO,Integer> {
    List<BaseUserMessageDO> findByRelationCode(String relationcode);
}

+ 95 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseBannerDoctorService.java

@ -0,0 +1,95 @@
package com.yihu.jw.hospital.message.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.message.BaseBannerDO;
import com.yihu.jw.entity.hospital.message.BaseBannerDoctorDO;
import com.yihu.jw.entity.hospital.message.BaseUserMessageDO;
import com.yihu.jw.hospital.message.dao.BaseBannerDao;
import com.yihu.jw.hospital.message.dao.BaseBannerDoctorDao;
import com.yihu.jw.hospital.message.dao.BaseUserMessageDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.xmlbeans.impl.xb.xsdschema.Public;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.swing.plaf.PanelUI;
import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@Service
public class BaseBannerDoctorService extends BaseJpaService<BaseBannerDoctorDO, BaseBannerDoctorDao> {
    @Autowired
    private BaseBannerDoctorDao baseBannerDoctorDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private BaseUserMessageDao baseUserMessageDao;
    @Autowired
    private BasePatientDao patientDao;
    //批量新增锦旗
    @Transactional
    public List<BaseBannerDoctorDO> bannerGive(String patientId, List<String> list,String content,
                           String doctor,String doctorName){
        String patientName = null;
        BasePatientDO basePatientDO=patientDao.findById(patientId);
        List<BaseBannerDoctorDO> bannerList = new ArrayList<>();
        if(null!=basePatientDO){
            patientName = basePatientDO.getName();
        }
        if (list.size()>0){
            for (int i=0;i<list.size();i++){
                BaseBannerDoctorDO baseBannerDoctorDO = new BaseBannerDoctorDO();
                baseBannerDoctorDO.setBannerId(list.get(i));
                baseBannerDoctorDO.setContent(content);
                baseBannerDoctorDO.setDoctor(doctor);
                baseBannerDoctorDO.setDoctorName(doctorName);
                baseBannerDoctorDO.setPatientId(patientId);
                baseBannerDoctorDO.setPatientName(patientName);
                baseBannerDoctorDO.setRelationType(1);
                baseBannerDoctorDO.setRelationName("赠送锦旗");
                baseBannerDoctorDO.setRelationCode("system");
                bannerList.add(baseBannerDoctorDO);
                baseBannerDoctorDao.save(baseBannerDoctorDO);
            }
            BaseUserMessageDO baseUserMessageDO = new BaseUserMessageDO();
            baseUserMessageDO.setReceiver(doctor);
            baseUserMessageDO.setReceiverName(doctorName);
            baseUserMessageDO.setRelationCode(UUID.randomUUID().toString());
            baseUserMessageDO.setSender(patientId);
            baseUserMessageDO.setSenderName(patientName);
            baseUserMessageDO.setRelationName("赠送锦旗");
            baseUserMessageDO.setRelationType(3);
            baseUserMessageDO.setStatus(1);
            baseUserMessageDO.setDel(1);
            baseUserMessageDao.save(baseUserMessageDO);
        }
        return bannerList;
    }
    //获取医生锦旗数量接口
    public JSONObject getDoctorBanners(String doctorID){
        StringBuffer sql = new StringBuffer();
        sql.append("SELECT COUNT(1) AS \"total\",b.name,b.img FROM base_banner_doctor a LEFT JOIN base_banner b on a.banner_id= b.id\n" +
                "where 1=1 ");
        sql.append("and a.doctor = '"+doctorID+"'");
        sql.append( " GROUP BY a.banner_id");
        //获取每个锦旗数量
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql.toString());
        int count = baseBannerDoctorDao.getTotalBannerCount(doctorID);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("count",count);
        jsonObject.put("resultlist",list);
        return jsonObject;
    }
}

+ 233 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseBannerService.java

@ -0,0 +1,233 @@
package com.yihu.jw.hospital.message.service;
import com.yihu.jw.entity.hospital.message.BaseBannerDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.BaseBannerDao;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.criteria.CriteriaBuilder;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service
public class BaseBannerService extends BaseJpaService<BaseBannerDO, BaseBannerDao> {
    @Autowired
    private BaseBannerDao baseBannerDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private HibenateUtils hibenateUtils;
    /**
     * 医生锦旗管理查询
     * @param
     * @return
     * @throws Exception
     */
   /* public List<BaseBannerDO> queryBannerByNameAndStatus(String name, String status, Integer page, Integer pageSize){
        Integer queryStatus =0;
        Integer pageNo = (page-1)*pageSize;
        Pageable pageable = new PageRequest(page,pageSize);
        if (StringUtils.isNotEmpty(status)) {
            queryStatus = Integer.valueOf(status);
            List<BaseBannerDO> result = baseBannerDao.queryByNameAndStatus(name,queryStatus,pageNo,pageSize);
            return result;
      }else {
            List<BaseBannerDO> result = baseBannerDao.queryByName(name,pageNo,pageSize);
            return result;
        }
    }*/
    public Envelop queryBannerByNameAndStatus(String name, String status, Integer page, Integer pageSize){
        Map<String,Object> params = new HashedMap();
        String sqlcount = dealSql(name,status,true);
        String sql  = dealSql(name,status,false);
        if (StringUtils.isNotEmpty(status)){
            params.put("status",status);
        }
        Long count = 0L;
        List<Map<String,Object>> total = hibenateUtils.createSQLQuery(sqlcount,params);
        if(total!=null){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            count = hibenateUtils.objTransformLong(total.get(0).get("total"));
        }
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params,page,pageSize);
        for (Map<String,Object> map:list){
            String createTime= map.get("create_time").toString();
            String updateTime = map.get("update_time").toString();
            map.put("create_time",DateUtil.dateToStrLong(DateUtil.strToDateLong(createTime)));
            map.put("update_time",DateUtil.dateToStrLong(DateUtil.strToDateLong(updateTime)));
        }
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, pageSize, count);
    }
    private String dealSql(String name, String status,Boolean isCount){
        StringBuffer sql = new StringBuffer();
        if (isCount) {
            sql.append("SELECT COUNT(1) AS \"total\" FROM (");
        }
        sql.append("select * from base_banner p where 1=1");
        if(StringUtils.isNotEmpty(name)){
            sql.append(" and p.name like '%"+name+"%'");
        }if (StringUtils.isNotEmpty(status)){
            sql.append(" and p.status =:status");
        }
        sql.append(" order by  p.sort desc ");
        if (isCount) {
            sql.append(") t");
        }
        return sql.toString();
    }
    /**
     * 医生锦旗新增
     * @param
     * @return
     * @throws Exception
     */
    public BaseBannerDO creatBanner(BaseBannerDO baseBannerDO){
        String sql = "select max(sort) as sort from base_banner";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        Map<String,Object> map = list.get(0);
        int sort = 0;
        if (null!=map.get("sort")){
            if(null!=map){
                sort = Integer.valueOf(map.get("sort").toString());
            }
        }
        baseBannerDO.setSort(sort+1);
        baseBannerDO.setUpdateTime(new Date());
        baseBannerDO.setCreateTime(new Date());
        BaseBannerDO result =  baseBannerDao.save(baseBannerDO);
        return result;
    }
    /**
     * 医生锦旗更新
     * @param
     * @return
     * @throws Exception
     */
    public BaseBannerDO updateBanner(String id,String name,String img,String status,String updateUser,String updateUserName,String description){
        BaseBannerDO bannerDO = baseBannerDao.findOne(id);
        if (null == bannerDO){
            return null;
        }
        if (!StringUtil.isEmpty(name)){
            bannerDO.setName(name);
            bannerDO.setUpdateTime(new Date());
        }
        if (!StringUtil.isEmpty(img)){
            bannerDO.setImg(img);
        }
        if (!StringUtil.isEmpty(updateUser)){
            bannerDO.setUpdateUser(updateUser);
        }
        if (!StringUtil.isEmpty(updateUserName)){
            bannerDO.setUpdateUser(updateUserName);
        }
        if (!StringUtil.isEmpty(status)){
            bannerDO.setStatus(Integer.valueOf(status));
        }
        if (!StringUtil.isEmpty(description)){
            bannerDO.setDescription(description);
        }
        baseBannerDao.save(bannerDO);
        return bannerDO;
    }
    /**
     * 医生锦旗删除
     * @param
     * @return
     * @throws Exception
     */
    public Boolean deleteBanner(String id){
        BaseBannerDO bannerDO = baseBannerDao.findOne(id);
        if (null == bannerDO){
            return false;
        }
        baseBannerDao.delete(id);
        return true;
    }
    /**
     * 医生锦旗上移
     * @param
     * @return
     * @throws Exception
     */
    public BaseBannerDO upBanner(String id) throws Exception{
        BaseBannerDO bannerDO = baseBannerDao.findOne(id);
        int maxSort = baseBannerDao.getMaxSort();
        int sort = 0;
        if(null!=bannerDO){
            sort = bannerDO.getSort();
        }
        BaseBannerDO upPrevious = baseBannerDao.upBanner(sort);
        if (maxSort==sort){
            throw new Exception("不能上移");
        }
        //交换sort值
        bannerDO.setSort(upPrevious.getSort());
        upPrevious.setSort(sort);
        baseBannerDao.save(bannerDO);
        baseBannerDao.save(upPrevious);
        return bannerDO;
    }
    /**
     * 医生锦旗下移
     * @param
     * @return
     * @throws Exception
     */
    public BaseBannerDO downBanner(String id) throws Exception{
        //当前banner
        BaseBannerDO bannerDO = baseBannerDao.findOne(id);
        int minSort = baseBannerDao.getMinSort();
        int sort = 0;
        if(null!=bannerDO){
            sort = bannerDO.getSort();
        }
        //获取的下一条banner
        BaseBannerDO downPrevious = baseBannerDao.downBanner(sort);
        if (minSort==sort){
            throw new Exception("不能下移");
        }
        //交换sort值
        bannerDO.setSort(downPrevious.getSort());
        downPrevious.setSort(sort);
        baseBannerDao.save(bannerDO);
        baseBannerDao.save(downPrevious);
        return bannerDO;
    }
    /**
     * 锦旗开关
     * @param
     * @return
     * @throws Exception
     */
    public BaseBannerDO onOff(String id ,String status){
        BaseBannerDO bannerDO = baseBannerDao.findOne(id);
        if(null!=bannerDO){
            bannerDO.setStatus(Integer.valueOf(status));
        }
        baseBannerDao.save(bannerDO);
        return bannerDO;
    }
}

+ 357 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseUserMsgService.java

@ -0,0 +1,357 @@
package com.yihu.jw.hospital.message.service;
import com.google.j2objc.annotations.AutoreleasePool;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.score.BaseEvaluateDO;
import com.yihu.jw.entity.base.score.BaseEvaluateScoreDO;
import com.yihu.jw.entity.hospital.message.BaseBannerDO;
import com.yihu.jw.entity.hospital.message.BaseUserMessageDO;
import com.yihu.jw.entity.hospital.message.BaseUserMsgContentDO;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateDao;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateScoreDao;
import com.yihu.jw.hospital.message.dao.BaseUserMessageDao;
import com.yihu.jw.hospital.message.dao.BaseUserMsgContentDao;
import com.yihu.jw.patient.dao.BasePatientDao;
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.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.mysql.query.URLQueryParser;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.jpa.provider.HibernateUtils;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.swing.plaf.PanelUI;
import javax.transaction.Transactional;
import java.util.*;
@Service
public class BaseUserMsgService extends BaseJpaService<BaseUserMessageDO, BaseUserMessageDao> {
    @Autowired
    private BaseUserMessageDao baseUserMessageDao;
    @Autowired
    private BaseUserMsgContentDao baseUserMsgContentDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private BaseEvaluateScoreDao baseEvaluateScoreDao;
    @Autowired
    private BaseEvaluateDao baseEvaluateDao;
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Value("${wechat.id}")
    private String wxId;
    @Value("${wechat.flag}")
    private boolean flag;
    //患者给医生自身留言接口
    public void leaveMessage(String content, String reciverId, String reciverName, String senderId) {
        BaseUserMessageDO baseUserMessageDO = new BaseUserMessageDO();
        BasePatientDO patientDO= basePatientDao.findById(senderId);
        String senderName=null;
        if(null!=patientDO){
            senderName = patientDO.getName();
        }
        String relationCode=UUID.randomUUID().toString();
        baseUserMessageDO.setContent(content);
        baseUserMessageDO.setSender(senderId);
        baseUserMessageDO.setSenderName(senderName);
        baseUserMessageDO.setReceiver(reciverId);
        baseUserMessageDO.setReceiverName(reciverName);
        baseUserMessageDO.setRelationCode(relationCode);
        baseUserMessageDO.setRelationName("留言");
        baseUserMessageDO.setRelationType(1);
        baseUserMessageDO.setStatus(1);
        baseUserMessageDO.setDel(1);
        baseUserMessageDao.save(baseUserMessageDO);
    }
    //回复留言接口
    @Transactional
    public void responseMessage(String contentId,String content, String reciverId, String reciverName, String senderId,Integer isDoctor) {
        BaseUserMessageDO baseUserMessageDOS = baseUserMessageDao.findOne(contentId);
        if(null!=baseUserMessageDOS){
            baseUserMessageDOS.setStatus(2);
        }
        baseUserMessageDao.save(baseUserMessageDOS);
        BaseUserMsgContentDO baseUserMsgContentDO =new BaseUserMsgContentDO();
        String senderName = null;
        if(1==isDoctor){
            BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(senderId);
            if(null!=baseDoctorDO){
                senderName = baseDoctorDO.getName();
            }
            baseUserMsgContentDO.setIsDoctor(1);
        }else {
            BasePatientDO patientDO= basePatientDao.findById(senderId);
            if(null!=patientDO){
                senderName = patientDO.getName();
            }
            baseUserMsgContentDO.setIsDoctor(0);
        }
        baseUserMsgContentDO.setBaseUserMsgId(contentId);
        baseUserMsgContentDO.setContent(content);
        baseUserMsgContentDO.setSender(senderId);
        baseUserMsgContentDO.setSenderName(senderName);
        baseUserMsgContentDO.setReceiver(reciverId);
        baseUserMsgContentDO.setReceiverName(reciverName);
        baseUserMsgContentDO.setDel(1);
        baseUserMsgContentDO.setStatus(1);
        baseUserMsgContentDao.save(baseUserMsgContentDO);
    }
    //评论留言展示
    public Envelop getMessage(String doctor, String showAll, String showAllType, String beginTime, String endTime, Integer page, Integer pageSize) {
        StringBuffer sql = new StringBuffer();
        Map<String,Object> params = new HashedMap();
        sql.append("select t.id as \"id\" ,t.content as \"content\"," +
                "t.sender as \"sender\",t.sender_name as \"sender_name\",t.receiver as \"receiver\"," +
                "t.receiver_name as \"receiver_name\",t.relation_type as \"relation_type\"," +
                "t.relation_code as \"relation_code\",t.relation_name as \"relation_name\",t.status as \"status\",t.update_time as \"update_time\"");
        /*if("xm_ykyy_wx".equals(wxId)){
            flag = true;
            if (flag){
               sql.append(",date_format(t.update_time,'%Y-%m-%d %H:%i:%S' )  AS \"update_time\"");
            }else {
                sql.append(",to_char(t.update_time,'YYYY-MM-DD hh24:mi:ss')  AS \"update_time\"");
            }
        }else{
            sql.append("date_format(t.update_time,'%Y-%m-%d %H:%i:%S' )  AS \"update_time\"");
        }*/
        sql.append(" from base_user_message t where 1 = 1");
        if (StringUtils.isNotEmpty(doctor)) {
            sql.append(" and t.receiver = '" + doctor + "'");
        }
        if (StringUtils.isNotEmpty(showAll)) {
            sql.append(" and t.status = " + showAll);
        }
        if (StringUtils.isNotEmpty(showAllType)) {
            sql.append(" and t.relation_type = " + showAllType);
        }
        if (StringUtils.isNotEmpty(beginTime)) {
            sql.append(" and t.update_time > '" + beginTime+"'");//DateUtil.stringToDate(beginTime,"yyyy-MM-dd HH:mm:ss")
        }
        if (StringUtils.isNotEmpty(endTime)) {
            sql.append(" and t.update_time < '" + endTime+"'");//DateUtil.stringToDate(endTime,"yyyy-MM-dd HH:mm:ss")
        }
        String sqlcount = "SELECT COUNT(1) AS \"total\" FROM ("+sql.toString()+") t";
        Long count = 0L;
        List<Map<String,Object>> total = hibenateUtils.createSQLQuery(sqlcount,params);
        if(total!=null){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            count = hibenateUtils.objTransformLong(total.get(0).get("total"));
        }
        sql.append(" GROUP BY t.relation_code ORDER BY t.update_time Desc");
        System.out.println(sql.toString());
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql.toString(),params,page,pageSize);
        List<Map<String, Object>> returnList = new ArrayList<>();
        for (Map<String, Object> map : list) {
            Map<String,Object> returnMap = new HashMap<>();
            String relationCode = map.get("relation_code").toString();
            String id =  map.get("id").toString();
            BaseUserMessageDO baseUserMsgContentDO =new BaseUserMessageDO();
            baseUserMsgContentDO.setId(id);
            baseUserMsgContentDO.setReceiver(map.get("receiver").toString());
            baseUserMsgContentDO.setReceiverName(map.get("receiver_name").toString());
            baseUserMsgContentDO.setSender(map.get("sender").toString());
            baseUserMsgContentDO.setContent(map.get("content")==null?"":map.get("content").toString());
            baseUserMsgContentDO.setRelationCode(map.get("relation_code").toString());
            baseUserMsgContentDO.setRelationType(Integer.valueOf(map.get("relation_type").toString()));
            baseUserMsgContentDO.setRelationName(map.get("relation_name").toString());
            BasePatientDO patientDO = basePatientDao.findById(map.get("sender").toString());
            String icon = null;
            if (null!=patientDO){
                icon = patientDO.getPhoto();
            }
            List<BaseUserMsgContentDO> contentlist=baseUserMsgContentDao.getContentListByID(id);
            baseUserMsgContentDO.setMsgList(contentlist);
            String updateTime = map.get("update_time").toString();
            baseUserMsgContentDO.setUpdateTime(DateUtil.strToDateLong(updateTime));
            //map.put("update_time",DateUtil.dateToStrLong(DateUtil.strToDateLong(updateTime)));
            List<BaseEvaluateDO> baseEvaluateDO=baseEvaluateDao.findByRelationCode(relationCode);
            BaseEvaluateScoreDO scoreList =null;
            if (baseEvaluateDO.size()>0){
                String findRC=baseEvaluateDO.get(0).getRelationCode();
                scoreList= baseEvaluateScoreDao.findOne(relationCode);
                if(null!=scoreList){
                    returnMap.put("everangScore",scoreList);
                    returnMap.put("scoreList",baseEvaluateDO);
                }
            }
            if(scoreList!=null){
                baseUserMsgContentDO.setSenderName(scoreList.getType()==1?map.get("sender_name").toString():map.get("sender_name").toString().substring(0,1)+"**");
            }else {
                baseUserMsgContentDO.setSenderName(map.get("sender_name").toString());
            }
            returnMap.put("contentList",baseUserMsgContentDO);
            returnMap.put("patientIcon",icon);
            returnList.add(returnMap);
        }
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, returnList, page, pageSize, count);
    }
    public List<Map<String,Object>> getListByRelationCode(String relationCode){
        //查询评价明细
        String sqlScoreList = "SELECT " +
                "a.score as \"score\"," +
                "a.score_type as \"score_type\"," +
                "a.content as \"content\",";
        if("xm_ykyy_wx".equals(wxId)){
            if (flag){
                sqlScoreList +=  "date_format(b.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"create_time\",";
            }else {
                sqlScoreList +=  "to_char(b.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"create_time\",";
            }
        }else{
            sqlScoreList +=  "date_format(b.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"create_time\",";
        }
        sqlScoreList +=	"c.type as \"type\"," +
                "c.name as \"patientname\"," +
                "b.id as \"id\"," +
                "c.photo as \"patientphoto\"," +
                "b.type as \"niming\" " +
                "FROM " +
                "base_evaluate a " +
                "LEFT JOIN base_evaluate_score b ON b.id=a.relation_code " +
                "LEFT JOIN wlyy_consult_team c ON c.consult=b.relation_code " +
                "WHERE a.relation_code=b.id "+
                "AND c.consult='"+relationCode+"'";
        System.out.println(sqlScoreList);
        List<Map<String,Object>> scoreList = hibenateUtils.createSQLQuery(sqlScoreList);
        if(scoreList.isEmpty()){
            return null;
        }
        return scoreList;
    }
    //获取单条评论详细信息
    public List<Map<String,Object>> getSingle(String id){
        BaseUserMessageDO baseUserMessageDO=baseUserMessageDao.findOne(id);
        List<BaseUserMsgContentDO> contentlist=baseUserMsgContentDao.getContentListByID(id);
        String relationCode= baseUserMessageDO.getRelationCode();
        List<Map<String,Object>> returnResult = new ArrayList<>();
        //List<Map<String,Object>> scoreList = this.getListByRelationCode(relationCode);
        Map<String,Object> map = new HashMap<>();
        BaseEvaluateScoreDO scoreList = new BaseEvaluateScoreDO();
        List<BaseEvaluateDO> baseEvaluateDO=baseEvaluateDao.findByRelationCode(relationCode);
        if (baseEvaluateDO.size()>0){
            String findRC=baseEvaluateDO.get(0).getRelationCode();
            scoreList= baseEvaluateScoreDao.findOne(relationCode);
            if(null!=scoreList){
                map.put("everangScore",scoreList);
                map.put("scoreList",baseEvaluateDO);
            }
        }
        map.put("scoreList",scoreList);
        map.put("sender",baseUserMessageDO.getSender());
        map.put("senderName",baseUserMessageDO.getSenderName());
        map.put("content",baseUserMessageDO.getContent());
        map.put("receiver",baseUserMessageDO.getReceiver());
        map.put("receiverName",baseUserMessageDO.getReceiverName());
        map.put("relationCode",baseUserMessageDO.getRelationCode());
        map.put("relationType",baseUserMessageDO.getRelationType());
        map.put("status",baseUserMessageDO.getStatus());
        map.put("updateTime",DateUtil.dateToStrLong(DateUtil.strToDateLong(baseUserMessageDO.getUpdateUserName())));
        map.put("relationName",baseUserMessageDO.getRelationName());
        map.put("contentlist",contentlist);
        returnResult.add(map);
        return returnResult;
    }
    //专家咨询留言
    public void expertMessage(String content, String reciverId, String reciverName, String senderId, String senderName, String relationCode) {
        BaseUserMessageDO baseUserMessageDO = new BaseUserMessageDO();
        baseUserMessageDO.setContent(content);
        baseUserMessageDO.setSender(senderId);
        baseUserMessageDO.setSenderName(senderName);
        baseUserMessageDO.setReceiver(reciverId);
        baseUserMessageDO.setReceiverName(reciverName);
        baseUserMessageDO.setRelationCode(relationCode);
        baseUserMessageDO.setRelationName("专家咨询");
        baseUserMessageDO.setRelationType(3);
        baseUserMessageDO.setStatus(1);
        baseUserMessageDO.setDel(1);
        baseUserMessageDao.save(baseUserMessageDO);
    }
    //在线复诊留言
    public void onlineVisitMessage(String content, String reciverId, String reciverName, String senderId, String senderName, String relationCode) {
        BaseUserMessageDO baseUserMessageDO = new BaseUserMessageDO();
        baseUserMessageDO.setContent(content);
        baseUserMessageDO.setSender(senderId);
        baseUserMessageDO.setSenderName(senderName);
        baseUserMessageDO.setReceiver(reciverId);
        baseUserMessageDO.setReceiverName(reciverName);
        baseUserMessageDO.setRelationCode(relationCode);
        baseUserMessageDO.setRelationName("在线复诊");
        baseUserMessageDO.setRelationType(4);
        baseUserMessageDO.setStatus(1);
        baseUserMessageDO.setDel(1);
        baseUserMessageDao.save(baseUserMessageDO);
    }
    //评论回复展示
    public Envelop showReply(String relationCode, Integer page, Integer pageSize){
        String sql = dealSql(relationCode,false);
        String sqlCount = dealSql(relationCode,true);
        Map<String,Object> params = new HashedMap();
        if (StringUtils.isNotEmpty(relationCode)){
            params.put("relationCode",relationCode);
        }
        Long count = 0L;
        List<Map<String,Object>> total = hibenateUtils.createSQLQuery(sqlCount,params);
        if(total!=null){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            count = hibenateUtils.objTransformLong(total.get(0).get("total"));
        }
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params,page,pageSize);
        for (Map<String,Object> map:list){
            String createTime= map.get("updateTime").toString();
            String updateTime = map.get("updateTime1").toString();
            map.put("updateTime",DateUtil.dateToStrLong(DateUtil.strToDateLong(createTime)));
            map.put("updateTime1",DateUtil.dateToStrLong(DateUtil.strToDateLong(updateTime)));
        }
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, pageSize, count);
    }
    private String dealSql(String relationCode,Boolean isCount){
        StringBuffer sql = new StringBuffer();
        if (isCount) {
            sql.append("SELECT COUNT(1) AS \"total\" FROM (");
        }
        sql.append("select " +"b.id AS \"id\",b.content AS \"topContent\",b.sender_name AS \"topSenderName\" " +
                ",a.content AS \"content\",b.update_time  AS \"updateTime\", a.sender_name AS \"senderName\",a.receiver_name AS \"receiverName\",a.update_time  AS \"updateTime1\""+
                "from base_user_msg_content a left join base_user_message b" +
                "on on b.id = a.base_user_msg_id");
        sql.append(" where 1=1 ");
        if (StringUtils.isNotEmpty(relationCode)){
            sql.append(" and a.relation_code = :relationCode");
        }
        if (isCount) {
            sql.append(") t");
        }
        return sql.toString();
    }
}

+ 125 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/UserMsgContentService.java

@ -0,0 +1,125 @@
package com.yihu.jw.hospital.message.service;
import com.yihu.jw.entity.hospital.message.BaseUserMessageDO;
import com.yihu.jw.entity.hospital.message.BaseUserMsgContentDO;
import com.yihu.jw.hospital.message.dao.BaseUserMessageDao;
import com.yihu.jw.hospital.message.dao.BaseUserMsgContentDao;
import com.yihu.jw.hospital.message.dao.MsgContentDao;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class UserMsgContentService extends BaseJpaService<BaseUserMsgContentDO, BaseUserMsgContentDao> {
    @Autowired
    private BaseUserMsgContentDao baseUserMsgContentDao;
    @Autowired
    private BaseUserMessageDao userMessageDao;
    @Autowired
    private MsgContentDao msgContentDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    //获取评论
    public List getAllMessage(String relationCode){
        List<BaseUserMessageDO> list = msgContentDao.findByRelationCode(relationCode);
        for(int i=0;i<list.size();i++){
            String id = list.get(i).getId();
            List<BaseUserMsgContentDO> contentlist=baseUserMsgContentDao.getContentListByID(id);
            list.get(i).setMsgList(contentlist);
        }
        return  list;
    }
    //好评率计算
    public List<Map<String, Object>> countPoint(String doctor){
        Map<String,Object> params = new HashedMap();
        /*sqlForExpert.append("select * from wlyy_consult a left join wlyy_consult_team b" +
                " on a.id = b.consult left join base_evaluate_score c on a.relation_code = c.id   where 1=1");
        if(StringUtils.isNotEmpty(doctor)){
            sqlForExpert.append(" and b.doctor = '"+doctor+"'");
        }
        //计算专家咨询
        sqlForExpert.append(" and a.type in (1,2,3,15)");*/
        String sqlForExpert = dealSql(doctor,true);
        String countsqlForExpert = "SELECT COUNT(1) AS \"total\" FROM ("+sqlForExpert+") t";
        //专家咨询业务数总量
        Long count = 1L;
        //专家咨询业务数满意数量
        Long expertFix = 0L;
        System.out.println(countsqlForExpert);
        List<Map<String,Object>> total = hibenateUtils.createSQLQuery(countsqlForExpert,params);
        if(total!=null){
            if (!"0".equals(total.get(0).get("total").toString())) {
                count = hibenateUtils.objTransformLong(total.get(0).get("total"));
            }
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
        }
        String sqlExpertFix = sqlForExpert+" and c.score >= 80";
        String countForExpert = "SELECT COUNT(1) AS \"total\" FROM ("+sqlExpertFix+") t";
        List<Map<String,Object>> expert = hibenateUtils.createSQLQuery(countForExpert,params);
        if (expert!=null){
            expertFix = hibenateUtils.objTransformLong(expert.get(0).get("total"));
        }
        String sql =dealSql(doctor,false);
        String countsqlForOnline= "SELECT COUNT(1) AS \"total\" FROM ("+sql+") t";
        //在线复诊业务数总量
        Long countOnlineTotal = 1L;
        //在线复诊业务数满意数量
        Long onlineFix = 0L;
        List<Map<String,Object>> totalOnline = hibenateUtils.createSQLQuery(countsqlForOnline,params);
        if(totalOnline!=null){
            if (!"0".equals(totalOnline.get(0).get("total").toString())){
                countOnlineTotal = hibenateUtils.objTransformLong(totalOnline.get(0).get("total"));
            }
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
        }
        String sqlOlineFix = sql+" and c.score >= 80";
        String countForFix = "SELECT COUNT(1) AS \"total\" FROM ("+sqlOlineFix+") t";
        System.out.println(countForFix
        );
        List<Map<String,Object>> onlineFixList = hibenateUtils.createSQLQuery(countForFix,params);
        if (onlineFixList!=null){
            onlineFix = hibenateUtils.objTransformLong(onlineFixList.get(0).get("total"));
        }
        float expertMY=(float) expertFix/count;
        float inlineMY = (float)onlineFix/countOnlineTotal;
        float totalConunt = (float)(expertFix+onlineFix)/(count+countOnlineTotal);
        DecimalFormat df = new DecimalFormat("0.00");
        List<Map<String,Object>> resultList= new ArrayList<>();
        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("zjzx",df.format(expertMY * 100)+"%");
        resultMap.put("zxfz",df.format(inlineMY * 100)+"%");
        resultMap.put("totalCount",df.format(totalConunt * 100)+"%");
        resultMap.put("doctor",doctor);
        resultList.add(resultMap);
        return resultList;
    }
    private String dealSql(String doctor,Boolean countExpert){
        StringBuffer sqlForExpert = new StringBuffer();
        sqlForExpert.append("select b.consult ,c.id from  wlyy_consult_team b \n" +
                "left join base_evaluate_score c on b.consult = c.relation_code  \n" +
                "where 1=1");
        if(StringUtils.isNotEmpty(doctor)){
            sqlForExpert.append(" and b.doctor = '"+doctor+"'");
        }
        if(countExpert){
            sqlForExpert.append(" and (b.type =1 OR b.type =15)");
        }else{
            sqlForExpert.append(" and (b.type =9 OR b.type =16)");
        }
        return sqlForExpert.toString();
    }
}

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

@ -0,0 +1,15 @@
package com.yihu.jw.hospital.prescription.dao;
import com.yihu.jw.entity.base.words.BaseSensitiveDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/7/6
 */
public interface BaseSensitiveDao extends PagingAndSortingRepository<BaseSensitiveDO, String>, JpaSpecificationExecutor<BaseSensitiveDO> {
    BaseSensitiveDO findBySensitiveWord(String sensitive);
}

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

@ -222,12 +222,14 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti
//        JSONObject respone = JSONObject.parseObject(re);
        String mailno = "";//顺丰运单号
        String bspOrderNo = "";//顺丰业务号
        
        JSONArray successResult =  respone.getJSONObject("result").getJSONArray("successResult");
        
        if(!successResult.isEmpty()){
            JSONObject object = successResult.getJSONObject(0);
            mailno = object.getString("mailNo");
            bspOrderNo = object.getString("bspOrderNo");
        }
    
        logger.info("顺丰快递下订单:mailno"+mailno);
@ -236,10 +238,39 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti
//        mailno = respone.getJSONObject("result").getJSONArray("successResult").getJSONObject(0).getString("mailNo");
        
        sfexpress_obj.setMailno(mailno);
        sfexpress_obj.setBspOrderNo(bspOrderNo);
        return sfexpress_obj;
    }
    /**
     * 顺丰面单查询
     * @param sfexpress_obj
     * @return
     * @throws Exception
     */
    public JSONObject postSFOrderQueryService(WlyyPrescriptionExpressageDO sfexpress_obj) throws Exception {
        //获取医生所处的医院详细地址,作为寄件人地址
        WlyyOutpatientDO outpatientDO = outpatientDao.findOne(sfexpress_obj.getOutpatientId());
        String orderNo=sfexpress_obj.getBspOrderNo();
        String re = this.SFExpressQueryPostV2(orderNo);
        //xml验证
        logger.info("顺丰快递面单查询:re"+re);
        verificationResponV2(re);
        JSONObject respone = JSONObject.parseObject(re);
        String mailno = "";//顺丰运单号
        JSONArray successResult =  respone.getJSONArray("result");
        JSONObject object = new JSONObject();
        if(!successResult.isEmpty()){
             object = successResult.getJSONObject(0);
        }
        return object;
    }
    /**
     * 向顺丰快递取消订单
     * @param sfexpress_obj
@ -455,6 +486,57 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti
        }
    }
    /**
     * 解析顺丰推送过来的路由信息,和本地数据匹配并进行增量更新)
     * @param waybillRoute
     * @return
     * @throws Exception
     */
    public void SFRoutePushServiceNew(String waybillRoute) throws Exception{
        JSONObject object = JSONObject.parseObject(waybillRoute);
        Map<String,List<WlyyPrescriptionExpressageLogDO>> wayroutlsit = new HashMap<>();
        logger.info("顺丰入参:"+object);
        WlyyPrescriptionExpressageLogDO sflog = new WlyyPrescriptionExpressageLogDO();
        String accept_time = object.getString("acceptTime");
        String accept_address = object.getString("acceptAddress");
        String accept_remark = object.getString("remark");
        String opcode = object.getString("opCode");
        String mailno = object.getString("mailNo");
        String orderid = object.getString("orderId");
        String id = object.getString("id");
        String signStr = "id="+id+"&mailNo="+mailno+"&orderId="+orderid+"&opCode="+opcode+"&secretKey="+sf_check_word;
        String signLocal = SHAUtils.SHA512(signStr);
        logger.info("signStr"+signLocal);
        String sign = object.getString("sign");
        if (signLocal.equalsIgnoreCase(sign)){
            sflog.setAcceptTime(DateUtil.stampToDate(accept_time));
            sflog.setAcceptAddress(accept_address);
            sflog.setAcceptRemark(accept_remark);
            sflog.setOpCode(opcode);
            sflog.setExpressageId(orderid);
            sflog.setId(UUID.randomUUID().toString());
            sflog.setCreateTime(new Date());
            if(wayroutlsit.keySet().contains(mailno)){
                wayroutlsit.get(mailno).add(sflog);
            }else{
                List<WlyyPrescriptionExpressageLogDO> newsflogs = new ArrayList<>();
                newsflogs.add(sflog);
                wayroutlsit.put(mailno,newsflogs);
            }
            if(!wayroutlsit.keySet().isEmpty()){
                for (String mailNo1:wayroutlsit.keySet()) {
                    List<WlyyPrescriptionExpressageLogDO> pushSFLogs = wayroutlsit.get(mailNo1);
                    //同一个快递单号的执行一个事务操作
                    this.saveSFPushRoutInfos(mailNo1,pushSFLogs);
                }
            }
        }else {
            throw new Exception("签名无效");
        }
    }
    /**
     * 同一个快递单号的执行一个事务操作
     * @param mailno
@ -739,7 +821,8 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti
     */
    private String SFExpressPostV2(JSONObject params)throws Exception{
        params.put("version","1.0");
        params.put("timestamp",new Date().getTime());
        params.put("timestamp","4070916000000");
        logger.info("timestamp"+params.getString("timestamp"));
        String sign = SHAUtils.SHA512(params.toJSONString()+sf_check_word);
        String url =sf_url+"/api/open/api/addOrder?hospitalCode="+sf_code+"&sign="+sign;
    
@ -750,6 +833,27 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti
        String re = HttpClientUtils.doPost(url, params.toJSONString(), ContentType.APPLICATION_JSON);
        return re;
    }
    /**
     * 查询面单组装请求参数,发送请求
     * @param params
     * @return
     * @throws Exception
     */
    private String SFExpressQueryPostV2(String params)throws Exception{
      /*  params.put("version","1.0");
        params.put("timestamp",new Date().getTime());*/
        String sign = SHAUtils.SHA512(params+sf_check_word);
        String url =sf_url+"/api/open/api/listSelfPrintDO?hospitalCode="+sf_code+"&sign="+sign+"&version=1.0"+"&timestamp=4070916000000&orderNo="+params;
        logger.info("顺丰快递面单查询:sf_url"+url);
        logger.info("顺丰快递面单查询:params"+params.toString());
        String re = HttpClientUtils.doGet(url);
        return re;
    }
    
    /**
     * 校验返回的报文

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

@ -12,8 +12,6 @@ import com.yihu.jw.entity.base.dict.DictDeptDescDO;
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.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
@ -46,6 +44,7 @@ import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.message.dao.BaseBannerDoctorDao;
import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
@ -62,8 +61,6 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
import com.yihu.jw.restmodel.base.org.BaseOrgVO;
import com.yihu.jw.restmodel.base.wx.WxGraphicMessageVO;
import com.yihu.jw.restmodel.base.wx.WxReplySceneVO;
import com.yihu.jw.restmodel.hospital.archive.ArchiveVO;
import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
import com.yihu.jw.restmodel.hospital.doctor.WlyyDoctorWorkTimeVO;
@ -77,12 +74,14 @@ import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.WebserviceUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxPushLogDao;
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
import com.yihu.jw.wechat.service.BaseSensitiveFilterWordsService;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
@ -213,8 +212,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    @Autowired
    private WlyyConsultAdviceDao wlyyConsultAdviceDao;
    @Autowired
    private BaseDoctorPatientDao baseDoctorPatientDao;
    @Autowired
    private BaseUserAgent userAgent;
    @Autowired
@ -222,8 +219,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    @Autowired
    private YlzPayService ylzPayService;
    @Autowired
    private BasePatientMedicareCardDao patientMedicareCardDao;
    @Autowired
    private PatientMappingDao patientMappingDao;
    @Autowired
    private WechatDao wechatDao;
@ -245,6 +240,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    @Autowired
    private DictDeptDescDao dictDeptDescDao;
    @Autowired
    private BaseSensitiveFilterWordsService baseSensitiveFilterWordsService;
    @Autowired
    private BaseBannerDoctorDao baseBannerDoctorDao;
    @Value("${demo.flag}")
    private boolean demoFlag;
    @Value("${wechat.id}")
@ -293,6 +295,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            BasePatientDO patientDO = basePatientDao.findById(patient);
            outpatientVO.setSex(patientDO.getSex() + "");
            outpatientVO.setBirthday(patientDO.getBirthday());
            outpatientVO.setIdcard(patientDO.getIdcard());
            return outpatientVO;
        }
        return null;
@ -390,7 +393,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }else {
                condition = "to_char(o.register_date ,'yyyy-MM-dd hh24:mi:ss' ) AS \"registerDate\",";
            }
            condition = "to_char(o.register_date ,'yyyy-MM-dd hh24:mi:ss' ) AS \"registerDate\",";
        } else {
            condition = "date_format(o.register_date ,'%Y-%m-%d %H:%i:%S' ) AS registerDate,";
        }
@ -455,6 +457,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        sql += " AND o.outpatient_type != '2' ORDER BY o.create_time DESC ";
        logger.info("sql="+sql);
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params, page, size);
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
@ -479,7 +482,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        rs.put("patientCancelType", outpatientDO.getPatientCancelType());
        rs.put("patientCancelValue", outpatientDO.getPatientCancelValue());
        rs.put("patientCancelRemark", outpatientDO.getPatientCancelRemark());
        rs.put("operator", userAgent.getUID());
        rs.put("operator",outpatientDO.getOperator());
        //居民详情
        BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient());
        rs.put("patientName", basePatientDO.getName());
@ -593,7 +596,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        if (StringUtils.isNotBlank(startTime)) {
            if ("xm_ykyy_wx".equals(wxId)) {
                totalSql += " and create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                if (flag){
                    totalSql += " and create_time >= str_to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                }else {
                    totalSql += " and create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                }
            } else {
                totalSql += " AND create_time >='" + startTime + " 00:00:00'";
            }
@ -601,7 +609,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        if (StringUtils.isNotBlank(endTime)) {
            if ("xm_ykyy_wx".equals(wxId)) {
                totalSql += " and create_time <= to_date('" + startTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
                if (flag){
                    totalSql += " and create_time <= str_to_date('" + startTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
                }else {
                    totalSql += " and create_time <= to_date('" + startTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
                }
            } else {
                totalSql += " AND create_time <='" + endTime + " 23:59:59'";
            }
@ -668,14 +680,22 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        if (StringUtils.isNotBlank(startTime)) {
            if ("xm_ykyy_wx".equals(wxId)) {
                sql += " and create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                if (flag){
                    sql += " and create_time >= str_to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                }else {
                    sql += " and create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                }
            } else {
                sql += " AND create_time >='" + startTime + " 00:00:00'";
            }
        }
        if (StringUtils.isNotBlank(endTime)) {
            if ("xm_ykyy_wx".equals(wxId)) {
                sql += " and create_time <= to_date('" + startTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
                if (flag){
                    sql += " and create_time <= str_to_date('" + startTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
                }else {
                    sql += " and create_time <= to_date('" + startTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
                }
            } else {
                sql += " AND create_time <='" + endTime + " 23:59:59'";
            }
@ -770,9 +790,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("WX_MONEY");
        Double price = 0.0;
        if (doctorDO != null && StringUtils.isNoneBlank(doctorDO.getFee())) {
            price = Double.parseDouble(doctorDO.getFee());
        }else {
            price = Double.parseDouble(hospitalSysDictDO.getDictValue());
        }
        if (price == 0.0) {
            outpatientDO.setPayStatus(1);
@ -2113,16 +2136,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                outpatientDao.save(outpatientDO);
                //先下单
                businessOrderService.savePrescriptionOrder(prescription.getId());
                //同步his
                ykyyEntranceService.findByRealOrder(prescription.getId(),demoFlag);
                List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findById(prescription.getId());
                if (prescriptionDOList != null && prescriptionDOList.size() != 0) {
                    WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDOList.get(0);
                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                    logger.info("cfsb", wlyyPrescriptionDO.getRealOrder());
                    ykyyService.updateDrugorderInfo(businessOrderDO.getOrderNo(), wlyyPrescriptionDO.getOrderId(), wlyyPrescriptionDO.getRealOrder());
                if(!demoFlag){
                    //同步his
                    ykyyEntranceService.findByRealOrder(prescription.getId(),demoFlag);
                    List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findById(prescription.getId());
                    if (prescriptionDOList != null && prescriptionDOList.size() != 0) {
                        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDOList.get(0);
                        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                        logger.info("cfsb", wlyyPrescriptionDO.getRealOrder());
                        ykyyService.updateDrugorderInfo(businessOrderDO.getOrderNo(), wlyyPrescriptionDO.getOrderId(), wlyyPrescriptionDO.getRealOrder());
                    }
                }
                result.put("code", 1);
                result.put("mes", "诊断完成");
                return result;
@ -2487,7 +2513,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        if (StringUtils.isNotBlank(startTime)) {
            if ("xm_ykyy_wx".equals(wxId)) {
                totalSql += " and e.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                if (flag){
                    totalSql += " and e.create_time >= str_to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                }else {
                    totalSql += " and e.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                }
            } else {
                totalSql += " AND e.create_time >='" + startTime + " 00:00:00'";
            }
@ -2495,7 +2525,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        if (StringUtils.isNotBlank(endTime)) {
            if ("xm_ykyy_wx".equals(wxId)) {
                totalSql += " and e.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
                if (flag){
                    totalSql += " and e.create_time <= str_to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
                }else {
                    totalSql += " and e.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
                }
            } else {
                totalSql += " AND e.create_time <='" + endTime + " 23:59:59'";
            }
@ -2509,7 +2543,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        String sql = "SELECT  ";
        if ("xm_ykyy_wx".equals(wxId)) {
            sql = sql + "to_char(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
            if (flag){
                sql = sql + "date_format(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
            }else {
                sql = sql + "to_char(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
            }
        } else {
            sql = sql + "date_format(e.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"createTime\",";
        }
@ -2537,7 +2576,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        if (StringUtils.isNotBlank(startTime)) {
            if ("xm_ykyy_wx".equals(wxId)) {
                sql += " and e.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                if (flag){
                    sql += " and e.create_time >= str_to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                }else {
                    sql += " and e.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                }
            } else {
                sql += " AND e.create_time >='" + startTime + " 00:00:00'";
            }
@ -2545,12 +2588,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        if (StringUtils.isNotBlank(endTime)) {
            if ("xm_ykyy_wx".equals(wxId)) {
                sql += " and e.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
                if (flag){
                    sql += " and e.create_time <= str_to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
                }else {
                    sql += " and e.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
                }
            } else {
                sql += " AND e.create_time <='" + endTime + " 23:59:59'";
            }
        }
        sql +=" order by e.create_time desc ";
        /*       sql += " LIMIT " + (page - 1) * size + "," + size + "";*/
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, page, size);
        for (Map<String, Object> map : list) {
@ -3038,6 +3087,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            rs.put("expertise", doctorDO.getExpertise());
            rs.put("introduce", doctorDO.getIntroduce());
            rs.put("consultStatus", doctorDO.getConsultStatus());// 咨询在线状态
            rs.put("img",doctorDO.getImg());//风采图
            rs.put("visitHospitalName",doctorDO.getVisitHospitalName());//出诊医院
            rs.put("visitHospital",doctorDO.getVisitHospital());
            rs.put("background",doctorDO.getBackground());//背景图
            rs.put("backgroundId",doctorDO.getBackgroundId());//背景图id
            rs.put("visitDeptName",doctorDO.getVisitDeptName());//出诊科室
            rs.put("visitDept",doctorDO.getVisitDept());
            //机构科室信息
            List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByDoctorCode(doctorDO.getId());
@ -3140,6 +3196,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            } else {
                rs.put("scoreDoctor", null);
            }
            int count = baseBannerDoctorDao.getTotalBannerCount(doctor);
            rs.put("bannerCount",count);
            //查询评价明细
            String sqlScoreList = "SELECT " +
@ -3159,12 +3217,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "LEFT JOIN wlyy_consult_team c ON c.consult=b.relation_code AND c.doctor='" + doctor + "' " +
                    "WHERE a.relation_code=b.id AND b.doctor='" + doctor + "' order by b.create_time DESC ";
            List<Map<String, Object>> scoreList = jdbcTemplate.queryForList(sqlScoreList);
            if (scoreList != null && scoreList.size() > 0) {
//                Set<String> datelist = new HashSet<>();
                HashMap<String, List<Map<String, Object>>> waitinglist = new HashMap<>();
               /* HashMap<String, List<Map<String, Object>>> waitinglist = new HashMap<>();
                if (scoreList != null && scoreList.size() > 0) {
                    for (Map<String, Object> scorepatient : scoreList) {
@ -3182,7 +3238,38 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                            waitinglist.put(id, _cu);
                        }
                    }
                }*/
                List<com.alibaba.fastjson.JSONArray> waitinglist = new ArrayList<>();
                if (scoreList != null && scoreList.size() > 0) {
                    List<String> stringList = new ArrayList<>();
                    for (Map<String, Object> scorepatient : scoreList) {
                        String id = (String) scorepatient.get("id");
                        if (id == null) {
                            continue;
                        }
                        if (!stringList.contains(id)){
                            stringList.add(id);
                        }
                        String content = (String)scorepatient.get("content");
                        if (StringUtils.isNotEmpty(content)){
                            String replace = baseSensitiveFilterWordsService.filterSensitiveWords(content);
                            scorepatient.put("content",replace);
                        }
                    }
                    for (String str:stringList){
                        com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
                        for (Map<String, Object> scorepatient : scoreList){
                            String id = (String) scorepatient.get("id");
                            if (id!=null&&str.equalsIgnoreCase(id)){
                                array.add(scorepatient);
                            }
                        }
                        waitinglist.add(array);
                    }
                }
                rs.put("scoreList", waitinglist);
            } else {
                rs.put("scoreList", null);
@ -3192,6 +3279,44 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return rs;
    }
    public BaseDoctorDO updateDoctorInfo(String id, String img,String background,String expertise,String visitHospital,String visitHospitalName,String visitDept,String visitDeptName,String backgroundId){
        if (StringUtils.isNoneBlank(id)){
            BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(id);
            if (StringUtils.isNoneBlank(img)){
                baseDoctorDO.setImg(img);
            }
            if (StringUtils.isNoneBlank(background)){
                baseDoctorDO.setBackground(background);
            }
            if (StringUtils.isNoneBlank(expertise)){
                baseDoctorDO.setExpertise(expertise);
            }
            if (StringUtils.isNoneBlank(visitHospital)){
                baseDoctorDO.setVisitHospital(visitHospital);
            }
            if(StringUtils.isNoneBlank(visitHospitalName)){
                baseDoctorDO.setVisitHospitalName(visitHospitalName);
            }
            if (StringUtils.isNoneBlank(visitDept)){
                baseDoctorDO.setVisitDept(visitDept);
            }
            if (StringUtils.isNoneBlank(visitDeptName)){
                baseDoctorDO.setVisitDeptName(visitDeptName);
            }
            if (StringUtils.isNoneBlank(backgroundId)){
                baseDoctorDO.setBackgroundId(backgroundId);
            }
            return baseDoctorDao.save(baseDoctorDO);
        }else {
            return null;
        }
    }
    public Map<String, Object> findDoctorBaseInfo(String doctor) {
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
@ -3210,6 +3335,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            rs.put("townCode", doctorDO.getTownCode());
            rs.put("townName", doctorDO.getTownName());
            rs.put("consultStatus", doctorDO.getConsultStatus());// 咨询在线状态
            rs.put("img",doctorDO.getImg());//风采图
            rs.put("visitHospitalName",doctorDO.getVisitHospitalName());//出诊医院
            rs.put("visitHospital",doctorDO.getVisitHospital());
            rs.put("background",doctorDO.getBackground());//背景图
            rs.put("backgroundId",doctorDO.getBackgroundId());//背景图id
            rs.put("visitDeptName",doctorDO.getVisitDeptName());//出诊科室
            rs.put("visitDept",doctorDO.getVisitDept());
            //机构科室信息
            List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByDoctorCode(doctorDO.getId());
@ -3303,6 +3435,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //更改门诊状态
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(outPatientId);
        wlyyOutpatientDO.setStatus("-1");
        //报错拒诊操作人
        wlyyOutpatientDO.setOperator(userAgent.getUID());
        String description = null;
        if (1 == operator) {
            //居民取消
@ -3338,12 +3472,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())) {
                    data.put("type", "9");
                    msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个图文复诊已被医生取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。";
                    sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "9", "doctorRefuse", "");
                    sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "9", "doctorRefuseRemind", "");
                }
                if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())) {
                    data.put("type", "16");
                    msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个视频复诊已被医生取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。";
                    sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "16", "doctorRefuse", "");
                    sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "16", "doctorRefuseRemind", "");
                }
                data.put("msg", msg);
                messageDO.setData(data.toString());
@ -3371,14 +3505,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            if (wxId.equalsIgnoreCase("xm_ykyy_wx")) {
                businessOrderService.orderRefund(wxId, wlyyOutpatientDO.getPatient(), businessOrderDO.getOrderNo(), businessOrderDO.getPayPrice(), description);
            } else if (wxId.equalsIgnoreCase("xm_zsyy_wx")) {
/*
                businessOrderService.ylzOrderRefund(wxId, wlyyOutpatientDO.getPatient(), businessOrderDO.getOrderNo(), businessOrderDO.getPayPrice(), description);
*/
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        rs.put("code", 1);
        rs.put("mes", "取消成功");
        rs.put("patientName",wlyyOutpatientDO.getPatientName());
        rs.put("doctor",wlyyOutpatientDO.getDoctor());
        rs.put("doctorName",wlyyOutpatientDO.getDoctorName());
        rs.put("patientCode",wlyyOutpatientDO.getPatient());
        return rs;
    }
@ -3394,10 +3533,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        BaseDoctorDO consDoctorDO = new BaseDoctorDO();
        BasePatientDO consPatientDO = new BasePatientDO();
        BaseDoctorHospitalDO hospitalDO = new BaseDoctorHospitalDO();
        //获取咨询的信息
        String msgUrl="";
        if (consultTeam!=null){
            consDoctorDO = baseDoctorDao.findById(consultTeam.getDoctor());
            consPatientDO = basePatientDao.findById(consultTeam.getPatient());
            List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(consultTeam.getDoctor());
            if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()>=0){
                hospitalDO=doctorHospitalDOS.get(0);
            }
        }
        WlyyOutpatientDO outpatientDO = new WlyyOutpatientDO();
@ -3409,6 +3554,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            patientDO = basePatientDao.findById(outpatientDO.getPatient());
        }
        logger.info("titelType:"+titelType+"&&remindMsg:"+remindMsg+"&&type"+type);
        String contentMsg = "";
        String first = "";
@ -3423,74 +3570,108 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                contentMsg = "您的视频复诊订单已被医生取消,您可重新发起。由于订单取消将不做扣费处理";
                first = outpatientDO.getPatientName() + ",您好!您的视频复诊已取消";
            }
            logger.info("doctorRefuseRemind医生拒诊入参:outpatientId="+outpatientId);
            msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
        } else if ("payRemind".equalsIgnoreCase(titelType)) {
            if ("9".equals(type)) {
                contentMsg = "您有一个图文复诊订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first = outpatientDO.getPatientName() + ",您好!您有一个图文复诊订单待支付,请及时支付。";
                msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
                logger.info("图文复诊订单待支付微信消息模板推送开始");
            } else if ("16".equals(type)) {
                contentMsg = "您有一个视频复诊订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first = outpatientDO.getPatientName() + ",您好!您有一个视频复诊订单待支付,请及时支付。";
                msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
                logger.info("视频复诊订单待支付微信消息模板推送开始");
            }
            if ("1".equals(type)) {
                contentMsg = "您有一个图文咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first = consPatientDO.getName() + ",您好!您有一个图文咨询订单待支付,请及时支付。";
                msgUrl="/ims-wx/index.html#/chatRoom?type=1&consultCode="+consultTeam.getConsult();
                logger.info("图文咨询订单待支付微信消息模板推送开始");
            } else if ("17".equals(type)) {
                contentMsg = "您有一个视频咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first =  consPatientDO.getName() + ",您好!您有一个视频咨询订单待支付,请及时支付。";
                msgUrl="/ims-wx/index.html#/chatRoom?type=1&consultCode="+consultTeam.getConsult();
                logger.info("视频咨询订单待支付微信消息模板推送开始");
            }
        } else if ("prescriptionPayRemind".equalsIgnoreCase(titelType)) {
            first = outpatientDO.getPatientName() + ",您好! 医生已为您开具处方,请及时支付。";
            contentMsg = "医生已为您开具处方,请及时支付。";
            remark = "点击完成支付,如您已支付请忽略本条信息";
            msgUrl="/ims-wx/index.html#/returnVisit/prescriptionDetail?outpatientId="+outpatientId;
            logger.info("处方支付微信消息模板推送开始");
        } else if ("msgRemind".equalsIgnoreCase(titelType)) {
            first = outpatientDO.getPatientName() + ",您好!";
            contentMsg = "" + remindMsg;
            remark = "请您尽快回复";
        } else if ("outpatientMsgRemind".equalsIgnoreCase(titelType)) {
            first = doctorDO.getName() + doctorDO.getJobTitleName() + "医生已向您发起视频通话邀请,请点击详情进入视频诊室。";
            if ("16".equals(type)) {
                contentMsg = "您的视频复诊已开始,错过将重新排队";
                remark = "点击消息进入视频诊室接听视频通话,开始视频咨询。";
            } else if ("17".equals(type)) {
                contentMsg = "您的视频咨询已开始,错过将重新排队";
                remark = "点击消息进入视频诊室接听视频通话,开始视频复诊。";
            }
          if (StringUtils.isNotEmpty(outpatientId)){
              if ("16".equals(type)) {
                  first = doctorDO.getName() + doctorDO.getJobTitleName() + "医生已向您发起视频通话邀请,请点击详情进入视频诊室。";
                  contentMsg = "您的视频复诊已开始,错过将重新排队";
                  remark = "点击消息进入视频诊室接听视频通话,开始视频咨询。";
                  msgUrl="/ims-wx/index.html#/returnVisit/preChat?type=16&outpatientId="+outpatientId;
                  logger.info("视频问诊已接诊提醒微信模板消息发送开始");
              }
          }
          if (consultTeam!=null){
              if ("17".equals(type)) {
                  first = consDoctorDO.getName() + consDoctorDO.getJobTitleName() + "医生已向您发起视频通话邀请,请点击详情进入视频诊室。";
                  contentMsg = "您的视频咨询已开始,错过将重新排队";
                  remark = "点击消息进入视频诊室接听视频通话,开始视频复诊。";
                  msgUrl="/ims-wx/index.html#/zx/prechat?consultCode="+consultTeam.getConsult();
                  logger.info("视频咨询已接诊提醒微信模板消息发送开始");
              }
          }
        } else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
            if ("16".equals(type)) {
                first = "您的视频复诊已预约成功。";
                contentMsg = "预计" + outpatientDO.getDoctorName() + "医生将于" + DateUtil.dateToStrLong(outpatientDO.getRegisterDate()) + " 与您进行视频复诊。请留意微信公众号消息。";
                msgUrl="/ims-wx/index.html#/returnVisit/preChat?type=16&outpatientId="+outpatientId;
                logger.info("视频复诊已预约成功微信消息模板推送开始");
            } else if ("17".equals(type)) {
                first = "您的视频咨询已预约成功。";
                contentMsg = "预计" + consDoctorDO.getName() + "医生将于" + DateUtil.dateToStrLong(consultTeam.getCzrq()) + " 与您进行视频咨询。请留意微信公众号消息。";
                msgUrl="/ims-wx/index.html#/zx/prechat?consultCode="+consultTeam.getConsult();
                logger.info("视频咨询已预约成功微信消息模板推送开始");
            }
            remark = "咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
        } else if ("evaluateRemind".equalsIgnoreCase(titelType)) {
            if (consultTeam.getType()!=null&&1==consultTeam.getType()){
                first = consultTeam.getName() + ",您好!您有1条图文咨询已结束,请及时对咨询医生进行评价。";
                logger.info("图文咨询服务评价微信消息模板推送开始");
            }
            if (consultTeam.getType()!=null&&9==consultTeam.getType()){
                first = consultTeam.getName() + ",您好!您有1条图文复诊已结束,请及时对咨询医生进行评价。";
                logger.info("图文复诊服务评价微信消息模板推送开始");
            }
            if (consultTeam.getType()!=null&&16==consultTeam.getType()){
                first = consultTeam.getName() + ",您好!您有1条视频复诊已结束,请及时对咨询医生进行评价。";
                logger.info("视频复诊服务评价微信消息模板推送开始");
            }
            if (consultTeam.getType()!=null&&17==consultTeam.getType()){
                first = consultTeam.getName() + ",您好!您有1条视频咨询已结束,请及时对咨询医生进行评价。";
                logger.info("视频咨询服务评价微信消息模板推送开始");
            }
            contentMsg = "请对" + consDoctorDO.getName() + "医生的服务进行评价";
            msgUrl="/ims-wx/index.html#/fuwupingjia?consultCode="+consultTeam.getConsult();
        }
        if ("xm_ykyy_wx".equalsIgnoreCase(wxId)) {
            List<BasePatientWechatDo> ps = new ArrayList<BasePatientWechatDo>();
            if (StringUtils.isNotEmpty(outpatientId)){
                ps = basePatientWechatDao.findByWechatIdAndPatientId(wxId, outpatientDO.getPatient());
            }
            if (consultTeam!=null){
                ps = basePatientWechatDao.findByWechatIdAndPatientId(wxId, consultTeam.getPatient());
            }
            List<BasePatientWechatDo> ps = basePatientWechatDao.findByWechatIdAndPatientId(wxId, outpatientDO.getPatient());
            if (ps.isEmpty()) {
                logger.info("该用户" + outpatientDO.getPatientName() + "没有openid,无法推送模版消息,用户ID:" + outpatientDO.getPatient() + "wechatId:" + wxId);
                return;
@ -3510,28 +3691,47 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                newConfig.setKeyword1(config.getKeyword1() + outpatientDO.getHospitalName());
                newConfig.setKeyword2(config.getKeyword2() + outpatientDO.getDoctorName());
                newConfig.setKeyword3(config.getKeyword3() + doctorDO.getFee());
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                logger.info("眼科微信消息模板推送 医生拒诊开始");
            } else if ("payRemind".equalsIgnoreCase(titelType)) {
                scene = "zxzfts";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_pay_notice", scene, 1);
                BeanUtils.copyProperties(config, newConfig);
                newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getPatientName()));
                if ("9".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "图文复诊"));
                    newConfig.setKeyword1(config.getKeyword1() + "图文复诊支付");
                } else if ("16".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "视频复诊"));
                    newConfig.setKeyword1(config.getKeyword1() + "视频复诊支付");
                } else if ("1".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "图文咨询"));
                    newConfig.setKeyword1(config.getKeyword1() + "图文咨询支付");
                } else if ("17".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "视频咨询"));
                    newConfig.setKeyword1(config.getKeyword1() + "视频咨询支付");
                //就诊支付
                if (StringUtils.isNotEmpty(outpatientId)){
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_pay_notice_jz", scene, 1);
                    BeanUtils.copyProperties(config, newConfig);
                    newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getPatientName()));
                    if ("9".equals(type)) {
                        newConfig.setFirst(newConfig.getFirst().replace("key2", "图文复诊"));
                        newConfig.setKeyword1(config.getKeyword1() + "图文复诊支付");
                    } else if ("16".equals(type)) {
                        newConfig.setFirst(newConfig.getFirst().replace("key2", "视频复诊"));
                        newConfig.setKeyword1(config.getKeyword1() + "视频复诊支付");
                    }
                    newConfig.setKeyword2(config.getKeyword2() + outpatientDO.getHospitalName());
                    newConfig.setKeyword3(config.getKeyword3() + outpatientDO.getDoctorName());
                    //发起微信消息模板推送
                    newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                    logger.info("眼科微信消息模板推送 就诊支付提醒开始");
                }
                //咨询支付
                if (consultTeam!=null){
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_pay_notice_zx", scene, 1);
                    BeanUtils.copyProperties(config, newConfig);
                    newConfig.setFirst(config.getFirst().replace("key1", consPatientDO.getName()));
                    if ("1".equals(type)) {
                        newConfig.setFirst(newConfig.getFirst().replace("key2", "图文咨询"));
                        newConfig.setKeyword1(config.getKeyword1() + "图文咨询支付");
                    } else if ("17".equals(type)) {
                        newConfig.setFirst(newConfig.getFirst().replace("key2", "视频咨询"));
                        newConfig.setKeyword1(config.getKeyword1() + "视频咨询支付");
                    }
                    newConfig.setKeyword2(config.getKeyword2() + hospitalDO.getOrgName());
                    newConfig.setKeyword3(config.getKeyword3() + consDoctorDO.getName());
                    //发起微信消息模板推送
                    newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult());
                    logger.info("眼科微信消息模板推送 咨询支付提醒开始");
                }
                newConfig.setKeyword2(config.getKeyword2() + outpatientDO.getHospitalName());
                newConfig.setKeyword3(config.getKeyword3() + outpatientDO.getDoctorName());
            } else if ("prescriptionPayRemind".equalsIgnoreCase(titelType)) {
                scene = "cfzfts";
@ -3542,6 +3742,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                newConfig.setKeyword1(config.getKeyword1() + "处方支付");
                newConfig.setKeyword2(config.getKeyword2() + outpatientDO.getHospitalName());
                newConfig.setKeyword3(config.getKeyword3() + outpatientDO.getDoctorName());
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                logger.info("眼科微信消息模板推送 处方支付提醒开始");
            } else if ("msgRemind".equalsIgnoreCase(titelType)) {
                scene = "zxxxtx";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_msg_notice", scene, 1);
@ -3549,52 +3752,110 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getPatientName()));
                newConfig.setKeyword1(config.getKeyword1() + remindMsg);
                newConfig.setKeyword2(config.getKeyword2() + DateUtil.getStringDate());
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
            } else if ("outpatientMsgRemind".equalsIgnoreCase(titelType)) {
                scene = "mzxxtx";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_outpatient_msg_notice", scene, 1);
                BeanUtils.copyProperties(config, newConfig);
                newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getPatientName()));
                newConfig.setFirst(config.getFirst().replace("key2", doctorDO.getJobTitleName()));
                newConfig.setKeyword1(config.getKeyword1() + outpatientDO.getDoctorName());
                newConfig.setKeyword2(config.getKeyword2() + outpatientDO.getAdmDate());
                newConfig.setKeyword3(config.getKeyword3() + outpatientDO.getDeptName());
                newConfig.setKeyword4(config.getKeyword4() + outpatientDO.getIcd10Name());
                if ("16".equals(type)) {
                    newConfig.setRemark(config.getRemark().replaceFirst("key1", "视频复诊"));
                } else if ("17".equals(type)) {
                    newConfig.setRemark(config.getRemark().replaceFirst("key1", "视频咨询"));
                if (StringUtils.isNotEmpty(outpatientId)){
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_outpatient_msg_notice_jz", scene, 1);
                    BeanUtils.copyProperties(config, newConfig);
                    newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getDoctorName()).replace("key2", doctorDO.getJobTitleName()));
                    newConfig.setKeyword1(config.getKeyword1() + outpatientDO.getDoctorName());
                    newConfig.setKeyword2(config.getKeyword2() + outpatientDO.getAdmDate());
                    newConfig.setKeyword3(config.getKeyword3() + outpatientDO.getDeptName());
                    newConfig.setKeyword4(config.getKeyword4() + outpatientDO.getIcd10Name());
                    if ("16".equals(type)) {
                        newConfig.setRemark(config.getRemark().replace("key1", "视频复诊"));
                    } else if ("17".equals(type)) {
                        newConfig.setRemark(config.getRemark().replace("key1", "视频咨询"));
                    }
                    //发起微信消息模板推送
                    newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                    logger.info("眼科微信消息模板推送 视频问诊接诊提醒开始");
                }
                if (consultTeam!=null){
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_outpatient_msg_notice_zx", scene, 1);
                    BeanUtils.copyProperties(config, newConfig);
                    newConfig.setFirst(config.getFirst().replace("key1", consPatientDO.getName()).replace("key2", consDoctorDO.getJobTitleName()));
                    newConfig.setKeyword1(config.getKeyword1() + consDoctorDO.getName());
                    newConfig.setKeyword2(config.getKeyword2() + consultTeam.getCzrq());//咨询暂无挂号时间
                    newConfig.setKeyword3(config.getKeyword3() + hospitalDO.getDeptName());
                    newConfig.setKeyword4(config.getKeyword4() + consultTeam.getSymptoms());
                    if ("16".equals(type)) {
                        newConfig.setRemark(config.getRemark().replace("key1", "视频复诊"));
                    } else if ("17".equals(type)) {
                        newConfig.setRemark(config.getRemark().replace("key1", "视频咨询"));
                    }
                    //发起微信消息模板推送
                    newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult());
                    logger.info("眼科微信消息模板推送 视频咨询接诊提醒开始");
                }
            } else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
                scene = "spwzyytx";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_video_notice", scene, 1);
                BeanUtils.copyProperties(config, newConfig);
                if ("16".equals(type)) {
                    newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频复诊"));
                } else if ("17".equals(type)) {
                    newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频咨询"));
                if (StringUtils.isNotEmpty(outpatientId)){
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_video_notice_fz", scene, 1);
                    BeanUtils.copyProperties(config, newConfig);
                    if ("16".equals(type)) {
                        newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频复诊"));
                    }
                    newConfig.setKeyword1(config.getKeyword1() + outpatientDO.getPatientName());
                    newConfig.setKeyword2(config.getKeyword2() + outpatientDO.getDeptName());
                    newConfig.setKeyword3(config.getKeyword3() + outpatientDO.getDoctorName());
                    newConfig.setKeyword4(config.getKeyword4() + outpatientDO.getRegisterDate());
                    newConfig.setKeyword5(config.getKeyword5() + generalDoctorWaitingNumber(doctorDO.getId(), wxId, outpatientId));
                    //发起微信消息模板推送
                    newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                    logger.info("眼科微信消息模板推送 视频问诊预约提醒开始");
                }
                newConfig.setKeyword1(config.getKeyword1() + outpatientDO.getPatientName());
                newConfig.setKeyword2(config.getKeyword2() + outpatientDO.getDeptName());
                newConfig.setKeyword3(config.getKeyword3() + outpatientDO.getDoctorName());
                newConfig.setKeyword4(config.getKeyword4() + outpatientDO.getRegisterDate());
                newConfig.setKeyword5(config.getKeyword5() + generalDoctorWaitingNumber(doctorDO.getId(), wxId, outpatientId));
                if (consultTeam!=null){
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_video_notice_zx", scene, 1);
                    BeanUtils.copyProperties(config, newConfig);
                    if ("17".equals(type)) {
                        newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频咨询"));
                    }
                    newConfig.setKeyword1(config.getKeyword1() + consPatientDO.getName());
                    newConfig.setKeyword2(config.getKeyword2() + hospitalDO.getDeptName());
                    newConfig.setKeyword3(config.getKeyword3() + consDoctorDO.getName());
                    newConfig.setKeyword4(config.getKeyword4() + consultTeam.getCzrq());
                    newConfig.setKeyword5(config.getKeyword5() + generalDoctorWaitingNumber(consDoctorDO.getId(), wxId, outpatientId));
                    //发起微信消息模板推送
                    newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                    logger.info("眼科微信消息模板推送 视频咨询预约提醒开始");
                }
            } else if ("evaluateRemind".equalsIgnoreCase(titelType)) {
                scene = "fwqjtx";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_evaluate_notice", scene, 1);
                BeanUtils.copyProperties(config, newConfig);
                newConfig.setFirst(config.getFirst().replaceFirst("key1", outpatientDO.getPatientName()));
                newConfig.setKeyword1(config.getKeyword1() + outpatientDO.getHospitalName());
                newConfig.setKeyword2(config.getKeyword2() + outpatientDO.getDoctorName());
                newConfig.setFirst(config.getFirst().replaceFirst("key1", consPatientDO.getName()));
                newConfig.setKeyword2(config.getKeyword2() + hospitalDO.getOrgName());
                newConfig.setKeyword3(config.getKeyword3() + consDoctorDO.getName());
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult());
                logger.info("眼科微信消息模板推送 服务评价提醒开始");
            }
            //发起微信消息模板推送
            newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
            logger.info("=======setUrl========" + newConfig.getUrl());
            WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
            for (BasePatientWechatDo one : ps) {
                weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), one.getOpenid(), newConfig);
                logger.info("发送的消息="+ com.alibaba.fastjson.JSONObject.toJSONString(newConfig));
                try {
                    logger.info("调用眼科微信模板消息接口的入参:AccessToken="+wxAccessTokenDO.getAccessToken()+"---Openid="+one.getOpenid());
                    weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), one.getOpenid(), newConfig);
                    logger.info("发送成功");
                } catch (Exception e) {
                    e.printStackTrace();
                    logger.info("发送失败,error="+e.getMessage());
                }
                //保存发送模板记录,
                WxPushLogDO wxPushLogDO = new WxPushLogDO();
                wxPushLogDO.setCreateTime(new Date());
@ -3608,28 +3869,66 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        } else if ("xm_xzzx_wx".equalsIgnoreCase(wxId)) {
            String MsgUrl = "https://www.xmheart.com/ims-wx/index.html#/returnVisit/record?outpatientId=" + outpatientDO.getPatient();
            String responseMsg = xzzxEntranceService.sendXCXMes(wxId,
                    patientDO.getId(),
                    patientDO.getIdcard(),
                    first,
                    contentMsg,
                    remark,
                    MsgUrl,
                    "wx53f6bb4ac081d840");
            String responseMsg="";
            String prefix="https://www.xmheart.com";
            if(StringUtils.isNotEmpty(outpatientId)){
                responseMsg = xzzxEntranceService.sendXCXMes(wxId,
                        patientDO.getId(),
                        patientDO.getIdcard(),
                        first,
                        contentMsg,
                        remark,
                        prefix+msgUrl,
                        "wx53f6bb4ac081d840");
            }
            if (consultTeam!=null&&consPatientDO!=null){
                responseMsg = xzzxEntranceService.sendXCXMes(wxId,
                        consPatientDO.getId(),
                        consPatientDO.getIdcard(),
                        first,
                        contentMsg,
                        remark,
                        prefix+msgUrl,
                        "wx53f6bb4ac081d840");
            }
            logger.info("url="+prefix+msgUrl);
            String msg="first:"+first+"contentMsg:"+contentMsg+"remark:"+remark;
            logger.info("发送的信息="+msg);
            logger.info("XZZX_Msg_" + titelType + "=" + responseMsg);
        } else if ("xm_zsyy_wx".equalsIgnoreCase(wxId)) {
            String MsgUrl = "https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/record?outpatientId=" + outpatientDO.getPatient();
            String responseMsg = entranceService.ehospitalNotice(patientDO.getName(),
                    patientDO.getIdcard(),
                    patientDO.getMobile(),
                    first,
                    MsgUrl,
                    contentMsg,
                    remark
            );
            if ("prescriptionPayRemind".equalsIgnoreCase(titelType)){
                return;
            }
            String responseMsg="";
            String prefix="https://hlwyy.xmzsh.com";
            if(StringUtils.isNotEmpty(outpatientId)){
                responseMsg = entranceService.ehospitalNotice(
                        patientDO.getName(),
                        patientDO.getIdcard(),
                        patientDO.getMobile(),
                        first,
                        prefix+msgUrl,
                        contentMsg,
                        remark
                );
            }
            if (consultTeam!=null&&consPatientDO!=null){
                responseMsg = entranceService.ehospitalNotice(
                        consPatientDO.getName(),
                        consPatientDO.getIdcard(),
                        consPatientDO.getMobile(),
                        first,
                        prefix+msgUrl,
                        contentMsg,
                        remark
                );
            }
            logger.info("url="+prefix+msgUrl);
            String msg="first:"+first+"-----contentMsg:"+contentMsg+"-----remark:"+remark;
            logger.info("发送的信息="+msg);
            logger.info("ZSYY_Msg" + titelType + "=" + responseMsg);
        }
    }
@ -3724,7 +4023,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "patient.birthday AS \"birthday\"," +
                "room.consult_type AS \"consult_type\",";
        if ("xm_ykyy_wx".equals(wechatId)) {
            sql += "to_char(room.reservation_time ,'yyyy-MM-dd hh24:mi:ss' ) AS \"timedate_format\",";
            if(flag){
                sql += "date_format(room.reservation_time ,'yyyy-MM-dd hh24:mi:ss' ) AS \"timedate_format\",";
            }else {
                sql += "to_char(room.reservation_time ,'yyyy-MM-dd hh24:mi:ss' ) AS \"timedate_format\",";
            }
        } else {
            sql += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS timedate_format,";
        }
@ -3767,7 +4071,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            sql += " AND outpatient.dept='" + dept + "' ";
        }
        logger.info("接口名称:findWaitingRoomOutpatientByDoctor-->sql="+sql);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        if (list != null && list.size() > 0) {
            //根据身份证计算年龄
@ -3812,8 +4116,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String totalSql = "SELECT count(id) AS \"total\" FROM wlyy_hospital_waiting_room WHERE visit_status=1 ";
        if ("xm_ykyy_wx".equals(wxId)) {
            totalSql += " and reservation_time >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
            totalSql += " and reservation_time <= to_date('" + DateUtil.dateToStrShort(new Date()) + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
            if (flag){
                totalSql += " and reservation_time >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                totalSql += " and reservation_time <= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
            } else {
                totalSql += " and reservation_time >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                totalSql += " and reservation_time <= to_date('" + DateUtil.dateToStrShort(new Date()) + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
            }
        } else {
            totalSql += " AND reservation_time >='" + DateUtil.dateToStrShort(new Date()) + " 00:00:00'";
            totalSql += " AND reservation_time <='" + DateUtil.dateToStrShort(new Date()) + " 23:59:59'";
@ -3884,8 +4194,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        if ("xm_ykyy_wx".equals(wxId)) {
            waitingSql += " AND room.reservation_time >= to_date('" + date + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
            waitingSql += " AND room.reservation_time <= to_date('" + date + " 23:59:59','YYYY-MM-DD HH24:MI:SS') GROUP BY room.doctor,room.doctor_name";
            if (flag){
                waitingSql += " AND room.reservation_time >= str_to_date('" + date + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                waitingSql += " AND room.reservation_time <= str_to_date('" + date + " 23:59:59','YYYY-MM-DD HH24:MI:SS') GROUP BY room.doctor,room.doctor_name";
            }else {
                waitingSql += " AND room.reservation_time >= to_date('" + date + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                waitingSql += " AND room.reservation_time <= to_date('" + date + " 23:59:59','YYYY-MM-DD HH24:MI:SS') GROUP BY room.doctor,room.doctor_name";
            }
        } else {
            waitingSql = waitingSql + "AND room.reservation_time>='" + date + " 00:00:00' AND room.reservation_time<='" + date + " 23:59:59' GROUP BY room.doctor,room.doctor_name; ";
        }
@ -3928,7 +4244,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "patient.birthday AS \"birthday\"," +
                "room.consult_type AS \"consult_type\",";
        if ("xm_ykyy_wx".equals(wxId)) {
            onlineSql = onlineSql + "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",ceil((sysdate-to_date(to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss'),'YYYY-MM-DD hh24:mi:ss'))* 24 * 60) AS \"time_cost\",";
            if(flag){
                onlineSql = onlineSql + "date_format(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",ceil((sysdate-to_date(date_format(room.reservation_time,'YYYY-MM-DD hh24:mi:ss'),'YYYY-MM-DD hh24:mi:ss'))* 24 * 60) AS \"time_cost\",";
            }else {
                onlineSql = onlineSql + "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",ceil((sysdate-to_date(to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss'),'YYYY-MM-DD hh24:mi:ss'))* 24 * 60) AS \"time_cost\",";
            }
        } else {
            onlineSql = onlineSql + "date_format(room.reservation_time,'%Y-%m-%d %H:%i:%S' )  AS \"time\",TIMESTAMPDIFF(MINUTE, room.reservation_time,NOW()) AS \"time_cost\",";
        }
@ -3953,8 +4274,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        onlineSql = onlineSql+ "AND room.reservation_time>='"+date+" 00:00:00' AND room.reservation_time<='"+date+" 23:59:59' GROUP BY room.doctor";
*/
        if ("xm_ykyy_wx".equalsIgnoreCase(wxId)) {
            onlineSql += " AND room.reservation_time >= to_date('" + date + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
            onlineSql += " AND room.reservation_time <= to_date('" + date + " 23:59:59','YYYY-MM-DD HH24:MI:SS') ";
            if (flag){
                onlineSql += " AND room.reservation_time >= str_to_date('" + date + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                onlineSql += " AND room.reservation_time <= str_to_date('" + date + " 23:59:59','YYYY-MM-DD HH24:MI:SS') ";
            }else {
                onlineSql += " AND room.reservation_time >= to_date('" + date + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                onlineSql += " AND room.reservation_time <= to_date('" + date + " 23:59:59','YYYY-MM-DD HH24:MI:SS') ";
            }
        } else {
            onlineSql = onlineSql + "AND room.reservation_time>='" + date + " 00:00:00' AND room.reservation_time<='" + date + " 23:59:59' ";
        }
@ -4175,7 +4502,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            params.put("endTime", date);
        }
        if (StringUtils.isNotBlank(orgCode)) {
            sql += " AND  h.org_code = :orgCode";
            sql += " AND  h.org_code =:orgCode";
            params.put("orgCode", orgCode);
        }
        if (StringUtils.isNotBlank(diseaseKey)) {
@ -4189,7 +4516,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        if (StringUtils.isNotBlank(dept)) {
            sql += " AND h.dept_code = :dept ";
            sql += " AND h.dept_code =:dept ";
            params.put("dept", dept);
        }
@ -4552,7 +4879,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                if (one.getEndTime().before(workTimeDO.getStartTime()) || one.getStartTime().after(workTimeDO.getEndTime())) {
                } else {
                    throw new Exception("您选择的时间与“开始时间-结束时间”的医院排班/自己排班冲突,请重新选择!");
                    throw new Exception("您选择的时间与“开始时间:"+DateUtil.dateToStrLong(one.getStartTime())+"-结束时间:"+DateUtil.dateToStrLong(one.getEndTime())+"”的医院排班/自己排班冲突,请重新选择!");
                }
            }
@ -4753,7 +5080,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public List<Map<String, Object>> getVideoPrescriptionByDoctor(String doctor, String general_doctor, String wxId) {
        String condition = "";
        if ("xm_ykyy_wx".equals(wxId)) {
            condition += "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
            if (flag){
                condition += "date_format(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
            }else {
                condition += "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
            }
        } else {
            condition += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS \"time\",";
        }
@ -4819,8 +5151,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public String generalDoctorWaitingNumber(String doctor, String wxId, String outpatientId) {
        String condition = "";
        if ("xm_ykyy_wx".equals(wxId)) {
            condition += "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
            condition += "to_char(room.reservation_time,'YYYY-MM-DD')  AS \"group_date\",";
            if (flag){
                condition += "date_format(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
                condition += "date_format(room.reservation_time,'YYYY-MM-DD')  AS \"group_date\",";
            }else {
                condition += "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
                condition += "to_char(room.reservation_time,'YYYY-MM-DD')  AS \"group_date\",";
            }
        } else {
            condition += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS \"time\",";
            condition += "date_format(room.reservation_time ,'%Y-%m-%d' ) AS \"group_date\",";
@ -4857,7 +5195,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
//                "AND room.reservation_time>='"+DateUtil.getStringDate("yyyy-MM-dd")+" 00:00:00"+"' ";*/
        if ("xm_ykyy_wx".equals(wxId)) {
            sql += " AND room.reservation_time >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
            if(flag){
                sql += " AND room.reservation_time >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
            }else {
                sql += " AND room.reservation_time >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
            }
        } else {
            sql += " AND room.reservation_time >= '" + DateUtil.dateToStrShort(new Date()) + " 00:00:00' ";
        }
@ -4877,8 +5220,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public com.alibaba.fastjson.JSONArray getWaitingForVisitVideoPrescriptionByDoctor(String doctor, String wxId) {
        String condition = "";
        if ("xm_ykyy_wx".equals(wxId)) {
            condition += "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
            condition += "to_char(room.reservation_time,'YYYY-MM-DD')  AS \"group_date\",";
            if(flag){
                condition += "date_format(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
                condition += "date_format(room.reservation_time,'YYYY-MM-DD')  AS \"group_date\",";
            }else{
                condition += "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
                condition += "to_char(room.reservation_time,'YYYY-MM-DD')  AS \"group_date\",";
            }
        } else {
            condition += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS \"time\",";
            condition += "date_format(room.reservation_time ,'%Y-%m-%d' ) AS \"group_date\",";
@ -4915,7 +5264,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
//                "AND room.reservation_time>='"+DateUtil.getStringDate("yyyy-MM-dd")+" 00:00:00"+"' ";*/
        if ("xm_ykyy_wx".equals(wxId)) {
            sql += " AND room.reservation_time >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
            if(flag){
                sql += " AND room.reservation_time >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
            }else {
                sql += " AND room.reservation_time >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
            }
        } else {
            sql += " AND room.reservation_time >= '" + DateUtil.dateToStrShort(new Date()) + " 00:00:00' ";
        }
@ -5104,14 +5458,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    System.out.println("获取顺丰物流面单信息:6");
                }
                wlyyPrescriptionDOS.setStatus(32);
                prescriptionDao.save(wlyyPrescriptionDOS);
                if (sfexpress_obj != null && StringUtils.isNoneBlank(sfexpress_obj.getMailno())) {
                    com.alibaba.fastjson.JSONObject object = sfexpressService.postSFOrderQueryService(sfexpress_obj);
                    System.out.println("获取顺丰物流面单信息7-1"+object.toJSONString());
                    System.out.println("获取顺丰物流面单信息:7");
                    com.alibaba.fastjson.JSONObject sfJsonObject = new com.alibaba.fastjson.JSONObject();
                    sfJsonObject.put("mailno", sfexpress_obj.getMailno());
                    sfJsonObject.put("mailtype", "标准快递");
                    sfJsonObject.put("destcode", "592");
                    sfJsonObject.put("destcode", object.getString("destRouteLabel"));
                    if (wxId.equalsIgnoreCase("xm_zsyy_wx")) {
                        sfJsonObject.put("j_name", "厦门大学附属中山医院");
                        sfJsonObject.put("j_phone", "4003008888");
@ -5140,11 +5498,121 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    System.out.println("获取顺丰物流面单信息:8");
                }
            }
        }
        System.out.println("获取顺丰物流面单信息:9");
        return result;
    }
    /**
     * 根据门诊唯一号,处方号,到顺丰下单,下单成功返回面单信息--心脏和眼科
     *
     * @param admNo     门诊唯一号
     * @param realOrder 处方号
     * @return
     */
    public Object getSFExpressInfoNew(String admNo, String realOrder, String wxId) throws Exception {
        //根据门诊唯一号取就诊记录
//        List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByAdmNo(admNo);
        if (StringUtils.isNoneBlank(realOrder)){
            String str[] = realOrder.split(";");
            Object result = "";
            for (int i=0;i<str.length;i++){
                WlyyPrescriptionDO wlyyPrescriptionDOS = prescriptionDao.findByAdmNoAndRealOrder(admNo,str[i]);
                System.out.println("获取顺丰物流面单信息:wlyyPrescriptionDOS != null=" + wlyyPrescriptionDOS != null);
                if (wlyyPrescriptionDOS != null) {
                    List<WlyyPrescriptionExpressageDO> expressageDOList = sfexpressService.findByField("outpatientId", wlyyPrescriptionDOS.getOutpatientId());
                    WlyyPrescriptionExpressageDO sfexpress_obj = null;
                    System.out.println("获取顺丰物流面单信息:CollectionUtils.isEmpty(expressageDOList)=" + CollectionUtils.isEmpty(expressageDOList));
                    if (CollectionUtils.isEmpty(expressageDOList)) {
                        throw new Exception("顺丰快递下单失败,未找到该处方的派送地址!");
                    } else {
                        System.out.println("获取顺丰物流面单信息:1");
                        sfexpress_obj = expressageDOList.get(0);
                        System.out.println("获取顺丰物流面单信息:2");
                        BasePatientDO basePatientDO = basePatientDao.findById(wlyyPrescriptionDOS.getPatientCode());
                        //如果该处方的快递单号已生成,则说明已经下单成功,不需要重复下单,直接返回面单信息
                        System.out.println("获取顺丰物流面单信息:3");
                        if (org.apache.commons.lang.StringUtils.isNotBlank(sfexpress_obj.getMailno())) {
                            //处方已下单成功
                            System.out.println("获取顺丰物流面单信息:4");
                        } else {
                            //如果该处方的快递单号未生成,则继续下单
                            //根据业务订单号判断是否已经下单成功
                            //--2020.05.20--顺丰V2.0接口已不提供查询接口,直接单下单--START
//                    boolean go_on = sfexpressService.sfOrderSearchService(sfexpress_obj);
//
//                    //如果该业务订单号未下单成功过,则重新下单
//                    if(go_on){
//                        //请求顺丰接口下单,成功下单后,返回快递单号
//                        sfexpress_obj = sfexpressService.postSFOrderService(sfexpress_obj);
//                        //保存快递单号和增加处方物流记录为配送
//                        sfexpressService.updatePrescriptionExpressage(sfexpress_obj);
//                    }
                            //--2020.05.20--顺丰V2.0接口已不提供查询接口,直接单下单--END
                            //请求顺丰接口下单,成功下单后,返回快递单号
                            sfexpress_obj = sfexpressService.postSFOrderService(sfexpress_obj);
                            System.out.println("获取顺丰物流面单信息:5");
                            //保存快递单号和增加处方物流记录为配送
                            sfexpressService.updatePrescriptionExpressage(sfexpress_obj);
                            System.out.println("获取顺丰物流面单信息:6");
                        }
                        wlyyPrescriptionDOS.setStatus(32);
                        prescriptionDao.save(wlyyPrescriptionDOS);
                        if (sfexpress_obj != null && StringUtils.isNoneBlank(sfexpress_obj.getMailno())) {
                            com.alibaba.fastjson.JSONObject object = sfexpressService.postSFOrderQueryService(sfexpress_obj);
                            System.out.println("获取顺丰物流面单信息7-1"+object.toJSONString());
                            System.out.println("获取顺丰物流面单信息:7");
                   /* com.alibaba.fastjson.JSONObject sfJsonObject = new com.alibaba.fastjson.JSONObject();*/
                    /*sfJsonObject.put("mailno", sfexpress_obj.getMailno());
                    sfJsonObject.put("mailtype", "标准快递");
                    sfJsonObject.put("destcode", object.getString("destRouteLabel"));
                    if (wxId.equalsIgnoreCase("xm_zsyy_wx")) {
                        sfJsonObject.put("j_name", "厦门大学附属中山医院");
                        sfJsonObject.put("j_phone", "4003008888");
                        sfJsonObject.put("j_townName", "思明区");
                        sfJsonObject.put("j_address", "湖滨南路201-209号");
                    } else if (wxId.equalsIgnoreCase("xm_ykyy_wx")) {
                        sfJsonObject.put("j_name", "厦门大学附属中山医院");
                        sfJsonObject.put("j_phone", "4003008888");
                        sfJsonObject.put("j_townName", "思明区");
                        sfJsonObject.put("j_address", "湖滨南路201-209号");
                    }
                    sfJsonObject.put("j_provinceName", "福建省");
                    sfJsonObject.put("j_cityName", "厦门市");
                    sfJsonObject.put("d_name", sfexpress_obj.getName());
                    sfJsonObject.put("d_provinceName", sfexpress_obj.getProvinceName());
                    sfJsonObject.put("d_cityName", sfexpress_obj.getCityName());
                    sfJsonObject.put("d_townName", sfexpress_obj.getTownName());
                    sfJsonObject.put("d_address", sfexpress_obj.getAddress());
                    sfJsonObject.put("d_phone", sfexpress_obj.getMobile());
                    sfJsonObject.put("express_type", 11);
                    sfJsonObject.put("pay_method", 2);
                    sfJsonObject.put("receive_time", "");
                    sfJsonObject.put("dispensaryType", 2);*/
                            result = object;
                            System.out.println("获取顺丰物流面单信息:8");
                        }
                    }
                }
                System.out.println("获取顺丰物流面单信息:9");
            }
            return result;
        }else {
            return "处方号未空!";
        }
    }
    /**
     * 根据类型获取候诊居民数量
     *
@ -5161,7 +5629,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "base_patient patient " +
                "WHERE " +
                "outpatient.patient=patient.id " +
                "AND outpatient.status in (0,1) " +
                "AND outpatient.status in (0,1,2) " +
                "AND outpatient.doctor='" + doctor + "' " +
                "AND outpatient.pay_status = 1 " +
                "AND outpatient.outpatient_type= '" + outpatient_type + "'  ";
@ -5169,7 +5637,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            sql = sql + " AND outpatient.type= '" + type + "' ";
            if ("2".equals(type)) {//视频复诊才需要判断时间,
                if ("xm_ykyy_wx".equals(wxId)) {
                    sql += " AND outpatient.register_date is not null and outpatient.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                    if (flag){
                        sql += " AND outpatient.register_date is not null and outpatient.register_date >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                    }else {
                        sql += " AND outpatient.register_date is not null and outpatient.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                    }
                } else {
                    sql = sql + " AND outpatient.register_date is not null AND  outpatient.register_date >= '" + DateUtil.dateToStrShort(new Date()) + " 00:00:00' ";
                }
@ -5177,11 +5649,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        } else if ("2".equals(outpatient_type)) {
            //协同门诊也需要判断时间
            if ("xm_ykyy_wx".equals(wxId)) {
                sql += " AND outpatient.register_date is not null and outpatient.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                if (flag){
                    sql += " AND outpatient.register_date is not null and outpatient.register_date >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                }else {
                    sql += " AND outpatient.register_date is not null and outpatient.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                }
            } else {
                sql = sql + " AND outpatient.register_date is not null AND  outpatient.register_date >= '" + DateUtil.dateToStrShort(new Date()) + " 00:00:00' ";
            }
        }
        logger.info("接口名称:doctorReviewConsultCount-->sql="+sql);
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
        Long waitVideoCount = 0l;
@ -5252,6 +5730,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        outpatientDO.setIdcard(patientDO.getIdcard());
        outpatientDO.setOutpatientType("2");
        outpatientDO.setCreateTime(new Date());
        outpatientDO.setPayStatus(1);
        if (outpatientDO.getRegisterDate() == null) {
            outpatientDO.setRegisterDate(new Date());
@ -5386,10 +5865,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (consultTeamDo!=null){
            BaseDoctorDO doctorDO = baseDoctorDao.findById(consultTeamDo.getDoctor());
            BasePatientDO patientDO = basePatientDao.findById(consultTeamDo.getPatient());
            if (consultTeamDo.getType().equals("17")){
            if (consultTeamDo.getType()==17){
                type = "17";
                msg = patientDO.getName() + ",您好!您有一个视频咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
            }else if (consultTeamDo.getType().equals("1")){
            }else if (consultTeamDo.getType()==1){
                type = "1";
                msg = patientDO.getName() + ",您好!您有一个图文咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
            }
@ -5475,6 +5954,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                room.setDeptName(outpatientDO.getDeptName());
                room.setDoctor(outpatientDO.getDoctor());
                room.setDoctorName(outpatientDO.getDoctorName());
                room.setConsultType(Integer.parseInt(outpatientDO.getType()));
                room.setChargeType(chargeType);
            }
            hospitalWaitingRoomDao.save(roomDOs);
@ -5597,7 +6077,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (StringUtils.isNotBlank(startDate)) {
            if ("xm_ykyy_wx".equals(wxId)) {
                sqlTotal += " and o.register_date >= to_date('" + startDate + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                if (flag){
                    sqlTotal += " and o.register_date >= str_to_date('" + startDate + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                }else {
                    sqlTotal += " and o.register_date >= to_date('" + startDate + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                }
            } else {
                sqlTotal += " AND o.register_date >='" + startDate + " 00:00:00' ";
            }
@ -5605,7 +6090,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        if (StringUtils.isNotBlank(endDate)) {
            if ("xm_ykyy_wx".equals(wxId)) {
                sqlTotal += " and o.register_date <= to_date('" + endDate + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
                if (flag){
                    sqlTotal += " and o.register_date <= str_to_date('" + endDate + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
                }else {
                    sqlTotal += " and o.register_date <= to_date('" + endDate + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
                }
            } else {
                sqlTotal += " AND o.register_date <='" + endDate + " 23:59:59' ";
            }
@ -5664,14 +6154,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " o.general_doctor = '" + generalDoctor + "'";
        if (StringUtils.isNotBlank(startDate)) {
            if ("xm_ykyy_wx".equals(wxId)) {
                sql += " and o.register_date >= to_date('" + startDate + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                if (flag){
                    sql += " and o.register_date >= str_to_date('" + startDate + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                }else {
                    sql += " and o.register_date >= to_date('" + startDate + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                }
            } else {
                sql += " AND o.register_date >='" + startDate + " 00:00:00' ";
            }
        }
        if (StringUtils.isNotBlank(endDate)) {
            if ("xm_ykyy_wx".equals(wxId)) {
                sql += " and o.register_date <= to_date('" + endDate + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
                if (flag){
                    sql += " and o.register_date <= str_to_date('" + endDate + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
                }else {
                    sql += " and o.register_date <= to_date('" + endDate + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
                }
            } else {
                sql += " AND o.register_date <='" + endDate + " 23:59:59' ";
            }
@ -5785,7 +6285,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "wlyy_outpatient outpatient " +
                "WHERE " +
                " room.outpatient_id=outpatient.id " +
                "AND outpatient.status = 0 AND room.doctor IS NULL AND outpatient.dept='" + dept + "' ";
                "AND outpatient.status = 0 AND room.doctor IS NULL AND outpatient.pay_status=1 AND outpatient.dept='" + dept + "' ";
        List<Map<String, Object>> alltotal = jdbcTemplate.queryForList(sqlAll);
@ -5804,7 +6304,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "wlyy_outpatient outpatient " +
                "WHERE " +
                " room.outpatient_id=outpatient.id " +
                "AND outpatient.status = 0 AND room.doctor IS NULL AND room.reservation_type=1 AND room.consult_type=1 AND outpatient.dept='" + dept + "' ";
                "AND outpatient.status = 0 AND room.doctor IS NULL AND outpatient.pay_status=1 AND room.reservation_type=1 AND room.consult_type=1 AND outpatient.dept='" + dept + "' ";
        List<Map<String, Object>> imgtotal = jdbcTemplate.queryForList(imgAll);
@ -5823,7 +6323,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "wlyy_outpatient outpatient " +
                "WHERE " +
                " room.outpatient_id=outpatient.id " +
                "AND outpatient.status = 0 AND room.doctor IS NULL AND room.reservation_type=1 AND room.consult_type=2 AND outpatient.dept='" + dept + "' ";
                "AND outpatient.status = 0 AND room.doctor IS NULL AND outpatient.pay_status=1 AND room.reservation_type=1 AND room.consult_type=2 AND outpatient.dept='" + dept + "' ";
        List<Map<String, Object>> sptotal = jdbcTemplate.queryForList(spsql);
@ -5843,7 +6343,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "wlyy_outpatient outpatient " +
                "WHERE " +
                " room.outpatient_id=outpatient.id " +
                "AND outpatient.status = 0 AND room.doctor IS NULL AND room.reservation_type=2 AND outpatient.dept='" + dept + "' ";
                "AND outpatient.status = 0 AND room.doctor IS NULL AND outpatient.pay_status=1 AND room.reservation_type=2 AND outpatient.dept='" + dept + "' ";
        List<Map<String, Object>> xttotal = jdbcTemplate.queryForList(xtsql);
@ -5904,7 +6404,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String condition = "";
        if ("xm_ykyy_wx".equals(wxId)) {
            condition = "to_char(p.register_date,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
            if (flag){
                condition = "date_format(p.register_date,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
            }else {
                condition = "to_char(p.register_date,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
            }
        } else {
            condition = "date_format(p.register_date,'%Y-%m-%d %H:%i:%S' )  AS \"time\",";
        }
@ -5912,9 +6417,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String sql = "SELECT " + condition + "d.NAME as \"doctorName\",d.job_title_name as \"job_title_name\",d.photo AS \"photo\",p.id as \"outpatientid\" FROM wlyy_outpatient p,base_doctor d " +
                "WHERE p.patient='" + patient + "' AND p.doctor=d.id AND p.status=0 ";
        if ("xm_ykyy_wx".equals(wxId)) {
            if (flag){
                sql += " AND p.register_date >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                sql += " AND p.register_date <= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
            }else {
                sql += " AND p.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                sql += " AND p.register_date <= to_date('" + DateUtil.dateToStrShort(new Date()) + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
            }
            sql += " AND p.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
            sql += " AND p.register_date <= to_date('" + DateUtil.dateToStrShort(new Date()) + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
        } else {
            sql += " BETWEEN '" + DateUtil.dateToStrShort(new Date()) + " 00:00:00' AND '" + DateUtil.dateToStrShort(new Date()) + " 23:59:59' ";
        }
@ -6238,7 +6748,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "\tp.idcard as \"idcard\",\n" +
                "\tp.ssc as \"ssc\",\n";
        if ("xm_ykyy_wx".equals(wxId)) {
            sql = sql + "to_char(p.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
            if (flag){
                sql = sql + "date_format(p.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
            }else {
                sql = sql + "to_char(p.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
            }
        } else {
            sql = sql + "date_format(p.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"createTime\",";
        }
@ -6312,6 +6827,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            count = hibenateUtils.objTransformLong(total.get(0).get("total"));
        }
        Map<String, Object> map = new HashedMap();
       /* for (Map<String,Object> map1:mapList){
            String outpatientId = null;
            List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(map1.get("doctor").toString());
            if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
                BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
            }
        }*/
        map.put("count", count);
        map.put("list", mapList);
        maps.add(map);
@ -6632,6 +7155,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public WlyyPrescriptionVO selectByPrescriptionId(String prescriptionId) throws Exception {
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
        if (wlyyPrescriptionDO != null) {
            List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(wlyyPrescriptionDO.getDoctor());
            String deptName = null;
            String hospitalName =null;
            String sex = null;
            String age = null;
            String cardNo = null;
            if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
                BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
                deptName = doctorHospitalDO.getDeptName();
                hospitalName = doctorHospitalDO.getOrgName();
            }
            BasePatientDO patientDO = basePatientDao.findById(wlyyPrescriptionDO.getPatientCode());
            if (patientDO!=null){
                sex = patientDO.getSex()+"";
                age = DateUtil.getAgeForIdcard(patientDO.getIdcard())+"";
            }
            WlyyOutpatientDO outpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
            if (outpatientDO!=null){
                cardNo = outpatientDO.getCardNo();
            }
            com.alibaba.fastjson.JSONObject objectString = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(wlyyPrescriptionDO);
            WlyyPrescriptionVO prescriptionVO = com.alibaba.fastjson.JSONObject.toJavaObject(objectString, WlyyPrescriptionVO.class);
            List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId, 1);
@ -6662,8 +7205,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                inspectionVOList.add(inspectionVO);
            }
            prescriptionVO.setInspectionVOs(inspectionVOList);
            prescriptionVO.setAge(StringUtils.isNoneBlank(wlyyPrescriptionDO.getIdcard()) ? IdCardUtil.getAgeForIdcard(wlyyPrescriptionDO.getIdcard()) + "" : null);
            prescriptionVO.setSex(StringUtils.isNoneBlank(wlyyPrescriptionDO.getIdcard()) ? IdCardUtil.getSexForIdcard_new(wlyyPrescriptionDO.getIdcard()) : null);
            prescriptionVO.setAge(age);
            prescriptionVO.setSex(sex);
            prescriptionVO.setDeptName(deptName);
            prescriptionVO.setHospitalName(hospitalName);
            prescriptionVO.setCardNo(cardNo);
            return prescriptionVO;
        }
        return null;
@ -7137,20 +7683,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "\t) \n" +
                    "WHERE\n" +
                    "\tROWNUM >= " + (page - 1) * size;
            logger.info("oracleSql=" + oracleSql);
            list = jdbcTemplate.query(oracleSql, new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
            if (flag){
                sql.append("  limit ").append((page - 1) * size).append(",").append(size);
                logger.info("MySql=" + sql.toString());
                list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
            }else {
                logger.info("oracleSql=" + oracleSql);
                list = jdbcTemplate.query(oracleSql, new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
            }
        } else {
//            sql+=" LIMIT  " + (page - 1) * size + "," + size + "";
            sql.append("  limit ").append((page - 1) * size).append(",").append(size);
            logger.info("MySql=" + sql.toString());
            list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
        }
//        List<WlyyPrescriptionVO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
        logger.info("countSql=" + countSql.toString());
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(countSql.toString());
        long count = Long.parseLong(mapList.get(0).get("count").toString());
        logger.info("sql=" + sql.toString());
        logger.info("countSql=" + countSql.toString());
        return PageEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, list, page, size, count);
    }
@ -7263,12 +7815,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        } else {
            deptDescDOList = dictDeptDescDao.findByOrgCode(orgCode, keyName);
        }
        deptDescDOList.forEach(one -> {
            one.setDeptDescription(null);
        List<DictDeptDescDO> res = new ArrayList<>();
        deptDescDOList.forEach(one->{
            DictDeptDescDO descDO = new DictDeptDescDO();
            BeanUtils.copyProperties(one,descDO);
            descDO.setDeptDescription(null);
            res.add(descDO);
        });
        if (deptDescDOList == null || deptDescDOList.size() == 0) {
            return MixEnvelop.getError("无科室信息");
        }
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find, deptDescDOList);
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find, res);
    }
}

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

@ -4,41 +4,29 @@ package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionExpressageDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionExpressageDao;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.prescription.service.useragent.BaseUserAgent;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.mysql.query.BaseJpaService;
@ -48,11 +36,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.lang.Boolean;
import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2019/5/17.
@ -96,6 +85,12 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    @Value("${demo.flag}")
    private boolean demoFlag;
    @Value("${wechat.flag}")
    private boolean flag;
    @Value("${pay.flag}")
    private boolean payFlag;
    /**
     * 获取居民就诊记录接口
@ -127,7 +122,7 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        }
        //BS16017(String REGISTER_SN,String realOrder,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception {
        logger.info("findOriginPrescriptionList: registerSn:"+registerSn+" patient"+patient+" patNo:"+patNo+" realOrder:"+realOrder+" admNo:"+admNo);
        return ykyyEntranceService.findV_MSDD01And02(admNo);
        return ykyyEntranceService.findV_MSDD01And02(admNo,demoFlag);
    }
    /**
@ -176,8 +171,11 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        outpatientDO.setIdcard(patientDO.getIdcard());
        outpatientDO.setOutpatientType("1");
        outpatientDO.setCreateTime(new Date());
        outpatientDO.setPayStatus(0);
        if (!payFlag){
            outpatientDO.setPayStatus(1);
        }else {
            outpatientDO.setPayStatus(0);
        }
        if (outpatientDO.getRegisterDate() == null) {
            outpatientDO.setRegisterDate(new Date());
        }
@ -198,8 +196,10 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            businessOrderDO.setOrderType(3);
            businessOrderDO.setOrderCategory("3");
        }
        businessOrderService.saveOrder(businessOrderDO);
        if (!flag){
            businessOrderService.saveOrder(businessOrderDO);
        }
        WlyyPatientRegisterTimeDO registerTimeDO = null;
@ -308,7 +308,34 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     PRIMARY KEY (`id`),
     */
    public JSONArray getDrugDictionary(String chargeCode, String pyKey, String winNo, String groupNo) throws Exception {
        JSONArray mapList = ykyyEntranceService.findYkYpxx(chargeCode, null, null, pyKey);
        JSONArray mapList = new JSONArray();
        if (demoFlag){
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("ypcd","400");
            jsonObject.put("ypjl",0.5);
            jsonObject.put("yfzf",0);
            jsonObject.put("kcsl",0);
            jsonObject.put("jldw","mg");
            jsonObject.put("lsjg",0.1);
            jsonObject.put("ypdm","0601");
            jsonObject.put("zfpb",0);
            jsonObject.put("yfgg","1ml:0.5mg");
            jsonObject.put("ypmc","维生素B12注射液");
            jsonObject.put("yfsx",null);
            jsonObject.put("fyfs",2);
            jsonObject.put("gyffmc","注射");
            jsonObject.put("jbywbz",1);
            jsonObject.put("yfbz",1);
            jsonObject.put("ybfl",null);
            jsonObject.put("yfdw","支");
            jsonObject.put("gyff",13);
            jsonObject.put("ypmc2","维生素B12注射液");
            jsonObject.put("ydyp",0);
            jsonObject.put("py_code","WSSB12ZS");
            mapList.add(jsonObject);
        }else {
            mapList = ykyyEntranceService.findYkYpxx(chargeCode, null, null, pyKey);
        }
        JSONArray array = new JSONArray();
        for (int i=0;i<mapList.size();i++){
            JSONObject map = mapList.getJSONObject(i);
@ -345,9 +372,18 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    /**
     * 获取药品用法
     */
    public JSONArray getDrugUse(String drugNo, String pyKey) throws Exception {
        JSONArray mapList = ykyyEntranceService.findYpyf(pyKey);
    public JSONArray getDrugUse(String drugNo, String pyKey,boolean demoFlag) throws Exception {
        JSONArray mapList = new JSONArray();
        if (demoFlag){
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("xmmc","含服");
            jsonObject.put("pydm","HF");
            jsonObject.put("ypyf",64);
            mapList.add(jsonObject);
        }else {
            mapList = ykyyEntranceService.findYpyf(pyKey);
        }
        JSONArray array = new JSONArray();
        for (int i=0;i<mapList.size();i++){
            JSONObject map = mapList.getJSONObject(i);
@ -365,8 +401,17 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     *
     * @return
     */
    public JSONArray getDrugFrequency() throws Exception {
        JSONArray mapList = ykyyEntranceService.findSypc(null);
    public JSONArray getDrugFrequency(boolean demoFlag) throws Exception {
        JSONArray mapList = new JSONArray();
        if (demoFlag){
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("pcmc","qd");
            jsonObject.put("pcmc1","每日一次");
            jsonObject.put("mrcs",1);
            mapList.add(jsonObject);
        }else {
            mapList= ykyyEntranceService.findSypc(null);
        }
        JSONArray array = new JSONArray();
        for (int i=0;i<mapList.size();i++){
            JSONObject map = mapList.getJSONObject(i);
@ -457,17 +502,19 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    public JSONArray findPatientCard(String patient)throws Exception{
        BasePatientDO patientDO = basePatientDao.findById(patient);
        if (patientDO!=null){
            JSONArray res = ykyyEntranceService.findHisCard(patientDO.getIdcard());
            JSONArray res = ykyyEntranceService.findHisCard(patientDO.getIdcard(),demoFlag);
            JSONArray rs = new JSONArray();
            if(res !=null){
                for (int i =0;i<res.size();i++){
                    JSONObject object = (JSONObject) res.get(i);
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("PAT_NO",jsonObject.get("pat_no"));
                    jsonObject.put("CARD_NO",jsonObject.get("card_no"));
                    jsonObject.put("OP_DATE",jsonObject.get("op_date"));
                    jsonObject.put("CARD_STAT",jsonObject.get("card_stat"));
                    jsonObject.put("CARD_TYPE",jsonObject.get("card_type"));
                    jsonObject.put("CARD_TYPE_NAME",jsonObject.get("card_type_name"));
                    jsonObject.put("PAT_NO",object.get("pat_no"));
                    jsonObject.put("CARD_NO",object.get("card_no"));
                    jsonObject.put("OP_DATE",object.get("op_date"));
                    jsonObject.put("CARD_STAT",object.get("card_stat"));
                    jsonObject.put("CARD_TYPE",object.get("card_type"));
                    jsonObject.put("CARD_TYPE_NAME",object.get("card_type_name"));
                    rs.add(jsonObject);
                }
            }
            return rs;
@ -523,8 +570,8 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     * @return
     * @throws Exception
     */
    public JSONArray getICD10(String pyKey) throws Exception {
        JSONArray array = ykyyEntranceService.findIcd10(pyKey);
    public JSONArray getICD10(String pyKey,boolean demoFlag) throws Exception {
        JSONArray array = ykyyEntranceService.findIcd10(pyKey,demoFlag);
        return array;
    }

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

@ -113,6 +113,9 @@ public class XzzxEntranceService{
    public static String entranceUrl = "http://172.16.100.240:10023/xzzx/";
    public static String entranceUrlLocal = "http://localhost:10023/xzzx/";
    public static String hospitalUrl = "http://192.168.118.240:10022/";//172.16.100.63
    public String getSelectUrl(){
@ -980,8 +983,8 @@ public class XzzxEntranceService{
            String rs = HttpUtil.sendPost(sendMessageUrl,params.toJSONString());
            logger.info("rs :"+rs);
            JSONObject rsJson = JSON.parseObject(rs);
            String resCode = rsJson.getString("resCode");
            if("000".equals(resCode)){
            String resCode = rsJson.getString("respCode");
            if("000000".equals(resCode)){
                return "1";
            }
            return "0";
@ -1021,8 +1024,8 @@ public class XzzxEntranceService{
            String rs = HttpUtil.sendPost(sendMessageUrl,params.toJSONString());
            logger.info("rs :"+rs);
            JSONObject rsJson = JSON.parseObject(rs);
            String resCode = rsJson.getString("resCode");
            if("000".equals(resCode)){
            String resCode = rsJson.getString("respCode");
            if("000000".equals(resCode)){
                return "1";
            }
            return "0";
@ -1201,16 +1204,20 @@ public class XzzxEntranceService{
     * @param cardNo 就诊卡
     * @return
     */
    public JSONArray selectCardInfo(String cardNo){
    public JSONObject selectCardInfo(String cardNo){
        JSONArray array = new JSONArray();
        String response="";
        String url = entranceUrl+"getCardInfo?cardNo="+cardNo;
        response = httpClientUtil.get(url,"GBK");
        JSONObject object = JSONObject.parseObject(response);
        JSONObject jsonObject = new JSONObject();
        if (object.getInteger("status")==200){
            array = JSONArray.parseArray(object.getString("obj")).getJSONArray(0);
            if (array!=null&&array.size()!=0){
                jsonObject = array.getJSONObject(0);
            }
        }
        return array;
        return jsonObject;
    }
@ -1968,4 +1975,33 @@ public class XzzxEntranceService{
//============================hospital业务层==================start====================
//===========================entrance访问hospital============start=======================
    /**
     *
     * @param admNo
     * @param realOrder
     * @return
     */
    public JSONObject getSFExpressInfoToHospital(String admNo, String realOrder) throws Exception {
        String response="";
        String url = hospitalUrl+"open/noLogin/getSFExpressInfoNew";
        Map<String,String> map = new HashedMap();
        map.put("admNo",admNo);
        map.put("realOrder",realOrder);
        logger.info("jsonobject"+map.toString());
        response = httpClientUtil.httpPost(url,map);
        JSONObject object = JSONObject.parseObject(response);
        JSONObject jsonObject1 = new JSONObject();
        logger.info("object"+object.toJSONString());
        if(object.getInteger("status")==200){
            String obj = object.getString("obj");
            object = JSONObject.parseObject(obj);
            jsonObject1.put("mailNo",object.getString("mailNo"));
        }
        return jsonObject1;
    }
//===========================entrance访问hospital============end=======================
}

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

@ -3,6 +3,7 @@ package com.yihu.jw.hospital.prescription.service.entrance;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.sun.org.apache.bcel.internal.generic.NEW;
import com.yihu.jw.dict.dao.DictDoctorDutyDao;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
@ -414,18 +415,18 @@ public class YkyyEntranceService {
            jsonObject.put("JZXH","2395501");
            JSONObject jsonObject2 = new JSONObject();
            jsonObject.put("BRID","1168517");
            jsonObject.put("BRXM","于小童");
            jsonObject.put("SJHM","");
            jsonObject.put("SFZH","");
            jsonObject.put("BRXZ","自费");
            jsonObject.put("YSDM","1630");
            jsonObject.put("KDYS","张纯");
            jsonObject.put("KSDM","1101");
            jsonObject.put("KSMC","高度近视专科(五缘院区)");
            jsonObject.put("KSSJ","2020/05/19 15:51:23");
            jsonObject.put("ZDMC","高度近视");
            jsonObject.put("JZXH","2395506");
            jsonObject2.put("BRID","1168517");
            jsonObject2.put("BRXM","于小童");
            jsonObject2.put("SJHM","");
            jsonObject2.put("SFZH","");
            jsonObject2.put("BRXZ","自费");
            jsonObject2.put("YSDM","1630");
            jsonObject2.put("KDYS","张纯");
            jsonObject2.put("KSDM","1101");
            jsonObject2.put("KSMC","高度近视专科(五缘院区)");
            jsonObject2.put("KSSJ","2020/05/19 15:51:23");
            jsonObject2.put("ZDMC","高度近视");
            jsonObject2.put("JZXH","2395506");
            jsonArray.add(jsonObject);
            jsonArray.add(jsonObject2);
@ -649,7 +650,7 @@ public class YkyyEntranceService {
     * HIS处方记录
     * @throws Exception
     */
    public List<WlyyPrescriptionVO> findV_MSDD01And02(String admNo) throws Exception{
    public List<WlyyPrescriptionVO> findV_MSDD01And02(String admNo,boolean demoFlag) throws Exception{
        List<WlyyPrescriptionVO> wlyyPrescriptionVOList = new ArrayList<>();
        //处方数据
@ -671,12 +672,38 @@ public class YkyyEntranceService {
                "\tV_MS_DD01 d\n" +
                "WHERE\n" +
                "\td.JZXH = '"+admNo+"'";
        Map<String,Object> params = new HashedMap();
        params.put("sql",msd01);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        JSONObject rs = new JSONObject();
        String content="";
        if (demoFlag){
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("cfsb","X155245");
            jsonObject.put("cfhm","2524863258522");
            jsonObject.put("fkzt","0");
            jsonObject.put("cflx",1100);
            jsonObject.put("kfrq","2020-06-23 15:25:58");
            jsonObject.put("scddh","SH2856545254");
            jsonObject.put("brid","25318532");
            jsonObject.put("brxm","杨楠");
            jsonObject.put("ksdm","350524A0221");
            jsonObject.put("ysdm","152586232");
            jsonObject.put("jzxh","MZ258515");
            jsonObject.put("guid","255df252s222");
            jsonObject.put("jzkh","JZ255317855");
            JSONArray array = new JSONArray();
            array.add(jsonObject);
            rs.put("detailModelList",array);
            rs.put("status","200");
            content=rs.toJSONString();
        }else {
            Map<String,Object> params = new HashedMap();
            params.put("sql",msd01);
            HttpResponse response = HttpUtils.doGet(url,params);
             content = response.getContent();
            logger.info("response:"+content);
            rs = JSON.parseObject(content);
        }
        Integer status = rs.getInteger("status");
        if(status!=null&&status == 200){
            JSONArray array =rs.getJSONArray("detailModelList");
@ -722,12 +749,37 @@ public class YkyyEntranceService {
                        "WHERE\n" +
                        "\td.cfsb = '"+wlyyPrescriptionVO.getRealOrder()+"'";
                Map<String,Object> params1 = new HashedMap();
                params1.put("sql",msd02);
                HttpResponse response1 = HttpUtils.doGet(url,params1);
                String content1 = response1.getContent();
                logger.info("response:"+content);
                JSONObject rs1 = JSON.parseObject(content1);
                JSONObject rs1 =new JSONObject();
                if (demoFlag){
                    JSONArray array1 = new JSONArray();
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("cfsb","X1552155");
                    jsonObject.put("ypxh","CF2552142");
                    jsonObject.put("ypcd","YP2552212");
                    jsonObject.put("ypsl","5");
                    jsonObject.put("ypdj","10");
                    jsonObject.put("hjje","9.99");
                    jsonObject.put("yfdw","盒");
                    jsonObject.put("mrcs","2");
                    jsonObject.put("yfbz","消化科");
                    jsonObject.put("ypyf","X1552155");//给药途径
                    jsonObject.put("ycjl","X1552155");
                    jsonObject.put("yyts","X1552155");
                    jsonObject.put("sbxh","X1552155");
                    jsonObject.put("yfgg","X1552155");
                    array1.add(jsonObject);
                    rs1.put("status","200");
                    rs1.put("detailModelList",array);
                }else {
                    Map<String,Object> params1 = new HashedMap();
                    params1.put("sql",msd02);
                    HttpResponse response1 = HttpUtils.doGet(url,params1);
                    String content1 = response1.getContent();
                    logger.info("response:"+content);
                    rs1 = JSON.parseObject(content1);
                }
                Integer status1 = rs1.getInteger("status");
                List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS = new ArrayList<>();
                if(status1!=null&&status1 == 200){
@ -737,12 +789,25 @@ public class YkyyEntranceService {
                        JSONObject object1 = array1.getJSONObject(i);
                        WlyyPrescriptionInfoVO prescriptionInfoVO = new WlyyPrescriptionInfoVO();
                        String sql = "SELECT ypxh as \"ypxh\",ypmc2 as \"ypmc2\" from V_ZKSG_MZ_YPXX WHERE ypxh='"+object1.getString("ypxh")+"' ";
                        Map<String,Object> params4 = new HashedMap();
                        params4.put("sql",sql);
                        HttpResponse response4 = HttpUtils.doGet(url,params4);
                        String content4 = response4.getContent();
                        logger.info("response:"+content4);
                        JSONObject rs4 = JSON.parseObject(content4);
                        JSONObject rs4 = new JSONObject();
                        if (demoFlag){
                            JSONObject jsonObject = new JSONObject();
                            jsonObject.put("ypxh","X456225");
                            jsonObject.put("ypmc2","板蓝根");
                            JSONArray array2 = new JSONArray();
                            rs4.put("detailModelList",array2);
                            rs4.put("status",200);
                        }else {
                            Map<String,Object> params4 = new HashedMap();
                            params4.put("sql",sql);
                            HttpResponse response4 = HttpUtils.doGet(url,params4);
                            String content4 = response4.getContent();
                            logger.info("response:"+content4);
                            rs4 = JSON.parseObject(content4);
                        }
                        Integer status4 = rs4.getInteger("status");
                        if(status4!=null&&status4 == 200){
                            JSONArray array4 =  rs4.getJSONArray("detailModelList");
@ -771,12 +836,24 @@ public class YkyyEntranceService {
                wlyyPrescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
                List<WlyyPrescriptionDiagnosisVO> diagnosisVOS = new ArrayList<>();
                String mz = "SELECT ICD AS \"icd\",MSZD AS \"mszd\",JZXH AS \"jzxh\" FROM v_hlwys_mz_jbzd WHERE jzxh = '"+admNo+"'";
                Map<String,Object> params2 = new HashedMap();
                params2.put("sql",mz);
                HttpResponse response2 = HttpUtils.doGet(url,params2);
                String content2 = response2.getContent();
                logger.info("response:"+content2);
                JSONObject rs2 = JSON.parseObject(content2);
                JSONObject rs2 =new JSONObject();
                if (demoFlag){
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("icd","250465322053223");
                    jsonObject.put("mszd","感冒");
                    jsonObject.put("jzxh","JZ25521875232");
                    JSONArray array1 = new JSONArray();
                    array1.add(jsonObject);
                    rs2.put("status",200);
                    rs2.put("detailModelList",array1);
                }else {
                    Map<String,Object> params2 = new HashedMap();
                    params2.put("sql",mz);
                    HttpResponse response2 = HttpUtils.doGet(url,params2);
                    String content2 = response2.getContent();
                    logger.info("response:"+content2);
                    rs2 = JSON.parseObject(content2);
                }
                Integer status2 = rs2.getInteger("status");
                if(status2!=null&&status2 == 200){
                    JSONArray array2 = rs2.getJSONArray("detailModelList");
@ -1468,25 +1545,36 @@ public class YkyyEntranceService {
     * @return
     * @throws Exception
     */
    public JSONArray findHisCard(String idcard) throws Exception {
    public JSONArray findHisCard(String idcard,boolean demoFlag) throws Exception {
        String sql = "select o.pat_no as \"pat_no\",o.card_no as \"card_no\",o.card_stat as \"card_stat\",o.op_date as \"op_date\",o.card_type as \"card_type\",o.card_type_name as \"card_type_name\" from v_zksg_brcx x,V_HLW_CARDINFO o where  o.pat_no = x.mzhm and x.sfzh = '"+idcard+"'";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("idcard:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            array = rs.getJSONArray("detailModelList");
        if (demoFlag){
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("pat_no","P5616242-0");
            jsonObject.put("card_no","D40136791");
            jsonObject.put("card_stat","激活");
            jsonObject.put("op_date","2020-06-25 08:46:40");
            jsonObject.put("card_type","2");
            jsonObject.put("card_type_name","社保卡");
            array.add(jsonObject);
        }else {
            HttpResponse response = HttpUtils.doGet(url,params);
            String content = response.getContent();
            logger.info("response:"+content);
            JSONObject rs = JSON.parseObject(content);
            Integer status = rs.getInteger("status");
            if (status==200){
                array = rs.getJSONArray("detailModelList");
            }
        }
        return array;
    }
    public JSONArray findIcd10(String pyCode) throws Exception {
    public JSONArray findIcd10(String pyCode,boolean demoFlag) throws Exception {
        String sql = "select i.code as \"code\",i.name as \"name\",i.disea_reason as \"disea_reason\",i.death_reason as \"death_reason\",i.py_code as \"py_code\",i.flag as \"flag\",i.add_code as \"add_code\",i.emr as \"emr\" from v_hlw_icd10 i";
        JSONArray array = new JSONArray();
        if (StringUtils.isNoneBlank(pyCode)){
@ -1495,14 +1583,28 @@ public class YkyyEntranceService {
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("ICD10:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            array = rs.getJSONArray("detailModelList");
        if (demoFlag){
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("add_code","");
            jsonObject.put("code","E25.000x011");
            jsonObject.put("d_code","11-UWSRB");
            jsonObject.put("death_reason","");
            jsonObject.put("disease_reason","");
            jsonObject.put("emr","");
            jsonObject.put("name","11-羟化酶缺陷");
            jsonObject.put("py_code","11-QHMQX");
            array.add(jsonObject);
        }else {
            HttpResponse response = HttpUtils.doGet(url,params);
            String content = response.getContent();
            logger.info("response:"+content);
            JSONObject rs = JSON.parseObject(content);
            Integer status = rs.getInteger("status");
            if (status==200){
                array = rs.getJSONArray("detailModelList");
            }
        }
        return array;
    }

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

@ -97,7 +97,7 @@ public class YkyyService {
            map.put("HospitalId",HospitalId);
        }
        logger.info("眼科获取充值订单号接口入参:"+map.toString());
        String url=yktUrl_90+"api/His/GetNewSerialNumber";
        String url=yktUrl_90+"api/His/GetNewSerialNumber4Jkzl";
        try {
            response=httpClientUtil.httpPost(url,map);
        } catch (Exception e) {

+ 15 - 0
business/base-service/src/main/java/com/yihu/jw/message/service/UserMessageService.java

@ -0,0 +1,15 @@
package com.yihu.jw.message.service;
import com.yihu.jw.entity.base.message.BaseMessageDO;
import com.yihu.jw.entity.hospital.message.BaseUserMessageDO;
import com.yihu.jw.hospital.message.dao.BaseUserMessageDao;
import com.yihu.jw.message.dao.MessageDao;
import com.yihu.mysql.query.BaseJpaService;
/**
 * Created by wangzhinan on 2020/7/9.
 */
public class UserMessageService extends BaseJpaService<BaseUserMessageDO, BaseUserMessageDao> {
}

+ 50 - 11
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -27,6 +27,7 @@ import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.order.dao.BusinessOrderDao;
@ -53,6 +54,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -108,6 +110,8 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    private BaseDoctorDao doctorDao;
    @Autowired
    private EntranceService entranceService;
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
@ -1073,21 +1077,45 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        if (businessOrderDO!=null){
            BasePatientDO patientDO = patientDao.findById(businessOrderDO.getPatient());
            String idcard = "";
            String ssc = "";
            if (patientDO!=null){
                idcard = patientDO.getIdcard();
            }
            logger.info("开始1"+idcard);
            String openId = "";
            BaseDoctorDO doctorDO = doctorDao.findById(businessOrderDO.getDoctor());
            String fee = doctorDO.getFee();
            if (!StringUtils.isNoneBlank(fee)){
                throw new Exception("医生费用为空");
            Double doctorFee = 0.0;
            if (StringUtils.isNoneBlank(businessOrderDO.getDoctor())){
                BaseDoctorDO doctorDO = doctorDao.findById(businessOrderDO.getDoctor());
                String fee = doctorDO.getFee();
                if (!StringUtils.isNoneBlank(fee)){
                    throw new Exception("医生费用为空");
                }
                doctorFee= Double.parseDouble(fee);
            }else {
                WlyyHospitalSysDictDO wlyyHospitalSysDictDO =hospitalSysDictDao.findById("WX_MONEY");
                doctorFee = Double.parseDouble(wlyyHospitalSysDictDO.getDictValue());
            }
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO =hospitalSysDictDao.findById("YLZ_YE");
            if (wlyyHospitalSysDictDO!=null&&wlyyHospitalSysDictDO.getDictValue().equalsIgnoreCase("0")){
                businessOrderDO.setPayPrice(doctorFee);
            }else {
                if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
                    net.sf.json.JSONObject object1 = entranceService.qutpatientBalance(cardNo, demoFlag);
                    Double cardFee = object1.getDouble("ZHYE");
                    BigDecimal b = new BigDecimal(String.valueOf(cardFee));
                    BigDecimal c = new BigDecimal(String.valueOf(doctorFee));
                    BigDecimal balance = c.subtract(b);
                    businessOrderDO.setPayPrice(balance.doubleValue());
                }else if(wechatId.equalsIgnoreCase("xm_xzzx_wx")){
                    JSONObject object = xzzxEntranceService.selectCardInfo(cardNo);
                    Double cardFee = object.getDouble("ZHYE");
                    BigDecimal b = new BigDecimal(String.valueOf(cardFee));
                    BigDecimal c = new BigDecimal(String.valueOf(doctorFee));
                    BigDecimal balance = c.subtract(b);
                    businessOrderDO.setPayPrice(balance.doubleValue());
                }
            }
            net.sf.json.JSONObject object1 = entranceService.qutpatientBalance(cardNo, demoFlag);
            Double cardFee = object1.getDouble("ZHYE");
            Double doctorFee = Double.parseDouble(fee);
            Double balance = doctorFee-cardFee;
            businessOrderDO.setPayPrice(balance);
            businessOrderDO.setPayType(4);
            businessOrderDao.save(businessOrderDO);
            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
@ -1097,7 +1125,16 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
            }
            String price = businessOrderDO.getPayPrice().toString();
            String notifyUrl = hospitalSysDictDO.getDictCode();
            response = ylzPayService.recharge("123456",businessOrderDO.getPatientName(),cardType,"01",cardNo,idcard,depositType,price,businessOrderDO.getOrderNo(),openId,patientDO.getName(),notifyUrl);
            String operatorId =null;
            String operatorName = null;
            if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
                operatorId = "123456";
                operatorName =businessOrderDO.getPatientName();
            }else if(wechatId.equalsIgnoreCase("xm_xzzx_wx")){
                operatorId = "hlwyy";
                operatorName = "互联网医院";
            }
            response = ylzPayService.recharge(operatorId,operatorName,cardType,"01",cardNo,idcard,depositType,price,businessOrderDO.getOrderNo(),openId,patientDO.getName(),notifyUrl);
            if (depositType.equalsIgnoreCase("WX_QR")){
                JSONObject object = JSONObject.parseObject(response);
                if (object!=null){
@ -1137,7 +1174,9 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
            if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
                this.orderRefund(wxId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
            }else if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
/*
                this.ylzOrderRefund(wxId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
*/
            }
            return businessOrderDO;
        }

+ 16 - 0
business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientBusinessDao.java

@ -0,0 +1,16 @@
package com.yihu.jw.patient.dao;
import com.yihu.jw.entity.base.patient.BasePatientBusinessDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 *
 */
public interface BasePatientBusinessDao extends PagingAndSortingRepository<BasePatientBusinessDO, String>, JpaSpecificationExecutor<BasePatientBusinessDO> {
    @Query("select a from BasePatientBusinessDO a where a.del=1 and a.id=?1")
    BasePatientBusinessDO findByIdAndDel(String id);
}

+ 2 - 2
business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java

@ -85,9 +85,9 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
        List<Map<String, Object>> result = new ArrayList<>();
        String param = null == nameOrIdcard ? "": nameOrIdcard;
        String sql = "SELECT\n" +
                "\tID AS \"ID\",\n" +
                "\tID AS \"id\",\n" +
                "\tidcard AS \"idcard\",\n" +
                "\tNAME AS \"NAME\",\n" +
                "\tNAME AS \"name\",\n" +
                "\tCASE\n" +
                "WHEN sex = 1 THEN\n" +
                "\t'男'\n" +

+ 143 - 0
business/base-service/src/main/java/com/yihu/jw/utils/SensitiveWordInit.java

@ -0,0 +1,143 @@
package com.yihu.jw.utils;
import java.io.*;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
public class SensitiveWordInit {
	private String ENCODING = "GBK";    //字符编码
	public HashMap sensitiveWordMap;
	public SensitiveWordInit(){
		super();
	}
	/**
	 * @author chenming
	 * @date 2014年4月20日 下午2:28:32
	 * @version 1.0
	 */
	public Map initKeyWord(String txt){
		try {
			//读取敏感词库
			Set<String> keyWordSet = readSensitiveWordFile(txt);
			//将敏感词库加入到HashMap中
			addSensitiveWordToHashMap(keyWordSet);
			//spring获取application,然后application.setAttribute("sensitiveWordMap",sensitiveWordMap);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return sensitiveWordMap;
	}
	public Map initKeyWord(Set<String> keyWordSet ){
		try {
			//将敏感词库加入到HashMap中
			addSensitiveWordToHashMap(keyWordSet);
			//spring获取application,然后application.setAttribute("sensitiveWordMap",sensitiveWordMap);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return sensitiveWordMap;
	}
	/**
	 * 读取敏感词库,将敏感词放入HashSet中,构建一个DFA算法模型:<br>
	 * 中 = {
	 *      isEnd = 0
	 *      国 = {<br>
	 *      	 isEnd = 1
	 *           人 = {isEnd = 0
	 *                民 = {isEnd = 1}
	 *                }
	 *           男  = {
	 *           	   isEnd = 0
	 *           		人 = {
	 *           			 isEnd = 1
	 *           			}
	 *           	}
	 *           }
	 *      }
	 *  五 = {
	 *      isEnd = 0
	 *      星 = {
	 *      	isEnd = 0
	 *      	红 = {
	 *              isEnd = 0
	 *              旗 = {
	 *                   isEnd = 1
	 *                  }
	 *              }
	 *      	}
	 *      }
	 * @author chenming
	 * @date 2014年4月20日 下午3:04:20
	 * @param keyWordSet  敏感词库
	 * @version 1.0
	 */
	private void addSensitiveWordToHashMap(Set<String> keyWordSet) {
		sensitiveWordMap = new HashMap(keyWordSet.size());     //初始化敏感词容器,减少扩容操作
		String key = null;
		Map nowMap = null;
		Map<String, String> newWorMap = null;
		//迭代keyWordSet
		Iterator<String> iterator = keyWordSet.iterator();
		while(iterator.hasNext()){
			key = iterator.next();    //关键字
			nowMap = sensitiveWordMap;
			for(int i = 0 ; i < key.length() ; i++){
				char keyChar = key.charAt(i);       //转换成char型
				Object wordMap = nowMap.get(keyChar);       //获取
				if(wordMap != null){        //如果存在该key,直接赋值
					nowMap = (Map) wordMap;
				}
				else{     //不存在则,则构建一个map,同时将isEnd设置为0,因为他不是最后一个
					newWorMap = new HashMap<String,String>();
					newWorMap.put("isEnd", "0");     //不是最后一个
					nowMap.put(keyChar, newWorMap);
					nowMap = newWorMap;
				}
				if(i == key.length() - 1){
					nowMap.put("isEnd", "1");    //最后一个
				}
			}
		}
	}
	/**
	 * 读取敏感词库中的内容,将内容添加到set集合中
	 * @author chenming
	 * @date 2014年4月20日 下午2:31:18
	 * @return
	 * @version 1.0
	 * @throws Exception
	 */
	private Set<String> readSensitiveWordFile(String words) throws Exception{
		Set<String> set = null;
		byte[] bytes = words.getBytes();
		InputStream is = new ByteArrayInputStream(bytes);
		InputStreamReader read = new InputStreamReader(is);
		try {
				set = new HashSet<String>();
				BufferedReader bufferedReader = new BufferedReader(read);
				String txt = null;
				while((txt = bufferedReader.readLine()) != null){    //读取文件,将文件内容放入到set中
				set.add(txt);
			}
		} catch (Exception e) {
			throw e;
		}finally{
			read.close();     //关闭文件流
		}
		return set;
	}
}

+ 165 - 0
business/base-service/src/main/java/com/yihu/jw/utils/SensitivewordFilter.java

@ -0,0 +1,165 @@
package com.yihu.jw.utils;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/7/8
 */
public class SensitivewordFilter {
    private Map sensitiveWordMap = null;
    public static int minMatchTYpe = 1;      //最小匹配规则
    public static int maxMatchType = 2;      //最大匹配规则
    /**
     * 构造函数,初始化敏感词库
     */
    public SensitivewordFilter(String txt){
        sensitiveWordMap = new SensitiveWordInit().initKeyWord(txt);
    }
    public SensitivewordFilter(HashSet<String> set){
        sensitiveWordMap = new SensitiveWordInit().initKeyWord(set);
    }
    /**
     * 判断文字是否包含敏感字符
     * @author chenming
     * @date 2014年4月20日 下午4:28:30
     * @param txt  文字
     * @param matchType  匹配规则&nbsp;1:最小匹配规则,2:最大匹配规则
     * @return 若包含返回true,否则返回false
     * @version 1.0
     */
    public boolean isContaintSensitiveWord(String txt,int matchType){
        boolean flag = false;
        for(int i = 0 ; i < txt.length() ; i++){
            int matchFlag = this.CheckSensitiveWord(txt, i, matchType); //判断是否包含敏感字符
            if(matchFlag > 0){    //大于0存在,返回true
                flag = true;
            }
        }
        return flag;
    }
    /**
     * 获取文字中的敏感词
     * @author chenming
     * @date 2014年4月20日 下午5:10:52
     * @param txt 文字
     * @param matchType 匹配规则&nbsp;1:最小匹配规则,2:最大匹配规则
     * @return
     * @version 1.0
     */
    public Set<String> getSensitiveWord(String txt , int matchType){
        Set<String> sensitiveWordList = new HashSet<String>();
        for(int i = 0 ; i < txt.length() ; i++){
            int length = CheckSensitiveWord(txt, i, matchType);    //判断是否包含敏感字符
            if(length > 0){    //存在,加入list中
                sensitiveWordList.add(txt.substring(i, i+length));
                i = i + length - 1;    //减1的原因,是因为for会自增
            }
        }
        return sensitiveWordList;
    }
    /**
     * 替换敏感字字符
     * @author chenming
     * @date 2014年4月20日 下午5:12:07
     * @param txt
     * @param matchType
     * @param replaceChar 替换字符,默认*
     * @version 1.0
     */
    public String replaceSensitiveWord(String txt,int matchType,String replaceChar){
        String resultTxt = txt;
        Set<String> set = getSensitiveWord(txt, matchType);     //获取所有的敏感词
        Iterator<String> iterator = set.iterator();
        String word = null;
        String replaceString = null;
        while (iterator.hasNext()) {
            word = iterator.next();
            replaceString = getReplaceChars(replaceChar, word.length());
            resultTxt = resultTxt.replaceAll(word, replaceString);
        }
        return resultTxt;
    }
    /**
     * 获取替换字符串
     * @author chenming
     * @date 2014年4月20日 下午5:21:19
     * @param replaceChar
     * @param length
     * @return
     * @version 1.0
     */
    private String getReplaceChars(String replaceChar,int length){
        String resultReplace = replaceChar;
        for(int i = 1 ; i < length ; i++){
            resultReplace += replaceChar;
        }
        return resultReplace;
    }
    /**
     * 检查文字中是否包含敏感字符,检查规则如下:<br>
     * @author chenming
     * @date 2014年4月20日 下午4:31:03
     * @param txt
     * @param beginIndex
     * @param matchType
     * @return,如果存在,则返回敏感词字符的长度,不存在返回0
     * @version 1.0
     */
    public int CheckSensitiveWord(String txt,int beginIndex,int matchType){
        boolean  flag = false;    //敏感词结束标识位:用于敏感词只有1位的情况
        int matchFlag = 0;     //匹配标识数默认为0
        char word = 0;
        Map nowMap = sensitiveWordMap;
        for(int i = beginIndex; i < txt.length() ; i++){
            word = txt.charAt(i);
            nowMap = (Map) nowMap.get(word);     //获取指定key
            if(nowMap != null){     //存在,则判断是否为最后一个
                matchFlag++;     //找到相应key,匹配标识+1
                if("1".equals(nowMap.get("isEnd"))){       //如果为最后一个匹配规则,结束循环,返回匹配标识数
                    flag = true;       //结束标志位为true
                    if(SensitivewordFilter.minMatchTYpe == matchType){    //最小规则,直接返回,最大规则还需继续查找
                        break;
                    }
                }
            }
            else{     //不存在,直接返回
                break;
            }
        }
        if(matchFlag < 1 || !flag){        //长度必须大于等于1,为词
            matchFlag = 0;
        }
        return matchFlag;
    }
    public static void main(String[] args) {
        SensitivewordFilter filter = new SensitivewordFilter("情节");
        System.out.println("敏感词的数量:" + filter.sensitiveWordMap.size());
        String string = "太多的伤感情怀也许只局限于饲养基地 荧幕中的情节,主人公尝试着去用某种方式渐渐的很潇洒地释自杀指南怀那些自己经历的伤感。"
                + "然后法轮功 我们的扮演的角色就是跟随着主人公的喜红客联盟 怒哀乐而过于牵强的把自己的情感也附加于银幕情节中,然后感动就流泪,"
                + "难过就躺在某一个人的怀里尽情的阐述心扉或者手机卡复制器一个人一杯红酒一部电影在夜三级片 深人静的晚上,关上电话静静的发呆着。";
        System.out.println("待检测语句字数:" + string.length());
        long beginTime = System.currentTimeMillis();
        Set<String> set = filter.getSensitiveWord(string, 1);
        long endTime = System.currentTimeMillis();
        System.out.println("语句中包含敏感词的个数为:" + set.size() + "。包含:" + set);
        System.out.println("总共消耗时间为:" + (endTime - beginTime));
        String s = filter.replaceSensitiveWord("太多的伤感情怀也许只局限于饲养基地 荧幕中的情节,主人公尝试着去用某种方式渐渐的很潇洒地释自杀指南怀那些自己经历的伤感", 1, "*");
        System.out.println(s);
    }
}

+ 56 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/service/BaseSensitiveFilterWordsService.java

@ -0,0 +1,56 @@
package com.yihu.jw.wechat.service;
import com.yihu.jw.entity.base.words.BaseSensitiveDO;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.prescription.dao.BaseSensitiveDao;
import com.yihu.jw.utils.SensitivewordFilter;
import com.yihu.mysql.query.BaseJpaService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/7/6
 */
@Service
public class BaseSensitiveFilterWordsService extends BaseJpaService<BaseSensitiveDO, BaseSensitiveDao> {
    @Autowired
    private BaseSensitiveDao baseSensitiveDao;
    @Autowired
    FileUploadService fileUploadService;
    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(BaseSensitiveFilterWordsService.class);
    /**
     * 敏感词过滤
     * @param txt
     * @return
     */
    public String filterSensitiveWords(String txt){
        List<BaseSensitiveDO> list = (List<BaseSensitiveDO>) baseSensitiveDao.findAll();
        HashSet<String> set = new HashSet<>();
        for (BaseSensitiveDO one : list) {
            set.add(one.getSensitiveWord());
        }
        SensitivewordFilter filter = new SensitivewordFilter(set);
        Set<String> words = filter.getSensitiveWord(txt, 1);
        logger.info("语句中包含敏感词的个数为:" + words.size() + "。包含:" + words);
        logger.info("过滤前="+txt);
        String replaceTxt = filter.replaceSensitiveWord(txt, 1, "*");
        logger.info("过滤后="+replaceTxt);
        return replaceTxt;
    }
}

+ 47 - 28
business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java

@ -27,6 +27,7 @@ import org.omg.CORBA.OBJ_ADAPTER;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -61,6 +62,8 @@ public class StatisticsEsService {
    private BaseEvaluateScoreService baseEvaluateScoreService;
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    @Value("${wechat.flag}")
    private boolean flag;
    /**
     * 问诊量
     * @param startDate
@ -749,24 +752,36 @@ public class StatisticsEsService {
    public JSONObject getOutPatientCircular(String startDate, String endDate, String area, int level, String index, String level2_type) throws Exception {
        JSONObject object = new JSONObject();
        //协同门诊
        SaveModel saveModel1 = null;
        saveModel1 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "12");
        //图文复诊
        SaveModel saveModel2 = null;
        //saveModel2 = elasticsearchUtil.findOneDateQuotaLevel2(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "1","1");
        saveModel2 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "9");
        //视频复诊
        SaveModel saveModel3 = null;
        if (flag){
            object.put("specialistCount",0);//专家咨询数
            object.put("specialistRate","0%");
            object.put("synergyCount",0);//专家咨询数
            object.put("synergyRate","0%");
            object.put("topicCount",0);//图文复诊数量
            object.put("topicRate","0%");
            object.put("videoCount",0);//视频复诊数量
            object.put("videoRate","0%");
            object.put("total",0);
        }else {
            //协同门诊
            SaveModel saveModel1 = null;
            saveModel1 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "12");
            //图文复诊
            SaveModel saveModel2 = null;
            //saveModel2 = elasticsearchUtil.findOneDateQuotaLevel2(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "1","1");
            saveModel2 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "9");
            //视频复诊
            SaveModel saveModel3 = null;
/*
        saveModel3 = elasticsearchUtil.findOneDateQuotaLevel2(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "1","2");
*/
        saveModel3 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "16");
        Double specialistCount =0.0;
        //专科咨询
        SaveModel saveModel4 = null;
        saveModel4 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "1");
        specialistCount = saveModel4.getResult1();//专家咨询数量
            saveModel3 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "16");
            Double specialistCount =0.0;
            //专科咨询
            SaveModel saveModel4 = null;
            saveModel4 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "1");
            specialistCount = saveModel4.getResult1();//专家咨询数量
        /*if(index.equalsIgnoreCase("5")){
            //专家咨询数量
            SaveModel saveModel = null;
@ -781,19 +796,23 @@ public class StatisticsEsService {
            specialistCount = 0.0;
        }*/
        Double synergyCount = saveModel1.getResult1();//协同门诊数量
        Double topicCount = saveModel2.getResult1();//图文复诊数量
        Double videoCount = saveModel3.getResult1();//视频复诊数量
        Double total = specialistCount+synergyCount+topicCount+videoCount;//总量
        object.put("specialistCount",specialistCount);//专家咨询数
        object.put("specialistRate",getRange(specialistCount.intValue(),total.intValue(),0));
        object.put("synergyCount",synergyCount);//专家咨询数
        object.put("synergyRate",getRange(synergyCount.intValue(),total.intValue(),0));
        object.put("topicCount",topicCount);//图文复诊数量
        object.put("topicRate",getRange(topicCount.intValue(),total.intValue(),0));
        object.put("videoCount",videoCount);//视频复诊数量
        object.put("videoRate",getRange(videoCount.intValue(),total.intValue(),0));
        object.put("total",total);
            Double synergyCount = saveModel1.getResult1();//协同门诊数量
            Double topicCount = saveModel2.getResult1();//图文复诊数量
            Double videoCount = saveModel3.getResult1();//视频复诊数量
            Double total = specialistCount+synergyCount+topicCount+videoCount;//总量
            object.put("specialistCount",specialistCount);//专家咨询数
            object.put("specialistRate",getRange(specialistCount.intValue(),total.intValue(),0));
            object.put("synergyCount",synergyCount);//专家咨询数
            object.put("synergyRate",getRange(synergyCount.intValue(),total.intValue(),0));
            object.put("topicCount",topicCount);//图文复诊数量
            object.put("topicRate",getRange(topicCount.intValue(),total.intValue(),0));
            object.put("videoCount",videoCount);//视频复诊数量
            object.put("videoRate",getRange(videoCount.intValue(),total.intValue(),0));
            object.put("total",total);
        }
        return object;
    }

+ 212 - 64
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -14,18 +14,17 @@ import com.yihu.jw.entity.base.im.ConsultTeamLogDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.score.BaseEvaluateDO;
import com.yihu.jw.entity.base.score.BaseEvaluateScoreDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.message.BaseBannerDoctorDO;
import com.yihu.jw.entity.hospital.message.BaseUserMessageDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateDao;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateScoreDao;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.message.dao.BaseBannerDoctorDao;
import com.yihu.jw.hospital.message.dao.BaseUserMessageDao;
import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
@ -35,34 +34,23 @@ import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.dao.ConsultTeamDao;
import com.yihu.jw.im.dao.ConsultTeamDoctorDao;
import com.yihu.jw.im.dao.ConsultTeamLogDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.im.util.ImageCompress;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
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;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -76,8 +64,6 @@ import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
/**
 * IM接口业务类
@ -124,9 +110,13 @@ public class ImService {
	@Autowired
	private YkyyService ykyyService;
	@Autowired
	private BusinessOrderDao businessOrderDao;
	@Autowired
	private PrescriptionService prescriptionService;
	@Autowired
	private BaseBannerDoctorDao baseBannerDoctorDao;
	
	@Value("${im.data_base_name}")
	private String data_base_name;
@ -151,31 +141,22 @@ public class ImService {
	
	@Autowired
	private JdbcTemplate jdbcTemplate;
	
	@Autowired
	private BaseDoctorDao baseDoctorDao;
	
	@Autowired
	private OutpatientDao outpatientDao;
	
	@Autowired
	private EntranceService entranceService;
	@Autowired
	private DoctorMappingService doctorMappingService;
	@Autowired
	private WlyyHttpLogDao wlyyHttpLogDao;
	
	@Autowired
	private BaseDoctorRoleDao baseDoctorRoleDao;
	
	@Autowired
	private StringRedisTemplate redisTemplate;
	@Autowired
	private HibenateUtils hibenateUtils;
	@Autowired
	private SystemMessageService systemMessageService;
	@Autowired
	private BaseUserMessageDao userMessageDao;
	
	@Value("${wechat.id}")
	private String wxId;
@ -316,15 +297,16 @@ public class ImService {
				"AND a.patient= '" +patient+"' "+
				"AND b.to_doctor='" +doctor+"' "+
				"AND a.del='1' " +
				"AND (a.type<> 9 and a.type<> 16)" +
				"AND (a.type<> 9 and a.type<> 16 and a.type<>12 )" +
				"AND a.status=0";
		
		List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql);
		
		String consultCode = "";
		String consultCode = null;
		if (rstotal != null && rstotal.size() > 0) {
			consultCode = rstotal.get(0).get("consultCode").toString();
		}
		logger.info("未结束判断语句"+totalSql+"======consultCode"+consultCode);
		return consultCode;
	}
	
@ -900,6 +882,8 @@ public class ImService {
	 */
	public JSONObject addTeamConsult(ConsultTeamDo ct, String patient, String doctor) throws Exception {
		JSONObject re = new JSONObject();
		boolean boo = StringUtils.isEmpty(getUnfinishedConsult(patient, doctor));
		logger.info("boo"+boo);
		if (!StringUtils.isEmpty(getUnfinishedConsult(patient, doctor))) {//判断是否有未结束的咨询移到同步方法中
//			re.put("status", -3);
//			return re;
@ -1099,13 +1083,23 @@ public class ImService {
	 * @param reason
	 * @return
	 */
	public JSONObject addPrescriptionConsult(String outpatientCode, String patient,String doctorCode, ConsultTeamDo ct, String reason, Integer type) throws Exception {
	public JSONObject addPrescriptionConsult(String outpatientCode, String patient,String doctorCode, ConsultTeamDo ct, String reason, Integer type,String wxId) throws Exception {
		
		synchronized (outpatientCode.intern()) {
			
			//1、获取his就诊记录详情(保存续方表、药品续方信息表、续方疾病类型表)
			WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(outpatientCode);
			if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
				//眼科接诊时更新眼科通状态
				if (!flag){
					BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(wlyyOutpatientDO.getId());
					if (businessOrderDO!=null){
						ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),"5");
					}
				}
			}
			
			//2. 调用HIS挂号接口---START  移到CONTROLER层,直接调用挂号接口
//			DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(doctorCode,wlyyOutpatientDO.getHospital());
@ -1488,7 +1482,7 @@ public class ImService {
		net.sf.json.JSONObject data = new net.sf.json.JSONObject();
		data.put("name",patient.getName());
		data.put("age",IdCardUtil.getAgeForIdcard(patient.getIdcard()));
		data.put("gender",patient.getSex().toString());
		data.put("gender", StringUtils.isEmpty(patient.getSex())?null:patient.getSex().toString());
		data.put("question",consultTeam.getSymptoms());
		String type="";
@ -1621,13 +1615,13 @@ public class ImService {
	 * @param scoreContent
	 * @param type
	 */
	public void evaluationByConsultCode(String consult, String scoreContent, Integer type) throws Exception{
	public void evaluationByConsultCode(String consult, String scoreContent, Integer type,String bannerList) throws Exception{
		JSONArray jsonArray =  JSONArray.parseArray(scoreContent);
		
		Integer totalScore = 0;
		
		ConsultTeamDo consultTeamDo = consultTeamDao.findByConsult(consult);
		
		if(!jsonArray.isEmpty() && jsonArray.size() >0){
			BaseEvaluateScoreDO evaluateScoreDO = new BaseEvaluateScoreDO();
			evaluateScoreDO.setDoctor(consultTeamDo.getDoctor());
@ -1668,7 +1662,49 @@ public class ImService {
			
			for(BaseEvaluateDO baseEvaluateDO :baseEvaluateDOS){
				baseEvaluateDO.setRelationCode(evaluateScoreDO.getId());
				baseEvaluateDao.save(baseEvaluateDO);
				baseEvaluateDO = baseEvaluateDao.save(baseEvaluateDO);
				if("4".equalsIgnoreCase(baseEvaluateDO.getScoreType())){
					BaseUserMessageDO baseUserMessageDO = new BaseUserMessageDO();
					baseUserMessageDO.setCreateTime(new Date());
					baseUserMessageDO.setReceiver(consultTeamDo.getDoctor());
					baseUserMessageDO.setReceiverName(consultTeamDo.getDoctorName());
					baseUserMessageDO.setSender(consultTeamDo.getPatient());
					baseUserMessageDO.setSenderName(consultTeamDo.getName());
					baseUserMessageDO.setRelationCode(baseEvaluateDO.getRelationCode());
					if(consultTeamDo.getType()==1||15==consultTeamDo.getType()){
						baseUserMessageDO.setRelationType(3);
						baseUserMessageDO.setRelationName("专家咨询");
					}else if(consultTeamDo.getType()==9||16==consultTeamDo.getType()){
						baseUserMessageDO.setRelationType(4);
						baseUserMessageDO.setRelationName("在线复诊");
					}
					baseUserMessageDO.setUpdateTime(new Date());
					userMessageDao.save(baseUserMessageDO);
					if (org.apache.commons.lang3.StringUtils.isNoneBlank(bannerList)){
						String str[]=bannerList.split(",");
						for (int i=0;i<bannerList.length();i++){
							BaseBannerDoctorDO bannerDoctorDO = new BaseBannerDoctorDO();
							bannerDoctorDO.setCreateTime(new Date());
							bannerDoctorDO.setUpdateTime(new Date());
							bannerDoctorDO.setPatientId(baseUserMessageDO.getSender());
							bannerDoctorDO.setRelationName(baseUserMessageDO.getSenderName());
							bannerDoctorDO.setDoctor(baseUserMessageDO.getReceiver());
							bannerDoctorDO.setDoctorName(baseUserMessageDO.getReceiverName());
							bannerDoctorDO.setBannerId(str[i]);
							bannerDoctorDO.setRelationCode(baseEvaluateDO.getRelationCode());
							if(consultTeamDo.getType()==1||15==consultTeamDo.getType()){
								bannerDoctorDO.setRelationType(3);
								bannerDoctorDO.setRelationName("专家咨询");
							}else if(consultTeamDo.getType()==9||16==consultTeamDo.getType()){
								bannerDoctorDO.setRelationType(4);
								bannerDoctorDO.setRelationName("在线复诊");
							}
							bannerDoctorDO.setContent(baseEvaluateDO.getContent());
							baseBannerDoctorDao.save(bannerDoctorDO);
						}
					}
				}
			}
			
			consultTeamDo.setEvaluate(1);//保存已评价标识
@ -1707,7 +1743,11 @@ public class ImService {
				"a.score_type as \"score_type\"," +
				"a.content as \"content\",";
		if("xm_ykyy_wx".equals(wxId)){
			sqlScoreList +=  "to_char(b.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"create_time\",";
			if (flag){
				sqlScoreList +=  "date_format(b.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"create_time\",";
			}else {
				sqlScoreList +=  "to_char(b.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"create_time\",";
			}
		}else{
			sqlScoreList +=  "date_format(b.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"create_time\",";
		}
@ -1723,10 +1763,16 @@ public class ImService {
				"LEFT JOIN wlyy_consult_team c ON c.consult=b.relation_code " +
				"WHERE a.relation_code=b.id "+
				"AND c.consult='"+consult+"'";
		System.out.println(sqlScoreList);
		List<Map<String,Object>> scoreList = hibenateUtils.createSQLQuery(sqlScoreList);
		if(scoreList.isEmpty()){
			return null;
		}else{
			Map<String,Object> map = new HashMap<>();
			String sql = "select b.name AS \"name\",b.img AS \"img\" from base_banner_doctor a LEFT JOIN base_banner b on a.banner_id= b.id where a.relation_code = '"+consult+"'";
			List<Map<String,Object>> bannerlist=hibenateUtils.createSQLQuery(sql);
			map.put("bannerList",bannerlist);
			scoreList.add(map);
			return scoreList;
		}
	}
@ -1761,7 +1807,14 @@ public class ImService {
		//获取诊断
		List<WlyyPrescriptionDiagnosisVO> wlyyPrescriptionDiagnosisVOS = wlyyPrescriptionVO.getDiagnosisVOs();
		if(wlyyPrescriptionDiagnosisVOS!=null&&wlyyPrescriptionDiagnosisVOS.size()!=0){
			String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_9", "24", JSON.toJSONString(wlyyPrescriptionDiagnosisVOS),"1");
			WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(wlyyPrescriptionVO.getOutpatientId());
			if (wlyyOutpatientDO.getOutpatientType()!=null){
				if (wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("1")&&wlyyOutpatientDO.getType().equalsIgnoreCase("1")){
					String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_9", "24", JSON.toJSONString(wlyyPrescriptionDiagnosisVOS),"1");
				}else if (wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("1")&&wlyyOutpatientDO.getType().equalsIgnoreCase("2")){
					String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_16", "24", JSON.toJSONString(wlyyPrescriptionDiagnosisVOS),"1");
				}
			}
		}
		
		//获取药品
@ -1772,7 +1825,14 @@ public class ImService {
		object.put("prescriptionid",wlyyPrescriptionVO.getId());
		object.put("ispay",wlyyPrescriptionVO.getPayStatus());
		if(infoVOs!=null&&infoVOs.size()!=0){
			String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_9", "27", JSON.toJSONString(object),"1");
			WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(wlyyPrescriptionVO.getOutpatientId());
			if (wlyyOutpatientDO.getOutpatientType()!=null){
				if (wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("1")&&wlyyOutpatientDO.getType().equalsIgnoreCase("1")){
					String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_9", "27", JSON.toJSONString(object),"1");
				}else if (wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("1")&&wlyyOutpatientDO.getType().equalsIgnoreCase("2")){
					String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_16", "27", JSON.toJSONString(object),"1");
				}
			}
		}
//		imUtil.sendImMsg("402803816babc778016babca6d540008", "梁敬兴", "3ae2673512154d5280d1dcf5ffa5626d_808080eb6c84eacb016c8dc118e9002f_9", "24", "[{\"id\":\"808080eb6c84eacb016c8dc172810037\",\"createTime\":null,\"createUser\":null,\"createUserName\":null,\"updateTime\":null,\"updateUser\":null,\"updateUserName\":null,\"prescriptionId\":\"808080eb6c84eacb016c8dc1727f0036\",\"code\":\"D21.002  \",\"name\":\"耳软骨良性肿瘤\",\"type\":1}]","1");
@ -1880,7 +1940,11 @@ public class ImService {
					"a.title AS \"title\"," +
					"a.symptoms AS \"symptoms\",";
			if("xm_ykyy_wx".equals(wxId)){
				sql = sql + "to_char(a.czrq,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\",";
				if (flag){
					sql = sql + "date_format(a.czrq,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
				}else {
					sql = sql + "to_char(a.czrq,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\",";
				}
			}else{
				sql = sql + "date_format(a.czrq,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
			}
@ -1904,7 +1968,11 @@ public class ImService {
					"a.title AS \"title\"," +
					"a.symptoms AS \"symptoms\"," ;
			if("xm_ykyy_wx".equals(wxId)){
				sql = sql + "to_char(a.czrq,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\",";
				if (flag) {
					sql = sql + "date_format(a.czrq,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
				}else {
					sql = sql + "to_char(a.czrq,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\",";
				}
			}else{
				sql = sql + "date_format(a.czrq,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
			}
@ -1935,7 +2003,12 @@ public class ImService {
		
		if(!StringUtils.isEmpty(start_time)){
			if("xm_ykyy_wx".equals(wxId)){
				sql +=" and a.czrq >= to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
				if (flag){
					sql +=" and a.czrq >= str_to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
				}else {
					sql +=" and a.czrq >= to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
				}
			}else {
				sql +=" and a.czrq >= '"+start_time+"'";
			}
@ -1944,7 +2017,12 @@ public class ImService {
		
		if(!StringUtils.isEmpty(end_time)){
			if("xm_ykyy_wx".equals(wxId)){
				sql +=" and a.czrq <= to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
				if (flag){
					sql +=" and a.czrq <= str_to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
				}else {
					sql +=" and a.czrq <= to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
				}
			}else {
				sql +=" and a.czrq <= '"+end_time+"'";
			}
@ -2006,7 +2084,12 @@ public class ImService {
		
		if(!StringUtils.isEmpty(start_time)){
			if("xm_ykyy_wx".equals(wxId)){
				sql +=" and a.czrq >= to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
				if (flag){
					sql +=" and a.czrq >= str_to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
				}else {
					sql +=" and a.czrq >= to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
				}
			}else {
				sql +=" and a.czrq >= '"+start_time+"'";
			}
@ -2015,7 +2098,12 @@ public class ImService {
		
		if(!StringUtils.isEmpty(end_time)){
			if("xm_ykyy_wx".equals(wxId)){
				sql +=" and a.czrq <= to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
				if (flag){
					sql +=" and a.czrq <= str_to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
				}else {
					sql +=" and a.czrq <= to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
				}
			}else {
				sql +=" and a.czrq <= '"+end_time+"'";
			}
@ -2285,7 +2373,11 @@ public class ImService {
				"a.title AS \"title\"," +
				"a.symptoms AS \"symptoms\"," ;
		if("xm_ykyy_wx".equals(wxId)){
			sql = sql + "to_char(a.czrq,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\",";
			if (flag){
				sql = sql + "date_format(a.czrq,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
			}else {
				sql = sql + "to_char(a.czrq,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\",";
			}
		}else{
			sql = sql + "date_format(a.czrq,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
		}
@ -2314,7 +2406,12 @@ public class ImService {
		
		if(!StringUtils.isEmpty(start_time)){
			if("xm_ykyy_wx".equals(wxId)){
				sql +=" and a.czrq >= to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
				if (flag){
					sql +=" and a.czrq >= str_to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
				}else {
					sql +=" and a.czrq >= to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
				}
			}else {
				sql +=" and a.czrq >= '"+start_time+"'";
			}
@ -2323,7 +2420,12 @@ public class ImService {
		
		if(!StringUtils.isEmpty(end_time)){
			if("xm_ykyy_wx".equals(wxId)){
				sql +=" and a.czrq <= to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
				if (flag){
					sql +=" and a.czrq <= str_to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
				}else {
					sql +=" and a.czrq <= to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
				}
			}else {
				sql +=" and a.czrq <= '"+end_time+"'";
			}
@ -2388,7 +2490,12 @@ public class ImService {
		
		if(!StringUtils.isEmpty(start_time)){
			if("xm_ykyy_wx".equals(wxId)){
				sql +=" and a.czrq >= to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
				if (flag){
					sql +=" and a.czrq >= str_to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
				}else {
					sql +=" and a.czrq >= to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
				}
			}else {
				sql +=" and a.czrq >= '"+start_time+"'";
			}
@ -2396,7 +2503,12 @@ public class ImService {
		
		if(!StringUtils.isEmpty(end_time)){
			if("xm_ykyy_wx".equals(wxId)){
				sql +=" and a.czrq <= to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
				if (flag){
					sql +=" and a.czrq <= str_to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
				}else {
					sql +=" and a.czrq <= to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
				}
			}else {
				sql +=" and a.czrq <= '"+end_time+"'";
			}
@ -2556,7 +2668,7 @@ public class ImService {
			
			String scoreContent= "[{\"scoreType\":\"1\",\"score\":100,\"content\":\"\"},{\"scoreType\":\"2\",\"score\":100,\"content\":\"\"},{\"scoreType\":\"3\",\"score\":100,\"content\":\"\"},{\"scoreType\":\"4\",\"score\":0,\"content\":\"五星好评!\"}]";
			
			this.evaluationByConsultCode(consult.getId(),scoreContent,2);
			this.evaluationByConsultCode(consult.getId(),scoreContent,2,"");
		}
	}
	
@ -2593,7 +2705,23 @@ public class ImService {
			
		}
	}
	
	public Long doctorConsults(String doctorCode){
		String sql=  "SELECT count(1) AS \"total\"  " +
					" FROM wlyy_consult a," +
					"wlyy_consult_team b," +
					"base_patient d  " +
					" WHERE a.id=b.consult " +
					" AND b.patient=d.id AND b.doctor='" + doctorCode + "' AND b.type in (1,15) and b.status = 0 and a.pay_status=1 " +
					" ORDER BY a.czrq desc ";
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
		Long consultCount = 0l;
		if (rstotal != null && rstotal.size() > 0) {
			consultCount = Long.parseLong(rstotal.get(0).get("total").toString());
		}
		return consultCount;
	}
	/**
	 * 医生待办事项列表
	 * @param doctorCode
@ -2609,7 +2737,11 @@ public class ImService {
					"a.title AS \"title\"," +
					"a.symptoms AS \"symptoms\",";
			if("xm_ykyy_wx".equals(wxId)){
				sql = sql + "to_char(a.czrq,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\",";
				if (flag){
					sql = sql + "date_format(a.czrq,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
				}else{
					sql = sql + "to_char(a.czrq,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\",";
				}
			}else{
				sql = sql + "date_format(a.czrq,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
			}
@ -2634,7 +2766,11 @@ public class ImService {
					"op.description AS \"title\"," +
					"op.description AS \"symptoms\",";
			if("xm_ykyy_wx".equals(wxId)){
				sql = sql + "to_char(op.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\",";
				if (flag){
					sql = sql + "date_format(op.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
				}else {
					sql = sql + "to_char(op.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\",";
				}
			}else{
				sql = sql + "date_format(op.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
			}
@ -2649,7 +2785,11 @@ public class ImService {
					"patient.photo AS \"patientphoto\"," +
					"op.id AS \"outpatientId\"," ;
			if("xm_ykyy_wx".equals(wxId)){
				sql = sql + "to_char(op.register_date,'YYYY-MM-DD hh24:mi:ss')  AS \"registerDate\",";
				if (flag){
					sql = sql + "date_format(op.register_date,'%Y-%m-%d %H:%i:%S' )  AS \"registerDate\",";
				}else {
					sql = sql + "to_char(op.register_date,'YYYY-MM-DD hh24:mi:ss')  AS \"registerDate\",";
				}
			}else{
				sql = sql + "date_format(op.register_date,'%Y-%m-%d %H:%i:%S' )  AS \"registerDate\",";
			}
@ -2661,7 +2801,7 @@ public class ImService {
						" left join wlyy_prescription p on p.outpatient_id = op.id "+
					"WHERE op.patient=patient.id " +
					"AND op.doctor='"+doctorCode+"' " +
					"AND op.status in ('0','1') and  op.pay_status=1 ";
					"AND op.status in ('0','1','2') and  op.pay_status=1 ";
			if("9".equals(type)){
				//图文复诊
				sql =sql +"AND op.type=1 AND op.outpatient_type=1 ";
@ -2669,7 +2809,12 @@ public class ImService {
				//视频复诊
				sql =sql +"AND op.type=2 AND op.outpatient_type=1 ";
				if("xm_ykyy_wx".equals(wxId)){
					sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					if (flag){
						sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					}else {
						sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					}
				}else {
					sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
				}
@ -2677,7 +2822,11 @@ public class ImService {
				//视频复诊
				sql =sql +"AND op.outpatient_type=2";
				if("xm_ykyy_wx".equals(wxId)){
					sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					if (flag){
						sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					}else  {
						sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					}
				}else {
					sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
				}
@ -2724,17 +2873,16 @@ public class ImService {
	 * 发送医生取消IM消息
	 * @param patientName
	 * @param doctor
	 * @param doctorName
	 * @param session_id
	 * @param cancleReason
	 * @param cancleContent
	 * @return
	 */
	public String sendOutPatientCancle(String patientName, String doctor, String doctorName, String session_id, String cancleReason, String cancleContent) {
	public String sendOutPatientCancle(String patientName,String patientCode,String doctor,String cancleReason, String cancleContent) {
		JSONObject msg = new JSONObject();
		msg.put("content",patientName+",您好!您的复诊已被医生取消");
		msg.put("cancleReason",cancleReason);
		msg.put("cancleContent",cancleContent);
		return imUtil.sendImMsg(doctor, doctorName, session_id, "36",msg.toString(),"1");
		logger.info("开始发送"+msg.toJSONString());
		return imUtil.sendMessage(doctor,patientCode,"2",msg.toString());
	}
}

+ 59 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorBackgroundDO.java

@ -0,0 +1,59 @@
package com.yihu.jw.entity.base.doctor;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* 医生背景图实体
*
* @author
*
*/
@Entity
@Table(name = "base_doctor_background")
public class BaseDoctorBackgroundDO extends UuidIdentityEntityWithOperator {
    /**
     * 医生code
     */
    private String doctor;
    /**
     * 背景图片名称;
     */
    private String title;
    /**
     * 背景图片地址;
     */
    private String background;
    @Column(name = "title")
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "background")
    public String getBackground() {
        return background;
    }
    public void setBackground(String background) {
        this.background = background;
    }
}

+ 99 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java

@ -2,7 +2,6 @@ package com.yihu.jw.entity.base.doctor;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import org.hibernate.annotations.Where;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -195,6 +194,42 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
     */
    private String fee;
    /**
     * 医生风采图,图片逗号隔开
     */
    private String img;
    /**
     * 医生出诊医院code
     */
    private String visitHospital;
    /**
     * 医生出诊医院名称
     */
    private String visitHospitalName;
    /**
     * 出诊科室code
     */
    private String visitDept;
    /**
     * 出诊科室名称
     */
    private String visitDeptName;
    /**
     * 背景图片
     */
    private String background;
    /**
     * 背景图片code
     */
    private String backgroundId;
	@Column(name = "password")
    public String getPassword() {
        return password;
@ -477,4 +512,67 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    public void setFee(String fee) {
        this.fee = fee;
    }
    @Column(name = "img")
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    @Column(name = "visit_hospital")
    public String getVisitHospital() {
        return visitHospital;
    }
    public void setVisitHospital(String visitHospital) {
        this.visitHospital = visitHospital;
    }
    @Column(name = "visit_hospital_name")
    public String getVisitHospitalName() {
        return visitHospitalName;
    }
    public void setVisitHospitalName(String visitHospitalName) {
        this.visitHospitalName = visitHospitalName;
    }
    @Column(name = "visit_dept")
    public String getVisitDept() {
        return visitDept;
    }
    public void setVisitDept(String visitDept) {
        this.visitDept = visitDept;
    }
    @Column(name = "visit_dept_name")
    public String getVisitDeptName() {
        return visitDeptName;
    }
    public void setVisitDeptName(String visitDeptName) {
        this.visitDeptName = visitDeptName;
    }
    @Column(name = "background")
    public String getBackground() {
        return background;
    }
    public void setBackground(String background) {
        this.background = background;
    }
    @Column(name = "background_id")
    public String getBackgroundId() {
        return backgroundId;
    }
    public void setBackgroundId(String backgroundId) {
        this.backgroundId = backgroundId;
    }
}

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultTeamDo.java

@ -20,8 +20,8 @@ public class ConsultTeamDo extends UuidIdentityEntity {
	private String consult;         // 咨询标识
	private String doctor;          // 医生标识
	private String team;            // 三师团队标识
	private Integer type;           //  1、三师咨询,2、家庭医生咨询,
	// 6、患者名医咨询 7医生名医咨询 8续方咨询 9在线复诊咨询(居民直接咨询专家)
	private Integer type;           //  1、15三师咨询,2、家庭医生咨询,
	// 6、患者名医咨询 7医生名医咨询 8续方咨询 9、16在线复诊咨询(居民直接咨询专家)
	// 10医生发起的求助 11思明区上门服务在线咨询
	// 13、互联网医院专家咨询
	private String patient;         // 提问者标识

+ 219 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientBusinessDO.java

@ -0,0 +1,219 @@
package com.yihu.jw.entity.base.patient;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.survey.WlyySurveyTemplateDO;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
 * 居民业务关联实体
 *
 * @author
 */
@Entity
@Table(name = "base_patient_business")
public class BasePatientBusinessDO extends UuidIdentityEntityWithOperator {
    /**
     * 患者code
     */
    private String patient;
    /**
     * 患者名字
     */
    private String patientName;
    /**
     * 医生code
     */
    private String doctor;
    /**
     * 医生名字
     */
    private String doctorName;
    /**
     * 业务code
     */
    private String relationCode;
    /**
     * 业务名称
     */
    private String relationName;
    /**
     * 业务类型1、文章2、问卷
     */
    private Integer relationType;
    /**
     * 是否收藏
     */
    private Integer collection;
    /**
     * 1已读0未读
     */
    private Integer isRead;
    /**
     * 1已赞,0未赞
     */
    private Integer fabulous;
    /**
     * 1分享0未分享
     */
    private Integer share;
    /**
     * 状态1正常0删除
     */
    private Integer del;
    /**
     * 会话id
     */
    private String sessionId;
    @Transient
    KnowledgeArticleDO knowledgeArticleDO;
    @Transient
    WlyySurveyTemplateDO wlyySurveyTemplateDO;
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getRelationCode() {
        return relationCode;
    }
    public void setRelationCode(String relationCode) {
        this.relationCode = relationCode;
    }
    public String getRelationName() {
        return relationName;
    }
    public void setRelationName(String relationName) {
        this.relationName = relationName;
    }
    public Integer getRelationType() {
        return relationType;
    }
    public void setRelationType(Integer relationType) {
        this.relationType = relationType;
    }
    @Transient
    public Integer getCollection() {
        return collection;
    }
    public void setCollection(Integer collection) {
        this.collection = collection;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    @Transient
    public KnowledgeArticleDO getKnowledgeArticleDO() {
        return knowledgeArticleDO;
    }
    public void setKnowledgeArticleDO(KnowledgeArticleDO knowledgeArticleDO) {
        this.knowledgeArticleDO = knowledgeArticleDO;
    }
    @Transient
    public WlyySurveyTemplateDO getWlyySurveyTemplateDO() {
        return wlyySurveyTemplateDO;
    }
    public void setWlyySurveyTemplateDO(WlyySurveyTemplateDO wlyySurveyTemplateDO) {
        this.wlyySurveyTemplateDO = wlyySurveyTemplateDO;
    }
    @Transient
    public Integer getFabulous() {
        return fabulous;
    }
    public void setFabulous(Integer fabulous) {
        this.fabulous = fabulous;
    }
    @Transient
    public Integer getShare() {
        return share;
    }
    public void setShare(Integer share) {
        this.share = share;
    }
    @Transient
    public Integer getIsRead() {
        return isRead;
    }
    public void setIsRead(Integer isRead) {
        this.isRead = isRead;
    }
    public String getSessionId() {
        return sessionId;
    }
    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }
}

+ 1 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/score/BaseEvaluateScoreDO.java

@ -26,6 +26,7 @@ public class BaseEvaluateScoreDO extends UuidIdentityEntityWithOperator {
    private Double score;//主表分数',
    private Integer type;//1、实名,2、匿名',
    @Column(name = "city")
    public String getCity() {
        return city;

+ 61 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/words/BaseImportSensitiveDO.java

@ -0,0 +1,61 @@
package com.yihu.jw.entity.base.words;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/7/6
 */
@Entity
@Table(name = "base_import_sensitive")
public class BaseImportSensitiveDO extends UuidIdentityEntityWithOperator {
    @Column(name = "row")
    private String row;
    @Column(name = "problem")
    private String problem;
    @Column(name = "operator_code")
    private String operatorCode;
    @Column(name = "operator")
    private String operator;
    public String getRow() {
        return row;
    }
    public void setRow(String row) {
        this.row = row;
    }
    public String getProblem() {
        return problem;
    }
    public void setProblem(String problem) {
        this.problem = problem;
    }
    public String getOperatorCode() {
        return operatorCode;
    }
    public void setOperatorCode(String operatorCode) {
        this.operatorCode = operatorCode;
    }
    public String getOperator() {
        return operator;
    }
    public void setOperator(String operator) {
        this.operator = operator;
    }
}

+ 86 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/words/BaseSensitiveDO.java

@ -0,0 +1,86 @@
package com.yihu.jw.entity.base.words;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/7/6
 */
@Entity
@Table(name = "base_sensitive")
public class BaseSensitiveDO extends UuidIdentityEntityWithOperator {
    @Column(name = "sensitive_word")
    private String sensitiveWord;//敏感词
    @Column(name = "explanation")
    private String explanation;//说明
    @Column(name = "status")
    private String status;//状态 0:关闭  1:开启
    @Column(name = "operator_code")
    private String operatorCode;//操作者code
    @Column(name = "operator")
    private String operator;//操作者
    @Column(name = "add_time")
    private Date addTime;
    public String getSensitiveWord() {
        return sensitiveWord;
    }
    public void setSensitiveWord(String sensitiveWord) {
        this.sensitiveWord = sensitiveWord;
    }
    public String getExplanation() {
        return explanation;
    }
    public void setExplanation(String explanation) {
        this.explanation = explanation;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public String getOperator() {
        return operator;
    }
    public void setOperator(String operator) {
        this.operator = operator;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getAddTime() {
        return addTime;
    }
    public void setAddTime(Date addTime) {
        this.addTime = addTime;
    }
    public String getOperatorCode() {
        return operatorCode;
    }
    public void setOperatorCode(String operatorCode) {
        this.operatorCode = operatorCode;
    }
}

+ 93 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeArticleDO.java

@ -5,6 +5,7 @@ import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
/**
@ -35,6 +36,22 @@ public class KnowledgeArticleDO extends UuidIdentityEntity {
	private Integer del; // 是否删除,1正常,0删除
	private Integer status;// 0未审核 1已审核
	private String cancelReason;//退回理由
	private Integer used;//常用数
	private Integer readCount;//已读数
	private Integer collection;//收藏数量
	private Integer fabulous;//点赞数量
	private Integer share;//分享 数量
	@Transient
	private Integer isUsed;//是否已设置常用
	@Transient
	private KnowledgeArticleUserDO knowledgeArticleUserDO;
	@Transient
	private String deptName;
	@Transient
	private String hospitalName;
	
	
	public String getCreateUser() {
@ -172,4 +189,80 @@ public class KnowledgeArticleDO extends UuidIdentityEntity {
	public void setCreateUserDeptName(String createUserDeptName) {
		this.createUserDeptName = createUserDeptName;
	}
	public Integer getUsed() {
		return used;
	}
	public void setUsed(Integer used) {
		this.used = used;
	}
	@Transient
	public String getDeptName() {
		return deptName;
	}
	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}
	@Transient
	public String getHospitalName() {
		return hospitalName;
	}
	public void setHospitalName(String hospitalName) {
		this.hospitalName = hospitalName;
	}
	public Integer getCollection() {
		return collection;
	}
	public void setCollection(Integer collection) {
		this.collection = collection;
	}
	public Integer getFabulous() {
		return fabulous;
	}
	public void setFabulous(Integer fabulous) {
		this.fabulous = fabulous;
	}
	public Integer getShare() {
		return share;
	}
	public void setShare(Integer share) {
		this.share = share;
	}
	public Integer getReadCount() {
		return readCount;
	}
	public void setReadCount(Integer readCount) {
		this.readCount = readCount;
	}
	@Transient
	public Integer getIsUsed() {
		return isUsed;
	}
	public void setIsUsed(Integer isUsed) {
		this.isUsed = isUsed;
	}
	@Transient
	public KnowledgeArticleUserDO getKnowledgeArticleUserDO() {
		return knowledgeArticleUserDO;
	}
	public void setKnowledgeArticleUserDO(KnowledgeArticleUserDO knowledgeArticleUserDO) {
		this.knowledgeArticleUserDO = knowledgeArticleUserDO;
	}
}

+ 130 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeArticleUserDO.java

@ -0,0 +1,130 @@
package com.yihu.jw.entity.hospital.article;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
 * 健康文章中间表
 * @author
 * @date
 */
@Entity
@Table(name = "wlyy_knowledge_article_user")
public class KnowledgeArticleUserDO extends UuidIdentityEntityWithOperator {
	private String user;//用户code
	private String userName;//用户名称
	private String relationCode;//文章code或者问卷code
	private Integer relationType;//1文章2问卷
	private String relationName;//文章名称
	private Integer fabulous;//1已赞0未赞
	private Integer isRead;//1已读0未读
	private Integer share;//1已分享0未分享
	private Integer collection;//是否收藏1是0否
	private Integer used;//1常用0不常用
	private Integer del;//是否删除,1正常,0删除
	@Transient
	KnowledgeArticleDO knowledgeArticleDO;
	public String getUser() {
		return user;
	}
	public void setUser(String user) {
		this.user = user;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getRelationCode() {
		return relationCode;
	}
	public void setRelationCode(String relationCode) {
		this.relationCode = relationCode;
	}
	public Integer getRelationType() {
		return relationType;
	}
	public void setRelationType(Integer relationType) {
		this.relationType = relationType;
	}
	public String getRelationName() {
		return relationName;
	}
	public void setRelationName(String relationName) {
		this.relationName = relationName;
	}
	public Integer getFabulous() {
		return fabulous;
	}
	public void setFabulous(Integer fabulous) {
		this.fabulous = fabulous;
	}
	public Integer getIsRead() {
		return isRead;
	}
	public void setIsRead(Integer isRead) {
		this.isRead = isRead;
	}
	public Integer getShare() {
		return share;
	}
	public void setShare(Integer share) {
		this.share = share;
	}
	public Integer getCollection() {
		return collection;
	}
	public void setCollection(Integer collection) {
		this.collection = collection;
	}
	public Integer getUsed() {
		return used;
	}
	public void setUsed(Integer used) {
		this.used = used;
	}
	public Integer getDel() {
		return del;
	}
	public void setDel(Integer del) {
		this.del = del;
	}
	@Transient
	public KnowledgeArticleDO getKnowledgeArticleDO() {
		return knowledgeArticleDO;
	}
	public void setKnowledgeArticleDO(KnowledgeArticleDO knowledgeArticleDO) {
		this.knowledgeArticleDO = knowledgeArticleDO;
	}
}

+ 102 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/BaseBannerDO.java

@ -0,0 +1,102 @@
package com.yihu.jw.entity.hospital.message;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * @author zmk
 * @vsrsion 1.0
 * Created at 2019/11/13
 */
@Entity
@Table(name = "base_banner")
public class BaseBannerDO extends UuidIdentityEntityWithOperator {
    /**
     *锦旗名称
     */
    private String name;
    /*
      *医生id
     */
    private String saasId;
    /**
     *锦旗描述
     */
    private String description;
    /**
     *锦旗图标
     */
    private String img;
    /**
     * 排序
     */
    private Integer sort;
    /*
    *状态
     */
    private Integer status;
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "description")
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    @Column(name = "img")
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    @Column(name = "sort")
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
}

+ 128 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/BaseBannerDoctorDO.java

@ -0,0 +1,128 @@
package com.yihu.jw.entity.hospital.message;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * @author zmk
 * @vsrsion 1.0
 * Created at 2019/11/13
 */
@Entity
@Table(name = "base_banner_doctor")
public class BaseBannerDoctorDO extends UuidIdentityEntityWithOperator {
    /**
     *锦旗id
     */
    private String bannerId;
    /**
     *医生code
     */
    private String doctor;
    /**
     *医生名称
     */
    private String doctorName;
    /**
     *患者id
     */
    private String patientId;
    /**
     *患者名称
     */
    private String patientName;
    /**
     *业务id
     */
    private String relationCode;
    /**
     *业务名称
     */
    private String relationName;
    /**
     *内容
     */
    private String content;
    /**
     *给医生送锦旗1/评价送锦旗0
     */
    private Integer relationType;
    public Integer getRelationType() {
        return relationType;
    }
    public void setRelationType(Integer relationType) {
        this.relationType = relationType;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getPatientId() {
        return patientId;
    }
    public void setPatientId(String patientId) {
        this.patientId = patientId;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getRelationCode() {
        return relationCode;
    }
    public void setRelationCode(String relationCode) {
        this.relationCode = relationCode;
    }
    @Column(name = "relation_name")
    public String getRelationName() {
        return relationName;
    }
    public void setRelationName(String rerelationName) {
        this.relationName = rerelationName;
    }
    @Column(name = "banner_id")
    public String getBannerId() {
        return bannerId;
    }
    public void setBannerId(String bannerId) {
        this.bannerId = bannerId;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
}

+ 157 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/BaseUserMessageDO.java

@ -0,0 +1,157 @@
package com.yihu.jw.entity.hospital.message;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.*;
import java.util.List;
/**
 * @author zmk
 * @vsrsion 1.0
 * Created at 2019/11/13
 */
@Entity
@Table(name = "base_user_message")
public class BaseUserMessageDO extends UuidIdentityEntityWithOperator {
    /**
     *发送者code
     */
    private String sender;
    /**
     *发送内容
     */
    private String content;
    /**
     * 发送者名字
     */
    private String senderName;
    /**
     *接收者
     */
    private String receiver;
    /**
     * 接收者名称
     */
    private String receiverName;
    /**
     *业务code
     */
    private String relationCode;
    /**
     * 业务类型 1自身留言,2、锦旗留言,3、专家咨询,4、在线复诊
     */
    private Integer relationType;
    /**
     * 业务名称
     */
    private String relationName;
    /**
     *1居民发起留言2回复
     */
    private Integer status;
    /**
     * 删除状态(1正常0删除)
     */
    private Integer del;
    @Transient
    private List<BaseUserMsgContentDO> msgList;
    @Transient
    public List<BaseUserMsgContentDO> getMsgList() {
        return msgList;
    }
    public void setMsgList(List<BaseUserMsgContentDO> msgList) {
        this.msgList = msgList;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public void setRelationType(Integer relationType) {
        this.relationType = relationType;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getSender() {
        return sender;
    }
    public void setSender(String sender) {
        this.sender = sender;
    }
    public String getSenderName() {
        return senderName;
    }
    public void setSenderName(String senderName) {
        this.senderName = senderName;
    }
    public String getReceiver() {
        return receiver;
    }
    public void setReceiver(String receiver) {
        this.receiver = receiver;
    }
    public String getReceiverName() {
        return receiverName;
    }
    public void setReceiverName(String receiverName) {
        this.receiverName = receiverName;
    }
    public String getRelationCode() {
        return relationCode;
    }
    public void setRelationCode(String relationCode) {
        this.relationCode = relationCode;
    }
    public String getRelationName() {
        return relationName;
    }
    public void setRelationName(String relationName) {
        this.relationName = relationName;
    }
    public Integer getRelationType() {
        return relationType;
    }
}

+ 130 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/BaseUserMsgContentDO.java

@ -0,0 +1,130 @@
package com.yihu.jw.entity.hospital.message;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.*;
@Entity
@Table(name = "base_user_msg_content")
public class BaseUserMsgContentDO extends UuidIdentityEntityWithOperator {
    /**
     *留言表Id
     */
    private String baseUserMsgId;
    /**
     *留言内容
     */
    private String content;
    /**
     *评论人Id
     */
    private String sender;
    /**
     *评论人Name
     */
    private String senderName;
    /**
     *接收人ID
     */
    private String receiver;
    /**
     *接收人Name
     */
    private String receiverName;
    /**
     *状态(1未回复、2回复)
     */
    private Integer status;
    /**
     *是否删除(1正常0删除)
     */
    private Integer del;
    /**
     *是否是医生(1是0不是)
     */
    private Integer isDoctor;
    public Integer getIsDoctor() {
        return isDoctor;
    }
    public void setIsDoctor(Integer isDoctor) {
        this.isDoctor = isDoctor;
    }
    private BaseUserMessageDO baseUserMessageDO;
    @Transient
    @ManyToOne
    @JoinColumn(name="id")
    public BaseUserMessageDO getBaseUserMessageDO() {
        return baseUserMessageDO;
    }
    public void setBaseUserMessageDO(BaseUserMessageDO baseUserMessageDO) {
        this.baseUserMessageDO = baseUserMessageDO;
    }
    public String getBaseUserMsgId() {
        return baseUserMsgId;
    }
    public void setBaseUserMsgId(String baseUserMsgId) {
        this.baseUserMsgId = baseUserMsgId;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getSender() {
        return sender;
    }
    public void setSender(String sender) {
        this.sender = sender;
    }
    public String getSenderName() {
        return senderName;
    }
    public void setSenderName(String senderName) {
        this.senderName = senderName;
    }
    public String getReceiver() {
        return receiver;
    }
    public void setReceiver(String receiver) {
        this.receiver = receiver;
    }
    public String getReceiverName() {
        return receiverName;
    }
    public void setReceiverName(String receiverName) {
        this.receiverName = receiverName;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 11 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java

@ -231,8 +231,18 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
     */
    private Integer payStatus;
    private String  operator;
	@Column(name = "adm_no")
    @Column(name = "operator")
    public String getOperator() {
        return operator;
    }
    public void setOperator(String operator) {
        this.operator = operator;
    }
    @Column(name = "adm_no")
    public String getAdmNo() {
        return admNo;
    }

+ 14 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionExpressageDO.java

@ -41,6 +41,11 @@ public class WlyyPrescriptionExpressageDO extends UuidIdentityEntity {
	 */
	private String mobile;
    /**
     * 顺丰业务号
     */
	private String bspOrderNo;
    /**
	 * 收货人座机号 0592-1111111
	 */
@ -324,4 +329,13 @@ public class WlyyPrescriptionExpressageDO extends UuidIdentityEntity {
    public void setDel(Integer del) {
        this.del = del;
    }
    @Column(name = "bsp_order_no")
    public String getBspOrderNo() {
        return bspOrderNo;
    }
    public void setBspOrderNo(String bspOrderNo) {
        this.bspOrderNo = bspOrderNo;
    }
}

+ 14 - 1
common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java

@ -397,7 +397,7 @@ public class BaseRequestMapping {
    /**
     * 医生基础信息
     * 医生基础信息  BaseSensitive
     */
    public static class BaseDoctor extends Basic {
        public static final String PREFIX  = "/baseDoctor";
@ -412,6 +412,19 @@ public class BaseRequestMapping {
    }
    public static class BaseSensitive extends Basic {
        public static final String PREFIX  = "/baseSensitive";
        public static final String createSensitiveWords = "/createSensitiveWords";
        public static final String updateSensitiveWords = "/updateSensitiveWords";
        public static final String delSensitiveWords = "/delSensitiveWords";
        public static final String updateSensitiveWordsStatus = "/updateSensitiveWordsStatus";
        public static final String findSensitiveWords = "/findSensitiveWords";
        public static final String importSensitiveWords = "/importSensitiveWords";
        public static final String exportSensitiveWordsLog = "/exportSensitiveWordsLog";
        public static final String filterSensitiveWords = "/filterSensitiveWords";
    }
    /**
     * 医生职业信息
     */

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

@ -121,7 +121,7 @@ public class BaseHospitalRequestMapping {
         * 查询机构底下部门
         */
        public static final String findDeptByOrgCode ="/findDeptByOrgCode";
    
        /**
         * 查询有所有已开放的科室
         */
@ -131,17 +131,17 @@ public class BaseHospitalRequestMapping {
         * 查询部门下医生
         */
        public static final String findDoctorByHospitalAndDept = "/findDoctorByHospitalAndDept";
    
        /**
         * 根据疾病名称,热门部门查询医生
         */
        public static final String findDoctorByHospitalAndDiseaseAndDept = "/findDoctorByHospitalAndDiseaseAndDept";
    
        /**
         * 居民关注医院
         */
        public static final String followOrgByPatient = "/followOrgByPatient";
    
        /**
         * 获取常见疾病、热门部门、医生拒绝接诊原因 字典
         */
@ -216,6 +216,8 @@ public class BaseHospitalRequestMapping {
         */
        public static final String findDoctorInfo="/findDoctorInfo";
        public static final String updateDoctorInfo="/updateDoctorInfo";
        public static final String findDoctorBaseInfo="/findDoctorBaseInfo";
        /**
         * 取消门诊
@ -372,7 +374,7 @@ public class BaseHospitalRequestMapping {
         * 居民取消续方
         */
        public static final String cancelPrescription ="/cancelPrescription";
    
        //居民获取当日就诊列表
        public static final String getTodayOutpatinetList ="/getTodayOutpatinetList";
@ -401,10 +403,10 @@ public class BaseHospitalRequestMapping {
        public static final String getDoctorIntroduction ="/getDoctorIntroduction";
        public static final String findByDict ="/findByDict";
    
        //根据居民CODE换取居民请求秘钥
        public static final String getPatientAccetokenByIdcard="/getPatientAccetokenByIdcard";
    
        //医生待办事项列表
        public static final String doctorUpcomingList = "/doctorUpcomingList";
@ -480,10 +482,6 @@ public class BaseHospitalRequestMapping {
        public static final String updatePayStatus = "/updatePayStatus";
        public static final String findPatNoByPatient = "/findPatNoByPatient";
    }
    public static class YkyyPrescription extends BaseHospitalRequestMapping.Basic {
@ -978,6 +976,9 @@ public class BaseHospitalRequestMapping {
    
        //医生端:进行中的专家咨询数量
        public static final String doctorSpecialistConsultCount="doctorSpecialistConsultCount";
        //医生端:进行中的专家咨询人数
        public static final String doctorSpecialistConsultCountNew="doctorSpecialistConsultCountNew";
    
        //医生端:图文复诊、视频复诊咨询数量、协同门诊候诊数量
        public static final String doctorReviewConsultCount="doctorReviewConsultCount";
@ -1060,7 +1061,22 @@ public class BaseHospitalRequestMapping {
    
        //设置部门发送文章
        public static final String saveDeptArticle  = "/saveDeptArticle";
        
        //发送居民业务
        public static final String sendPatientBusiness  = "/sendPatientBusiness";
        //设置为常用/不常用
        public static final String setArticleUsed  = "/setArticleUsed";
        //获取患者文章列表
        public static final String searchPatientArticle  = "/searchPatientArticle";
        //查询文章收藏,转发,点赞
        public static final String searchArticleByStatus  = "/searchArticleByStatus";
        //设置文章状态
        public static final String setArticleCollection  = "/setArticleCollection";
        
    }
@ -1110,8 +1126,57 @@ public class BaseHospitalRequestMapping {
        public static final String updateMessage  = "/updateMessage";
        public static final String searchMessagePageList  = "/searchMessagePageList";
        public static final String queryById  = "/queryById";
    }
    /**
     * 医生锦旗管理
     */
    public static class BaseBannerssage extends Basic{
        public static final String baseBanner  = "/baseBanner";
        public static final String queryByAndStatud = "/getByNameAndStatus";
        public static final String createBanner = "/creaetBanner";
        public static final String updateBanner = "/updateBanner";
        public static final String deleteBanner = "/deleteBanner";
        public static final String upBanner = "/upBanner";
        public static final String downBanner = "/downBanner";
        public static final String onOff = "/onOff";
    }
    /**
     * 医生锦旗展示
     */
    public static class DoctorBanner extends Basic{
        public static final String doctorBanner  = "/doctorBanner";
        public static final String giveBanner  = "/giveBanner";
        public static final String getBanner  = "/getBanner";
    }
    /**
     * 背景展示
     */
    public static class BaseBackground extends Basic{
        public static final String backgroundManage  = "/backgroundManage";
        public static final String getAllBackground  = "/getAllBackground";
        public static final String saveDoctorBG  = "/saveDoctorBG";;
        public static final String createDoctorBG  = "/createDoctorBG";
        public static final String removeDoctorBG  = "/removeDoctorBG";
        public static final String updateDoctorBG  = "/updateDoctorBG";
    }
    /**
     * 留言展示
     */
    public static class UserMessage extends Basic{
        public static final String userMessage  = "/userMessage";
        public static final String leaveMessage  = "/leaveMessage";
        public static final String responseMessage  = "/responseMessage";
        public static final String showMessage  = "/showMessage";
        public static final String getSingleMessage  = "/getSingleMessage";
        public static final String expertMessage  = "/expertMessage";
        public static final String onlineVisitMessage  = "/onlineVisitMessage";
        public static final String getMessage  = "/getMessage";
        public static final String getPoint  = "/getPoint";
    }
    /**
     * 医生分析总览
     */

+ 22 - 0
common/common-util/src/main/java/com/yihu/jw/util/date/DateUtil.java

@ -422,6 +422,28 @@ public class DateUtil {
    }
    /*
     * 将时间戳转换为时间
     */
    public static String stampToString(String s){
        String res;
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        long lt = new Long(s);
        Date date = new Date(lt);
        res = simpleDateFormat.format(date);
        return res;
    }
    /*
     * 将时间戳转换为时间
     */
    public static Date stampToDate(String s){
        long lt = new Long(s);
        Date date = new Date(lt);
        return date;
    }
    public static String getNextDay(Date d, int days) {
        Calendar c = Calendar.getInstance();
        c.setTime(d);

+ 3 - 3
server/svr-authentication/pom.xml

@ -75,11 +75,11 @@
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
       <!-- <dependency>
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
            &lt;!&ndash; <scope>runtime</scope> &ndash;&gt;
        </dependency>-->
            <!-- <scope>runtime</scope> -->
        </dependency>
        <!-- Redis  -->
        <dependency>

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

@ -199,7 +199,8 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        if (null == authenticatedClient) {
            throw new InvalidRequestException("client_id");
        }
        logger.info("login:登录进入4");
        logger.info("login:登录进入4"+authenticatedClient.getClientId());
        TokenRequest tokenRequest = oAuth2RequestFactory.createTokenRequest(parameters, authenticatedClient);
        oAuth2RequestValidator.validateScope(tokenRequest, authenticatedClient);
        OAuth2AccessToken token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
@ -209,15 +210,15 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        /*如果是移动端登陆则移除之前的token,
        在网关处通过HTTP状态码告知前端是过期(402)还是账号在别处登陆(403),
        实现同一账号只能在一处登陆*/
//        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
//        if (request.getHeader("login-device") != null && request.getHeader("login-device").equals("mobile")) {
//            tokenStore.removeAccessToken(token.getValue());
//            tokenStore.removeRefreshToken(token.getRefreshToken().getValue());
//            token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
//        }
//        if (token == null) {
//            throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
//        }
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        if (request.getHeader("login-device") != null && (request.getHeader("login-device").equalsIgnoreCase("mobile")||request.getHeader("login-device").equalsIgnoreCase("pc"))) {
            tokenStore.removeAccessToken(token.getValue());
            tokenStore.removeRefreshToken(token.getRefreshToken().getValue());
            token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
        }
        if (token == null) {
            throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
        }
        WlyyUserSimple wlyyUserSimple = userDetailsService.authSuccess(parameters.get("username"));
        wlyyUserSimple.setAccessToken(token.getValue());
        wlyyUserSimple.setTokenType(token.getTokenType());
@ -650,7 +651,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
            在网关处通过HTTP状态码告知前端是过期 还是账号在别处登陆
            实现同一账号只能在一处登陆*/
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            if (request.getHeader("login-device") != null && request.getHeader("login-device").equals("mobile")) {
            if (request.getHeader("login-device") != null && (request.getHeader("login-device").equalsIgnoreCase("mobile")||request.getHeader("login-device").equalsIgnoreCase("pc"))) {
                tokenStore.removeAccessToken(token.getValue());
                tokenStore.removeRefreshToken(token.getRefreshToken().getValue());
                token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
@ -1511,15 +1512,15 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        /*如果是移动端登陆则移除之前的token,
        在网关处通过HTTP状态码告知前端是过期(402)还是账号在别处登陆(403),
        实现同一账号只能在一处登陆*/
//        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
//        if (request.getHeader("login-device") != null && request.getHeader("login-device").equals("mobile")) {
//            tokenStore.removeAccessToken(token.getValue());
//            tokenStore.removeRefreshToken(token.getRefreshToken().getValue());
//            token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
//        }
//        if (token == null) {
//            throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
//        }
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        if (request.getHeader("login-device") != null && (request.getHeader("login-device").equalsIgnoreCase("mobile")||request.getHeader("login-device").equalsIgnoreCase("pc"))) {
            tokenStore.removeAccessToken(token.getValue());
            tokenStore.removeRefreshToken(token.getRefreshToken().getValue());
            token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
        }
        if (token == null) {
            throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
        }
        WlyyUserSimple wlyyUserSimple = userDetailsService.authSuccess(parameters.get("username"));
        wlyyUserSimple.setAccessToken(token.getValue());
        wlyyUserSimple.setTokenType(token.getTokenType());

+ 2 - 0
server/svr-authentication/src/main/resources/application.yml

@ -4,6 +4,8 @@ server:
spring:
  datasource:
  hikari:
    registerMbeans: true
    driver-class-name: com.mysql.jdbc.Driver
    max-active: 100
    max-idle: 100 #最大空闲连接

+ 14 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/word/BaseImportSensitiveDao.java

@ -0,0 +1,14 @@
package com.yihu.jw.base.dao.word;
import com.yihu.jw.entity.base.words.BaseImportSensitiveDO;
import com.yihu.jw.entity.base.words.BaseSensitiveDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/7/6
 */
public interface BaseImportSensitiveDao  extends PagingAndSortingRepository<BaseImportSensitiveDO, String>, JpaSpecificationExecutor<BaseImportSensitiveDO> {
}

+ 16 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/word/BaseSensitiveWordDao.java

@ -0,0 +1,16 @@
package com.yihu.jw.base.dao.word;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.words.BaseSensitiveDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/7/6
 */
public interface BaseSensitiveWordDao extends PagingAndSortingRepository<BaseSensitiveDO, String>, JpaSpecificationExecutor<BaseSensitiveDO> {
    BaseSensitiveDO findBySensitiveWord(String sensitive);
}

+ 1 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/excel/AExcelReader.java

@ -1,6 +1,7 @@
package com.yihu.jw.base.endpoint.common.excel;
import com.yihu.jw.base.service.doctor.excelImport.BaseDoctorExcelDO;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;

+ 8 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/saas/SaasEndpoint.java

@ -186,13 +186,18 @@ public class SaasEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        List<SaasDO> saasDOS = saasService.search(fields, filters, sorts, page, size);
        if (saasDOS.isEmpty()){
        if (saasDOS==null&&saasDOS.size()==0){
            return PageEnvelop.getSuccess("无信息");
        }
        saasDOS.forEach(saas->{
        for (SaasDO saas : saasDOS) {
            SaasTypeDictDO saasTypeDictDO = saasTypeDictService.findById(saas.getType());
            if (saasTypeDictDO==null){
                return PageEnvelop.getSuccess("租户类型字典为空");
            }
            saas.setTypeName(saasTypeDictDO.getName());
        });
        }
        int count = (int)saasService.getCount(filters);
        return success(saasDOS, count, page, size, SaasVO.class);
    }

+ 171 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/word/BaseSensitiveEndpoint.java

@ -0,0 +1,171 @@
package com.yihu.jw.base.endpoint.word;
import com.yihu.jw.base.service.doctor.excelImport.BaseDoctorExcelDO;
import com.yihu.jw.base.service.word.BaseSensitiveService;
import com.yihu.jw.base.service.word.BaseSensitiveExcelReader;
import com.yihu.jw.base.service.word.excelImport.BaseSensitiveExcelDO;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/7/6
 */
@RestController
@RequestMapping(value = BaseRequestMapping.BaseSensitive.PREFIX)
@Api(value = "敏感词汇管理", description = "敏感词汇管理服务接口", tags = {"wlyy基础服务 - 敏感词汇管理服务接口"})
public class BaseSensitiveEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseSensitiveService baseSensitiveService;
    @Autowired
    private BaseSensitiveExcelReader baseSensitiveExcelReader;
    @Value("${fastDFS.fastdfs_file_url}")
    private String fastdfs_file_url;
    @PostMapping(value = BaseRequestMapping.BaseSensitive.createSensitiveWords)
    @ApiOperation(value = "创建敏感词汇")
    public MixEnvelop createSensitiveWords (
            @ApiParam(name = "words", value = "敏感词")
            @RequestParam(value = "words", required = false) String words,
            @ApiParam(name = "explanation", value = "说明")
            @RequestParam(value = "explanation", required = false) String explanation,
            @ApiParam(name = "status", value = "status")
            @RequestParam(value = "status", required = false,defaultValue = "1") Integer status) throws Exception {
        try {
            baseSensitiveService.createSensitiveWords(words,explanation,status+"",getUID(),getUNAME());
            return MixEnvelop.getSuccess("创建成功");
        } catch (Exception e) {
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = BaseRequestMapping.BaseSensitive.updateSensitiveWords)
    @ApiOperation(value = "更新敏感词汇")
    public MixEnvelop updateSensitiveWords (
            @ApiParam(name = "id", value = "id")
            @RequestParam(value = "id", required = false) String id,
            @ApiParam(name = "words", value = "敏感词")
            @RequestParam(value = "words", required = false) String words,
            @ApiParam(name = "explanation", value = "说明")
            @RequestParam(value = "explanation", required = false) String explanation,
            @ApiParam(name = "status", value = "status")
            @RequestParam(value = "status", required = false,defaultValue = "1") String status) throws Exception {
        try {
            baseSensitiveService.updateSensitiveWords(id,words,explanation,status,getUID(),getUNAME());
            return MixEnvelop.getSuccess("更新成功");
        } catch (Exception e) {
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = BaseRequestMapping.BaseSensitive.delSensitiveWords)
    @ApiOperation(value = "删除敏感词汇")
    public MixEnvelop delSensitiveWords (
            @ApiParam(name = "ids", value = "ids")
            @RequestParam(value = "ids", required = false) String ids) throws Exception {
        try {
            baseSensitiveService.delSensitiveWords(ids);
            return MixEnvelop.getSuccess("删除成功");
        } catch (Exception e) {
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = BaseRequestMapping.BaseSensitive.updateSensitiveWordsStatus)
    @ApiOperation(value = "修改敏感词汇状态")
    public MixEnvelop updateSensitiveWordsStatus (
            @ApiParam(name = "ids", value = "ids")
            @RequestParam(value = "ids", required = false) String ids,
            @ApiParam(name = "status", value = "status")
            @RequestParam(value = "status", required = false,defaultValue = "1") Integer status) throws Exception {
        try {
            baseSensitiveService.updateSensitiveWordsStatus(ids,status+"",getUID(),getUNAME());
            return MixEnvelop.getSuccess("修改成功");
        } catch (Exception e) {
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = BaseRequestMapping.BaseSensitive.findSensitiveWords)
    @ApiOperation(value = "查找敏感词")
    public MixEnvelop findSensitiveWords (
            @ApiParam(name = "page", value = "page")
            @RequestParam(value = "page", required = false,defaultValue = "1") Integer page,
            @ApiParam(name = "pageSize", value = "pageSize")
            @RequestParam(value = "pageSize", required = false,defaultValue = "15") Integer pageSize,
            @ApiParam(name = "status", value = "status")
            @RequestParam(value = "status", required = false) Integer status,
            @ApiParam(name = "words", value = "words")
            @RequestParam(value = "words", required = false) String words) throws Exception {
        try {
            return baseSensitiveService.findSensitiveWords(status+"",words,page,pageSize);
        } catch (Exception e) {
            return MixEnvelop.getError(e.getMessage());
        }
    }
//    @GetMapping(value = BaseRequestMapping.BaseSensitive.exportSensitiveWordsLog)
//    @ApiOperation(value = "导出日志")
//    public void exportSensitiveWordsLog (HttpServletResponse response) throws Exception {
//        response.setContentType("octets/stream");
//        response.setHeader("Content-Disposition", "attachment; filename="+ new String( "sensitiveLog.xls"));
//        OutputStream os = response.getOutputStream();
//            baseSensitiveService.exportSensitiveWordsLog(os);
//    }
    @PostMapping(value = BaseRequestMapping.BaseSensitive.importSensitiveWords)
    @ApiOperation(value = "导入敏感词")
    public Envelop importData(
            @ApiParam(name = "file", value = "文件", required = true)
            @RequestPart(value = "file") MultipartFile file,
            HttpServletRequest request,HttpServletResponse response){
        try {
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename="+ new String( "sensitiveLog.xls"));
            OutputStream os = response.getOutputStream();
            request.setCharacterEncoding("UTF-8");
            baseSensitiveExcelReader.read(file);
            //验证未通过(暂无验证)
            List<BaseSensitiveExcelDO> correctLs = baseSensitiveExcelReader.getCorrectLs();
            if(correctLs.size()>0){
                Map<String, Object> result = baseSensitiveService.importSensitive(correctLs,getUID(),getUNAME(),os,fastdfs_file_url);
                return success("导入成功!", result);
            }
        }catch (Exception e){
            e.printStackTrace();
            return failed("导入异常,请检查导入文件格式" + e.getMessage());
        }
        return failed("导入失败");
    }
}

+ 37 - 20
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java

@ -28,6 +28,7 @@ import com.yihu.jw.restmodel.base.wx.WxReplySceneVO;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -84,6 +85,8 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    @Autowired
    private DictDoctorDutyService dictDoctorDutyService;
    @Value("${wechat.flag}")
    private boolean flag;
@ -184,7 +187,12 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                "\ttb.sex AS \"sex\",\n" +
                "\ttb.mobile AS \"mobile\",";
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            sql+="  wm_concat (tb.org || ',') AS \"orgInfo\",";
            if (flag){
                sql+=" GROUP_CONCAT(tb.org SEPARATOR ',') AS orgInfo,";
            }else {
                sql+="  wm_concat (tb.org || ',') AS \"orgInfo\",";
            }
        }else {
            sql+=" GROUP_CONCAT(tb.org SEPARATOR ',') AS orgInfo,";
        }
@ -275,25 +283,34 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        List<Map<String,Object>> list=null;
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            String oracleSql="SELECT\n" +
                    "\t*\n" +
                    "FROM\n" +
                    "\t(\n" +
                    "\t\tSELECT\n" +
                    "\t\t\tA .*\n" +
                    "\t\tFROM\n" +
                    "\t\t\t(";
            oracleSql+=finalSql;
            oracleSql+="\t\t\t) A\n" +
                    "\t\tWHERE\n" +
                    "  ROWNUM <="+page*size +
                    "\t) \n" +
                    "WHERE\n" +
                    "\tROWNUM >= "+(page-1)*size;
            Logger.getAnonymousLogger().info("oracleSql="+oracleSql);
            list = jdbcTemplate.queryForList(oracleSql);
            if (flag){
                finalSql+=" LIMIT  " + (page - 1) * size + "," + size + "";
                Logger.getAnonymousLogger().info("finalCountSql="+finalSql);
                list = jdbcTemplate.queryForList(finalSql);
            }else {
                String oracleSql="SELECT\n" +
                        "\t*\n" +
                        "FROM\n" +
                        "\t(\n" +
                        "\t\tSELECT\n" +
                        "\t\t\tA .*\n" +
                        "\t\tFROM\n" +
                        "\t\t\t(";
                oracleSql+=finalSql;
                oracleSql+="\t\t\t) A\n" +
                        "\t\tWHERE\n" +
                        "  ROWNUM <="+page*size +
                        "\t) \n" +
                        "WHERE\n" +
                        "\tROWNUM >= "+(page-1)*size;
                Logger.getAnonymousLogger().info("oracleSql="+oracleSql);
                list = jdbcTemplate.queryForList(oracleSql);
            }
        }else {
            finalSql+=" LIMIT  " + (page - 1) * size + "," + size + "";
            Logger.getAnonymousLogger().info("finalCountSql="+finalSql);

+ 29 - 18
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java

@ -72,6 +72,8 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
    @Autowired
    private HibenateUtils hibenateUtils;
    @Value("${wechat.flag}")
    private boolean flag;
    /**
     * 机构基础信息列表
@ -149,25 +151,34 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
        List<Map<String, Object>> list=null;
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            String oracleSql="SELECT\n" +
                    "\t*\n" +
                    "FROM\n" +
                    "\t(\n" +
                    "\t\tSELECT\n" +
                    "\t\t\tA .*\n" +
                    "\t\tFROM\n" +
                    "\t\t\t(";
            oracleSql+=finalSql;
            oracleSql+="\t\t\t) A\n" +
                    "\t\tWHERE\n" +
                    "  ROWNUM <="+page*size +
                    "\t) \n" +
                    "WHERE\n" +
                    "\tROWNUM >= "+(page-1)*size;
            list = jdbcTemplate.queryForList(oracleSql);
            if (flag){
                finalSql+=" LIMIT  " + (page - 1) * size + "," + size + "";
                list = jdbcTemplate.queryForList(finalSql);
            }else {
                String oracleSql="SELECT\n" +
                        "\t*\n" +
                        "FROM\n" +
                        "\t(\n" +
                        "\t\tSELECT\n" +
                        "\t\t\tA .*\n" +
                        "\t\tFROM\n" +
                        "\t\t\t(";
                oracleSql+=finalSql;
                oracleSql+="\t\t\t) A\n" +
                        "\t\tWHERE\n" +
                        "  ROWNUM <="+page*size +
                        "\t) \n" +
                        "WHERE\n" +
                        "\tROWNUM >= "+(page-1)*size;
                list = jdbcTemplate.queryForList(oracleSql);
            }
        }else {
            finalSql+=" LIMIT  " + (page - 1) * size + "," + size + "";
            list = jdbcTemplate.queryForList(finalSql);

+ 2 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/OrgTree.java

@ -41,6 +41,7 @@ public class OrgTree extends IntegerIdentityEntity implements TreeNode {
        this.parentCode = parentCode;
        this.name = name;
        this.level = level;
    }
@ -101,7 +102,7 @@ public class OrgTree extends IntegerIdentityEntity implements TreeNode {
        this.name = name;
    }
    @Column(name = "level",nullable = false)
    @Column(name = "org_level",nullable = false)
    public Integer getLevel() {
        return level;
    }

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

@ -25,6 +25,7 @@ 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;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.team.BaseTeamDO;
@ -69,6 +70,8 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
    private OrgTreeService orgTreeService;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Value("${wechat.flag}")
    private boolean flag;
    /**
     * 新增团队
@ -380,25 +383,32 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
        List<Map<String,Object>>  list=null;
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            String oracleSql="SELECT\n" +
                    "\t*\n" +
                    "FROM\n" +
                    "\t(\n" +
                    "\t\tSELECT\n" +
                    "\t\t\tA .*\n" +
                    "\t\tFROM\n" +
                    "\t\t\t(";
            oracleSql+=finalSql;
            oracleSql+="\t\t\t) A\n" +
                    "\t\tWHERE\n" +
                    "  ROWNUM <="+page*size +
                    "\t) \n" +
                    "WHERE\n" +
                    "\tROWNUM >= "+(page-1)*size;
            Logger.getAnonymousLogger().info("oracleSql="+oracleSql);
            list = jdbcTemplate.queryForList(oracleSql);
            if (flag){
                finalSql+=" LIMIT  " + (page - 1) * size + "," + size + "";
                Logger.getAnonymousLogger().info("oracleSql="+finalSql);
                list = jdbcTemplate.queryForList(finalSql);
            }else {
                String oracleSql="SELECT\n" +
                        "\t*\n" +
                        "FROM\n" +
                        "\t(\n" +
                        "\t\tSELECT\n" +
                        "\t\t\tA .*\n" +
                        "\t\tFROM\n" +
                        "\t\t\t(";
                oracleSql+=finalSql;
                oracleSql+="\t\t\t) A\n" +
                        "\t\tWHERE\n" +
                        "  ROWNUM <="+page*size +
                        "\t) \n" +
                        "WHERE\n" +
                        "\tROWNUM >= "+(page-1)*size;
                Logger.getAnonymousLogger().info("oracleSql="+oracleSql);
                list = jdbcTemplate.queryForList(oracleSql);
            }
        }else {
            finalSql+=" LIMIT  " + (page - 1) * size + "," + size + "";
            Logger.getAnonymousLogger().info("oracleSql="+finalSql);

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

@ -82,6 +82,9 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Value("${wechat.flag}")
    private boolean flag;
    public UserDO registerWithIdcard(UserDO userDO) {
        userDO.setSalt(randomString(5));
@ -717,25 +720,33 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
        List<Map<String, Object>> list=null;
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            String oracleSql="SELECT\n" +
                    "\t*\n" +
                    "FROM\n" +
                    "\t(\n" +
                    "\t\tSELECT\n" +
                    "\t\t\tA .*\n" +
                    "\t\tFROM\n" +
                    "\t\t\t(";
            oracleSql+=sql;
            oracleSql+="\t\t\t) A\n" +
                    "\t\tWHERE\n" +
                    "  ROWNUM <="+page*size +
                    "\t) \n" +
                    "WHERE\n" +
                    "\tROWNUM >= "+(page-1)*size;
            Logger.getAnonymousLogger().info("oracleSql="+oracleSql);
            list = jdbcTemplate.queryForList(oracleSql);
            if (flag){
                sql+=" LIMIT  " + (page - 1) * size + "," + size + "";
                Logger.getAnonymousLogger().info("sql="+sql);
                list = jdbcTemplate.queryForList(sql);
            }else {
                String oracleSql="SELECT\n" +
                        "\t*\n" +
                        "FROM\n" +
                        "\t(\n" +
                        "\t\tSELECT\n" +
                        "\t\t\tA .*\n" +
                        "\t\tFROM\n" +
                        "\t\t\t(";
                oracleSql+=sql;
                oracleSql+="\t\t\t) A\n" +
                        "\t\tWHERE\n" +
                        "  ROWNUM <="+page*size +
                        "\t) \n" +
                        "WHERE\n" +
                        "\tROWNUM >= "+(page-1)*size;
                Logger.getAnonymousLogger().info("oracleSql="+oracleSql);
                list = jdbcTemplate.queryForList(oracleSql);
            }
        }else {
            sql+=" LIMIT  " + (page - 1) * size + "," + size + "";
            Logger.getAnonymousLogger().info("sql="+sql);

+ 56 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/word/BaseSensitiveExcelReader.java

@ -0,0 +1,56 @@
package com.yihu.jw.base.service.word;
import com.yihu.jw.base.endpoint.common.excel.AExcelReader;
import com.yihu.jw.base.service.word.excelImport.BaseSensitiveExcelDO;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.stereotype.Component;
import java.util.HashSet;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/7/7
 */
@Component
public class BaseSensitiveExcelReader extends AExcelReader {
    @Override
    public void read(Workbook rwb) throws Exception {
        try{
            Sheet sheetAt = rwb.getSheetAt(0);
//            Iterator<Sheet> sheets = rwb.sheetIterator();
            int j = 0, rows;
            BaseSensitiveExcelDO baseSensitiveExcelDO;
            getRepeat().put("id", new HashSet<>());
            getRepeat().put("sensitiveWords", new HashSet<>());
            getRepeat().put("explanation", new HashSet<>());
//            while (sheets.hasNext()){
//                Sheet sheet = sheets.next();
                if ((rows = sheetAt.getLastRowNum()) == 0) {
                   return;
                }
            correctLs.clear();
                for (int i = 1; i <= rows; i++) {
                    baseSensitiveExcelDO = new BaseSensitiveExcelDO();
                    baseSensitiveExcelDO.setId(getCellCont(sheetAt, i, 0));
                    baseSensitiveExcelDO.setSensitiveWord(getCellCont(sheetAt, i, 1));
                    baseSensitiveExcelDO.setExplanation(getCellCont(sheetAt, i, 2));
                    baseSensitiveExcelDO.validate(repeat);
                    correctLs.add(baseSensitiveExcelDO);
                    errorLs.add(baseSensitiveExcelDO);
                }
                j++;
//            }
        }catch (Exception e){
            e.printStackTrace();
            throw e;
        }finally {
            if (rwb != null) {
                rwb.close();
            }
        }
    }
}

+ 300 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/word/BaseSensitiveService.java

@ -0,0 +1,300 @@
package com.yihu.jw.base.service.word;
import com.yihu.jw.base.dao.word.BaseImportSensitiveDao;
import com.yihu.jw.base.dao.word.BaseSensitiveWordDao;
import com.yihu.jw.base.service.word.excelImport.BaseSensitiveExcelDO;
import com.yihu.jw.utils.SensitivewordFilter;
import com.yihu.jw.entity.base.words.BaseImportSensitiveDO;
import com.yihu.jw.entity.base.words.BaseSensitiveDO;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
import jxl.write.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;
import java.io.*;
import java.util.*;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/7/6
 */
@Service
public class BaseSensitiveService extends BaseJpaService<BaseSensitiveDO, BaseSensitiveWordDao> {
    @Autowired
    private BaseSensitiveWordDao baseSensitiveWordDao;
    @Autowired
    private BaseImportSensitiveDao baseImportSensitiveDao;
    @Autowired
    FileUploadService fileUploadService;
    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(BaseSensitiveService.class);
    /**
     * 创建敏感词汇
     * @param words
     * @param explanation
     */
    public void createSensitiveWords(String words, String explanation,String status,String operatorCode,String name) {
        BaseSensitiveDO baseSensitiveDO = new BaseSensitiveDO();
        baseSensitiveDO.setSensitiveWord(words);
        baseSensitiveDO.setExplanation(explanation);
        baseSensitiveDO.setStatus(status);
        baseSensitiveDO.setAddTime(DateUtil.getNowDate());
        baseSensitiveDO.setOperatorCode(operatorCode);
        baseSensitiveDO.setOperator(name);
        baseSensitiveWordDao.save(baseSensitiveDO);
    }
    /**
     * 更新敏感词汇
     * @param id
     * @param words
     * @param explanation
     */
    public void updateSensitiveWords(String id, String words, String explanation,String status,String operatorCode,String name) {
        BaseSensitiveDO baseSensitiveDO = baseSensitiveWordDao.findOne(id);
        baseSensitiveDO.setSensitiveWord(words);
        baseSensitiveDO.setExplanation(explanation);
        baseSensitiveDO.setUpdateTime(DateUtil.getNowDate());
        baseSensitiveDO.setOperatorCode(operatorCode);
        baseSensitiveDO.setOperator(name);
        baseSensitiveDO.setStatus(status);
        baseSensitiveWordDao.save(baseSensitiveDO);
    }
    /**
     * 删除敏感词
     * @param ids
     */
    public void delSensitiveWords(String ids) {
        String[] list = ids.split(",");
        for (String id : list) {
            if (StringUtils.isNotEmpty(id)){
                baseSensitiveWordDao.delete(id);
            }
        }
    }
    /**
     * 修改敏感词状态
     * @param ids
     * @param status
     */
    public void updateSensitiveWordsStatus(String ids, String status,String operatorCode,String name) {
        String[] list = ids.split(",");
        for (String id : list) {
            if (StringUtils.isNotEmpty(id)){
                BaseSensitiveDO baseSensitiveDO = baseSensitiveWordDao.findOne(id);
                baseSensitiveDO.setStatus(status);
                baseSensitiveDO.setUpdateTime(DateUtil.getNowDate());
                baseSensitiveDO.setOperatorCode(operatorCode);
                baseSensitiveDO.setOperator(name);
                baseSensitiveWordDao.save(baseSensitiveDO);
            }
        }
    }
    /**
     * 查询所有敏感词
     * @param status
     * @param words
     * @param page
     * @param pageSize
     * @return
     */
    public MixEnvelop findSensitiveWords(String status, String words, Integer page, Integer pageSize) {
        StringBuffer sql = new StringBuffer("select * from base_sensitive s where 1=1 ");
        StringBuffer countSql = new StringBuffer("select count(*) count from base_sensitive s where 1=1 ");
        if (!status.equalsIgnoreCase("null")){
            sql.append(" AND s.status='").append(status).append("'");
            countSql.append(" AND s.status='").append(status).append("'");
        }
        if (StringUtils.isNotEmpty(words)){
            sql.append(" AND (s.sensitive_word like'%").append(words).append("%'").append(" or ").append("s.explanation like'%").append(words).append("%')");
            countSql.append(" AND (s.sensitive_word like'%").append(words).append("%'").append(" or ").append("s.explanation like'%").append(words).append("%')");
        }
        sql.append(" ORDER BY s.update_time desc LIMIT ").append((page-1)*pageSize).append(",").append(pageSize);
        logger.info("sql="+sql.toString());
        List<BaseSensitiveDO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(BaseSensitiveDO.class));
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(countSql.toString());
        long count = (long)mapList.get(0).get("count");
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find,list,page,pageSize,count);
    }
    /**
     * 导出敏感词日志
     * @param
     * @return
     */
    public String exportSensitiveWordsLog(OutputStream os,String operatorCode,String path) throws Exception {
        String sql="SELECT * FROM base_import_sensitive b WHERE b.create_time=(SELECT MAX(b.create_time) FROM base_import_sensitive b WHERE b.operator_code='"+operatorCode+"') ";
        List<BaseImportSensitiveDO> list =jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(BaseImportSensitiveDO.class));
//        WritableWorkbook wwb = jxl.Workbook.createWorkbook(os);
//
//        try {
//            WritableSheet ws;
//            ws = wwb.createSheet("sheet", 1);
//
//            String[] header = {"序号", "原因"};
//            int k = 0;
//            for (String h : header) {
//                addCell(ws, 0, k, h);//表名,行,列,header
//                k++;
//            }
//            int i = 1;
//
//            for (BaseImportSensitiveDO one : list) {
//                addCell(ws, i, 0,one.getRow() , "");
//                addCell(ws, i, 1,  one.getProblem(), "");
//                i++;
//            }
//            wwb.write();
//            wwb.close();
//        } catch (IOException e) {
//            e.printStackTrace();
//            if (wwb != null){
//                wwb.close();
//            }
//            throw e;
//        }
//        byte[] bytes = wwb.toString().getBytes();
//        InputStream in = new ByteArrayInputStream(bytes) {
//        };
//        UploadVO uploadVO = fileUploadService.uploadStream(in, "sentitiveLog.xls", path);
        //拼接字符串
        StringBuffer text = new StringBuffer();
            text.append("序号").append("   ").append("原因").append("\r\n");
        for(BaseImportSensitiveDO one:list){
            text.append("第");
            text.append(one.getRow());
            text.append("行");
            text.append("   ");
            text.append(one.getProblem());
            text.append("\r\n");//换行字符
        }
        byte[] bytes = text.toString().getBytes();
        InputStream in = new ByteArrayInputStream(bytes);
        UploadVO uploadVO = fileUploadService.uploadStream(in, "sentitiveLog.xls", path);
        return uploadVO.getFullUri();
    }
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column, String data) throws WriteException {
        Label label = new Label(column, row, data);
        ws.addCell(label);
    }
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column, String data, String memo) throws WriteException {
        Label label = new Label(column, row, data);
        if (!org.springframework.util.StringUtils.isEmpty(memo)) {
            WritableCellFeatures cellFeatures = new WritableCellFeatures();
            cellFeatures.setComment(memo);
            label.setCellFeatures(cellFeatures);
        }
        ws.addCell(label);
    }
    /**
     * 导入敏感词
     * @param correctLs
     * @return
     */
    public Map<String, Object> importSensitive(List<BaseSensitiveExcelDO> correctLs,String operatorCode,String name,OutputStream os,String fastdfs_file_url){
        Map<String, Object> rs = new HashMap<>();
        int total = correctLs.size();
        rs.put("total",total);
        Date nowDate = DateUtil.getNowDate();
        for (BaseSensitiveExcelDO one : correctLs) {
            BaseSensitiveDO sensitive = baseSensitiveWordDao.findBySensitiveWord(one.getSensitiveWord());
            if (sensitive!=null){
                BaseImportSensitiveDO importSensitiveDO = new BaseImportSensitiveDO();
                importSensitiveDO.setRow(one.getId());
                importSensitiveDO.setProblem("敏感词已存在");
                importSensitiveDO.setCreateTime(nowDate);
                importSensitiveDO.setOperatorCode(operatorCode);
                importSensitiveDO.setOperator(name);
                baseImportSensitiveDao.save(importSensitiveDO);
                total-=1;
                continue;
            }
            if (StringUtils.isEmpty(one.getSensitiveWord())){
                BaseImportSensitiveDO importSensitiveDO = new BaseImportSensitiveDO();
                importSensitiveDO.setRow(one.getId());
                importSensitiveDO.setProblem("敏感词为空");
                importSensitiveDO.setCreateTime(nowDate);
                importSensitiveDO.setOperatorCode(operatorCode);
                importSensitiveDO.setOperator(name);
                baseImportSensitiveDao.save(importSensitiveDO);
                total-=1;
                continue;
            }
            BaseSensitiveDO baseSensitiveDO = new BaseSensitiveDO();
            baseSensitiveDO.setId(UUID.randomUUID().toString().replaceAll("-",""));
            baseSensitiveDO.setStatus("1");
            baseSensitiveDO.setExplanation(one.getExplanation());
            baseSensitiveDO.setSensitiveWord(one.getSensitiveWord());
            baseSensitiveDO.setOperatorCode(operatorCode);
            baseSensitiveDO.setOperator(name);
            baseSensitiveDO.setAddTime(nowDate);
            baseSensitiveWordDao.save(baseSensitiveDO);
        }
        //
        try {
            String url = exportSensitiveWordsLog(os, operatorCode, fastdfs_file_url);
            rs.put("downloadLogUrl",url);
            logger.info("downloadLogUrl="+url);
        } catch (Exception e) {
            e.printStackTrace();
            rs.put("downloadLogUrl","导出日志失败");
            logger.info("Logerror="+e.getMessage());
        }
        rs.put("success",total);
        return rs;
    }
    /**
     * 敏感词过滤
     * @param txt
     * @return
     */
    public String filterSensitiveWords(String txt){
        List<BaseSensitiveDO> list = (List<BaseSensitiveDO>) baseSensitiveWordDao.findAll();
        HashSet<String> set = new HashSet<>();
        for (BaseSensitiveDO one : list) {
            set.add(one.getSensitiveWord());
        }
        SensitivewordFilter filter = new SensitivewordFilter(set);
        Set<String> words = filter.getSensitiveWord(txt, 1);
        logger.info("语句中包含敏感词的个数为:" + words.size() + "。包含:" + words);
        logger.info("过滤前="+txt);
        String replaceTxt = filter.replaceSensitiveWord(txt, 1, "*");
        logger.info("过滤后="+replaceTxt);
        return replaceTxt;
    }
}

+ 64 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/word/excelImport/BaseSensitiveExcelDO.java

@ -0,0 +1,64 @@
package com.yihu.jw.base.service.word.excelImport;
import com.yihu.jw.util.excel.ExcelUtil;
import com.yihu.jw.util.excel.Validation;
import com.yihu.jw.util.excel.annotation.Location;
import com.yihu.jw.util.excel.annotation.Row;
import com.yihu.jw.util.excel.annotation.Title;
import com.yihu.jw.util.excel.annotation.ValidRepeat;
import java.util.Map;
import java.util.Set;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/7/7
 */
@Row(start = 1)
@Title(names= "{'序号', '敏感词','说明'}")
public class BaseSensitiveExcelDO extends ExcelUtil implements Validation {
    @Location(x=0)
    @ValidRepeat
    String id;
    @Location(x=1)
    @ValidRepeat
    String sensitiveWord;
    @Location(x=2)
    @ValidRepeat
    String explanation;
    @Override
    public int validate(Map<String, Set> repeatMap) throws Exception {
        int rs = 1;
        return rs;
    }
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getSensitiveWord() {
        return sensitiveWord;
    }
    public void setSensitiveWord(String sensitiveWord) {
        this.sensitiveWord = sensitiveWord;
    }
    public String getExplanation() {
        return explanation;
    }
    public void setExplanation(String explanation) {
        this.explanation = explanation;
    }
}

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

@ -19,6 +19,7 @@ import com.yihu.jw.wechat.service.WxAccessTokenService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -61,6 +62,9 @@ public class WechatService {
    @Autowired
    private HibenateUtils hibenateUtils;
    @Value("${wechat.flag}")
    private boolean flag;
    //====================微信与租户管理=======================
    public MixEnvelop getWxWechatList(String name,String saasName,Integer status,Integer publicType,Integer page,Integer size,String wechatId){
@ -112,25 +116,33 @@ public class WechatService {
        List<WxWechatVO> list =null;
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            String oracleSql="SELECT\n" +
                    "\t*\n" +
                    "FROM\n" +
                    "\t(\n" +
                    "\t\tSELECT\n" +
                    "\t\t\tA .*\n" +
                    "\t\tFROM\n" +
                    "\t\t\t(";
            oracleSql+=sql;
            if (flag){
                sql += " LIMIT " + (page - 1) * size + "," + size + "";
                Logger.getAnonymousLogger().info("sql="+sql);
                list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WxWechatVO.class));
            }else {
                String oracleSql="SELECT\n" +
                        "\t*\n" +
                        "FROM\n" +
                        "\t(\n" +
                        "\t\tSELECT\n" +
                        "\t\t\tA .*\n" +
                        "\t\tFROM\n" +
                        "\t\t\t(";
                oracleSql+=sql;
                oracleSql+="\t\t\t) A\n" +
                        "\t\tWHERE\n" +
                        "  ROWNUM <="+page*size +
                        "\t) \n" +
                        "WHERE\n" +
                        "\tROWNUM >= "+(page-1)*size;
                Logger.getAnonymousLogger().info("oracleSql="+oracleSql);
                list = jdbcTemplate.query(oracleSql, new BeanPropertyRowMapper(WxWechatVO.class));
            }
            oracleSql+="\t\t\t) A\n" +
                    "\t\tWHERE\n" +
                    "  ROWNUM <="+page*size +
                    "\t) \n" +
                    "WHERE\n" +
                    "\tROWNUM >= "+(page-1)*size;
            Logger.getAnonymousLogger().info("oracleSql="+oracleSql);
            list = jdbcTemplate.query(oracleSql, new BeanPropertyRowMapper(WxWechatVO.class));
        }else {
            sql += " LIMIT " + (page - 1) * size + "," + size + "";
            Logger.getAnonymousLogger().info("sql="+sql);

+ 2 - 0
svr/svr-base/src/main/resources/application.yml

@ -163,6 +163,7 @@ wlyy:
  url: http://ehr.yihu.com/wlyy/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040
  flag: false
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
@ -511,6 +512,7 @@ wlyy:
  url: http://ehr.yihu.com/wlyy/
wechat:
  id: xm_ykyy_wx
  flag: true
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0

+ 12 - 12
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java

@ -123,8 +123,8 @@ public class YkyyController extends EnvelopRestEndpoint {
        JSONObject object = JSONObject.parseObject(json);
        if (table.equalsIgnoreCase("HLW_CF01")){
            HlwCf01DO hlwCf01VO =  JSONObject.toJavaObject(object,HlwCf01DO.class);
            String cfsbSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@xec_link where bmc = 'MS_CF01'";
            String cfhmSql="select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@xec_link where bmc = 'MS_CF01_CFHM'";
            String cfsbSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@ykzxtest where bmc = 'MS_CF01'";
            String cfhmSql="select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@ykzxtest where bmc = 'MS_CF01_CFHM'";
            List<Map<String,Object>> cfsbList = hibenateUtils.createSQLQuery(cfsbSql);
            List<Map<String,Object>> cfhmList = hibenateUtils.createSQLQuery(cfhmSql);
            Long cfsb = 0L;
@ -132,14 +132,14 @@ public class YkyyController extends EnvelopRestEndpoint {
            if (cfsbList!=null&&cfsbList.size()!=0){
                cfsb = Long.parseLong(cfsbList.get(0).get("total").toString());
                System.out.println("cfsb:"+cfsb);
                String updateCfsb = "update portal_his.gy_identity_ms@xec_link set dqz=dqz+1 where bmc = 'MS_CF01'";
                String updateCfsb = "update portal_his.gy_identity_ms@ykzxtest set dqz=dqz+1 where bmc = 'MS_CF01'";
                hibenateUtils.updateBySql(updateCfsb);
            }
            if (cfhmList!=null&&cfhmList.size()!=0){
                cfhm = Long.parseLong(cfhmList.get(0).get("total").toString());
                System.out.println("cfhm:"+cfhm);
                String updateCfhm = "update portal_his.gy_identity_ms@xec_link set dqz=dqz+1 where bmc = 'MS_CF01_CFHM'";
                String updateCfhm = "update portal_his.gy_identity_ms@ykzxtest set dqz=dqz+1 where bmc = 'MS_CF01_CFHM'";
                hibenateUtils.updateBySql(updateCfhm);
            }
            hlwCf01VO.setCFSB(cfsb.intValue());
@ -152,12 +152,12 @@ public class YkyyController extends EnvelopRestEndpoint {
            envelop.setObj(object1);
        }else if (table.equalsIgnoreCase("HLW_CF02")){
            HlwCf02DO hlwCf02VO =  JSONObject.toJavaObject(object,HlwCf02DO.class);
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@xec_link where bmc = 'MS_CF02'";
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@ykzxtest where bmc = 'MS_CF02'";
            List<Map<String,Object>> sbxhList = hibenateUtils.createSQLQuery(sbxhSql);
            Long sbxh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){
                sbxh = Long.parseLong(sbxhList.get(0).get("total").toString());
                String updateSbxh = "update portal_his.gy_identity_ms@xec_link set dqz=dqz+1 where bmc = 'MS_CF02'";
                String updateSbxh = "update portal_his.gy_identity_ms@ykzxtest set dqz=dqz+1 where bmc = 'MS_CF02'";
                hibenateUtils.updateBySql(updateSbxh);
            }
            JSONObject object1 = new JSONObject();
@ -169,12 +169,12 @@ public class YkyyController extends EnvelopRestEndpoint {
        }else if(table.equalsIgnoreCase("HlwYsMzJbzdDO")){
            // portal_his.gy_identity_ms@xec_link
            HlwYsMzJbzdDO hlwYsMzJbzdDO =  JSONObject.toJavaObject(object,HlwYsMzJbzdDO.class);
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ys@xec_link where bmc = 'YS_MZ_JBZD'";
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ys@ykzxtest where bmc = 'YS_MZ_JBZD'";
            List<Map<String,Object>> sbxhList = hibenateUtils.createSQLQuery(sbxhSql);
            Long jlbh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){
                jlbh = Long.parseLong(sbxhList.get(0).get("total").toString());
                String updateJlbh = "update portal_his.gy_identity_ms@xec_link set dqz=dqz+1 where bmc = 'YS_MZ_JBZD'";
                String updateJlbh = "update portal_his.gy_identity_ms@ykzxtest set dqz=dqz+1 where bmc = 'YS_MZ_JBZD'";
                hibenateUtils.updateBySql(updateJlbh);
            }
            JSONObject object1 = new JSONObject();
@ -185,12 +185,12 @@ public class YkyyController extends EnvelopRestEndpoint {
        }else if(table.equalsIgnoreCase("HlwGhmxDO")){
            // portal_his.gy_identity_ms@xec_link
            HlwGhmxDO hlwGhmxDO =  JSONObject.toJavaObject(object,HlwGhmxDO.class);
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@xec_link where bmc = 'MS_GHMX'";
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@ykzxtest where bmc = 'MS_GHMX'";
            List<Map<String,Object>> sbxhList = hibenateUtils.createSQLQuery(sbxhSql);
            Long sbxh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){
                sbxh = Long.parseLong(sbxhList.get(0).get("total").toString());
                String updateSbxh = "update portal_his.gy_identity_ms@xec_link set dqz=dqz+1 where bmc = 'MS_GHMX'";
                String updateSbxh = "update portal_his.gy_identity_ms@ykzxtest set dqz=dqz+1 where bmc = 'MS_GHMX'";
                hibenateUtils.updateBySql(updateSbxh);
            }
            JSONObject object1 = new JSONObject();
@ -202,12 +202,12 @@ public class YkyyController extends EnvelopRestEndpoint {
        }else if(table.equalsIgnoreCase("HlwYsMzJzLsDO")){
            // portal_his.gy_identity_ms@xec_link
            HlwYsMzJzLsDO hlwYsMzJzLsDO =  JSONObject.toJavaObject(object,HlwYsMzJzLsDO.class);
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ys@xec_link where bmc = 'YS_MZ_JZLS'";
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ys@ykzxtest where bmc = 'YS_MZ_JZLS'";
            List<Map<String,Object>> sbxhList = hibenateUtils.createSQLQuery(sbxhSql);
            Long jzxh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){
                jzxh = Long.parseLong(sbxhList.get(0).get("total").toString());
                String updateJzxh = "update portal_his.gy_identity_ms@xec_link set dqz=dqz+1 where bmc = 'YS_MZ_JZLS'";
                String updateJzxh = "update portal_his.gy_identity_ms@ykzxtest set dqz=dqz+1 where bmc = 'YS_MZ_JZLS'";
                hibenateUtils.updateBySql(updateJzxh);
            }
            JSONObject object1 = new JSONObject();

Diferenças do arquivo suprimidas por serem muito extensas
+ 88 - 0
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/third/PrescriptionUpdateController.java


+ 18 - 2
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/third/SfRoutePushController.java

@ -31,8 +31,8 @@ public class SfRoutePushController extends EnvelopRestEndpoint {
    @Autowired
    private PrescriptionExpressageService sfexpressService;
    private String successxml = "<Response service='RoutePushService'><Head>OK</Head></Response>";
    private String failedxml = "<Response service='RoutePushService'><Head>ERR</Head><ERROR code='4001'>系统发生数据错误或运行时异常</ERROR></Response>";
    private String successxml = "SUCCESS";
    private String failedxml = "FALSE";
    @RequestMapping(value="/routepushservice",method = RequestMethod.POST)
    @ApiOperation("顺丰路由信息推送")
@ -51,5 +51,21 @@ public class SfRoutePushController extends EnvelopRestEndpoint {
        }
    }
    @RequestMapping(value="/sfroutepushservice",method = RequestMethod.POST)
    @ApiOperation("顺丰路由信息推送")
    public String SFRoutePushServiceNew(
            @ApiParam(name="WaybillRoute", value="入参报文") @RequestParam(value = "WaybillRoute",required = true) String WaybillRoute){
        try {
            logger.info("顺丰路由信息推送,WaybillRoute="+WaybillRoute);
            sfexpressService.SFRoutePushServiceNew(WaybillRoute);
            return successxml;
        }catch (Exception e){
            logger.error("接收顺丰路由信息推送失败,入参WaybillRoute:"+WaybillRoute);
            //日志文件中记录异常信息
            //返回接口异常信息处理结果
            return failedxml;
        }
    }
}

+ 29 - 45
svr/svr-internet-hospital-entrance/src/main/resources/application.yml

@ -71,6 +71,9 @@ spring:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -109,6 +112,9 @@ spring:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -129,7 +135,7 @@ wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段  # todo 待配置
  flag: false #演示环境  true走Mysql数据库  false走Oracle
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL
@ -145,6 +151,9 @@ spring:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -165,6 +174,7 @@ wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
express:
  sf_url: https://mrds-admin.sf-express.com:443
  sf_code: WH000102
@ -190,6 +200,9 @@ spring:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -210,6 +223,7 @@ wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段  # todo 待配置
  flag: false #演示环境  true走Mysql数据库  false走Oracle
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
@ -235,6 +249,9 @@ spring:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -255,7 +272,7 @@ wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: WH000091
@ -273,6 +290,9 @@ spring:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -293,51 +313,12 @@ wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: xm_xzzx_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code:
  sf_check_word:
---
spring:
  profiles: jwtest
  datasource:
    url: jdbc:mysql://172.26.0.104/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: ssgg
    password: ssgg@jkzl2019
  redis:
    host: 172.26.0.253 # Redis server host.
    port: 6379 # Redis server port.
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://172.26.0.193:3000/
  data_base_name: im_internet_hospital
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
fast-dfs:
  tracker-server: 172.26.0.110:22122 #服务器地址
#是否开启i健康接口 0关闭,1开启
testPattern:
  sign: 0
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段  # todo 待配置
  sf_code: WH000061
  sf_check_word: BEWFSCXSyjt4314rz
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
---
spring:
@ -353,6 +334,9 @@ spring:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -373,7 +357,7 @@ wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段  # todo 待配置
  flag: false #演示环境  true走Mysql数据库  false走Oracle
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL

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

@ -309,7 +309,9 @@ public class PrescriptionStatusUpdateService {
                            if (businessOrderDO.getPayType()==1){
                                businessOrderService.orderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
                            }else if (businessOrderDO.getPayType()==3){
/*
                                businessOrderService.ylzOrderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
*/
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
@ -353,7 +355,9 @@ public class PrescriptionStatusUpdateService {
                            if (businessOrderDO.getPayType()==1){
                                businessOrderService.orderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
                            }else if (businessOrderDO.getPayType()==3){
/*
                                businessOrderService.ylzOrderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
*/
                            }
                        } catch (Exception e) {
                            e.printStackTrace();

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

@ -71,6 +71,9 @@ hlwyyEntrance:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -84,6 +87,7 @@ fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL
@ -102,6 +106,9 @@ hlwyyEntrance:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -117,6 +124,7 @@ wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL
@ -142,6 +150,9 @@ hlwyyEntrance:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -157,6 +168,7 @@ wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
@ -182,6 +194,9 @@ hlwyyEntrance:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -197,6 +212,7 @@ wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL
@ -215,6 +231,9 @@ hlwyyEntrance:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
#支付支付
pay:
  flag: true
hospital:
  url: https://172.16.1.34
  mqUser: JKZL
@ -230,6 +249,7 @@ wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: WH000091
@ -249,6 +269,10 @@ hlwyyEntrance:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -264,6 +288,7 @@ wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code:
@ -282,6 +307,9 @@ hlwyyEntrance:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -297,6 +325,7 @@ wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code:

+ 4 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/dao/consult/KnowledgeArticleDao.java

@ -16,4 +16,8 @@ import java.util.List;
public interface KnowledgeArticleDao extends PagingAndSortingRepository<KnowledgeArticleDO, String>, JpaSpecificationExecutor<KnowledgeArticleDO> {
	@Query("select a from KnowledgeArticleDO a where a.del=1 and (categoryFirst = ?1 or categorySecond=?1)")
	List<KnowledgeArticleDO> findByCategory(String category);
	@Query("select a from KnowledgeArticleDO a where a.del=1 and a.id=?1")
	KnowledgeArticleDO findByIdAndDel(String id);
}

+ 17 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/dao/consult/KnowledgeArticleUserDao.java

@ -0,0 +1,17 @@
package com.yihu.jw.hospital.dao.consult;
import com.yihu.jw.entity.base.patient.BasePatientBusinessDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 健康文章中间库DAO
 * @author
 * @date 2019/9/10 14:07
 */
public interface KnowledgeArticleUserDao extends PagingAndSortingRepository<KnowledgeArticleUserDO, String>, JpaSpecificationExecutor<KnowledgeArticleUserDO> {
	@Query("select a from KnowledgeArticleUserDO a where a.del=1 and a.relationCode=?1 and a.user=?2")
	KnowledgeArticleUserDO findByrelationCodeAndUserAndDel(String relationCode,String user);
}

+ 176 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/article/ArticleEndpoint.java

@ -1,9 +1,17 @@
package com.yihu.jw.hospital.endpoint.article;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.patient.BasePatientBusinessDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
import com.yihu.jw.entity.hospital.article.KnowledgeCategoryDO;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleUserDao;
import com.yihu.jw.hospital.service.consult.BasePatientBusinessService;
import com.yihu.jw.hospital.service.consult.KnowledgeArticleService;
import com.yihu.jw.hospital.service.consult.KnowledgeArticleUserService;
import com.yihu.jw.hospital.service.consult.KnowledgeCategoryService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -34,6 +42,15 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
	
	@Autowired
	private KnowledgeCategoryService knowledgeCategoryService;
	@Autowired
	private BasePatientBusinessService patientBusinessService;
	@Autowired
	private BaseDoctorHospitalDao doctorHospitalDao;
	@Autowired
	private KnowledgeArticleUserService knowledgeArticleUserService;
	@Autowired
	private KnowledgeArticleUserDao knowledgeArticleUserDao;
	
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchKnowledgePageList)
	@ApiOperation(value = "获取文章列表")
@ -67,6 +84,18 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
		}
		
		List<KnowledgeArticleDO> list  = knowledgeArticleService.search(fields,filters,sorts,page,pageSize);
		for (KnowledgeArticleDO knowledgeArticleDO:list){
			List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
			if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
				BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
				knowledgeArticleDO.setDeptName(doctorHospitalDO.getDeptName());
				knowledgeArticleDO.setHospitalName(doctorHospitalDO.getOrgName());
			}
			KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(knowledgeArticleDO.getId(),getUID());
			if (knowledgeArticleUserDO!=null&&knowledgeArticleUserDO.getUsed()==1){
				knowledgeArticleDO.setIsUsed(1);
			}
		}
		List<KnowledgeArticleDO> totals  = knowledgeArticleService.search(fields,filters,sorts);
		
		JSONObject result = new JSONObject();
@ -82,6 +111,11 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "id", value = "id", required = true)
			@RequestParam(value = "id", required = true)String id) throws Exception{
			KnowledgeArticleDO articleDO = knowledgeArticleService.retrieve(id);
			KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(articleDO.getId(),getUID());
			if (knowledgeArticleUserDO!=null){
				articleDO.setUsed(knowledgeArticleUserDO.getUsed());
				articleDO.setKnowledgeArticleUserDO(knowledgeArticleUserDO);
			}
		return success(articleDO);
	}
	
@ -195,4 +229,146 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
	                                 @RequestParam(value = "sdJsons",required = false)String sdJsons)throws Exception {
		return success(knowledgeArticleService.saveDeptArticle(dept,sdJsons));
	}
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.sendPatientBusiness)
	@ApiOperation(value = "发送文章/问卷")
	public ListEnvelop sendPatientBusiness(@ApiParam(name = "json", value = "患者业务关联表")
									  @RequestParam(value = "json",required = false)String json)throws Exception {
		ListEnvelop listEnvelop = new ListEnvelop();
		JSONArray jsonArray = JSONArray.parseArray(json);
		List<BasePatientBusinessDO> patientBusinessDOList = new ArrayList<>();
		for (int i=0;i<jsonArray.size();i++){
			JSONObject jsonObject = jsonArray.getJSONObject(i);
			BasePatientBusinessDO patientBusinessDO = toEntity(jsonObject.toJSONString(),BasePatientBusinessDO.class);
			patientBusinessDOList.add(patientBusinessDO);
		}
		listEnvelop.setDetailModelList(knowledgeArticleService.sendBusinessToPatient(patientBusinessDOList));
		return  listEnvelop;
	}
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.setArticleUsed)
	@ApiOperation(value = "设置文章为常用/不常用")
	public ObjEnvelop setArticleUsed(@ApiParam(name = "id", value = "文章id")
									  @RequestParam(value = "id",required = true)String id,
									  @ApiParam(name = "used", value = "常用")
									  @RequestParam(value = "used",required = false)Integer used,
									 @ApiParam(name = "doctor", value = "医生code")
										 @RequestParam(value = "doctor",required = false)String doctor)throws Exception {
		return success(knowledgeArticleService.setUsed(id,used,doctor));
	}
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchPatientArticle)
	@ApiOperation(value = "获取患者文章列表")
	public Envelop searchPatientArticle(
			@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
			@RequestParam(value = "fields", required = false) String fields,
			@ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
			@RequestParam(value = "filters", required = false) String filters,
			@ApiParam(name = "sorts", value = "排序,规则参见说明文档")
			@RequestParam(value = "sorts", required = false) String sorts,
			@ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1")
			@RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
			@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
			@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
		if(StringUtils.isBlank(filters)){
			filters=filters+"del=1";
		}else{
			filters=filters+";del=1";
		}
		List<BasePatientBusinessDO> list  = patientBusinessService.search(fields,filters,sorts,page,pageSize);
		for (BasePatientBusinessDO patientBusinessDO:list){
			Integer type = patientBusinessDO.getRelationType();
			if (type==1){
				KnowledgeArticleDO knowledgeArticleDO = knowledgeArticleService.selectById(patientBusinessDO.getRelationCode());
				if (knowledgeArticleDO!=null){
					List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
					if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
						knowledgeArticleDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
						knowledgeArticleDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
					}
				}
				patientBusinessDO.setKnowledgeArticleDO(knowledgeArticleDO);
				KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(patientBusinessDO.getRelationCode(),patientBusinessDO.getPatient());
				if (knowledgeArticleUserDO!=null){
					patientBusinessDO.setIsRead(knowledgeArticleUserDO.getIsRead());
					patientBusinessDO.setShare(knowledgeArticleUserDO.getShare());
					patientBusinessDO.setFabulous(knowledgeArticleUserDO.getFabulous());
					patientBusinessDO.setCollection(knowledgeArticleUserDO.getCollection());
				}
			}
		}
		List<BasePatientBusinessDO> totals  = patientBusinessService.search(fields,filters,sorts);
		JSONObject result = new JSONObject();
		result.put("total",totals.size());
		result.put("detailModelList",list);
		return success(result);
	}
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.setArticleCollection)
	@ApiOperation(value = "设置文章状态")
	public ObjEnvelop setArticleCollection(@ApiParam(name = "id", value = "文章id")
									 @RequestParam(value = "id",required = true)String id,
									 @ApiParam(name = "flag", value = "1收藏2阅读3点赞4分享")
									 @RequestParam(value = "flag",required = true)Integer flag,
									 @ApiParam(name = "status", value = "收藏(1收藏0未收藏)/阅读(1已读0未读)/点赞(1已赞0未赞)分享(1已分享0未分享)")
									 @RequestParam(value = "status",required = true)Integer status,
										   @ApiParam(name = "user", value = "用户code")
											   @RequestParam(value = "user",required = true)String user,
										   @ApiParam(name = "userType", value = "用户类型(1患者2医生)")
											   @RequestParam(value = "userType",required = true)String userType)throws Exception {
		return success(patientBusinessService.setCollectionById(id,flag,status,user,userType));
	}
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchArticleByStatus)
	@ApiOperation(value = "获取患者文章状态列表")
	public Envelop searchPatientArticleByStatus(
			@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
			@RequestParam(value = "fields", required = false) String fields,
			@ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
			@RequestParam(value = "filters", required = false) String filters,
			@ApiParam(name = "sorts", value = "排序,规则参见说明文档")
			@RequestParam(value = "sorts", required = false) String sorts,
			@ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1")
			@RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
			@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
			@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
		if(StringUtils.isBlank(filters)){
			filters=filters+"del=1";
		}else{
			filters=filters+";del=1";
		}
		List<KnowledgeArticleUserDO> list  = knowledgeArticleUserService.search(fields,filters,sorts,page,pageSize);
		for (KnowledgeArticleUserDO knowledgeArticleUserDO:list){
			Integer type = knowledgeArticleUserDO.getRelationType();
			if (type==1){
				KnowledgeArticleDO knowledgeArticleDO = knowledgeArticleService.selectById(knowledgeArticleUserDO.getRelationCode());
				if (knowledgeArticleDO!=null){
					List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
					if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
						knowledgeArticleDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
						knowledgeArticleDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
					}
				}
				knowledgeArticleUserDO.setKnowledgeArticleDO(knowledgeArticleDO);
			}
		}
		List<KnowledgeArticleUserDO> totals  = knowledgeArticleUserService.search(fields,filters,sorts);
		JSONObject result = new JSONObject();
		result.put("total",totals.size());
		result.put("detailModelList",list);
		return success(result);
	}
}

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

@ -2,6 +2,7 @@ package com.yihu.jw.hospital.endpoint.consult;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.thoughtworks.xstream.mapper.Mapper;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
@ -32,6 +33,7 @@ import com.yihu.jw.wlyy.service.WlyyBusinessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -173,6 +175,9 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			ConsultTeamDo consult = new ConsultTeamDo();
			if(2 == type){
				consult.setType(16);//视频复诊
				if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
					prescriptionService.sendWxTemplateMsg(wxId,outpatientCode,null,"16","outpatientMsgRemind","");
				}
			}else{
				consult.setType(9);//图文复诊
			}
@ -194,6 +199,9 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
						JSONObject res = xzyyPrescriptionService.registerOutPatient(outpatientCode,doctorCode);
						rsCode = res.getString("@RESULT");
						mes = res.getString("@MSG");
						if (type==2){
							prescriptionService.sendWxTemplateMsg(wxId,outpatientCode,null,"16","outpatientMsgRemind","");
						}
					}else {
						if (demoFlag.equalsIgnoreCase("true")){
							rsCode="0";
@ -203,8 +211,6 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
							rsCode = (String)res.get("@RESULT");
							mes = (String)res.get("@MSG");
						}
					}
					if("0".equals(rsCode)||"-2".equals(rsCode)){
@ -217,7 +223,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
				
				
				//2.
				result = imService.addPrescriptionConsult(outpatientCode, patientCode,doctorCode,consult,reason,type);
				result = imService.addPrescriptionConsult(outpatientCode, patientCode,doctorCode,consult,reason,type,wxId);
			}
			return success("操作成功",result);
	}
@ -399,9 +405,15 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		if (data != null) {
			for(Map<String,Object> consult :data){
				//如果是协同门诊,多返回全科医生的详细信息
				if(13 == Integer.parseInt(consult.get("type").toString()) && StringUtils.isNoneBlank((String)consult.get("generalDoctor"))){
				if(12 == Integer.parseInt(consult.get("type").toString()) && StringUtils.isNoneBlank((String)consult.get("generalDoctor"))){
					BaseDoctorDO baseDoctorDO = baseDoctorDao.findById((String)consult.get("generalDoctor"));
					List<BaseDoctorHospitalDO> baseDoctorHospitalDOList = baseDoctorHospitalDao.findByDoctorCode((String)consult.get("generalDoctor"));
					consult.put("generalDoctorName", baseDoctorDO.getName());
					if (baseDoctorHospitalDOList!=null&&baseDoctorHospitalDOList.size()!=0){
						BaseDoctorHospitalDO baseDoctorHospitalDO = baseDoctorHospitalDOList.get(0);
						consult.put("generalOrgName",baseDoctorHospitalDO.getOrgName());
						consult.put("generalDeptName",baseDoctorHospitalDO.getDeptName());
					}
				}
			}
@ -456,8 +468,24 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	                                   @RequestParam(value = "cancelValue", required = false)String cancelValue,
	                                   @ApiParam(name = "cancelRemark", value = "取消原因详细说明")
	                                   @RequestParam(value = "cancelRemark", required = false)String cancelRemark) {
		
		return success(prescriptionService.cancelOutPatient(outPatientId,cancelType,cancelValue,cancelRemark,2,wxId));
		Map<String,Object> map = new HashedMap();
		try {
			map = prescriptionService.cancelOutPatient(outPatientId,cancelType,cancelValue,cancelRemark,2,wxId);
			if (map != null) {
				logger.info("进入外层");
				if (map.get("code").toString().equalsIgnoreCase("1")){
					String patientName = map.get("patientName").toString();
					String patientCode = map.get("patientCode").toString();
					String doctor = map.get("doctor").toString();
					String immsg = imService.sendOutPatientCancle(patientName,patientCode,doctor,cancelRemark,cancelValue);
					System.out.println("发送拒绝接诊消息成功:"+immsg);
				}
			}
		}catch (Exception e){
			System.out.println("发送拒绝接诊消息失败:"+e.getMessage());
		}
		return success(map);
	}
	
	
@ -529,6 +557,16 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		result.put("zjCount",zjCount+zjqzCount);//专家咨询数量
		return success("请求成功",result);
	}
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.doctorSpecialistConsultCountNew)
	@ApiOperation(value = "医生端:进行中的专家咨询数量", notes = "医生端:进行中的专家咨询数量")
	public Envelop doctorSpecialistConsultCountNew(@ApiParam(name = "doctor", value = "医生CODE")
												@RequestParam(value = "doctor",required = true) String doctor){
		//专家咨询
		JSONObject result = new JSONObject();
		result.put("zjCount",imService.doctorConsults(doctor));//专家咨询数量
		return success("请求成功",result);
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.doctorReviewConsultCount)
	@ApiOperation(value = "医生端:图文复诊、视频复诊咨询数量、协同门诊候诊数量", notes = "医生端:图文复诊、视频复诊咨询数量、协同门诊候诊数量")
@ -752,7 +790,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		return success("操作成功",prescriptionService.getConsultSuggest(consultcode));
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.DodtorIM.sendOutPatientCancle)
/*	@PostMapping(value = BaseHospitalRequestMapping.DodtorIM.sendOutPatientCancle)
	@ApiOperation(value = "医生端:发送医生取消IM消息", notes = "医生端:发送医生取消IM消息")
	public Envelop sendOutPatientCancle(@ApiParam(name = "patientName", value = "patientName")
	                                     @RequestParam(value = "patientName", required = true)String patientName,
@ -776,6 +814,6 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
//            e.printStackTrace();
		}
		return success("操作成功");
	}
	}*/
}

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

@ -413,7 +413,8 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
		consult.setImages(images);
		// 设置咨询语音URL
		consult.setVoice(voice);
		consult.setDoctor(doctor);
		consult.setPatient(patient);
		// 保存到数据库
//		int res = 0;
//		JSONArray dts = null;
@ -422,42 +423,35 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			re = imService.addTeamConsult(consult, patient,doctor);
//			res = re.getInteger("status");
//			dts = re.containsKey("doctor")?re.getJSONArray("doctor"):null;
			//线上问诊支付提醒
			if (type==17||type==1){
				SystemMessageDO systemMessageDO = new SystemMessageDO();
				systemMessageDO.setTitle("支付提醒");
				systemMessageDO.setType("11");
				systemMessageDO.setSender(re.getString("doctor"));
				systemMessageDO.setSenderName(re.getString("doctorName"));
				systemMessageDO.setRelationCode(re.getString("consult"));
				systemMessageDO.setReceiver(re.getString("patient"));
				systemMessageDO.setReceiverName(re.getString("patientName"));
				net.sf.json.JSONObject data = new net.sf.json.JSONObject();
				data.put("name",re.getString("patientName"));
				data.put("age", IdCardUtil.getAgeForIdcard(re.getString("patient_idcard")));
				data.put("gender",IdCardUtil.getSexForIdcard_new(re.getString("patient_idcard")));
				data.put("question",symptoms);
                data.put("type",type);
				String msg= "";
				if (type==17){
					msg=re.getString("patientName")+",您好!您有一个视频咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
					prescriptionService.sendWxTemplateMsg(wxId,"",consult,type+"","videoOrderRemind","");
				}else {
					msg=re.getString("patientName")+",您好!您有一个图文咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
				}
				if (payFlag){
			if (payFlag){
				//线上问诊支付提醒
				if (type==17||type==1){
					SystemMessageDO systemMessageDO = new SystemMessageDO();
					systemMessageDO.setTitle("支付提醒");
					systemMessageDO.setType("11");
					systemMessageDO.setSender(re.getString("doctor"));
					systemMessageDO.setSenderName(re.getString("doctorName"));
					systemMessageDO.setRelationCode(re.getString("consult"));
					systemMessageDO.setReceiver(re.getString("patient"));
					systemMessageDO.setReceiverName(re.getString("patientName"));
					net.sf.json.JSONObject data = new net.sf.json.JSONObject();
					data.put("name",re.getString("patientName"));
					data.put("age", IdCardUtil.getAgeForIdcard(re.getString("patient_idcard")));
					data.put("gender",IdCardUtil.getSexForIdcard_new(re.getString("patient_idcard")));
					data.put("question",symptoms);
					data.put("type",type);
					String msg= "";
					/*prescriptionService.sendWxTemplateMsg(wxId,"",consult,type+"","payRemind","");*/
					prescriptionService.saveInquirySystemMessage(null,consult);
					data.put("msg",msg);
					systemMessageDO.setData(data.toString());
					systemMessageService.saveMessage(systemMessageDO);
					BasePatientDO patientDO = basePatientDao.findById(patient);
					if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
						String templateMsgResult = ykyyService.pushNotificationToYktPatient(patientDO.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
					}
				}
				data.put("msg",msg);
				systemMessageDO.setData(data.toString());
				systemMessageService.saveMessage(systemMessageDO);
				BasePatientDO patientDO = basePatientDao.findById(patient);
				if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
					String templateMsgResult = ykyyService.pushNotificationToYktPatient(patientDO.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
				}
			}
			//发送系统消息
@ -634,11 +628,13 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "scoreContent", value = "评价内容")
			@RequestParam(value = "scoreContent",required = false) String scoreContent,
			@ApiParam(name = "type", value = "1、实名,2、匿名")
			@RequestParam(value = "type",required = true) Integer type)throws Exception{
			@RequestParam(value = "type",required = true) Integer type,
			@ApiParam(name = "bannerList",value = "锦旗")
			@RequestParam(value = "bannerList",required = false) String bannerList)throws Exception{
//		if(StringUtils.isEmpty(scoreContent)){
//			scoreContent= "[{\"scoreType\":\"1\",\"score\":100,\"content\":\"\"},{\"scoreType\":\"2\",\"score\":80,\"content\":\"\"},{\"scoreType\":\"3\",\"score\":80,\"content\":\"\"},{\"scoreType\":\"4\",\"score\":0,\"content\":\"测试评语。。。。123123\"}]";
//		}
		imService.evaluationByConsultCode(consult,scoreContent,type);
		imService.evaluationByConsultCode(consult,scoreContent,type,bannerList);
		return success("请求成功");
	}
	

+ 91 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/BaseDoctorBGController.java

@ -0,0 +1,91 @@
package com.yihu.jw.hospital.endpoint.hospital;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.doctor.BaseDoctorBackgroundDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.hospital.doctor.dao.service.BaseDoctorBGService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.BaseBackground.backgroundManage)
@Api(value = "背景管理", description = "背景管理", tags = {"互联网医院 - 医生背景管理"})
public class BaseDoctorBGController extends EnvelopRestEndpoint {
    @Autowired
    private BaseDoctorBGService baseDoctorBGService;
    @ApiOperation("获取背景板")
    @PostMapping(value= BaseHospitalRequestMapping.BaseBackground.getAllBackground)
    public Envelop getAllBG( @ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1")
                                 @RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
                             @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
                                 @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize){
        Integer curPage = (page-1)*pageSize;
        List<BaseDoctorBackgroundDO> list = baseDoctorBGService.getBackground(curPage,pageSize);
        if (list.size()>0){
            return success(list);
        }else {
            return failed("查询失败");
        }
    }
    @ApiOperation("保存医生选择的背景")
    @PostMapping(value= BaseHospitalRequestMapping.BaseBackground.saveDoctorBG)
    public Envelop saveBG(@ApiParam(name = "doctor", value = "doctor", required = false)
                              @RequestParam(value = "doctor", required = false)String doctor,
                          @ApiParam(name = "id", value = "id", required = false)
                          @RequestParam(value = "id", required = false)String id){
        BaseDoctorDO baseDoctorDO = baseDoctorBGService.setDoctorBackground(doctor,id);
        if (null!=baseDoctorDO){
            return success("操作成功");
        }else {
            return failed("操作失败");
        }
    }
    @ApiOperation("新增背景板")
    @PostMapping(value= BaseHospitalRequestMapping.BaseBackground.createDoctorBG)
    public Envelop createBg(@ApiParam(name = "bgName", value = "bgName", required = false)
                          @RequestParam(value = "bgName", required = false)String bgName,
                          @ApiParam(name = "bgUrl", value = "bgUrl", required = false)
                          @RequestParam(value = "bgUrl", required = false)String bgUrl){
        BaseDoctorBackgroundDO baseDoctorBackgroundDO = baseDoctorBGService.createBackground(bgName,bgUrl);
        if (null!=baseDoctorBackgroundDO){
            return success("操作成功");
        }else {
            return failed("操作失败");
        }
    }
    @ApiOperation("删除背景板")
    @PostMapping(value= BaseHospitalRequestMapping.BaseBackground.removeDoctorBG)
    public Envelop removeBg(@ApiParam(name = "id", value = "id", required = false)
                            @RequestParam(value = "id", required = false)String id){
         baseDoctorBGService.deleteBg(id);
        return success("操作成功");
    }
    @ApiOperation("修改背景板")
    @PostMapping(value= BaseHospitalRequestMapping.BaseBackground.updateDoctorBG)
    public Envelop updateBg(@ApiParam(name = "id", value = "id", required = false)
                                @RequestParam(value = "id", required = false)String id,
            @ApiParam(name = "bgName", value = "bgName", required = false)
                            @RequestParam(value = "bgName", required = false)String bgName,
                            @ApiParam(name = "baUrl", value = "baUrl", required = false)
                            @RequestParam(value = "baUrl", required = false)String baUrl){
        BaseDoctorBackgroundDO baseDoctorBackgroundDO = baseDoctorBGService.updateBackground(id,baUrl,bgName);
        if (null!=baseDoctorBackgroundDO){
            return success("操作成功");
        }else {
            return failed("操作失败");
        }
    }
}

+ 55 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/BannerDoctorController.java

@ -0,0 +1,55 @@
package com.yihu.jw.hospital.endpoint.message;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.message.BaseBannerDoctorDO;
import com.yihu.jw.hospital.message.dao.BaseBannerDoctorDao;
import com.yihu.jw.hospital.message.service.BaseBannerDoctorService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.apache.commons.lang.StringUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.DoctorBanner.doctorBanner)
@Api(value = "患者赠送锦旗", description = "患者锦旗管理", tags = {"互联网医院 - 患者锦旗管理接口"})
public class BannerDoctorController extends EnvelopRestEndpoint {
    @Autowired
    private BaseBannerDoctorService baseBannerDoctorService;
    @ApiOperation("批量赠送锦旗")
    @PostMapping(value= BaseHospitalRequestMapping.DoctorBanner.giveBanner)
    public Envelop giveBanner(@ApiParam(name = "bannerIds", value = "bannerIds", required = true)
                                  @RequestParam(value = "bannerIds", required = true)String bannerIds,
                              @ApiParam(name = "doctor", value = "doctor", required = false)
                                  @RequestParam(value = "doctor", required = false)String doctor,
                              @ApiParam(name = "doctorName", value = "doctorName", required = false)
                                  @RequestParam(value = "doctorName", required = false)String doctorName,
                              @ApiParam(name = "content", value = "content", required = false)
                                  @RequestParam(value = "content", required = false)String content){
        List<BaseBannerDoctorDO> resultList = new ArrayList<>();
        if(StringUtils.isNotEmpty(bannerIds)){
            List<String> list =  Arrays.asList(bannerIds.split(","));
            String patientId= getUID();
            resultList = baseBannerDoctorService.bannerGive(patientId,list,content,doctor,doctorName);
        }
    return success("赠送成功",resultList);
    }
    @ApiOperation("查询赠送锦旗")
    @PostMapping(value= BaseHospitalRequestMapping.DoctorBanner.getBanner)
    public Envelop getBanners(@ApiParam(name = "doctor", value = "doctor", required = false)
                                     @RequestParam(value = "doctor", required = false)String doctor){
        JSONObject jsonObject = baseBannerDoctorService.getDoctorBanners(doctor);
        return success(jsonObject);
    }
}

+ 147 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/BaseBannerController.java

@ -0,0 +1,147 @@
package com.yihu.jw.hospital.endpoint.message;
import com.yihu.jw.entity.hospital.message.BaseBannerDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.wlyy.agreement.WlyyAgreementDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.hospital.message.service.BaseBannerService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.BaseBannerssage.baseBanner)
@Api(value = "医生锦旗管理", description = "医生锦旗管理", tags = {"互联网医院 - 医生锦旗管理接口"})
public class BaseBannerController extends EnvelopRestEndpoint{
    private static Logger logger = LoggerFactory.getLogger(SystemMessageController.class);
    @Autowired
    private BaseBannerService baseBannerService;
    @ApiOperation("查询锦旗")
    @PostMapping(value= BaseHospitalRequestMapping.BaseBannerssage.queryByAndStatud)
    public Envelop queryByAndStatud(@ApiParam(name = "name", value = "锦旗名称")
                                                   @RequestParam(value = "name", required = false) String name,
                                        @ApiParam(name = "status", value = "锦旗状态")
                                                   @RequestParam(value = "status", required = false) String status,
                                        @ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1")
                                                   @RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
                                        @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
                                                   @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize){
            return baseBannerService.queryBannerByNameAndStatus(name,status,page,pageSize);
    }
    @PostMapping(value= BaseHospitalRequestMapping.BaseBannerssage.createBanner)
    @ApiOperation("新增医生锦旗")
    public Envelop createBanner(
            @ApiParam(name = "json", value = "Json数据", required = true)
            @RequestParam(value = "json", required = false)String json)throws Exception{
        BaseBannerDO bannerDO = toEntity(json,BaseBannerDO.class);
        BaseBannerDO result = baseBannerService.creatBanner(bannerDO);
        if (null == result){
            return failed("新增失败");
        }
        return success("新增成功");
    }
    @PostMapping(value= BaseHospitalRequestMapping.BaseBannerssage.updateBanner)
    @ApiOperation("更新锦旗信息")
    public Envelop updateMessage(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id", required = true)String id,
            @ApiParam(name = "name", value = "name", required = false)
            @RequestParam(value = "name", required = false)String name,
            @ApiParam(name = "img", value = "img", required = false)
            @RequestParam(value = "img", required = false)String img,
            @ApiParam(name = "status", value = "status", required = false)
            @RequestParam(value = "status", required = false)String status,
            @ApiParam(name = "description", value = "description", required = false)
            @RequestParam(value = "description", required = false)String description)throws Exception {
        String updateUser = getUID();
        String updateUserName = getUNAME();
        BaseBannerDO result = baseBannerService.updateBanner(id,name,img,status,updateUser,updateUserName,description);
        if (null == result) {
            return failed("更新失败,礼物不存在");
        }
        return success("更新成功");
    }
    @GetMapping(value= BaseHospitalRequestMapping.BaseBannerssage.deleteBanner)
    @ApiOperation("删除礼物信息")
    public Envelop deleteBanner(@ApiParam(name = "id", value = "id", required = true)
                                    @RequestParam(value = "id", required = true)String id){
        boolean flag = baseBannerService.deleteBanner(id);
        if (true==flag){
            return success("删除成功");
        }else {
            return failed("删除失败");
        }
    }
    @GetMapping(value= BaseHospitalRequestMapping.BaseBannerssage.upBanner)
    @ApiOperation("上移锦旗信息")
    public Envelop upBanner(@ApiParam(name = "id", value = "id", required = true)
                                @RequestParam(value = "id", required = true)String id){
        BaseBannerDO bannerDO = new BaseBannerDO();
        String erroMessage = null;
        try {
            bannerDO = baseBannerService.upBanner(id);
        } catch (Exception e) {
            erroMessage = e.getMessage();
        }
        if (StringUtils.isNotEmpty(erroMessage)){
            return failed("上移失败"+erroMessage);
        }else {
            return success("上移成功");
        }
    }
    @GetMapping(value= BaseHospitalRequestMapping.BaseBannerssage.downBanner)
    @ApiOperation("下移锦旗信息")
    public Envelop downBanner(@ApiParam(name = "id", value = "id", required = true)
                                 @RequestParam(value = "id", required = true)String id){
        BaseBannerDO bannerDO = new BaseBannerDO();
        String erroMessage = null;
        try {
            bannerDO = baseBannerService.downBanner(id);
        } catch (Exception e) {
            erroMessage = e.getMessage();
        }
        if (StringUtils.isNotEmpty(erroMessage)){
            return failed("下移失败"+erroMessage);
        }else {
            return success("下移成功");
        }
    }
    @GetMapping(value= BaseHospitalRequestMapping.BaseBannerssage.onOff)
    @ApiOperation("锦旗开关")
    public Envelop onOff(@ApiParam(name = "id", value = "id", required = true)
                              @RequestParam(value = "id", required = true)String id,
                         @ApiParam(name = "status", value = "status", required = true)
                         @RequestParam(value = "status", required = true)String status){
       BaseBannerDO bannerDO = baseBannerService.onOff(id,status);
       if (null!=bannerDO.getId()){
           return success("开关切换成功");
       }else {
           return failed("开关失败");
       }
    }
}

+ 135 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/BaseUserMsgController.java

@ -0,0 +1,135 @@
package com.yihu.jw.hospital.endpoint.message;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.hospital.message.service.BaseUserMsgService;
import com.yihu.jw.hospital.message.service.UserMsgContentService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.print.Doc;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.UserMessage.userMessage)
@Api(value = "评论管理接口", description = "评论管理接口", tags = {"互联网医院 - 评论管理接口"})
public class BaseUserMsgController extends EnvelopRestEndpoint {
    @Autowired
    private BaseUserMsgService baseUserMsgService;
    @Autowired
    private UserMsgContentService userMsgContentService;
    @ApiOperation("回复留言")
    @PostMapping(value= BaseHospitalRequestMapping.UserMessage.responseMessage)
    public Envelop responseMessage(@ApiParam(name = "reciverId", value = "reciverId", required = false)
                                       @RequestParam(value = "reciverId", required = false)String reciverId,
                                   @ApiParam(name = "reciverName", value = "reciverName", required = false)
                                       @RequestParam(value = "reciverName", required = false)String reciverName,
                                   @ApiParam(name = "content", value = "content", required = false)
                                       @RequestParam(value = "content", required = false)String content,
                                   @ApiParam(name = "contentId", value = "contentId", required = false)
                                       @RequestParam(value = "contentId", required = false)String  contentId,
                                   @ApiParam(name = "isDoctor", value = "isDoctor", required = false)
                                       @RequestParam(value = "isDoctor", required = false)Integer  isDoctor){
        String patient = getUID();
        baseUserMsgService.responseMessage(contentId,content,reciverId,reciverName,patient,isDoctor);
        return success("回复成功" );
    }
    @ApiOperation("自身评论")
    @PostMapping(value= BaseHospitalRequestMapping.UserMessage.leaveMessage)
    public Envelop leaveMessage(@ApiParam(name = "reciverId", value = "reciverId", required = false)
                              @RequestParam(value = "reciverId", required = false)String reciverId,
                              @ApiParam(name = "reciverName", value = "reciverName", required = false)
                              @RequestParam(value = "reciverName", required = false)String reciverName,
                              @ApiParam(name = "content", value = "content", required = false)
                              @RequestParam(value = "content", required = false)String content
                              ){
        String senderId = getUID();
        //String senderName = getUNAME();
        baseUserMsgService.leaveMessage(content,reciverId,reciverName,senderId);
        return success("留言成功" );
}
    @ApiOperation("医生评论展示")
    @PostMapping(value= BaseHospitalRequestMapping.UserMessage.showMessage)
    public Envelop showMessage(@ApiParam(name = "doctor", value = "doctor", required = false)
                                   @RequestParam(value = "doctor", required = false)String doctor,
                               @ApiParam(name = "showAll", value = "showAll", required = false)
                               @RequestParam(value = "showAll", required = false)String showAll,
                               @ApiParam(name = "showAllType", value = "showAllType", required = false)
                                   @RequestParam(value = "showAllType", required = false)String showAllType,
                               @ApiParam(name = "beginTime", value = "beginTime", required = false)
                                   @RequestParam(value = "beginTime", required = false)String beginTime,
                               @ApiParam(name = "endTime", value = "endTime", required = false)
                                   @RequestParam(value = "endTime", required = false)String endTime,
                                           @ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1")
                                           @RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
                               @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
                                   @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize){
        return baseUserMsgService.getMessage(doctor,showAll,showAllType,beginTime,endTime,page,pageSize);
    }
    @ApiOperation("医生评论展示")
    @PostMapping(value= BaseHospitalRequestMapping.UserMessage.getSingleMessage)
    public Envelop getSingleMessage(@ApiParam(name = "id", value = "id", required = false)
                               @RequestParam(value = "id", required = false)String id){
        List<Map<String,Object>> list = baseUserMsgService.getSingle(id);
        if (list.size()>=0){
            return success(list);
        }else {
            return failed("查询失败");
        }
    }
    @ApiOperation("在线复诊")
    @PostMapping(value= BaseHospitalRequestMapping.UserMessage.onlineVisitMessage)
    public Envelop onlineVisitMessage(@ApiParam(name = "reciverId", value = "reciverId", required = false)
                                   @RequestParam(value = "reciverId", required = false)String reciverId,
                                   @ApiParam(name = "reciverName", value = "reciverName", required = false)
                                   @RequestParam(value = "reciverName", required = false)String reciverName,
                                   @ApiParam(name = "content", value = "content", required = false)
                                   @RequestParam(value = "content", required = false)String content,
                                   @ApiParam(name = "relationCode", value = "relationCode", required = false)
                                   @RequestParam(value = "relationCode", required = false)String relationCode){
        String senderId = getUID();
        String senderName = getUNAME();
        baseUserMsgService.onlineVisitMessage(content,reciverId,reciverName,senderId,senderName,relationCode);
        return success("留言成功" );
    }
    @ApiOperation("专家咨询")
    @PostMapping(value= BaseHospitalRequestMapping.UserMessage.expertMessage)
    public Envelop expertMessage(@ApiParam(name = "reciverId", value = "reciverId", required = false)
                                   @RequestParam(value = "reciverId", required = false)String reciverId,
                                   @ApiParam(name = "reciverName", value = "reciverName", required = false)
                                   @RequestParam(value = "reciverName", required = false)String reciverName,
                                   @ApiParam(name = "content", value = "content", required = false)
                                   @RequestParam(value = "content", required = false)String content,
                                   @ApiParam(name = "relationCode", value = "relationCode", required = false)
                                   @RequestParam(value = "relationCode", required = false)String relationCode){
        String senderId = getUID();
        String senderName = getUNAME();
        baseUserMsgService.expertMessage(content,reciverId,reciverName,senderId,senderName,relationCode);
        return success("留言成功" );
    }
    @ApiOperation("获取评论")
    @PostMapping(value= BaseHospitalRequestMapping.UserMessage.getMessage)
    public Envelop getMessage(
                                 @ApiParam(name = "relationCode", value = "relationCode", required = false)
                                 @RequestParam(value = "relationCode", required = false)String relationCode){
        return success(userMsgContentService.getAllMessage(relationCode));
    }
    @ApiOperation("获取评分")
    @PostMapping(value= BaseHospitalRequestMapping.UserMessage.getPoint)
    public Envelop getPoint(
            @ApiParam(name = "doctor", value = "doctor", required = false)
            @RequestParam(value = "doctor", required = false)String doctor){
        return success(userMsgContentService.countPoint(doctor));
    }
}

Diferenças do arquivo suprimidas por serem muito extensas
+ 74 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java


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

@ -11,7 +11,6 @@ import com.yihu.jw.entity.base.area.BaseCityDO;
import com.yihu.jw.entity.base.area.BaseCommitteeDO;
import com.yihu.jw.entity.base.area.BaseProvinceDO;
import com.yihu.jw.entity.base.area.BaseTownDO;
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.mapping.service.PatientMappingService;
@ -38,7 +37,6 @@ import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.*;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.wlyy.service.WlyyBusinessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -568,6 +566,34 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                     @RequestParam(value = "withWork", required = false)String withWork){
        return success(prescriptionService.findDoctorInfo(doctor,withWork));
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.updateDoctorInfo)
    @ApiOperation(value = "更新医生信息", notes = "更新医生信息")
    public ObjEnvelop updateDoctorInfo(@ApiParam(name = "id", value = "医生id")
                                     @RequestParam(value = "id", required = true)String id,
                                       @ApiParam(name = "img", value = "风采图")
                                       @RequestParam(value = "img", required = false)String img,
                                       @ApiParam(name = "background", value = "医生id")
                                           @RequestParam(value = "background", required = false)String background,
                                       @ApiParam(name = "expertise", value = "医生特长")
                                           @RequestParam(value = "expertise", required = false)String expertise,
                                       @ApiParam(name = "visitHospital", value = "出诊医院code")
                                           @RequestParam(value = "visitHospital", required = false)String visitHospital,
                                       @ApiParam(name = "visitHospitalName", value = "出诊医院名称")
                                           @RequestParam(value = "visitHospitalName", required = false)String visitHospitalName,
                                       @ApiParam(name = "visitDept", value = "出诊科室code")
                                           @RequestParam(value = "visitDept", required = false)String visitDept,
                                       @ApiParam(name = "visitDeptName", value = "出诊科室名称")
                                           @RequestParam(value = "visitDeptName", required = false)String visitDeptName,
                                       @ApiParam(name = "backgroundId", value = "背景id")
                                           @RequestParam(value = "backgroundId", required = false)String backgroundId){
        try {
            return success(prescriptionService.updateDoctorInfo(id, img,background,expertise, visitHospital, visitHospitalName, visitDept, visitDeptName, backgroundId));
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorBaseInfo)
    @ApiOperation(value = "获取医生基本信息信息", notes = "获取医生基本信息信息")

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

@ -177,14 +177,14 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
                                  @RequestParam(value = "pyKey", required = false)String pyKey,
                                  @ApiParam(name = "drugNo", value = "药品编码")
                                  @RequestParam(value = "drugNo", required = false)String drugNo)throws Exception {
        return success(prescriptionService.getDrugUse(drugNo,pyKey));
        return success(prescriptionService.getDrugUse(drugNo,pyKey,demoFlag));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDrugFrequency)
    @ApiOperation(value = "获取用药频次", notes = "获取用药频次")
    public ListEnvelop getDrugFrequency()throws Exception {
        return success(prescriptionService.getDrugFrequency());
        return success(prescriptionService.getDrugFrequency(demoFlag));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getInspectionDictionary)
@ -231,7 +231,7 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取ICD10诊断编码", notes = "获取ICD10诊断编码")
    public ListEnvelop getICD10(@ApiParam(name = "pyKey", value = "拼音关键字")
                                @RequestParam(value = "pyKey", required = false)String pyKey)throws Exception {
        return success(prescriptionService.getICD10(pyKey));
        return success(prescriptionService.getICD10(pyKey,demoFlag));
    }

+ 156 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/BasePatientBusinessService.java

@ -0,0 +1,156 @@
package com.yihu.jw.hospital.service.consult;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientBusinessDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleDao;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleUserDao;
import com.yihu.jw.patient.dao.BasePatientBusinessDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
 * 患者文章业务层代码
 */
@Service
public class BasePatientBusinessService extends BaseJpaService<BasePatientBusinessDO, BasePatientBusinessDao> {
	@Autowired
	private BasePatientBusinessDao patientBusinessDao;
	@Autowired
	private KnowledgeArticleDao knowledgeArticleDao;
	@Autowired
	private KnowledgeArticleUserDao knowledgeArticleUserDao;
	@Autowired
	private BasePatientDao patientDao;
	@Autowired
	private BaseDoctorDao doctorDao;
	/**
	 *
	 * @param id
	 * @param flag 1收藏2阅读3点赞4分享
	 * @param status
	 * @return
	 */
	public KnowledgeArticleUserDO setCollectionById(String id,Integer flag,Integer status,String user,String userType){
		KnowledgeArticleDO knowledgeArticleDO = knowledgeArticleDao.findByIdAndDel(id);
		KnowledgeArticleUserDO knowledgeArticleUserDO =knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(id,user);
		if (knowledgeArticleUserDO==null){
			knowledgeArticleUserDO = new KnowledgeArticleUserDO();
			knowledgeArticleUserDO.setRelationCode(id);
			knowledgeArticleUserDO.setRelationName(knowledgeArticleDO.getTitle());
			knowledgeArticleUserDO.setRelationType(1);
			knowledgeArticleUserDO.setDel(1);
			knowledgeArticleUserDO.setUser(user);
			if (StringUtils.isNoneBlank(userType)&&userType.equalsIgnoreCase("1")){
				BasePatientDO patientDO = patientDao.findById(user);
				if (patientDO!=null){
					knowledgeArticleUserDO.setUserName(patientDO.getName());
					knowledgeArticleUserDO.setCreateUserName(patientDO.getName());
				}
			}else if (StringUtils.isNoneBlank(userType)&&userType.equalsIgnoreCase("2")){
				BaseDoctorDO doctorDO = doctorDao.findById(user);
				if (doctorDO!=null){
					knowledgeArticleUserDO.setUserName(doctorDO.getName());
					knowledgeArticleUserDO.setCreateUserName(doctorDO.getName());
				}
			}
			knowledgeArticleUserDO.setCreateTime(new Date());
			knowledgeArticleUserDO.setUpdateTime(new Date());
			knowledgeArticleUserDO.setCreateUser(user);
			knowledgeArticleUserDO.setUpdateUser(user);
			knowledgeArticleUserDO = knowledgeArticleUserDao.save(knowledgeArticleUserDO);
		}
		if (knowledgeArticleDO!=null){
			if (flag!=null&&flag==1){
				knowledgeArticleUserDO.setCollection(status);
				knowledgeArticleUserDO.setRelationName(knowledgeArticleDO.getTitle());
				knowledgeArticleUserDao.save(knowledgeArticleUserDO);
				if (knowledgeArticleDO!=null){
					if (knowledgeArticleDO.getCollection()!=null){
						if (status==1){
							knowledgeArticleDO.setCollection(knowledgeArticleDO.getCollection()+1);
							knowledgeArticleDao.save(knowledgeArticleDO);
						}else {
							knowledgeArticleDO.setCollection(knowledgeArticleDO.getCollection()-1);
							knowledgeArticleDao.save(knowledgeArticleDO);
						}
					}else {
						if (status==1){
							knowledgeArticleDO.setCollection(1);
							knowledgeArticleDao.save(knowledgeArticleDO);
						}
					}
				}
			}else if (flag!=null&&flag==2){
				knowledgeArticleUserDO.setIsRead(status);
				knowledgeArticleUserDao.save(knowledgeArticleUserDO);
				if (knowledgeArticleDO!=null){
					if (knowledgeArticleDO.getReadCount()!=null){
						if (status==1){
							knowledgeArticleDO.setReadCount(knowledgeArticleDO.getReadCount()+1);
							knowledgeArticleDao.save(knowledgeArticleDO);
						}else {
							knowledgeArticleDO.setReadCount(knowledgeArticleDO.getReadCount()-1);
							knowledgeArticleDao.save(knowledgeArticleDO);
						}
					}else {
						if (status==1){
							knowledgeArticleDO.setReadCount(1);
							knowledgeArticleDao.save(knowledgeArticleDO);
						}
					}
				}
			}else if (flag!=null&&flag==3){
				knowledgeArticleUserDO.setFabulous(status);
				knowledgeArticleUserDao.save(knowledgeArticleUserDO);
				if (knowledgeArticleDO!=null){
					if (knowledgeArticleDO.getFabulous()!=null){
						if (status==1){
							knowledgeArticleDO.setFabulous(knowledgeArticleDO.getFabulous()+1);
							knowledgeArticleDao.save(knowledgeArticleDO);
						}else {
							knowledgeArticleDO.setFabulous(knowledgeArticleDO.getFabulous()-1);
							knowledgeArticleDao.save(knowledgeArticleDO);
						}
					}else {
						if (status==1){
							knowledgeArticleDO.setFabulous(1);
							knowledgeArticleDao.save(knowledgeArticleDO);
						}
					}
				}
			}else if (flag!=null&&flag==4){
				knowledgeArticleUserDO.setShare(status);
				knowledgeArticleUserDao.save(knowledgeArticleUserDO);
				if (knowledgeArticleDO!=null){
					if (knowledgeArticleDO.getShare()!=null){
						if (status==1){
							knowledgeArticleDO.setShare(knowledgeArticleDO.getShare()+1);
							knowledgeArticleDao.save(knowledgeArticleDO);
						}else {
							knowledgeArticleDO.setShare(knowledgeArticleDO.getShare()-1);
							knowledgeArticleDao.save(knowledgeArticleDO);
						}
					}else {
						if (status==1){
							knowledgeArticleDO.setShare(1);
							knowledgeArticleDao.save(knowledgeArticleDO);
						}
					}
				}
			}
		}
		return knowledgeArticleUserDO;
	}
}

+ 115 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeArticleService.java

@ -1,10 +1,19 @@
package com.yihu.jw.hospital.service.consult;
import com.alibaba.fastjson.JSON;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientBusinessDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDeptDO;
import com.yihu.jw.entity.hospital.survey.WlyySurveyDeptDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleDao;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleDeptDao;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleUserDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientBusinessDao;
import com.yihu.jw.utils.EntityUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
@ -29,6 +38,16 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO,
	
	@Autowired
	private KnowledgeArticleDeptDao knowledgeArticleDeptDao;
	@Autowired
	private WlyyHospitalSysDictDao hospitalSysDictDao;
	@Autowired
	private BasePatientBusinessDao patientBusinessDao;
	@Autowired
	private KnowledgeArticleUserDao knowledgeArticleUserDao;
	@Autowired
	private BaseDoctorDao doctorDao;
	@Autowired
	private ImUtil imUtil;
	
	/**
	 * 删除,支持批量
@ -52,6 +71,7 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO,
	 * @throws Exception
	 */
	public KnowledgeArticleDO saveArticle(String jsonData) throws  Exception {
		WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("EXAMINE");
		KnowledgeArticleDO knowledgeArticleDO = EntityUtils.jsonToEntity(jsonData, KnowledgeArticleDO.class);
		if (null == knowledgeArticleDO.getId()) {
			// 新增
@ -59,6 +79,9 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO,
			knowledgeArticleDO.setCreateTime(new Date());
//			knowledgeArticleDO.setSource("客服");
			knowledgeArticleDO.setDel(1);
			if (wlyyHospitalSysDictDO!=null&&wlyyHospitalSysDictDO.getDictValue().equalsIgnoreCase("0")){
				knowledgeArticleDO.setStatus(1);
			}
			knowledgeArticleDO = knowledgeArticleDao.save(knowledgeArticleDO);
			return knowledgeArticleDO;
		} else {
@ -67,6 +90,9 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO,
			one.setContent(knowledgeArticleDO.getContent());
			one.setImage(knowledgeArticleDO.getImage());
			one.setUpdateTime(new Date());
			if (wlyyHospitalSysDictDO!=null&&wlyyHospitalSysDictDO.getDictValue().equalsIgnoreCase("0")){
				one.setStatus(1);
			}
			knowledgeArticleDao.save(one);
			return  one;
		}
@ -174,4 +200,92 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO,
		}
		return true;
	}
	/**
	 *	患者接收问卷/文章
	 * @param businessDOS
	 * @return
	 */
	public List<BasePatientBusinessDO> sendBusinessToPatient(List<BasePatientBusinessDO> businessDOS){
		if (businessDOS!=null&&businessDOS.size()!=0){
			for (BasePatientBusinessDO patientBusinessDO:businessDOS){
				patientBusinessDO.setCreateTime(new Date());
				patientBusinessDO.setUpdateTime(new Date());
				patientBusinessDO.setCreateUser(patientBusinessDO.getDoctor());
				patientBusinessDO.setUpdateUser(patientBusinessDO.getDoctor());
				patientBusinessDO.setCreateUserName(patientBusinessDO.getDoctorName());
				patientBusinessDO.setUpdateUserName(patientBusinessDO.getUpdateUserName());
				patientBusinessDO.setCollection(0);
				patientBusinessDO.setDel(1);
				patientBusinessDO = patientBusinessDao.save(patientBusinessDO);
				if (patientBusinessDO.getRelationType()==1){
					KnowledgeArticleDO knowledgeArticleDO = knowledgeArticleDao.findByIdAndDel(patientBusinessDO.getRelationCode());
					System.out.println("content:"+JSON.toJSONString(knowledgeArticleDO));
					imUtil.sendImMsg(patientBusinessDO.getDoctor(), patientBusinessDO.getDoctorName(), patientBusinessDO.getSessionId(), "4", JSON.toJSONString(knowledgeArticleDO),"1");
				}
			}
		}
		return businessDOS;
	}
	/**
	 * 设置为1常用或者0不常用
	 * @param id
	 * @param used
	 * @return
	 */
	public KnowledgeArticleDO setUsed(String id,Integer used,String doctor){
		KnowledgeArticleDO knowledgeArticleDO = knowledgeArticleDao.findByIdAndDel(id);
		BaseDoctorDO doctorDO = doctorDao.findById(doctor);
		KnowledgeArticleUserDO knowledgeArticleUserDO =knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(id,doctor);
		if (knowledgeArticleUserDO==null){
			knowledgeArticleUserDO = new KnowledgeArticleUserDO();
			knowledgeArticleUserDO.setRelationCode(id);
			knowledgeArticleUserDO.setRelationName(knowledgeArticleDO.getTitle());
			knowledgeArticleUserDO.setRelationType(1);
			knowledgeArticleUserDO.setDel(1);
			knowledgeArticleUserDO.setUser(doctor);
			if (doctorDO!=null){
				knowledgeArticleUserDO.setUserName(doctorDO.getName());
				knowledgeArticleUserDO.setCreateUserName(doctorDO.getName());
			}
			knowledgeArticleUserDO.setCreateTime(new Date());
			knowledgeArticleUserDO.setUpdateTime(new Date());
			knowledgeArticleUserDO.setCreateUser(doctor);
			knowledgeArticleUserDO.setUpdateUser(doctor);
			knowledgeArticleUserDO = knowledgeArticleUserDao.save(knowledgeArticleUserDO);
		}
        if (knowledgeArticleDO!=null){
            if (knowledgeArticleDO.getUsed()!=null){
            	if (used==1){
					knowledgeArticleUserDO.setUsed(1);
					knowledgeArticleDO.setUsed(knowledgeArticleDO.getUsed()+1);
				}else if (used==0){
            		knowledgeArticleUserDO.setUsed(0);
            		knowledgeArticleDO.setUsed(knowledgeArticleDO.getUsed()-1);
				}
			}else {
				if (used==1){
					knowledgeArticleDO.setUsed(1);
				}else if (used==0){
					knowledgeArticleDO.setUsed(0);
				}
			}
        }
		knowledgeArticleUserDO.setRelationName(knowledgeArticleDO.getTitle());
        knowledgeArticleUserDao.save(knowledgeArticleUserDO);
		return knowledgeArticleDao.save(knowledgeArticleDO);
	}
	public KnowledgeArticleDO selectById(String id){
		return knowledgeArticleDao.findByIdAndDel(id);
	}
}

+ 20 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeArticleUserService.java

@ -0,0 +1,20 @@
package com.yihu.jw.hospital.service.consult;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleUserDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
/**
 * 健康文章中间表层代码
 * @author
 * @date
 */
@Service
public class KnowledgeArticleUserService extends BaseJpaService<KnowledgeArticleUserDO, KnowledgeArticleUserDao> {
	
}

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

@ -118,6 +118,9 @@ sms:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -152,7 +155,7 @@ qywx:
  id: 2
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_url: https://mrds-admin.sf-express.com:443
  sf_code: JKZL
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
---
@ -193,6 +196,9 @@ myFamily:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -232,9 +238,9 @@ qywx:
  id: 1
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
  sf_url: http://mrds-admin-ci.sit.sf-express.com:45478
  sf_code: HD000001
  sf_check_word: AAAABBBBCCCCDDDD
---
spring:
  profiles: jwprod
@ -274,6 +280,9 @@ myFamily:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -314,9 +323,9 @@ qywx:
  id: zsyy
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
  sf_url: https://mrds-admin.sf-express.com:443
  sf_code: WH000102
  sf_check_word: TGUQASFNAZyjt9112
---
spring:
  profiles: jwOracleTest
@ -364,6 +373,9 @@ myFamily:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -402,7 +414,7 @@ qywx:
  id: 1
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_url: https://mrds-admin.sf-express.com:443
  sf_code: WH000091
  sf_check_word: SFAHKAOFAAITyjt7890
---
@ -450,6 +462,9 @@ myFamily:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -489,7 +504,7 @@ qywx:
  id: 1
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_url: https://mrds-admin.sf-express.com:443
  sf_code: WH000091
  sf_check_word: SFAHKAOFAAITyjt7890
@ -533,6 +548,9 @@ myFamily:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -571,9 +589,9 @@ qywx:
  id: xm_xzzx_wx
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: WH000091
  sf_check_word: SFAHKAOFAAITyjt7890
  sf_url: https://mrds-admin.sf-express.com:443
  sf_code: WH000101
  sf_check_word: EDSAFWFAQWyjt8099
---
##==心脏中心外 ===============================================================================
spring:
@ -614,6 +632,9 @@ myFamily:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -654,9 +675,9 @@ qywx:
  id: xm_xzzx_wx
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: WH000091
  sf_check_word: SFAHKAOFAAITyjt7890
  sf_url: https://mrds-admin.sf-express.com:443
  sf_code: WH000101
  sf_check_word: EDSAFWFAQWyjt8099
---
##==厦门卫计委 ===============================================================================
spring:
@ -697,6 +718,9 @@ myFamily:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -736,9 +760,9 @@ qywx:
  id: 2
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: WH000091
  sf_check_word: SFAHKAOFAAITyjt7890
  sf_url: https://mrds-admin.sf-express.com:443
  sf_code:
  sf_check_word:
---
spring:
@ -822,7 +846,7 @@ qywx:
  id: 1
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_url: https://mrds-admin.sf-express.com:443
  sf_code: JKZL
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk