Browse Source

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

wangjun 3 years ago
parent
commit
f9f17a8a73
100 changed files with 8799 additions and 191 deletions
  1. 249 45
      business/base-service/src/main/java/com/yihu/jw/complaint/BaseComplaintService.java
  2. 32 0
      business/base-service/src/main/java/com/yihu/jw/dict/dao/BaseDictIcd10Dao.java
  3. 33 0
      business/base-service/src/main/java/com/yihu/jw/dict/dao/BaseDrugDictDao.java
  4. 31 0
      business/base-service/src/main/java/com/yihu/jw/dict/dao/BaseDrugUseDictDao.java
  5. 31 0
      business/base-service/src/main/java/com/yihu/jw/dict/dao/BaseFollowUpDictDao.java
  6. 29 0
      business/base-service/src/main/java/com/yihu/jw/dict/dao/BaseFrequencyDictDao.java
  7. 10 0
      business/base-service/src/main/java/com/yihu/jw/dict/dao/BaseTemplateDao.java
  8. 23 0
      business/base-service/src/main/java/com/yihu/jw/dict/dao/BaseTemplateDictDao.java
  9. 26 0
      business/base-service/src/main/java/com/yihu/jw/dict/dao/BaseTemplateOrgDao.java
  10. 123 0
      business/base-service/src/main/java/com/yihu/jw/dict/service/FollowUpDictService.java
  11. 90 7
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  12. 34 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/WorkTimeService.java
  13. 2 2
      business/base-service/src/main/java/com/yihu/jw/order/dao/BusinessOrderDao.java
  14. 9 6
      business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java
  15. 40 0
      business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java
  16. 75 1
      common/common-entity/sql记录
  17. 35 2
      common/common-entity/src/main/java/com/yihu/jw/entity/base/complaint/BaseComplaintDO.java
  18. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/complaint/BaseComplaintOperateLogDO.java
  19. 325 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseDrugDictDO.java
  20. 111 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseDrugUseDictDO.java
  21. 67 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseFollowUpDictDO.java
  22. 93 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseFrequencyDictDO.java
  23. 76 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseTemplateDO.java
  24. 40 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseTemplateDictDO.java
  25. 68 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseTemplateOrgDO.java
  26. 65 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictIcd10DO.java
  27. 22 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/login/BaseLoginLogDO.java
  28. 20 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java
  29. 255 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/birthday/BirthDayWishesToPatient.java
  30. 112 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/birthday/BirthdayWishesTemplate.java
  31. 59 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/common/GetuiClientDO.java
  32. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/lifeCare/LifeCareItemDictDO.java
  33. 11 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/SystemMessageDO.java
  34. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/doctor/WlyyDoctorWorkTimeVO.java
  35. 123 0
      common/common-util/src/main/java/com/yihu/jw/util/healthIndex/HealthIndexUtil.java
  36. 0 1
      server/svr-authentication/pom.xml
  37. 100 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java
  38. 22 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/dao/patient/BaseGetuiClientDao.java
  39. 12 14
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  40. 895 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/utils/ImUtil.java
  41. 63 9
      server/svr-authentication/src/main/resources/application.yml
  42. 14 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictIcd10Dao.java
  43. 9 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/excel/AExcelReader.java
  44. 86 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/BaseDrugUseEndpoint.java
  45. 85 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/BaseFollowUpDictEndpoint.java
  46. 84 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/BaseFrequencyEndpoint.java
  47. 88 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/DictDrugEndpoint.java
  48. 50 34
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/DictIcd10Endpoint.java
  49. 468 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/TemplateManageEndpoint.java
  50. 198 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/BaseDrugDictService.java
  51. 158 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/BaseDrugUseService.java
  52. 150 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/BaseFrequencyService.java
  53. 136 3
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictIcd10Service.java
  54. 943 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/TemplateManageService.java
  55. 322 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/importManage/BasDrugExcelDO.java
  56. 135 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/importManage/BasDrugUseExcelDO.java
  57. 114 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/importManage/BasFrequencyExcelDO.java
  58. 122 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/importManage/BasIcd10ExcelDO.java
  59. 148 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/importManage/BaseDrugExcelDOReader.java
  60. 108 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/importManage/BaseDrugUseExcelDOReader.java
  61. 104 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/importManage/BaseFrequencyExcelDOReader.java
  62. 106 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/importManage/BaseIcd10ExcelDOReader.java
  63. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  64. 3 3
      svr/svr-base/src/main/resources/application.yml
  65. 12 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/birthday/BirthDayWishesToPatientDao.java
  66. 29 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/birthday/BirthdayWishesTemplateDao.java
  67. 2 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/PatientDeviceController.java
  68. 281 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorBirthdayWishesEndpoint.java
  69. 25 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/family/FamilyMemberEndpoint.java
  70. 17 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/PatientMessageEndpoint.java
  71. 12 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/PatientContactsEndpoint.java
  72. 6 6
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/PatientEndpoint.java
  73. 5 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java
  74. 35 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/statistics/OpenStatisticsEndpoint.java
  75. 503 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/birthday/BirthdayWishesService.java
  76. 20 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/contacts/ContactsService.java
  77. 24 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/DeviceService.java
  78. 4 11
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doctor/CareDoctorService.java
  79. 76 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/family/PatientFamilyMemberService.java
  80. 6 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/label/PatientLableService.java
  81. 25 5
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/PatientMessageService.java
  82. 134 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java
  83. 2 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/pay/PayService.java
  84. 23 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageService.java
  85. 98 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/StatisticsService.java
  86. 6 6
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/wechat/WeiXinEventProcess.java
  87. 8 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/MessageUtil.java
  88. 3 3
      svr/svr-cloud-care/src/main/resources/application.yml
  89. 1 1
      svr/svr-cloud-care/src/main/resources/wechat/weixin_menu.txt
  90. 1 1
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/endpoint/DeviceController.java
  91. 97 7
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceService.java
  92. 72 1
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceUploadService.java
  93. 2 2
      svr/svr-cloud-job/src/main/resources/application.yml
  94. 75 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/config/JDBCUtils.java
  95. 0 2
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/SyncWlyyHospitalService.java
  96. 7 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/complaint/BaseComplaintEndPoint.java
  97. 1 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  98. 67 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  99. 47 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  100. 0 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/SystemMessage/HospitalSystemMessageService.java

+ 249 - 45
business/base-service/src/main/java/com/yihu/jw/complaint/BaseComplaintService.java

@ -25,12 +25,15 @@ import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.enterprise.EnterpriseService;
import jdk.management.resource.internal.TotalResourceContext;
import org.apache.commons.lang3.StringUtils;
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;
import javax.persistence.criteria.CriteriaBuilder;
import java.text.SimpleDateFormat;
import java.util.*;
@Service
@ -89,6 +92,12 @@ public class BaseComplaintService {
            baseComplaintDictDO.setUpdateTime(new Date());
            baseComplaintDictDao.save(baseComplaintDictDO);
        }
        List<BaseComplaintDoctorDO> baseComplaintDoctorDOs = baseComplaintDoctorDao.findbyComplaintId(id);
        for (BaseComplaintDoctorDO baseComplaintDoctorDO:baseComplaintDoctorDOs){
            baseComplaintDoctorDO.setIsDel("0");
        }
        baseComplaintDoctorDao.save(baseComplaintDoctorDOs);
        return baseComplaintDictDO;
    }
@ -120,6 +129,26 @@ public class BaseComplaintService {
            String doctorName = "";
            BaseComplaintDoctorDO preDoctor= baseComplaintDoctorDao.findbyDoctorAndDel(doctor);
            BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
            List<BaseDoctorRoleDO> baseDoctorRoleDOs = baseDoctorRoleDao.findByDoctorCode(doctor);
            if (baseDoctorRoleDOs==null||baseDoctorRoleDOs.size()==0){
                BaseDoctorRoleDO baseDoctorRoleDO = new BaseDoctorRoleDO();
                baseDoctorRoleDO.setDoctorCode(doctor);
                baseDoctorRoleDO.setRoleCode("specialist");
                baseDoctorRoleDao.save(baseDoctorRoleDO);
            }else if (baseDoctorRoleDOs!=null){
                Boolean addRoleFlag=true;//是否为对应医生添加专科医生角色表示 true即为添加
                for (BaseDoctorRoleDO baseDoctorRoleDO :baseDoctorRoleDOs){
                    if (baseDoctorRoleDO.getRoleCode().equalsIgnoreCase("specialist")){
                        addRoleFlag=false;
                    }
                }
                if(addRoleFlag){
                    BaseDoctorRoleDO baseDoctorRoleDO = new BaseDoctorRoleDO();
                    baseDoctorRoleDO.setDoctorCode(doctor);
                    baseDoctorRoleDO.setRoleCode("specialist");
                    baseDoctorRoleDao.save(baseDoctorRoleDO);
                }
            }
            if (null != baseDoctorDO) {
                doctorName = baseDoctorDO.getName();
            }
@ -231,6 +260,7 @@ public class BaseComplaintService {
        baseComplaintDO.setIsDel("1");
        baseComplaintDO.setStatus("0");
        baseComplaintDO.setCreateTime(new Date());
        baseComplaintDO.setDefaultdoctor("defalutDoctor");
        baseComplaintDO=  baseComplaintDao.save(baseComplaintDO);
        BaseComplaintOperateLogDO baseComplaintOperateLogDO = new BaseComplaintOperateLogDO();
        baseComplaintOperateLogDO.setOperateFrom(baseComplaintDO.getPatient());
@ -253,13 +283,14 @@ public class BaseComplaintService {
    /*
     * 医生转交
     * */
    public BaseComplaintDO passTo(String id,String complaintId,String doctor,String operator){
    public BaseComplaintDO passTo(String id,String complaintId,String doctor,String operator,String reason){
        BaseComplaintDO baseComplaintDO = baseComplaintDao.findOne(id);
        BaseComplaintOperateLogDO baseComplaintOperateLogDO = new BaseComplaintOperateLogDO();
        String doctorName="";
        String complaitTypeName="";
        if (null!=baseComplaintDO){
            baseComplaintOperateLogDO.setOperateFrom(operator);
            baseComplaintOperateLogDO.setReason(reason);
            baseComplaintOperateLogDO.setOperateTo(doctor);
            baseComplaintOperateLogDO.setComplaintTo(complaintId);
            baseComplaintOperateLogDO.setComplaintFrom(baseComplaintDO.getComplaintId());
@ -274,7 +305,12 @@ public class BaseComplaintService {
                baseComplaintDO.setAcceptorName(doctorName);
            }
            baseComplaintDO.setAcceptor(doctor);*/
            if ("1".equalsIgnoreCase(baseComplaintDO.getStatus())){
                baseComplaintDO.setStatus("0");
            }
            baseComplaintDO.setDefaultdoctor(doctor);
            baseComplaintDO.setComplaintId(complaintId);
            baseComplaintDO.setPassto(doctor);
            BaseComplaintDictDO baseComplaintDictDO = baseComplaintDictDao.findById(complaintId);
            if (baseComplaintDictDO!=null){
                complaitTypeName=baseComplaintDictDO.getName();
@ -282,11 +318,11 @@ public class BaseComplaintService {
            }
            baseComplaintDO= baseComplaintDao.save(baseComplaintDO);
            try {
                List<BaseComplaintDoctorDO> doctorList=baseComplaintDoctorDao.findbyComplaintId(baseComplaintDO.getComplaintId());
                for (BaseComplaintDoctorDO baseComplaintDoctorDO:doctorList){
                    String url="https://hlwyy.xmzsh.com/hlwyy/ims-app-web/#/complaint/detail?id="+baseComplaintDO.getId();
                    enterpriseService.sendTWMesByDoctor("zsyy",baseComplaintDoctorDO.getDoctor(),"投诉反馈","您收到一条投诉反馈,点击查看。",url);
                }
                /*List<BaseComplaintDoctorDO> doctorList=baseComplaintDoctorDao.findbyComplaintId(baseComplaintDO.getComplaintId());
                for (BaseComplaintDoctorDO baseComplaintDoctorDO:doctorList)*/
                String url="https://hlwyy.xmzsh.com/hlwyy/ims-app-web/#/complaint/detail?id="+baseComplaintDO.getId();
                enterpriseService.sendTWMesByDoctor("zsyy",doctor,"投诉反馈","您收到一条投诉反馈,点击查看。",url);
            }catch (Exception e){
            }
@ -297,13 +333,14 @@ public class BaseComplaintService {
    //接受投诉
    public BaseComplaintDO doctorAccept(String id,String doctor) throws Exception{
        BaseComplaintDO baseComplaintDO = baseComplaintDao.findOne(id);
        if (baseComplaintDO!=null&&"0".equalsIgnoreCase(baseComplaintDO.getStatus())){
        if (baseComplaintDO!=null){
            baseComplaintDO.setStatus("1");
            BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
            if (null != baseDoctorDO) {
                baseComplaintDO.setAcceptorName(baseDoctorDO.getName());
            }
            baseComplaintDO.setAcceptor(doctor);
            baseComplaintDO.setDefaultdoctor(doctor);
            baseComplaintDO.setAcceptTime(new Date());
            baseComplaintDao.save(baseComplaintDO);
            BaseComplaintOperateLogDO baseComplaintOperateLogDO = new BaseComplaintOperateLogDO();
@ -313,21 +350,22 @@ public class BaseComplaintService {
            baseComplaintOperateLogDO.setRelationCode(id);
            baseComplaintOperateLogDO.setCreateTime(new Date());
            baseComplaintOperateDao.save(baseComplaintOperateLogDO);
        }else if ("1".equalsIgnoreCase(baseComplaintDO.getStatus())){
        }/*else if ("1".equalsIgnoreCase(baseComplaintDO.getStatus())){
            throw new Exception("该工单已被接受");
        }else {
            throw new Exception("该工单已被处理完成");
        }
        }*/
        return baseComplaintDO;
    }
    //反馈投诉
    public BaseComplaintDO dealComplaint(String id,String operator,String content,String imgUrl ,String deptCode) throws  Exception{
        BaseComplaintDO baseComplaintDO = baseComplaintDao.findOne(id);
        if (baseComplaintDO!=null&&"1".equalsIgnoreCase(baseComplaintDO.getStatus())){
        if (baseComplaintDO!=null){
            baseComplaintDO.setDealTime(new Date());
            baseComplaintDO.setFeedBack(content);
            baseComplaintDO.setFeedImg(imgUrl);
            baseComplaintDO.setOperator(operator);
            baseComplaintDO.setDefaultdoctor(operator);
            baseComplaintDO.setStatus("2");
            BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(operator);
            if (null != baseDoctorDO) {
@ -346,11 +384,11 @@ public class BaseComplaintService {
            baseComplaintOperateLogDO.setRelationCode(id);
            baseComplaintOperateLogDO.setCreateTime(new Date());
            baseComplaintOperateDao.save(baseComplaintOperateLogDO);
        }else if ("2".equalsIgnoreCase(baseComplaintDO.getStatus())){
        }/*else if ("2".equalsIgnoreCase(baseComplaintDO.getStatus())){
            throw new Exception("该工单已被处理完成");
        }else if ("0".equalsIgnoreCase(baseComplaintDO.getStatus())){
            throw new Exception("该工单未被接收");
        }
        }*/
        return baseComplaintDO;
    }
@ -362,7 +400,7 @@ public class BaseComplaintService {
        if ("admin".equalsIgnoreCase(role)){
            queryAll=true;
        }
        String sql="select t.id as \"id\"," +
        String sql="select DISTINCT t.id as \"id\"," +
                " t.complaint_id as \"complaintId\"," +
                " t.complaint_name as \"complaintName\"," +
                " t.complaint_content as \"complaintContent\"," +
@ -390,12 +428,20 @@ public class BaseComplaintService {
                " t.feed_back as \"feedBack\"," +
                " t.feed_img as \"feedImg\"," +
                " t.acceptor as \"acceptor\"," +
                " b.mobile as \"mobile\"," +
                " t.mobile as \"mobile\"," +
                " t.passto as \"passto\"," +
                " t.acceptor_name as \"acceptorName\"" +
                "from base_complaint t " +
                " left join base_patient b on t.patient=b.id" +
                " where t.is_del=1";
                "from base_complaint t  " +
                " left join base_patient b on t.patient=b.id " ;
        sql+=" left join base_complaint_operate_log g on t.id=g.relation_code where t.is_del=1 ";
        if (StringUtils.isNoneBlank(status)&&"3".equalsIgnoreCase(status)){
            sql+=" and  g.status='3' ";
        }/*else if (StringUtils.isNoneBlank(status)&&"1".equalsIgnoreCase(status)){
            sql+=" and  g.status='1' ";
        }
        else if (StringUtils.isNoneBlank(status)&&"2".equalsIgnoreCase(status)){
            sql+=" and  g.status='2' ";
        }*/
        if (!queryAll){
            BaseComplaintDoctorDO baseComplaintDoctorDO= baseComplaintDoctorDao.findbyDoctorAndDel(doctor);
            /*List<BaseComplaintOperateLogDO> logList =baseComplaintOperateDao.findbyOperateFrom(doctor);
@ -411,27 +457,60 @@ public class BaseComplaintService {
            }*/
            String complaint="";
            if (baseComplaintDoctorDO!=null){
                complaint=baseComplaintDoctorDO.getComplaintId();
                if (baseComplaintDoctorDO.getComplaintId().equalsIgnoreCase("808080eb7a194099017a1943fa820004")){
                    complaint=baseComplaintDoctorDO.getComplaintId();
                }
            }
            //complaint=complaint+","+types;
            if (StringUtils.isNoneBlank(complaint)){
                if (!StringUtils.isNoneBlank(status)){
                    sql+=" and t.status !='-1'";
                    sql+=" and (t.defaultdoctor ='defalutDoctor' or t.defaultdoctor='"+doctor+"')";
                }
                if (StringUtils.isNoneBlank(status)&&"3".equalsIgnoreCase(status)){
                    sql+=" and g.operate_from='"+doctor+"'";
                }else {
                    sql+=" and t.complaint_id='"+complaint+"'";
                }
                if (!StringUtils.isNoneBlank(status)){
                    sql+=" or (g.operate_from='"+doctor+"'  and g.status='3')";
                }
                if (StringUtils.isNoneBlank(status)&&"3".equalsIgnoreCase(status)){
                    sql+=" and g.operate_from='"+doctor+"'";
                }else if (StringUtils.isNoneBlank(status)&&"0".equalsIgnoreCase(status)){
                    sql+=" and t.status='0' and (t.passto='"+doctor+"' or t.passto is null )";
                } else if (StringUtils.isNoneBlank(status)&&"1".equalsIgnoreCase(status)){
                    sql+="  and t.status='1' and t.acceptor='"+doctor+"' ";
                } else if (StringUtils.isNoneBlank(status)&&"2".equalsIgnoreCase(status)){
                    sql+=" and t.status='2' and t.operator='"+doctor+"' ";
                }
                //sql+=" and t.complaint_id in ('"+complaint.replace(",","','")+"')";
                sql+=" and t.complaint_id='"+complaint+"'";
            }else {
                return null;
            }
            if (!StringUtils.isNoneBlank(status)){
                sql+=" and t.status !='-1'";
                if (StringUtils.isNoneBlank(status)&&"3".equalsIgnoreCase(status)){
                    sql+=" and g.operate_from='"+doctor+"'";
                }else if (StringUtils.isNoneBlank(status)&&"0".equalsIgnoreCase(status)){
                    sql+=" and t.status='0' and t.passto='"+doctor+"'";
                } else if (StringUtils.isNoneBlank(status)&&"1".equalsIgnoreCase(status)){
                    sql+="  and t.status='1' and t.acceptor='"+doctor+"' ";
                } else if (StringUtils.isNoneBlank(status)&&"2".equalsIgnoreCase(status)){
                    sql+=" and t.status='2' and t.operator='"+doctor+"' ";
                } else {
                    sql+=" and t.id IN (select col.relation_code from base_complaint_operate_log col where col.operate_to = '"+doctor+"'  )";
                }
            }
            //complaint=complaint+","+types;
        }else {
            if (StringUtils.isNoneBlank(complaintId)){
                //sql+=" and t.complaint_id in ('"+complaint.replace(",","','")+"')";
                sql+=" and t.complaint_id='"+complaintId+"'";
            }
            if (StringUtils.isNoneBlank(status)){
                sql+=" and t.status ='"+status+"'";
            }
        }
        if (StringUtils.isNoneBlank(status)){
            sql+=" and t.status ='"+status+"'";
        }
        if (StringUtils.isNoneBlank(patientName)){
            sql+=" and t.patient_name like '%"+patientName+"%'";
        }
@ -464,6 +543,7 @@ public class BaseComplaintService {
            }
        }
        sql+=" order by t.create_time desc ";
        System.out.println("sql"+sql);
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
        String sqlcount = "SELECT COUNT(1) AS \"total\" FROM ("+sql+") q";
        Long count = 0L;
@ -484,6 +564,13 @@ public class BaseComplaintService {
        if (null!=basePatientDO){
            baseComplaintDO.setMobile(basePatientDO.getMobile());
        }
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO =wlyyHospitalSysDictDao.findById("latestFeedBackTime");
        Integer timeOut=15;
        if (wlyyHospitalSysDictDO!=null){
            timeOut =Integer.parseInt(wlyyHospitalSysDictDO.getDictValue());
        }
        long latestDate=baseComplaintDO.getCreateTime().getTime()+timeOut*24*60*60*1000;
        baseComplaintDO.setLatestFeedTime( (new Date(latestDate)));
        baseComplaintDO.setVisitTypeName(baseComplaintDO.getVisitType().equalsIgnoreCase("1")?"门诊":"住院");
        return baseComplaintDO;
    }
@ -524,7 +611,7 @@ public class BaseComplaintService {
                " t.feed_back as \"feedBack\"," +
                " t.feed_img as \"feedImg\"," +
                " t.acceptor as \"acceptor\"," +
                " b.mobile as \"mobile\"," +
                " t.mobile as \"mobile\"," +
                " t.acceptor_name as \"acceptorName\"" +
                " from base_complaint t " +
                " left join base_patient b on t.patient=b.id" +
@ -586,33 +673,150 @@ public class BaseComplaintService {
        Integer recieve=0;
        Integer deal=0;
        Integer cacel=0;
        Integer passto=0;
        Integer total=0;
        if (baseComplaintDoctorDO!=null){
            Boolean queryAll=false;
            if ("admin".equalsIgnoreCase(role)){
                queryAll=true;
            }
            if (!queryAll){
                complaints=baseComplaintDao.getCountByStatusAndComplaintId("0",baseComplaintDoctorDO.getComplaintId());
                recieve=baseComplaintDao.getCountByStatusAndComplaintId("1",baseComplaintDoctorDO.getComplaintId());
                deal=baseComplaintDao.getCountByStatusAndComplaintId("2",baseComplaintDoctorDO.getComplaintId());
                //cacel=baseComplaintDao.getCountByStatusAndComplaintId("-1",baseComplaintDoctorDO.getComplaintId());
            }else {
                complaints=baseComplaintDao.getCountByStatus("0");
                recieve=baseComplaintDao.getCountByStatus("1");
                deal=baseComplaintDao.getCountByStatus("2");
                cacel=baseComplaintDao.getCountByStatus("-1");
            }
                Boolean queryAll=false;
                if ("admin".equalsIgnoreCase(role)){
                    queryAll=true;
                }
                if (!queryAll){
                    if ("808080eb7a194099017a1943fa820004".equalsIgnoreCase(baseComplaintDoctorDO.getComplaintId())) {
                        complaints = getCountByStatus(doctor,"0",role);
                        recieve = getCountByStatus(doctor,"1",role);
                        deal = getCountByStatus(doctor,"2",role);
                        passto = getCountByPassto(doctor);
                        total = getCountByStatus(doctor,"",role);
                    }else{
                        complaints=getCountByStatus(doctor,"0",role);
                        recieve=getCountByStatus(doctor,"1",role);
                        deal=getCountByStatus(doctor,"2",role);
                        passto=getCountByPassto(doctor);
                        total=getCountByStatus(doctor,"",role);
                    }
                    //cacel=baseComplaintDao.getCountByStatusAndComplaintId("-1",baseComplaintDoctorDO.getComplaintId());
                }else {
                    complaints=baseComplaintDao.getCountByStatus("0");
                    recieve=baseComplaintDao.getCountByStatus("1");
                    deal=baseComplaintDao.getCountByStatus("2");
                    cacel=baseComplaintDao.getCountByStatus("-1");
                    total = complaints+recieve+deal+cacel;
                }
        }
        Integer total = complaints+recieve+deal+cacel;
        Map map=new HashMap();
        map.put("complaints",complaints);
        map.put("recieve",recieve);
        map.put("deal",deal);
        map.put("passto",passto);
        map.put("cacel",cacel);
        map.put("total",total);
        return map;
    }
    public Integer getCountByPassto(String doctor){
        String sql ="select count(1) as \"total\" from (select  DISTINCT t.id   from base_complaint t left join base_complaint_operate_log b" +
                " on t.id=b.relation_code where t.is_del='1' and b.status='3'";
        if (StringUtils.isNoneBlank(doctor)){
            sql+=" and b.operate_from='"+doctor+"'";
        }
        sql+=") m";
        List<Map<String,Object>> listcount=hibenateUtils.createSQLQuery(sql);
        Integer count=0;
        if (listcount!=null&&listcount.size()>0){
            count=Integer.valueOf(listcount.get(0).get("total").toString());
        }
        return count;
    }
    public Integer getCountByStatus(String doctor,String status,String role){
        Boolean queryAll=false;
        if ("admin".equalsIgnoreCase(role)){
            queryAll=true;
        }
        String sql="select count(1)  as \"count\" from (select DISTINCT t.id  "+
                "  from base_complaint t  " +
                " left join base_patient b on t.patient=b.id " ;
        sql+=" left join base_complaint_operate_log g on t.id=g.relation_code where t.is_del=1 ";
        if (StringUtils.isNoneBlank(status)&&"3".equalsIgnoreCase(status)){
            sql+="  and g.status='3' ";
        } /*else if (StringUtils.isNoneBlank(status)&&"1".equalsIgnoreCase(status)){
            sql+=" and  g.status='1' ";
        }
        else if (StringUtils.isNoneBlank(status)&&"2".equalsIgnoreCase(status)){
            sql+=" and  g.status='2' ";
        }*/
        if (!queryAll){
            BaseComplaintDoctorDO baseComplaintDoctorDO= baseComplaintDoctorDao.findbyDoctorAndDel(doctor);
            /*List<BaseComplaintOperateLogDO> logList =baseComplaintOperateDao.findbyOperateFrom(doctor);
            String types= "";
            if (logList!=null&&logList.size()>0){
                for (int i=0;i<logList.size();i++){
                    if (i==logList.size()-1){
                        types+=logList.get(i).getComplaintTo();
                    }else {
                        types+=logList.get(i).getComplaintTo()+",";
                    }
                }
            }*/
            String complaint="";
            if (baseComplaintDoctorDO!=null){
                if (baseComplaintDoctorDO.getComplaintId().equalsIgnoreCase("808080eb7a194099017a1943fa820004")){
                    complaint=baseComplaintDoctorDO.getComplaintId();
                }
            }
            //complaint=complaint+","+types;
            if (StringUtils.isNoneBlank(complaint)){
                if (!StringUtils.isNoneBlank(status)){
                    sql+=" and t.status !='-1'";
                    sql+=" and (t.defaultdoctor ='defalutDoctor' or t.defaultdoctor='"+doctor+"')";
                }
                if (StringUtils.isNoneBlank(status)&&"3".equalsIgnoreCase(status)){
                    sql+=" and g.operate_from='"+doctor+"'";
                }else {
                    sql+=" and t.complaint_id='"+complaint+"'";
                }
               if (!StringUtils.isNoneBlank(status)){
                   sql+=" or (g.operate_from='"+doctor+"'  and g.status='3')";
                }
                if (StringUtils.isNoneBlank(status)&&"3".equalsIgnoreCase(status)){
                    sql+=" and g.operate_from='"+doctor+"'";
                }else if (StringUtils.isNoneBlank(status)&&"0".equalsIgnoreCase(status)){
                    sql+=" and t.status='0' and (t.passto='"+doctor+"' or t.passto is null )";
                } else if (StringUtils.isNoneBlank(status)&&"1".equalsIgnoreCase(status)){
                    sql+="  and t.status='1' and t.acceptor='"+doctor+"' ";
                } else if (StringUtils.isNoneBlank(status)&&"2".equalsIgnoreCase(status)){
                    sql+=" and t.status='2' and t.operator='"+doctor+"' ";
                }
                //sql+=" and t.complaint_id in ('"+complaint.replace(",","','")+"')";
            }else {
                if (StringUtils.isNoneBlank(status)&&"3".equalsIgnoreCase(status)){
                    sql+=" and g.operate_from='"+doctor+"'";
                }else if (StringUtils.isNoneBlank(status)&&"0".equalsIgnoreCase(status)){
                    sql+=" and t.status='0' and t.passto='"+doctor+"'";
                } else if (StringUtils.isNoneBlank(status)&&"1".equalsIgnoreCase(status)){
                    sql+="  and t.status='1' and t.acceptor='"+doctor+"' ";
                } else if (StringUtils.isNoneBlank(status)&&"2".equalsIgnoreCase(status)){
                    sql+=" and t.status='2' and t.operator='"+doctor+"' ";
                } else {
                    sql+=" and t.id IN (select col.relation_code from base_complaint_operate_log col where col.operate_to = '"+doctor+"'  )";
                }
            }
            if (!StringUtils.isNoneBlank(status)){
                sql+=" and t.status !='-1'";
            }
            //complaint=complaint+","+types;
        }
        System.out.println("sql"+sql);
        Integer count = 0;
        sql+=")g";
        List<Map<String,Object>> total = hibenateUtils.createSQLQuery(sql);
        if(total!=null&&total.size()>0){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            count = Integer.valueOf(total.get(0).get("count").toString());
        }
        return count;
    }
    /*
     * 查询投诉数量*/
@ -625,7 +829,6 @@ public class BaseComplaintService {
        recieve=baseComplaintDao.getCountByStatusByPatient("1",patient);
        deal=baseComplaintDao.getCountByStatusByPatient("2",patient);
        cacel=baseComplaintDao.getCountByStatusByPatient("-1",patient);
        Integer total = complaints+recieve+deal+cacel;
        Map map=new HashMap();
        map.put("complaints",complaints);
@ -660,6 +863,7 @@ public class BaseComplaintService {
                " p.name as \"complaintNameFrom\" ," +
                " n.name as \"complaintNameto\", " +
                " t.operate_from as \"operateFrom\" ," +
                " t.reason as \"reason\" ," +
                " t.operate_to as \"operateTo\" ," +
                " t.cancel_by as \"cancelBy\", " +
                " t.operate_type as \"operateType\", " +

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

@ -0,0 +1,32 @@
package com.yihu.jw.dict.dao;
import com.yihu.jw.entity.base.dict.BaseDrugDictDO;
import com.yihu.jw.entity.base.dict.BaseFrequencyDictDO;
import com.yihu.jw.entity.base.dict.DictIcd10DO;
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;
public interface BaseDictIcd10Dao extends PagingAndSortingRepository<DictIcd10DO, Integer>, JpaSpecificationExecutor<DictIcd10DO> {
    List<DictIcd10DO>  findByCodeAndName(String code, String name);
    @Query("from DictIcd10DO t where t.is_del='1' and t.status ='1' order by t.createTime desc")
    List<DictIcd10DO> findByDel(Pageable pageRequest);
    @Query("select  count(1) from DictIcd10DO t where t.is_del='1' and t.status='1'")
    Integer getconuntByDel();
    @Query("from DictIcd10DO t where t.is_del='1' and t.status ='1' and t.name like %?1%  and t.code like %?2% order by t.createTime desc")
    List<DictIcd10DO> findByNameDel(String name,String code,Pageable pageRequest);
    @Query("from DictIcd10DO t where t.is_del='1' and t.status='1' and t.code=?1")
    DictIcd10DO findByCode(String code);
    @Query("from DictIcd10DO t where t.code=?1 and t.is_del='1'")
    List<DictIcd10DO>  findByIcdCode(String code);
}

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

@ -0,0 +1,33 @@
package com.yihu.jw.dict.dao;
import com.yihu.jw.entity.base.dict.BaseDrugDictDO;
import com.yihu.jw.entity.base.dict.BaseFrequencyDictDO;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
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;
public interface BaseDrugDictDao  extends PagingAndSortingRepository<BaseDrugDictDO, String>, JpaSpecificationExecutor<BaseDrugDictDO> {
    @Query("from BaseDrugDictDO t where t.charge_code=?1 and t.drugname=?2 and t.dosage=?3")
    List<BaseDrugDictDO>  findByCodeAndNameAndDosage(String code,String name,String dosage);
    @Query("from BaseDrugDictDO t where t.charge_code=?1 and t.is_del='1'")
    List<BaseDrugDictDO>  findByChargeCode(String code);
    @Query("from BaseDrugDictDO t where t.is_del='1' and t.status='1' order by  t.create_time desc")
    List<BaseDrugDictDO> findByDel(Pageable pageRequest);
    @Query("select  count(1) from BaseDrugDictDO t where t.is_del='1' and t.status='1'")
    Integer getconuntByDel();
    @Query("from BaseDrugDictDO t where t.is_del='1' and t.status='1' and t.drugname like %?1%  and t.charge_code like %?2% order by  t.create_time desc")
    List<BaseDrugDictDO> findByNameDel(String name,String code ,Pageable pageRequest);
    @Query("from BaseDrugDictDO t where t.is_del='1' and t.status='1' and t.charge_code=?1")
    BaseDrugDictDO findByCode(String code);
}

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

@ -0,0 +1,31 @@
package com.yihu.jw.dict.dao;
import com.yihu.jw.entity.base.dict.BaseDrugDictDO;
import com.yihu.jw.entity.base.dict.BaseDrugUseDictDO;
import com.yihu.jw.entity.base.dict.DictIcd10DO;
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;
public interface BaseDrugUseDictDao extends PagingAndSortingRepository<BaseDrugUseDictDO, String>, JpaSpecificationExecutor<BaseDrugUseDictDO> {
    @Query("from BaseDrugUseDictDO t where t.supply_code=?1 and t.supply_name=?2")
    List<BaseDrugUseDictDO>  findByCodeAndName(String code, String name);
    @Query("from BaseDrugUseDictDO t where t.del_flag='1' and t.status ='1' order by t.createTime desc")
    List<BaseDrugUseDictDO> findByDel(Pageable pageRequest);
    @Query("select  count(1) from BaseDrugUseDictDO t where t.del_flag='1' and t.status='1'")
    Integer getconuntByDel();
    @Query("from BaseDrugUseDictDO t where t.del_flag='1' and t.status ='1' and t.supply_name like %?1% and t.sort_code like %?2% order by t.createTime desc")
    List<BaseDrugUseDictDO> findByNameDel(String name,String code,Pageable pageRequest);
    @Query("from BaseDrugUseDictDO t where t.del_flag='1' and t.status='1' and t.supply_code=?1")
    BaseDrugUseDictDO findByCode(String code);
    @Query("from BaseDrugUseDictDO t where t.supply_code=?1 and t.del_flag='1'")
    List<BaseDrugUseDictDO>  findBySupCode(String code);
}

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

@ -0,0 +1,31 @@
package com.yihu.jw.dict.dao;
import com.yihu.jw.entity.base.dict.BaseDrugUseDictDO;
import com.yihu.jw.entity.base.dict.BaseFollowUpDictDO;
import com.yihu.jw.entity.base.dict.BaseFrequencyDictDO;
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;
public interface BaseFollowUpDictDao extends PagingAndSortingRepository<BaseFollowUpDictDO, String>, JpaSpecificationExecutor<BaseFollowUpDictDO> {
    @Query("from BaseFollowUpDictDO t where t.code=?1 and t.name=?2")
    List<BaseFollowUpDictDO> findByCodeAndName(String code, String name);
    @Query("from BaseFollowUpDictDO t where t.isDel='1' and t.status ='1' order by t.createTime desc")
    List<BaseFollowUpDictDO> findByDel(Pageable pageRequest);
    @Query("select  count(1) from BaseFollowUpDictDO t where t.isDel='1' and t.status='1'")
    Integer getconuntByDel();
    @Query("from BaseFollowUpDictDO t where t.isDel='1' and t.status ='1' and t.name like %?1% and t.code like %?2% order by t.createTime desc")
    List<BaseFollowUpDictDO> findByNameDel(String name,String code,Pageable pageRequest);
    @Query("from BaseFollowUpDictDO t where t.isDel='1' and t.status='1' and t.code=?1")
    BaseFollowUpDictDO findByCode(String code);
    @Query("from BaseFollowUpDictDO t where t.code=?1 and t.isDel='1'")
    List<BaseFollowUpDictDO>  findBySupCode(String code);
}

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

@ -0,0 +1,29 @@
package com.yihu.jw.dict.dao;
import com.yihu.jw.entity.base.dict.BaseDrugUseDictDO;
import com.yihu.jw.entity.base.dict.BaseFrequencyDictDO;
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;
public interface BaseFrequencyDictDao extends PagingAndSortingRepository<BaseFrequencyDictDO, String>, JpaSpecificationExecutor<BaseFrequencyDictDO> {
    @Query("from BaseFrequencyDictDO t where  t.freq_code=?1 and t.freq_name=?2")
    List<BaseFrequencyDictDO>  findByCodeAndIdName(String code, String name);
    @Query("from BaseFrequencyDictDO t where t.is_del='1' and t.status ='1' order by t.createTime desc")
    List<BaseFrequencyDictDO> findByDel(Pageable pageRequest);
    @Query("select  count(1) from BaseFrequencyDictDO t where t.is_del='1' and t.status='1'")
    Integer getconuntByDel();
    @Query("from BaseFrequencyDictDO t where t.is_del='1' and t.status ='1' and t.freq_name like %?1% and t.freq_code like %?2%  order by t.createTime desc")
    List<BaseFrequencyDictDO> findByNameDel(String name ,String code ,Pageable pageRequest);
    @Query("from BaseFrequencyDictDO t where t.is_del='1' and t.status='1' and t.freq_code=?1")
    BaseFrequencyDictDO findByCode(String code);
    @Query("from BaseFrequencyDictDO t where t.freq_code=?1 and t.is_del='1'")
    List<BaseFrequencyDictDO>  findByFrqCode(String code);
}

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

@ -0,0 +1,10 @@
package com.yihu.jw.dict.dao;
import com.yihu.jw.entity.base.dict.BaseTemplateDO;
import com.yihu.jw.entity.base.dict.BaseTemplateDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface BaseTemplateDao extends PagingAndSortingRepository<BaseTemplateDO, String>, JpaSpecificationExecutor<BaseTemplateDO> {
}

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

@ -0,0 +1,23 @@
package com.yihu.jw.dict.dao;
import com.yihu.jw.entity.base.dict.BaseTemplateDictDO;
import com.yihu.jw.entity.base.dict.BaseTemplateOrgDO;
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 BaseTemplateDictDao extends PagingAndSortingRepository<BaseTemplateDictDO, String>, JpaSpecificationExecutor<BaseTemplateDictDO> {
    @Query("select  count(1) from BaseTemplateDictDO t where t.isDel = '1' and t.templateId=?1")
    Integer getCountByTemplateId(String templateId);
    @Query("from BaseTemplateDictDO t where t.dictId=?1 and t.templateId=?2")
    BaseTemplateDictDO findByDictIdAndTemplateId(String dictId,String templateId);
    @Query("from BaseTemplateDictDO t where t.templateId=?1 and t.isDel='1'")
    List<BaseTemplateDictDO> findByTemplateId(String templateId);
    @Query("from BaseTemplateDictDO t where t.dictId=?1 and t.isDel='1'")
    List<BaseTemplateDictDO> findByDictId(String dictId);
}

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

@ -0,0 +1,26 @@
package com.yihu.jw.dict.dao;
import com.yihu.jw.entity.base.dict.BaseDrugDictDO;
import com.yihu.jw.entity.base.dict.BaseTemplateOrgDO;
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 BaseTemplateOrgDao extends PagingAndSortingRepository<BaseTemplateOrgDO, String>, JpaSpecificationExecutor<BaseTemplateOrgDO> {
    @Query("from BaseTemplateOrgDO t where  t.orgCode =?1 and t.templateType=?2  and t.isDel ='1'")
    BaseTemplateOrgDO findByOrgCodeAndtemplateType(String orgCode,String templateType);
    @Query("from BaseTemplateOrgDO t where  t.orgCode =?1 and t.isDel='1' ")
    List<BaseTemplateOrgDO> findByOrgCode(String saasId);
    @Query("from BaseTemplateOrgDO t where  t.templateId =?1 and t.isDel='1' ")
    List<BaseTemplateOrgDO> findByTemplateId(String templateId);
    @Query("from BaseTemplateOrgDO t where  t.templateType =?1 and t.orgCode =?2 and t.isDel='1' ")
    List<BaseTemplateOrgDO> findByTemplateType(String templateType,String orgCode);
}

+ 123 - 0
business/base-service/src/main/java/com/yihu/jw/dict/service/FollowUpDictService.java

@ -0,0 +1,123 @@
package com.yihu.jw.dict.service;
import com.yihu.jw.dict.dao.BaseFollowUpDictDao;
import com.yihu.jw.dict.dao.BaseTemplateDictDao;
import com.yihu.jw.entity.base.dict.BaseDrugUseDictDO;
import com.yihu.jw.entity.base.dict.BaseFollowUpDictDO;
import com.yihu.jw.entity.base.dict.BaseTemplateDictDO;
import com.yihu.jw.entity.hospital.manage.BaseDiseaseHomepageBannerDO;
import com.yihu.jw.hospital.dict.BaseDiseaseHomepageBannerDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import static com.yihu.jw.util.common.BeanUtils.getNullPropertyNames;
@Service
public class FollowUpDictService extends BaseJpaService<BaseFollowUpDictDO, BaseFollowUpDictDao> {
    @Autowired
    private BaseFollowUpDictDao baseFollowUpDictDao;
    @Autowired
    private BaseTemplateDictDao baseTemplateDictDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    public void saveFollowUp(BaseFollowUpDictDO baseFollowUpDictDO) throws  Exception{
        BaseFollowUpDictDO baseDrugUseDictDO1=baseFollowUpDictDao.findByCode(baseFollowUpDictDO.getCode());
        if (baseDrugUseDictDO1!=null&&StringUtils.isNotBlank(baseDrugUseDictDO1.getId())){
            if (baseDrugUseDictDO1!=null){
                throw  new Exception("该随访code已存在");
            }
            BaseFollowUpDictDO oldfollow= baseFollowUpDictDao.findOne(baseFollowUpDictDO.getId());
            BeanUtils.copyProperties(baseFollowUpDictDO, oldfollow, getNullPropertyNames(baseFollowUpDictDO));
            baseFollowUpDictDao.save(oldfollow);
        }else {
            if (baseDrugUseDictDO1!=null){
                if (!baseDrugUseDictDO1.getId().equalsIgnoreCase(baseFollowUpDictDO.getId())){
                    throw  new Exception("该随访code已存在");
                }
            }
            baseFollowUpDictDO.setCreateTime(new Date());
            baseFollowUpDictDO.setIsDel("1");
            baseFollowUpDictDao.save(baseFollowUpDictDO);
        }
    }
    public MixEnvelop findList(String name, String status, Integer page , Integer pageSize){
        String sql="select t.id as \"id\"," +
                " t.code as \"code\"," +
                " t.name as \"name\"," +
                " t.is_required as \"isRequired\"," +
                " t.project_content as \"project_content\"," +
                " t.status as \"status\"," +
                " t.is_del as \"is_del\"," +
                " t.create_time as \"create_time\"," +
                " t.create_user as \"create_user\"," +
                " t.create_user_name as \"create_user_name\"" +
                "from base_follow_up_dict t " +
                " where t.is_del='1'";
        String sqlCount =" select count(1) as \"count\" from base_follow_up_dict t where t.is_del='1'";
        if (StringUtils.isNoneBlank(name)){
            sql+=" and t.name like '%"+name+"%'";
            sqlCount+=" and t.name like '%"+name+"%'";
        }
        if (StringUtils.isNoneBlank(status)){
            sql+=" and t.status ='"+status+"'";
            sqlCount+=" and t.status ='"+status+"'";
        }
        List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
        for (Map<String,Object> map:list){
            if (map.get("status")!=null&&"1".equalsIgnoreCase(map.get("status").toString())){
                map.put("statusName","生效中");
            }else {
                map.put("statusName","已失效");
            }
            if (map.get("isRequired")!=null&&"1".equalsIgnoreCase(map.get("isRequired").toString())){
                map.put("requiredName","必填");
            }else {
                map.put("requiredName","非必填");
            }
        }
        List<Map<String,Object>> countList=hibenateUtils.createSQLQuery(sqlCount);
        Integer count=0;
        if (countList!=null&&countList.size()>0) {
            count = Integer.valueOf(countList.get(0).get("count").toString());
        }
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setDetailModelList(list);
        mixEnvelop.setTotalCount(count);
        return mixEnvelop;
    }
    public BaseFollowUpDictDO findOneDict(String dictId){
        return baseFollowUpDictDao.findOne(dictId);
    }
    public void updateFollowUpStatus(String id,String status,String del) throws  Exception{
        BaseFollowUpDictDO baseFollowUpDictDO = baseFollowUpDictDao.findOne(id);
        if (baseFollowUpDictDO!=null){
            if (StringUtils.isNoneBlank(status)){
                baseFollowUpDictDO.setStatus(status);
            }
            if (StringUtils.isNoneBlank(del)){
                baseFollowUpDictDO.setIsDel(del);
                List<BaseTemplateDictDO> baseTemplateDictDO = baseTemplateDictDao.findByDictId(id);
                if (baseTemplateDictDO!=null&&baseTemplateDictDO.size()>0){
                    throw  new Exception("该使用方式已存在现有模板之中不允许删除");
                }
            }
            baseFollowUpDictDao.save(baseFollowUpDictDO);
        }
    }
}

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

@ -106,6 +106,7 @@ 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.enterprise.EnterpriseService;
import com.yihu.jw.wechat.service.BaseSensitiveFilterWordsService;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import com.yihu.jw.yx.dao.YxTokenMappingDao;
@ -319,6 +320,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private BaseOperateLogService baseOperateLogService;
    @Autowired
    private BaseAdviceTreatmentDao baseAdviceTreatmentDao;
    @Autowired
    private EnterpriseService enterpriseService;
    @Value("${demo.flag}")
    private boolean demoFlag;
@ -622,6 +625,32 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //复诊信息
        WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outpatientId);
        if("2".equalsIgnoreCase(outpatientDO.getOutpatientType())){
            String generalDept="";
            String generalDeptName="";
            String generalSex="";
            String generalJob="";
            String generalOrgName="";
            List<BaseDoctorHospitalDO> depts = baseDoctorHospitalDao.findByDoctorCode(outpatientDO.getGeneralDoctor());
            if(depts!=null&&depts.size()>0){
                generalDept=depts.get(0).getDeptCode();
                generalDeptName=depts.get(0).getDeptName();
                generalOrgName=depts.get(0).getOrgName();
            }
            BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(outpatientDO.getGeneralDoctor());
            if(baseDoctorDO!=null){
                generalJob=baseDoctorDO.getJobTitleName();
                generalSex= IdCardUtil.getSexForIdcard(baseDoctorDO.getIdcard());
                rs.put("generalName",baseDoctorDO.getName());
                rs.put("generalPhoto",baseDoctorDO.getPhoto());
            }
            rs.put("generalDept",generalDept);
            rs.put("generalDeptName",generalDeptName);
            rs.put("generalSex",generalSex);
            rs.put("generalJob",generalJob);
            rs.put("generalOrgName",generalOrgName);
        }
        rs.put("outpatient", convertToModel(outpatientDO, WlyyOutpatientVO.class));
        rs.put("doctorCancelType", outpatientDO.getDoctorCancelType());
        rs.put("doctorCancelValue", outpatientDO.getDoctorCancelValue());
@ -1815,6 +1844,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    if (timeVOs != null && timeVOs.size() > 0) {
                        for (WlyyDoctorWorkTimeVO timeVO : timeVOs) {
                            timeVO.setCount(findWorkTimeInfoCout(timeVO.getId()));
                            try {
                                timeVO.setWeekday(getDayForWeek(DateUtil.dateToStr(timeVO.getStartTime(),"yyyy-MM-dd")));
                            }catch (Exception e){
                                e.printStackTrace();
                            }
                        }
                    }
                }
@ -1823,7 +1857,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        return null;
    }
    public Integer getDayForWeek(String pTime) throws Exception {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        Calendar c = Calendar.getInstance();
        c.setTime(format.parse(pTime));
        Integer dayForWeek = 0;
        if (c.get(Calendar.DAY_OF_WEEK) == 1) {
            dayForWeek = 7;
        } else {
            dayForWeek = c.get(Calendar.DAY_OF_WEEK) - 1;
        }
        return dayForWeek;
    }
    /**
     * 查询医生列表带月份排班状态
     *
@ -6670,7 +6715,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                rs.put("flag","0");
            }
        }else {
            rs.put("flag","0");
            rs.put("flag","1");
        }
        rs.put("id", patient);
        rs.put("name", basePatientDO.getName());
@ -7588,15 +7633,35 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        outpatientDO.setOutpatientType("2");
        outpatientDO.setCreateTime(new Date());
        outpatientDO.setPayStatus(1);
        if (outpatientDO.getRegisterDate() == null) {
            outpatientDO.setRegisterDate(new Date());
        }
        String msg = "";
        String name=outpatientDO.getPatientName();
        String sex = "";
        String age="";
        String title = "";
        if (patientDO!=null){
            sex= IdCardUtil.getSexForIdcard(patientDO.getIdcard());
            age = IdCardUtil.getAgeForIdcard(patientDO.getIdcard())+"";
        }
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        if (outpatientDO.getOutpatientType().equalsIgnoreCase("2")) {
            title = "协同复诊";
            msg = name + "(" + sex + " " + age + "岁)向您发起了协同复诊,点击查看";
        }
        if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
            String url=findDomainUrlInDict()+"/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
            enterpriseService.sendTWMesByDoctor("zsyy",outpatientDO.getDoctor(),title,msg,url);
        }else if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
            String url="https://ih.xmheart.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
            enterpriseService.sendTWMesByDoctor("xm_xzzx_wx",outpatientDO.getDoctor(),title,msg,url);
        }else if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
            String url=findDomainUrlInDict()+"/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
            enterpriseService.sendTWMesByDoctor("xm_ykyy_wx",outpatientDO.getDoctor(),title,msg,url);
        }
        System.out.println("发送协同复诊企业模板消息成功");
        WlyyPatientRegisterTimeDO registerTimeDO = null;
        try {
            //如果是视频预约咨询
            if (StringUtils.isNotBlank(registerJson)) {
@ -7631,6 +7696,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            if ("2".equals(outpatient.getOutpatientType())) {
                systemMessageDO.setTitle("协同门诊");
                systemMessageDO.setType("3");
                systemMessageDO.setReceiver(outpatient.getDoctor());
                systemMessageDO.setReceiverName(outpatient.getDoctorName());
                systemMessageDO.setRelationCode(outpatient.getId());
                systemMessageDO.setSender(outpatient.getPatient());
                systemMessageDO.setSenderName(outpatient.getPatientName());
                systemMessageDO.setRelationCode(outpatient.getId());
                data.put("name", outpatient.getPatientName());
                data.put("age", IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
                data.put("gender", IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
                data.put("question", outpatient.getDescription());
                data.put("msg", msg);
                systemMessageDO.setData(data.toString());
                logger.info("添加模板消息4");
                systemMessageService.saveMessage(systemMessageDO);
                BasePatientDO patient = basePatientDao.findById(outpatient.getPatient());
                if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                    ykyyService.pushNotificationToYktPatient(patient.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
                }
            } else if ("3".equals(outpatient.getOutpatientType())) {//专家咨询
                //1.图文 2.视频 3家医
                if ("1".equals(outpatient.getType())) {
@ -7676,7 +7759,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                    ykyyService.pushNotificationToYktPatient(patient.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
                }
            } else if ("1".equals(outpatient.getOutpatientType()))  {//在线复诊
            } else if ("1".equals(outpatient.getOutpatientType()))  {        //在线复诊
                //1.图文 2.视频
                if ("1".equals(outpatient.getType())) {
                    systemMessageDO.setTitle("图文复诊");

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

@ -17,6 +17,7 @@ import com.yihu.jw.hospital.doctor.dao.DoctorWorkTimeDao;
import com.yihu.jw.hospital.prescription.dao.WlyyHospitalWorkRuleDao;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
@ -412,5 +413,38 @@ public class WorkTimeService {
//
//        System.out.println(monthDay);
//    }
    public String  findChargeTypeByDoctor(String doctor,String chargeType){
        JSONObject jsonObject = new JSONObject();
        String sqlCharge = "SELECT\n" +
                "\tt.id as \"id\",\n" +
                "\tt.name as \"name\",\n" +
                "\tt.idcard as \"idcard\",\n" +
                "\tm.req_fee as \"twfzFee\",\n" +
                "\ta.req_fee as \"spfzFee\",\n" +
                "\tb.req_fee as \"spzxFee\",\n" +
                "\tv.req_fee as \"twzxFee\",\n" +
                "\tg.req_fee as \"jyzxFee\",\n" +
                "\td.req_fee as \"xtzxFee\"\n" +
                "FROM\n" +
                "\tbase_doctor t\n" +
                "LEFT JOIN wlyy_charge_dict m ON t.twfz_charge_type = m.charge_type and m.is_del='1'\n" +
                "LEFT JOIN wlyy_charge_dict a ON t.spfz_charge_type = a.charge_type and a.is_del='1'\n" +
                "LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type and b.is_del='1'\n" +
                "LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type and v.is_del='1'\n" +
                "LEFT JOIN wlyy_charge_dict d ON t.twzx_charge_type = d.charge_type and d.is_del='1'\n" +
                " LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type and g.is_del='1'\n" +
                "WHERE t.id = '"+doctor+"' ";
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sqlCharge);
        String chargeFee="";
       if (list!=null&&list.size()>0){
           Map<String,Object> map = list.get(0);
           if (StringUtils.isNoneBlank(chargeType)){
               System.out.println("=="+map.get("spfzFee"));
               chargeFee= map.get(chargeType)==null?"":map.get(chargeType).toString();
           }
       }
        return chargeFee;
    }
}

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

@ -35,6 +35,6 @@ public interface BusinessOrderDao extends PagingAndSortingRepository<BusinessOrd
    @Query("from BusinessOrderDO w where w.patient = ?1 and w.status=?2  and w.orderCategory =?3")
    List<BusinessOrderDO> selectByPatientAndStatusAndOrderCategory(String patient,Integer status,String orderCategory);
    @Query("from BusinessOrderDO  w where w.status=0 and w.lastPayTime<=?1")
    List<BusinessOrderDO> selectByLastPayTime(Long lastPayTime);
   /* @Query("from BusinessOrderDO  w where w.status=0 and w.lastPayTime<=?1")
    List<BusinessOrderDO> selectByLastPayTime(Long lastPayTime);*/
}

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

@ -645,13 +645,13 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
    }
    public PageEnvelop pageByCondition(String name, Integer archiveType, Integer archiveStatus,int page,int size){
        List<BasePatientVO> list = new ArrayList<>();
        List<Map<String ,Object>> list = new ArrayList<>();
        if (page>0){
            page--;
        }else{
            page=0;
        }
        String sqlCount = "select count(*) from base_patient where 1=1 ";
        String sqlCount = "select count(*) as \"total\" from base_patient where 1=1 ";
        String sql = "select * from base_patient where 1=1 ";
        String sqlCondition = "";
        if (StringUtils.isNotBlank(name)){
@ -663,10 +663,13 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
        if (archiveStatus!=null){
            sqlCondition += " and archive_status ="+archiveStatus;
        }
        Long count = jdbcTemplate.queryForObject(sqlCount+sqlCondition,Long.class);
        sqlCondition +=" limit "+page*size+","+size;
        list = jdbcTemplate.query(sql+sqlCondition,new BeanPropertyRowMapper<>(BasePatientVO.class));
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
        List<Map<String ,Object>> count = hibenateUtils.createSQLQuery(sqlCount+sqlCondition);
        Long cou=0l;
        if (count!=null&&count.size()>0){
            cou= Long.valueOf(count.get(0).get("total").toString());
        }
        list = hibenateUtils.createSQLQuery(sql+sqlCondition,page,size);
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,cou);
    }

+ 40 - 0
business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java

@ -90,6 +90,15 @@ public class ImUtil {
		return response;
	}
	public String sendPatientSystemMessage(String targetUserId, String message) {
		String imAddr = im_host + "api/v2/message/patientSystemMessage";
		JSONObject params = new JSONObject();
		params.put("targetUserId", targetUserId);
		params.put("message", message);
		String response = HttpClientUtil.postBody(imAddr,params);
		return response;
	}
	/**
	 * 发送消息
	 * @param senderId 发送者的code
@ -852,4 +861,35 @@ public class ImUtil {
			throw new RuntimeException("获取会话成员!sessionId =" + sessionId);
		}
	}
	/**
	 * 获取在线人数
	 * helper 助老员,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
	 */
	public String getOnlineCountByType(String type) {
		String url = im_host + "api/v2/sessions/getOnlineCountByType?type="+type;
		String ret = HttpClientUtil.get(url, "UTF-8");
		return ret;
	}
	/**
	 * 获取在线人数列表
	 * helper 助老员,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
	 */
	public String getOnlineListByType(String type) {
		String url = im_host + "api/v2/sessions/getOnlineListByType?type="+type;
		String ret = HttpClientUtil.get(url, "UTF-8");
		return ret;
	}
	/**
	 * 获取在线状态
	 * helper 助老员,teacher 教师,child 幼儿,older 老人
	 * 返回 {"status":200,"data":1} data>0 说明在线 data =0 不在线
	 */
	public String findByUserIdAndType(String userId,String type) {
		String url = im_host + "api/v2/sessions/findByUserIdAndType?userId="+userId+"&type="+type;
		String ret = HttpClientUtil.get(url, "UTF-8");
		return ret;
	}
}

+ 75 - 1
common/common-entity/sql记录

@ -1094,4 +1094,78 @@ ALTER table base.dm_device add column need_register tinyint(2) DEFAULT '0' COMME
ALTER TABLE wlyy_patient_rehabilitation_plan add COLUMN  `admin_team_code` int(11) DEFAULT NULL COMMENT '家签行政团队Id';
-- 2021-07-12 lb
ALTER table base.dm_device modify column need_register varchar(255) DEFAULT NULL COMMENT '注册至iot接口,为空表示不注册'
ALTER table base.dm_device modify column need_register varchar(255) DEFAULT NULL COMMENT '注册至iot接口,为空表示不注册'
-- 2021-07-16 lb
CREATE TABLE `wlyy_birthday_wishes_template` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(50) DEFAULT NULL,
  `type` int(2) DEFAULT NULL COMMENT '类型(1系统模板、2服务人员创建)',
  `applicable_range` int(2) DEFAULT NULL COMMENT '适用范围(1未成年、2成年、3老年人)',
  `content` text COMMENT '祝福语',
  `del` int(2) DEFAULT NULL COMMENT '是否删除(0是、1否)',
  `create_user` varchar(50) DEFAULT NULL COMMENT '创建人(系统模板为null)',
  `create_user_name` varchar(50) DEFAULT NULL COMMENT '创建人名称',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `is_default` int(2) DEFAULT '0' COMMENT '是否为默认模板(1是 0否)',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4474 DEFAULT CHARSET=utf8mb4 COMMENT='生日祝福模板';
CREATE TABLE `birthday_wishes_to_patient` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `batch_no` varchar(50) DEFAULT NULL comment '批次号记录发送所属批次',
  `patient_code` varchar(50) DEFAULT NULL comment '患者标识',
  `patient_name` varchar(50) DEFAULT NULL comment '患者名称',
  `doctor_code` varchar(50) DEFAULT NULL comment '发送人code',
  `doctor_name` varchar(50) DEFAULT NULL comment '发送人名称',
  `user_type` int(2) DEFAULT NULL comment '1、患者,2医生',
  `send_pic` varchar(100) DEFAULT NULL comment '发送人头像',
  `send_sex` varchar(50) DEFAULT NULL comment '发送人性别',
  `admin_team_code` int(50) DEFAULT NULL comment '医生所在',
  `admin_team_name` varchar(50) DEFAULT NULL comment '行政团队名称',
  `hospital` varchar(50) DEFAULT NULL comment '所属机构',
  `hospital_name` varchar(50) DEFAULT NULL comment '所属机构名称',
  `town` varchar(50) DEFAULT NULL comment '所属区划',
  `town_name` varchar(50) DEFAULT NULL comment '所属区划名称',
  `send_type` int(3) DEFAULT NULL comment '发送类型 1医生发送 2管理员',
  `send_level` int(3) DEFAULT NULL comment '发送人级别 1社区医生,2助老员, 3教师 4管理员',
  `current_user_role_code` varchar(255) DEFAULT NULL comment '当前登录角色code ',
  `current_user_role_level` varchar(255) DEFAULT NULL comment 		'当前登录的角色级别,1、省,2、市,3、区,4、机构',
  `send_source` int(11) DEFAULT NULL comment '发送平台',
  `all_count` int(11) DEFAULT NULL comment '批次发送排序',
  `openid_set` text comment '本次批号推送openid集合',
  `birthday` varchar(10) DEFAULT NULL comment '居民生日 MM-dd',
  `template_id` int(15) DEFAULT NULL comment '生日模板id',
  `content` text comment '生日祝福内容',
  `create_time` varchar(20) DEFAULT NULL comment '创建时间',
  PRIMARY KEY (`id`),
	KEY index_pd(patient_code,doctor_code) USING BTREE,
	KEY index_time(create_time) USING BTREE,
	KEY index_birthday(birthday)USING BTREE
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COMMENT='生日祝福发送记录';
ALTER table base.dm_device modify column need_register varchar(255) DEFAULT NULL COMMENT '注册至iot接口,为空表示不注册';
-- 2021-07-19 ysj
ALTER table base.base_patient add column pad_imei varchar(50) DEFAULT NULL COMMENT '平板imei';
ALTER table base.base_patient add column residential_area varchar(50) DEFAULT NULL COMMENT '居住小区';
CREATE TABLE `base_getui_client` (
  `id` varchar(50) NOT NULL,
  `user` varchar(50) DEFAULT NULL COMMENT '居民或医生code',
  `type` tinyint(1) DEFAULT NULL COMMENT '1居民 2医生',
  `client_id` varchar(50) DEFAULT NULL COMMENT '个推clientId',
  `create_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `index_1` (`user`,`type`,`client_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='个推clientid表';
-- 2021-07-21 ysj
ALTER table base.base_login_log add column name varchar(50) DEFAULT NULL COMMENT '用户姓名';
ALTER table base.base_login_log add column client_type varchar(10) DEFAULT NULL COMMENT '客服端类型app,wx,pad,pc';
-- 2021-7-22 lb
alter table base_life_care_item_dict add column pad_icon_img varchar(255) DEFAULT NULL COMMENT 'pad图标'

+ 35 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/base/complaint/BaseComplaintDO.java

@ -30,9 +30,42 @@ public class BaseComplaintDO  extends UuidIdentityEntity {
    private String imgUrl;
    private String isDel;
    private String status;
    @Transient
    private String mobile;
    private String visitTypeName;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date latestFeedTime;
    private String passto;
    private String defaultdoctor;
    @Column(name = "defaultdoctor")
    public String getDefaultdoctor() {
        return defaultdoctor;
    }
    public void setDefaultdoctor(String defaultdoctor) {
        this.defaultdoctor = defaultdoctor;
    }
    @Column(name = "passto")
    public String getPassto() {
        return passto;
    }
    public void setPassto(String passto) {
        this.passto = passto;
    }
    @Transient
    public Date getLatestFeedTime() {
        return latestFeedTime;
    }
    public void setLatestFeedTime(Date latestFeedTime) {
        this.latestFeedTime = latestFeedTime;
    }
    @Transient
    public String getVisitTypeName() {
        return visitTypeName;
@ -42,7 +75,7 @@ public class BaseComplaintDO  extends UuidIdentityEntity {
        this.visitTypeName = visitTypeName;
    }
    @Transient
    @Column(name = "mobile")
    public String getMobile() {
        return mobile;
    }

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/complaint/BaseComplaintOperateLogDO.java

@ -19,6 +19,16 @@ public class BaseComplaintOperateLogDO extends UuidIdentityEntity {
    private String  status;
    private String  operateType;
    private String  cancelBy;
    private String  reason;
    @Column(name = "reason")
    public String getReason() {
        return reason;
    }
    public void setReason(String reason) {
        this.reason = reason;
    }
    @Column(name = "cancel_by")
    public String getCancelBy() {
        return cancelBy;

+ 325 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseDrugDictDO.java

@ -0,0 +1,325 @@
package com.yihu.jw.entity.base.dict;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@Entity
@Table(name = "base_drug_dict")
public class BaseDrugDictDO extends UuidIdentityEntity {
    private String charge_code;
    private String drugname;
    private String specification;
    private String py_code;
    private String supply_code;
    private String supply_name;
    private String retprice;
    private String manu_name;
    private String weigh_unit;
    private String mini_unit_name;
    private String pack_unit_name;
    private String weigh_unit_name;
    private String vol_unit_name;
    private String win_no;
    private String pack_retprice;
    private String jbyw;
    private String mini_unit;
    private String pack_size;
    private String action;
    private String serial;
    private String group_no;
    private String stock_amount;
    private String visible_flag;
    private String drug_flag;
    private Date create_time;
    private String status;
    private Date update_time;
    private String is_del;
    private String dosage;
    private String mini_stock_amount;
    private String max_stock_amount;
    private String pack_unit;
    private String vol_unit;
    private String manufactory;
    @Column(name = "vol_unit")
    public String getVol_unit() {
        return vol_unit;
    }
    public void setVol_unit(String vol_unit) {
        this.vol_unit = vol_unit;
    }
    @Column(name = "manufactory")
    public String getManufactory() {
        return manufactory;
    }
    public void setManufactory(String manufactory) {
        this.manufactory = manufactory;
    }
    @Column(name = "pack_unit")
    public String getPack_unit() {
        return pack_unit;
    }
    public void setPack_unit(String pack_unit) {
        this.pack_unit = pack_unit;
    }
    @Column(name = "dosage")
    public String getDosage() {
        return dosage;
    }
    public void setDosage(String dosage) {
        this.dosage = dosage;
    }
    @Column(name = "mini_stock_amount")
    public String getMini_stock_amount() {
        return mini_stock_amount;
    }
    public void setMini_stock_amount(String mini_stock_amount) {
        this.mini_stock_amount = mini_stock_amount;
    }
    @Column(name = "max_stock_amount")
    public String getMax_stock_amount() {
        return max_stock_amount;
    }
    public void setMax_stock_amount(String max_stock_amount) {
        this.max_stock_amount = max_stock_amount;
    }
    @Column(name = "is_del")
    public String getIs_del() {
        return is_del;
    }
    public void setIs_del(String is_del) {
        this.is_del = is_del;
    }
    @Column(name = "update_time")
    public Date getUpdate_time() {
        return update_time;
    }
    public void setUpdate_time(Date update_time) {
        this.update_time = update_time;
    }
    @Column(name = "charge_code")
    public String getCharge_code() {
        return charge_code;
    }
    public void setCharge_code(String charge_code) {
        this.charge_code = charge_code;
    }
    @Column(name = "drugname")
    public String getDrugname() {
        return drugname;
    }
    public void setDrugname(String drugname) {
        this.drugname = drugname;
    }
    @Column(name = "specification")
    public String getSpecification() {
        return specification;
    }
    public void setSpecification(String specification) {
        this.specification = specification;
    }
    @Column(name = "py_code")
    public String getPy_code() {
        return py_code;
    }
    public void setPy_code(String py_code) {
        this.py_code = py_code;
    }
    @Column(name = "supply_code")
    public String getSupply_code() {
        return supply_code;
    }
    public void setSupply_code(String supply_code) {
        this.supply_code = supply_code;
    }
    @Column(name = "supply_name")
    public String getSupply_name() {
        return supply_name;
    }
    public void setSupply_name(String supply_name) {
        this.supply_name = supply_name;
    }
    @Column(name = "retprice")
    public String getRetprice() {
        return retprice;
    }
    public void setRetprice(String retprice) {
        this.retprice = retprice;
    }
    @Column(name = "manu_name")
    public String getManu_name() {
        return manu_name;
    }
    public void setManu_name(String manu_name) {
        this.manu_name = manu_name;
    }
    @Column(name = "weigh_unit")
    public String getWeigh_unit() {
        return weigh_unit;
    }
    public void setWeigh_unit(String weigh_unit) {
        this.weigh_unit = weigh_unit;
    }
    @Column(name = "mini_unit_name")
    public String getMini_unit_name() {
        return mini_unit_name;
    }
    public void setMini_unit_name(String mini_unit_name) {
        this.mini_unit_name = mini_unit_name;
    }
    @Column(name = "pack_unit_name")
    public String getPack_unit_name() {
        return pack_unit_name;
    }
    public void setPack_unit_name(String pack_unit_name) {
        this.pack_unit_name = pack_unit_name;
    }
    @Column(name = "weigh_unit_name")
    public String getWeigh_unit_name() {
        return weigh_unit_name;
    }
    public void setWeigh_unit_name(String weigh_unit_name) {
        this.weigh_unit_name = weigh_unit_name;
    }
    @Column(name = "vol_unit_name")
    public String getVol_unit_name() {
        return vol_unit_name;
    }
    public void setVol_unit_name(String vol_unit_name) {
        this.vol_unit_name = vol_unit_name;
    }
    @Column(name = "win_no")
    public String getWin_no() {
        return win_no;
    }
    public void setWin_no(String win_no) {
        this.win_no = win_no;
    }
    @Column(name = "pack_retprice")
    public String getPack_retprice() {
        return pack_retprice;
    }
    public void setPack_retprice(String pack_retprice) {
        this.pack_retprice = pack_retprice;
    }
    @Column(name = "jbyw")
    public String getJbyw() {
        return jbyw;
    }
    public void setJbyw(String jbyw) {
        this.jbyw = jbyw;
    }
    @Column(name = "mini_unit")
    public String getMini_unit() {
        return mini_unit;
    }
    public void setMini_unit(String mini_unit) {
        this.mini_unit = mini_unit;
    }
    @Column(name = "pack_size")
    public String getPack_size() {
        return pack_size;
    }
    public void setPack_size(String pack_size) {
        this.pack_size = pack_size;
    }
    @Column(name = "action")
    public String getAction() {
        return action;
    }
    public void setAction(String action) {
        this.action = action;
    }
    @Column(name = "serial")
    public String getSerial() {
        return serial;
    }
    public void setSerial(String serial) {
        this.serial = serial;
    }
    @Column(name = "group_no")
    public String getGroup_no() {
        return group_no;
    }
    public void setGroup_no(String group_no) {
        this.group_no = group_no;
    }
    @Column(name = "stock_amount")
    public String getStock_amount() {
        return stock_amount;
    }
    public void setStock_amount(String stock_amount) {
        this.stock_amount = stock_amount;
    }
    @Column(name = "visible_flag")
    public String getVisible_flag() {
        return visible_flag;
    }
    public void setVisible_flag(String visible_flag) {
        this.visible_flag = visible_flag;
    }
    @Column(name = "drug_flag")
    public String getDrug_flag() {
        return drug_flag;
    }
    public void setDrug_flag(String drug_flag) {
        this.drug_flag = drug_flag;
    }
    @Column(name = "create_time")
    public Date getCreate_time() {
        return create_time;
    }
    public void setCreate_time(Date create_time) {
        this.create_time = create_time;
    }
    @Column(name = "status")
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
}

+ 111 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseDrugUseDictDO.java

@ -0,0 +1,111 @@
package com.yihu.jw.entity.base.dict;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "base_drug_use_dict")
public class BaseDrugUseDictDO extends UuidIdentityEntityWithCreateTime {
    private String supply_code;
    private String supply_name;
    private String supply_occ;
    private String del_flag;
    private String sort_code;
    private String print_name;
    private String py_code;
    private String d_code;
    private String yb_name;
    private String yb_code;
    private String status;
    @Column(name = "supply_code")
    public String getSupply_code() {
        return supply_code;
    }
    public void setSupply_code(String supply_code) {
        this.supply_code = supply_code;
    }
    @Column(name = "supply_name")
    public String getSupply_name() {
        return supply_name;
    }
    public void setSupply_name(String supply_name) {
        this.supply_name = supply_name;
    }
    @Column(name = "supply_occ")
    public String getSupply_occ() {
        return supply_occ;
    }
    public void setSupply_occ(String supply_occ) {
        this.supply_occ = supply_occ;
    }
    @Column(name = "del_flag")
    public String getDel_flag() {
        return del_flag;
    }
    public void setDel_flag(String del_flag) {
        this.del_flag = del_flag;
    }
    @Column(name = "sort_code")
    public String getSort_code() {
        return sort_code;
    }
    public void setSort_code(String sort_code) {
        this.sort_code = sort_code;
    }
    @Column(name = "print_name")
    public String getPrint_name() {
        return print_name;
    }
    public void setPrint_name(String print_name) {
        this.print_name = print_name;
    }
    @Column(name = "py_code")
    public String getPy_code() {
        return py_code;
    }
    public void setPy_code(String py_code) {
        this.py_code = py_code;
    }
    @Column(name = "d_code")
    public String getD_code() {
        return d_code;
    }
    public void setD_code(String d_code) {
        this.d_code = d_code;
    }
    @Column(name = "yb_name")
    public String getYb_name() {
        return yb_name;
    }
    public void setYb_name(String yb_name) {
        this.yb_name = yb_name;
    }
    @Column(name = "yb_code")
    public String getYb_code() {
        return yb_code;
    }
    public void setYb_code(String yb_code) {
        this.yb_code = yb_code;
    }
    @Column(name = "status")
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
}

+ 67 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseFollowUpDictDO.java

@ -0,0 +1,67 @@
package com.yihu.jw.entity.base.dict;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "base_follow_up_dict")
public class BaseFollowUpDictDO extends UuidIdentityEntityWithOperator {
    private String code;
    private String name;
    private String projectContent;
    private String status;
    private String isDel;
    private String isRequired;
    @Column(name = "is_required")
    public String getIsRequired() {
        return isRequired;
    }
    public void setIsRequired(String isRequired) {
        this.isRequired = isRequired;
    }
    @Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "project_content")
    public String getProjectContent() {
        return projectContent;
    }
    public void setProjectContent(String projectContent) {
        this.projectContent = projectContent;
    }
    @Column(name = "status")
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    @Column(name = "is_del")
    public String getIsDel() {
        return isDel;
    }
    public void setIsDel(String isDel) {
        this.isDel = isDel;
    }
}

+ 93 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseFrequencyDictDO.java

@ -0,0 +1,93 @@
package com.yihu.jw.entity.base.dict;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "base_frequency_dict")
public class BaseFrequencyDictDO extends UuidIdentityEntityWithCreateTime {
    private String freq_code;
    private String freq_name;
    private String freq_sp;
    private String daily_times;
    private String weekly_times;
    private String hosp_code;
    private String is_op_ip;
    private String is_del;
    private String status;
    @Column(name = "freq_code")
    public String getFreq_code() {
        return freq_code;
    }
    public void setFreq_code(String freq_code) {
        this.freq_code = freq_code;
    }
    @Column(name = "freq_name")
    public String getFreq_name() {
        return freq_name;
    }
    public void setFreq_name(String freq_name) {
        this.freq_name = freq_name;
    }
    @Column(name = "freq_sp")
    public String getFreq_sp() {
        return freq_sp;
    }
    public void setFreq_sp(String freq_sp) {
        this.freq_sp = freq_sp;
    }
    @Column(name = "daily_times")
    public String getDaily_times() {
        return daily_times;
    }
    public void setDaily_times(String daily_times) {
        this.daily_times = daily_times;
    }
    @Column(name = "weekly_times")
    public String getWeekly_times() {
        return weekly_times;
    }
    public void setWeekly_times(String weekly_times) {
        this.weekly_times = weekly_times;
    }
    @Column(name = "hosp_code")
    public String getHosp_code() {
        return hosp_code;
    }
    public void setHosp_code(String hosp_code) {
        this.hosp_code = hosp_code;
    }
    @Column(name = "is_op_ip")
    public String getIs_op_ip() {
        return is_op_ip;
    }
    public void setIs_op_ip(String is_op_ip) {
        this.is_op_ip = is_op_ip;
    }
    @Column(name = "is_del")
    public String getIs_del() {
        return is_del;
    }
    public void setIs_del(String is_del) {
        this.is_del = is_del;
    }
    @Column(name = "status")
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
}

+ 76 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseTemplateDO.java

@ -0,0 +1,76 @@
package com.yihu.jw.entity.base.dict;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "base_template")
public class BaseTemplateDO extends UuidIdentityEntityWithOperator {
    private String name;
    private String code;
    private String childrenCount;
    private String isDel;
    private String templateType;
    private String diseaseId;
    private String diseaseName;
    @Column(name = "disease_id")
    public String getDiseaseId() {
        return diseaseId;
    }
    public void setDiseaseId(String diseaseId) {
        this.diseaseId = diseaseId;
    }
    @Column(name = "disease_name")
    public String getDiseaseName() {
        return diseaseName;
    }
    public void setDiseaseName(String diseaseName) {
        this.diseaseName = diseaseName;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "children_count")
    public String getChildrenCount() {
        return childrenCount;
    }
    public void setChildrenCount(String childrenCount) {
        this.childrenCount = childrenCount;
    }
    @Column(name = "is_del")
    public String getIsDel() {
        return isDel;
    }
    public void setIsDel(String isDel) {
        this.isDel = isDel;
    }
    @Column(name = "template_type")
    public String getTemplateType() {
        return templateType;
    }
    public void setTemplateType(String templateType) {
        this.templateType = templateType;
    }
}

+ 40 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseTemplateDictDO.java

@ -0,0 +1,40 @@
package com.yihu.jw.entity.base.dict;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "base_template_dict")
public class BaseTemplateDictDO extends UuidIdentityEntityWithCreateTime {
    private String dictId;
    private String isDel;
    private String templateId;
    @Column(name = "dict_id")
    public String getDictId() {
        return dictId;
    }
    public void setDictId(String dictId) {
        this.dictId = dictId;
    }
    @Column(name = "is_del")
    public String getIsDel() {
        return isDel;
    }
    public void setIsDel(String isDel) {
        this.isDel = isDel;
    }
    @Column(name = "template_id")
    public String getTemplateId() {
        return templateId;
    }
    public void setTemplateId(String templateId) {
        this.templateId = templateId;
    }
}

+ 68 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseTemplateOrgDO.java

@ -0,0 +1,68 @@
package com.yihu.jw.entity.base.dict;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import org.springframework.beans.factory.annotation.Autowired;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "base_template_org")
public class BaseTemplateOrgDO extends UuidIdentityEntityWithCreateTime {
    private String templateId;
    private String orgCode;
    private String isDel;
    private String orgName;
    private String templateType;
    private String saasId;
    @Column(name = "template_type")
    public String getTemplateType() {
        return templateType;
    }
    public void setTemplateType(String templateType) {
        this.templateType = templateType;
    }
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "template_id")
    public String getTemplateId() {
        return templateId;
    }
    public void setTemplateId(String templateId) {
        this.templateId = templateId;
    }
    @Column(name = "org_code")
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    @Column(name = "is_del")
    public String getIsDel() {
        return isDel;
    }
    public void setIsDel(String isDel) {
        this.isDel = isDel;
    }
    @Column(name = "org_name")
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
}

+ 65 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictIcd10DO.java

@ -40,6 +40,71 @@ public class DictIcd10DO extends IntegerIdentityEntity {
	 */
	private String description;
	private String disea_reason;
	private String death_reason;
	private String py_code;
    private String flag;
    private String d_code;
    private String is_del;
    private String status;
    @Column(name = "is_del")
    public String getIs_del() {
        return is_del;
    }
    public void setIs_del(String is_del) {
        this.is_del = is_del;
    }
    @Column(name = "status")
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    @Column(name = "disea_reason")
    public String getDisea_reason() {
        return disea_reason;
    }
    public void setDisea_reason(String disea_reason) {
        this.disea_reason = disea_reason;
    }
    @Column(name = "death_reason")
    public String getDeath_reason() {
        return death_reason;
    }
    public void setDeath_reason(String death_reason) {
        this.death_reason = death_reason;
    }
    @Column(name = "py_code")
    public String getPy_code() {
        return py_code;
    }
    public void setPy_code(String py_code) {
        this.py_code = py_code;
    }
    @Column(name = "flag")
    public String getFlag() {
        return flag;
    }
    public void setFlag(String flag) {
        this.flag = flag;
    }
    @Column(name = "d_code")
    public String getD_code() {
        return d_code;
    }
    public void setD_code(String d_code) {
        this.d_code = d_code;
    }
    /**
	 * 创建时间
	 */

+ 22 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/login/BaseLoginLogDO.java

@ -20,6 +20,10 @@ public class BaseLoginLogDO extends UuidIdentityEntity implements java.io.Serial
	private String openid;//微信openid
	private String loginType;
	private Date operateTime;
	private String name;//用户姓名
	private String clientType;//客服端类型app,wx,pad,pc
	@Column(name="operate_time")
	public Date getOperateTime() {
		return operateTime;
@ -74,4 +78,22 @@ public class BaseLoginLogDO extends UuidIdentityEntity implements java.io.Serial
	public void setLoginType(String loginType) {
		this.loginType = loginType;
	}
	@Column(name="name")
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Column(name="client_type")
	public String getClientType() {
		return clientType;
	}
	public void setClientType(String clientType) {
		this.clientType = clientType;
	}
}

+ 20 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java

@ -280,6 +280,8 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    private String marriageName;
    private String latLon;//定位经纬度
    private String padImei;//绑定平板标志
    private String residentialArea;//居住小区
    public String getCardType() {
        return cardType;
@ -849,4 +851,22 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    public void setLatLon(String latLon) {
        this.latLon = latLon;
    }
    @Column(name = "pad_imei")
    public String getPadImei() {
        return padImei;
    }
    public void setPadImei(String padImei) {
        this.padImei = padImei;
    }
    @Column(name = "residential_area")
    public String getResidentialArea() {
        return residentialArea;
    }
    public void setResidentialArea(String residentialArea) {
        this.residentialArea = residentialArea;
    }
}

+ 255 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/birthday/BirthDayWishesToPatient.java

@ -0,0 +1,255 @@
package com.yihu.jw.entity.care.birthday;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 生日祝福推送记录表
 * Created by humingfen on 2018/10/24.
 */
@Entity
@Table(name = "birthday_wishes_to_patient")
public class BirthDayWishesToPatient extends IdEntity {
    //说明:如医生推送生日祝福给5个居民,则保存5条userType=1的记录和1条userType=2的记录(共6条)batchNo批次号一样。
    private String batchNo;//批次号记录发送所属批次(ES:必填)
    private String patientCode; // 患者标识(ES)(根据userType的值,userType=1,必填;userType=2,为空)
    private String patientName; // 患者名称(ES)(根据userType的值,userType=1,必填;userType=2,为空)
    private String doctorCode;  //发送人code(doctor表中的code)(ES:必填)
    private String doctorName;  //发送人名称(doctor表中的name)(ES:必填)
    private Integer userType; // 1、患者,2医生(ES:必填)
    //备注:从发送人的信息中获取(doctor表获取)
    private String sendPic;   // 发送人头像(ES)
    private String sendSex;   // 发送人性别(ES)
    private Long adminTeamCode;// 行政团队(ES)
    private String adminTeamName;// 行政团队(ES)
    private String hospital; // 所属机构(ES)
    private String hospitalName; // 所属机构(ES)
    private String town; // 所属区划(ES)
    private String townName; // 所属区划(ES)
    private Integer sendType;//发送类型 1医生发送 2(管理员)卫纪委发送(ES:必填)
    private Integer sendLevel;   // 发送人级别  1专科医生,2全科医生,3健康管理师 4 管理员(ES)
    //说明:如普通医生推送则保存doctor表中的hospital字段,如管理员推送则保存当前角色的code(取wlyy_user_role表中的role字段)
    private String currentUserRoleCode;//发送者当前登录的角色code(ES:必填)
    private String currentUserRoleLevel;//发送者当前登录的角色级别,1、省,2、市,3、区,4、机构(ES:必填)
    private Integer sendSource; //1或者为空 i健康后台推送  2PC端推送(默认旧数据为1)(为后续平台推送统计做备用字段)
    private Integer allCount;//所有的推送数目(ES:必填)
    private String openidSet;//本次发送生日祝福的openid的总集合
    //生日祝福
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "MM-dd")
    private String birthday;  // 居民生日(ES:必填)
    private Long templateId; //生日模板id
    private String content; //生日祝福内容 (ES:必填)
    private String createTime;  // 创建时间(ES:必填)
    public String getBatchNo() {
        return batchNo;
    }
    public void setBatchNo(String batchNo) {
        this.batchNo = batchNo;
    }
    public String getPatientCode() {
        return patientCode;
    }
    public void setPatientCode(String patientCode) {
        this.patientCode = patientCode;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public Integer getUserType() {
        return userType;
    }
    public void setUserType(Integer userType) {
        this.userType = userType;
    }
    public String getSendPic() {
        return sendPic;
    }
    public void setSendPic(String sendPic) {
        this.sendPic = sendPic;
    }
    public String getSendSex() {
        return sendSex;
    }
    public void setSendSex(String sendSex) {
        this.sendSex = sendSex;
    }
    public Long getAdminTeamCode() {
        return adminTeamCode;
    }
    public void setAdminTeamCode(Long adminTeamCode) {
        this.adminTeamCode = adminTeamCode;
    }
    public String getAdminTeamName() {
        return adminTeamName;
    }
    public void setAdminTeamName(String adminTeamName) {
        this.adminTeamName = adminTeamName;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public String getTown() {
        return town;
    }
    public void setTown(String town) {
        this.town = town;
    }
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
    public String getCurrentUserRoleCode() {
        return currentUserRoleCode;
    }
    public void setCurrentUserRoleCode(String currentUserRoleCode) {
        this.currentUserRoleCode = currentUserRoleCode;
    }
    public String getCurrentUserRoleLevel() {
        return currentUserRoleLevel;
    }
    public void setCurrentUserRoleLevel(String currentUserRoleLevel) {
        this.currentUserRoleLevel = currentUserRoleLevel;
    }
    public Integer getSendSource() {
        return sendSource;
    }
    public void setSendSource(Integer sendSource) {
        this.sendSource = sendSource;
    }
    public Integer getAllCount() {
        return allCount;
    }
    public void setAllCount(Integer allCount) {
        this.allCount = allCount;
    }
    public String getBirthday() {
        return birthday;
    }
    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getCreateTime() {
        return createTime;
    }
    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
    public Integer getSendType() {
        return sendType;
    }
    public void setSendType(Integer sendType) {
        this.sendType = sendType;
    }
    public Integer getSendLevel() {
        return sendLevel;
    }
    public void setSendLevel(Integer sendLevel) {
        this.sendLevel = sendLevel;
    }
    public String getOpenidSet() {
        return openidSet;
    }
    public void setOpenidSet(String openidSet) {
        this.openidSet = openidSet;
    }
    public Long getTemplateId() {
        return templateId;
    }
    public void setTemplateId(Long templateId) {
        this.templateId = templateId;
    }
}

+ 112 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/birthday/BirthdayWishesTemplate.java

@ -0,0 +1,112 @@
package com.yihu.jw.entity.care.birthday;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 生日祝福语模板
 *
 * @author humingfen
 */
@Entity
@Table(name = "wlyy_birthday_wishes_template")
public class BirthdayWishesTemplate extends IdEntity {
    private String code;//业务主键
    private Integer type;//类型(1系统模板、2服务人员创建)
    private Integer applicableRange;//适用范围(1小孩、2中年、3老年人)
    private String content;//祝福语
    private Integer del;//是否删除(0否、1是)
    private String createUser;//创建人(系统模板值为空)
    private String createUserName;//创建人姓名
    private Date createTime;//创建时间
    private Integer isDefault;//是否为默认模板(1是 0否)
    @Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    @Column(name = "applicable_range")
    public Integer getApplicableRange() {
        return applicableRange;
    }
    public void setApplicableRange(Integer applicableRange) {
        this.applicableRange = applicableRange;
    }
    @Column(name = "content")
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    @Column(name = "del")
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    @Column(name = "create_user")
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    @Column(name = "create_user_name")
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getIsDefault() {
        return isDefault;
    }
    public void setIsDefault(Integer isDefault) {
        this.isDefault = isDefault;
    }
}

+ 59 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/common/GetuiClientDO.java

@ -0,0 +1,59 @@
package com.yihu.jw.entity.care.common;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/7/19
 * @Description:
 */
@Entity
@Table(name="base_getui_client")
public class GetuiClientDO extends UuidIdentityEntityWithCreateTime {
    /**
     * 居民或医生code
     */
    private String user;
    /**
     * 1居民 2医生
     */
    private Integer type;
    /**
     * 个推clientId
     */
    private String clientId;
    @Column(name = "user")
    public String getUser() {
        return user;
    }
    public void setUser(String user) {
        this.user = user;
    }
    @Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    @Column(name = "client_id")
    public String getClientId() {
        return clientId;
    }
    public void setClientId(String clientId) {
        this.clientId = clientId;
    }
}

+ 9 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/lifeCare/LifeCareItemDictDO.java

@ -21,6 +21,7 @@ public class LifeCareItemDictDO extends UuidIdentityEntity{
    private Integer sort;//排序字段
    private Integer del;//删除标志 1正常,0删除
    private String lifeCareImg;//服务项目图片
    private String padIconImg;//pad图标
    public String getCode() {
        return code;
@ -78,4 +79,12 @@ public class LifeCareItemDictDO extends UuidIdentityEntity{
    public void setLifeCareImg(String lifeCareImg) {
        this.lifeCareImg = lifeCareImg;
    }
    public String getPadIconImg() {
        return padIconImg;
    }
    public void setPadIconImg(String padIconImg) {
        this.padIconImg = padIconImg;
    }
}

+ 11 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/SystemMessageDO.java

@ -19,6 +19,8 @@ public class SystemMessageDO extends UuidIdentityEntity {
    /**
     *消息类型 上门服务400开头,生活照料500开头 ,安防监控600开头, 上门辅导700开头,紧急救助800开头
     * 人文关怀系统消息 41
     * 体征设备测量系统消息 42
     * 家属紧急预警系统消息 50
     * 新生儿在线咨询 850
     * 老人在线咨询 851
@ -76,6 +78,7 @@ public class SystemMessageDO extends UuidIdentityEntity {
    private Integer state;
    private Integer readonly;
    private String reason;
    private String code;
    private String senderPhoto;
    private String code;
    @Column(name = "code")
@ -232,4 +235,12 @@ public class SystemMessageDO extends UuidIdentityEntity {
    public void setOver(String over) {
        this.over = over;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
}

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/doctor/WlyyDoctorWorkTimeVO.java

@ -54,6 +54,16 @@ public class WlyyDoctorWorkTimeVO {
    @ApiModelProperty(value = "创建人类型1医院2医生", example = "模块1")
    private Integer createUserType;//创建人类型1医院2医生
    @ApiModelProperty(value = "当前号源时间的星期数", example = "模块1")
    private Integer weekday;//创建人类型1医院2医生
    public Integer getWeekday() {
        return weekday;
    }
    public void setWeekday(Integer weekday) {
        this.weekday = weekday;
    }
    public String getId() {
        return id;

+ 123 - 0
common/common-util/src/main/java/com/yihu/jw/util/healthIndex/HealthIndexUtil.java

@ -0,0 +1,123 @@
package com.yihu.jw.util.healthIndex;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.stereotype.Component;
/**
 * Created by Bing on 2021/7/20.
 * 体征数据
 */
@Component
public class HealthIndexUtil {
    // 血糖餐前最小值
    public static final double HEALTH_STANDARD_ST_MIN_BEFORE = 4;
    // 血糖餐前最大值
    public static final double HEALTH_STANDARD_ST_MAX_BEFORE = 7;
    // 血糖餐后最小值
    public static final double HEALTH_STANDARD_ST_MIN_AFTER = 4;
    // 血糖餐后最大值
    public static final double HEALTH_STANDARD_ST_MAX_AFTER = 11.1;
    // 舒张压最小值
    public static final double HEALTH_STANDARD_SZY_MIN = 60;
    // 舒张压最大值
    public static final double HEALTH_STANDARD_SZY_MAX = 90;
    // 收缩压最小值
    public static final double HEALTH_STANDARD_SSY_MIN = 90;
    // 收缩压最大值
    public static final double HEALTH_STANDARD_SSY_MAX = 140;
    //最小值
    public static final double HEALTH_STANDARD_HEART_RATE_MIN = 60;
    //最大值
    public static final double HEALTH_STANDARD_HEART_RATE_MAX = 100;
    /**
     * type:1血糖2血压,3体重/身高/BMI,4腰围,5心率,6体温
     * @return
     */
    public JSONArray verifyHealthIndex(Integer type, String ...values) {
        //血糖校验
        JSONArray result = new JSONArray();
        JSONObject tmp = new JSONObject();
        if (1 ==type) {
            // 血糖记录,查询患者血糖预警值
            Double maxValueBefore = HEALTH_STANDARD_ST_MAX_BEFORE;
            Double minValueBefore = HEALTH_STANDARD_ST_MIN_BEFORE;
            Double maxValueAfter = HEALTH_STANDARD_ST_MAX_AFTER;
            Double minValueAfter = HEALTH_STANDARD_ST_MIN_AFTER;
            int index = Integer.valueOf(values[1]);
            String value1 = values[0];
            // 餐后
            if (index % 2 == 0) {
                tmp.put("value1",value1);
                tmp.put("indexName","血糖");
                tmp.put("error",checkHealthIndex(NumberUtils.toDouble(value1), maxValueAfter, minValueAfter));
            } else { //餐前
                tmp.put("value1",value1);
                tmp.put("indexName","血糖");
                tmp.put("error",checkHealthIndex(NumberUtils.toDouble(value1), maxValueBefore, minValueBefore));
            }
            result.add(tmp);
        }
        //血压校验
        else if (type == 2) {
            String value1 = values[0];//收缩压
            String value2 = values[1];//舒张压
            String value3 = values[2];//脉搏
            // 血压记录,查询患者血压预警值
            Double maxValueSSY = HEALTH_STANDARD_SSY_MAX;
            Double minValueSSY = HEALTH_STANDARD_SSY_MIN;
            Double maxValueSZY = HEALTH_STANDARD_SZY_MAX;
            Double minValueSZY = HEALTH_STANDARD_SZY_MIN;
            // 收缩压/舒张压校验
            tmp.put("value1",value1);
            tmp.put("indexName","收缩压");
            tmp.put("error",checkHealthIndex(NumberUtils.toDouble(value1), maxValueSSY, minValueSSY));
            result.add(tmp);
            //舒张压校验
            tmp = new JSONObject();
            tmp.put("value1",value2);
            tmp.put("indexName","舒张压");
            tmp.put("error",checkHealthIndex(NumberUtils.toDouble(value2), maxValueSZY, minValueSZY));
            result.add(tmp);
            tmp = new JSONObject();
            //脉搏检验
            if (StringUtils.isNotBlank(value3)){
                tmp.put("value1",value3);
                tmp.put("indexName","脉搏");
                tmp.put("error",checkHealthIndex(NumberUtils.toDouble(value3), HEALTH_STANDARD_HEART_RATE_MAX, HEALTH_STANDARD_HEART_RATE_MIN));
                result.add(tmp);
            }
        }
        else if (type == 5) {//心率
            String value1 = values[0];//心率
            tmp.put("value1",value1);
            tmp.put("indexName","心率");
            tmp.put("error",checkHealthIndex(NumberUtils.toDouble(value1), HEALTH_STANDARD_HEART_RATE_MAX, HEALTH_STANDARD_HEART_RATE_MIN));
            result.add(tmp);
        }
        return result;
    }
    /**
     * 判断当前值是否在区间内
     */
    private Integer checkHealthIndex(Double current, Double max, Double min) {
        if (current > max  ) {
            return 1;//指标过高
        }else if(current < min || current < 0) {
            return -1;//指标过低
        }
        else {//正常
            return 0;
        }
    }
}

+ 0 - 1
server/svr-authentication/pom.xml

@ -164,7 +164,6 @@
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>axis</groupId>
            <artifactId>axis-jaxrpc</artifactId>

+ 100 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java

@ -1,17 +1,22 @@
package com.yihu.jw.security.core.userdetails.jdbc;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.login.BaseLoginLogDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientFamilyMemberDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.care.common.GetuiClientDO;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.security.core.userdetails.SaltUser;
import com.yihu.jw.security.dao.patient.BaseGetuiClientDao;
import com.yihu.jw.security.dao.patient.BasePatientDao;
import com.yihu.jw.security.dao.patient.BasePatientWechatDao;
import com.yihu.jw.security.dao.patient.WlyyPatientFamilyMemberDao;
import com.yihu.jw.security.model.WlyyUserDetails;
import com.yihu.jw.security.model.WlyyUserSimple;
import com.yihu.jw.security.utils.IdCardUtil;
import com.yihu.jw.security.utils.ImUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.utils.security.MD5;
import org.apache.commons.lang.StringUtils;
@ -97,6 +102,12 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
    @Autowired
    private WlyyPatientFamilyMemberDao familyMemberDao;
    @Autowired
    private BaseGetuiClientDao baseGetuiClientDao;
    @Autowired
    private ImUtil imUtil;
    @Value("${kick.eachOther}")
    private String kickEachOther;
    public WlyyUserDetailsService(DataSource dataSource) {
        this.setDataSource(dataSource);
@ -630,6 +641,95 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
        } //...
    }
    /**
     * 更新个推clientId 和老人平板登录信息
     * @param clientId
     * @param padImei
     * @param loginType
     * @param id
     */
    public void updateInfo(String clientId,String padImei,String loginType,String id,BaseLoginLogDO baseLoginLogDO){
        int isPateint = isPatient(loginType);
        if(StringUtils.isNotBlank(padImei)){
            try {
                if(isPateint == 1){
                    this.getJdbcTemplate().update("update base_patient p set p.pad_imei = ? where p.id = ? or p.idcard = ?", padImei, id);
                }
            }catch (Exception e){
                e.printStackTrace();
            }
        }
        if(StringUtils.isNotBlank(clientId)&&isPateint<3){
            try {
                List<GetuiClientDO> list = baseGetuiClientDao.findByUser(id,isPateint,clientId);
                if(list.size() == 0){
                    GetuiClientDO getuiClientDO = new GetuiClientDO();
                    getuiClientDO.setClientId(clientId);
                    getuiClientDO.setType(isPateint);
                    getuiClientDO.setUser(id);
                    getuiClientDO.setCreateTime(new Date());
                    baseGetuiClientDao.save(getuiClientDO);
                }
            }catch (Exception e){
                e.printStackTrace();
            }
        }
        if(StringUtils.isNotBlank(baseLoginLogDO.getClientType())&&"0".equals(kickEachOther)){
            try {
                //pc管理端端推送消息
                JSONObject message = new JSONObject();
                //陈XXX登录云照护平台   登录终端:多媒体平板   2021-7-7 16:38:25
                String content = baseLoginLogDO.getName() + "登录云照护平台 登录终端:" + getClientName(baseLoginLogDO.getClientType())
                        + " " + DateUtil.dateToStrLong(baseLoginLogDO.getCreateTime());
                message.put("content",content);
                message.put("content_type",41);
                imUtil.sendPcManageMessageToPc("cloudCare_pcManage",message.toString());
            }catch (Exception e){
                e.printStackTrace();
            }
        }
    }
    /**
     * app,wx,pad,pc
     * @param clientType
     * @return
     */
    private String getClientName(String clientType){
        String result = "";
        switch (clientType){
            case "app":
                result = "APP";
                break;
            case "wx":
                result = "微信公众号";
                break;
            case "pad":
                result = "多媒体平板";
                break;
            case "pc":
                result = "脑端";
                break;
        }
        return result;
    }
    /**
     * 根据登录类型判断登录是医生2 ,居民1 还是后台管理员 3
     * @param loginType
     * @return
     */
    public int isPatient(String loginType){
        if(StringUtils.isBlank(loginType) || "1".equals(loginType)){
            return 3;
        }
        if("2".equals(loginType)){
            return 2;
        }
        return 1;
    }
    private Collection<? extends GrantedAuthority> getGrantedAuthorities(String username) {
        Collection<GrantedAuthority> authorities = new ArrayList<>(1);
        authorities.add(new SimpleGrantedAuthority("ROLE_USER"));

+ 22 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/dao/patient/BaseGetuiClientDao.java

@ -0,0 +1,22 @@
package com.yihu.jw.security.dao.patient;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.common.GetuiClientDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/7/19
 * @Description:
 */
public interface BaseGetuiClientDao extends PagingAndSortingRepository<GetuiClientDO, String>, JpaSpecificationExecutor<GetuiClientDO> {
    @Query("from GetuiClientDO p where p.user = ?1 and p.type=?2 and p.clientId=?3")
    List<GetuiClientDO> findByUser(String user, Integer type,String clientId);
}

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

@ -264,20 +264,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        //图形验证码验证
        String key = parameters.get("key");
        String text = parameters.get("text");
        String isNeedGeet= "1";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO= wlyyhospitalSysdictDao.findDictById("isNeedGeet");
        if (wlyyHospitalSysDictDO!=null){
            isNeedGeet=wlyyHospitalSysDictDO.getDictValue();
        }
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)&&"1".equalsIgnoreCase(isNeedGeet)){
            String geetestChallenge = parameters.get("geetestChallenge");
            String geetestValidate = parameters.get("geetestValidate");
            String geetestSeccode = parameters.get("geetestSeccode");
            JSONObject resResult =validateGeet(geetestChallenge,geetestValidate,geetestSeccode,"1");
            if (resResult==null||!resResult.getString("result").equalsIgnoreCase("success")){
                throw new  Exception("验证失败");
            }
        }
        if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
            if(!verifyCaptcha(key,text)){
                throw new ImgCaptchaException("img_captcha error");
@ -378,14 +365,25 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
            //使用密码登录成功后, 更新失败次数为 0
            userDetailsService.addFailureCount(username, 0);
        }
        userDetailsService.setRolePhth(loginType, token, wlyyUserSimple.getId(), redisTemplate);
        String clientType = parameters.get("clientType");
        baseLoginLogDO.setUserId(wlyyUserSimple.getId());
        baseLoginLogDO.setCreateTime(new Date());
        String userAgent = JSONObject.toJSONString(wlyyUserSimple);
        baseLoginLogDO.setUserAgent(userAgent);
        baseLoginLogDO.setLoginType(loginType);
        baseLoginLogDO.setName(wlyyUserSimple.getName());
        baseLoginLogDO.setClientType(clientType);
        baseLoginLogService.save(baseLoginLogDO);
        //个推 clientId
        String clientId = parameters.get("getuiClientId");
        String padImei = parameters.get("padImei");
        //客户端类型 app,wx,pad,pc
        userDetailsService.updateInfo(clientId,padImei,loginType,wlyyUserSimple.getId(),baseLoginLogDO);
        return getResponse(wlyyUserSimple);
    }

+ 895 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/utils/ImUtil.java

@ -0,0 +1,895 @@
package com.yihu.jw.security.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.util.http.HttpClientUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
/**
 * IM工具类
 * @author huangwenjie
 */
@Component
public class ImUtil {
	
	@Autowired
	private HttpClientUtil HttpClientUtil;
	
	@Value("${im.im_list_get}")
	private String im_host;
	
	
	public enum ContentType {
		plainText("信息", "1"),
		image("图片信息", "2"),
		audio("创建处方", "3"),
		article("文章信息", "4"),
		goTo("跳转信息,求组其他医生或者邀请其他医生发送的推送消息", "5"),
		topicBegin("议题开始", "6"),
		topicEnd("议题结束", "7"),
		personalCard("个人名片", "18"),
		messageForward("消息转发", "19"),
		topicInto("进入议题", "14"),
		video("视频", "12"),
		system("系统消息", "13"),
		prescriptionCheck("续方审核消息消息", "15"),
		prescriptionBloodStatus("续方咨询血糖血压咨询消息", "16"),
		prescriptionFollowupContent("续方咨询随访问卷消息", "17"),
		Rehabilitation("康复计划发送","20"),
		Reservation("转诊预约发送","21"),
		Know("已知悉","22");
		
		private String name;
		private String value;
		ContentType(String name, String value) {
			this.name = name;
			this.value = value;
		}
		
		public String getName() {
			return name;
		}
		
		public void setName(String name) {
			this.name = name;
		}
		
		public String getValue() {
			return value;
		}
		
		public void setValue(String value) {
			this.value = value;
		}
	}
	public String sendMDTSocketMessageToDoctor(String targetUserId, String message) {
		String imAddr = im_host + "api/v2/message/doctorSystemMessage";
		JSONObject params = new JSONObject();
		params.put("targetUserId", targetUserId);
		params.put("message", message);
		String response = HttpClientUtil.postBody(imAddr,params);
		return response;
	}
	public String sendPcManageMessageToPc(String clientType, String message) {
		String imAddr = im_host + "api/v2/message/cloudCarePcManageMessage";
		JSONObject params = new JSONObject();
		params.put("clientType", clientType);
		params.put("message", message);
		String response = HttpClientUtil.postBody(imAddr,params);
		return response;
	}
	public String sendPatientSystemMessage(String targetUserId, String message) {
		String imAddr = im_host + "api/v2/message/patientSystemMessage";
		JSONObject params = new JSONObject();
		params.put("targetUserId", targetUserId);
		params.put("message", message);
		String response = HttpClientUtil.postBody(imAddr,params);
		return response;
	}
	/**
	 * 发送消息
	 * @param senderId 发送者的code
	 * @param receiverId 接受者code
	 * @param contentType 消息类型 1二维码内容
	 * @param content 消息内容
	 * @return
	 */
	public String sendMessage(String senderId,String receiverId,String contentType,String content){
		String imAddr = im_host + "api/v2/message/send";
		JSONObject params = new JSONObject();
		params.put("sender_id", senderId);
		params.put("sender_name", receiverId);
		params.put("content_type", contentType);
		params.put("content", content);
		String response = HttpClientUtil.postBody(imAddr, params);
		return response;
	}
	
	/**
	 * 获取医生统计数据
	 * status reply 为空值是是该医生总咨询量
	 *
	 * @param user          团队就把团队的医生合并起来用,隔开(医生编码)
	 * @param adminTeamCode
	 * @param status
	 * @param reply
	 * @return
	 */
	public String getConsultData(String user, Integer adminTeamCode, Integer status, Integer reply) {
		String imAddr = im_host + "api/v2/sessions/topics/count/reply";
		imAddr = imAddr + "?user=" + user;
		if (status != null) {
			imAddr += ("&status=" + status);
		}
		if (adminTeamCode != null) {
			imAddr += ("&adminTeamCode=" + adminTeamCode);
		}
		if (reply != null) {
			imAddr += ("&reply=" + reply);
		}
		String response = HttpClientUtil.get(imAddr, "UTF-8");
		return response;
	}
	
	public void updateTopics(String topicId, String jsonValue) {
		String imAddr = im_host + "api/v2/sessions/" + topicId + "/topics";
		JSONObject params = new JSONObject();
		params.put("topic_id", topicId);
		params.put("data", jsonValue);
		HttpClientUtil.putBody(imAddr, params);
	}
	
	/**
	 * 当前医生下当前团队列表接口
	 * 获取团队内医生的健康咨询状况
	 * status = 10 已结束的咨询,status=0,reply = 1 已回复 ,status=0,reply=0未回复
	 *
	 * @param user          团队就把团队的医生合并起来用,隔开(医生编码)
	 * @param adminTeamCode 行政团队code
	 * @param page
	 * @param pagesize
	 * @param status
	 * @param reply
	 * @return
	 */
	public String getTeamConsultByStatus(String user, Integer adminTeamCode, Integer status, Integer reply, int page, int pagesize) {
		String imAddr = im_host + "api/v2/sessions/healthTeamTopics";
		imAddr = imAddr + "?user=" + user + "&page=" + page + "&pagesize=" + pagesize;
		if (adminTeamCode != null) {
			imAddr += ("&adminTeamCode=" + adminTeamCode);
		}
		if (status != null) {
			imAddr += ("&status=" + status);
		}
		if (reply != null) {
			imAddr += ("&reply=" + reply);
		}
		String response = HttpClientUtil.get(imAddr, "UTF-8");
		return response;
	}
	
	/**
	 * 列表接口
	 * 获取团队内医生的健康咨询状况
	 * status = 10 已结束的咨询,status=0,reply = 1 已回复 ,status=0,reply=0未回复
	 *
	 * @param user     团队就把团队的医生合并起来用,隔开(医生编码)
	 * @param page
	 * @param pagesize
	 * @param status
	 * @param reply
	 * @return
	 */
	public String getConsultByStatus(String user, Integer status, Integer reply, int page, int pagesize) {
		String imAddr = im_host + "api/v2/sessions/healthTopics";
		imAddr = imAddr + "?user=" + user + "&page=" + page + "&pagesize=" + pagesize;
		if (status != null) {
			imAddr += ("&status=" + status);
		}
		if (reply != null) {
			imAddr += ("&reply=" + reply);
		}
		String response = HttpClientUtil.get(imAddr, "UTF-8");
		return response;
	}
	
	/**
	 * 咨询列表
	 * @param user
	 * @param status status = 10 已结束的咨询,status=0,reply = 1 已回复 ,status=0,reply=0未回复
	 * @param reply
	 * @param type 1、三师咨询,2、家庭医生咨询,6、患者名医咨询 7医生名医咨询 8续方咨询 10医生发起的求助
	 * @param page
	 * @param pagesize
	 * @return
	 */
	public String getConsultByStatusAndType(String user,Integer status,Integer reply,Integer type,String patientName,String startTime,String endTime,int page,int pagesize){
		String imAddr = im_host + "api/v2/sessions/topicListByType";
		imAddr = imAddr + "?user="+user + "&page=" + page + "&pagesize=" + pagesize;
		if (status != null) {
			imAddr += ("&status=" + status);
		}
		if (reply != null) {
			imAddr += ("&reply=" + reply);
		}
		if (type != null) {
			imAddr += ("&type=" + type);
		}
		if (patientName != null) {
			imAddr += ("&patientName=" + patientName);
		}
		if (startTime != null) {
			imAddr += ("&startTime=" + startTime);
		}
		if (endTime != null) {
			imAddr += ("&endTime=" + endTime);
		}
		String response = HttpClientUtil.get(imAddr, "UTF-8");
		return response;
	}
	
	/**
	 * 咨询列表总数
	 * @param user
	 * @param status status = 10 已结束的咨询,status=0,reply = 1 已回复 ,status=0,reply=0未回复
	 * @param reply
	 * @param type 1、三师咨询,2、家庭医生咨询,6、患者名医咨询 7医生名医咨询 8续方咨询 10医生发起的求助
	 * @return
	 */
	public String getConsultCountByStatusAndType(String user,Integer status,Integer reply,Integer type,String patientName,String startTime,String endTime){
		String imAddr = im_host + "api/v2/sessions/topicListCountByType";
		imAddr = imAddr + "?user="+user;
		if (status != null) {
			imAddr += ("&status=" + status);
		}
		if (reply != null) {
			imAddr += ("&reply=" + reply);
		}
		if (type != null) {
			imAddr += ("&type=" + type);
		}
		if (patientName != null) {
			imAddr += ("&patientName=" + patientName);
		}
		if (startTime != null) {
			imAddr += ("&startTime=" + startTime);
		}
		if (endTime != null) {
			imAddr += ("&endTime=" + endTime);
		}
		String response = HttpClientUtil.get(imAddr, "UTF-8");
		return response;
	}
	
	/**
	 * 发送消息给IM
	 *
	 * @param from        来自
	 * @param contentType 1文字 2图片消息
	 * @param content     内容
	 */
	public String sendImMsg(String from, String fromName, String sessionId, String contentType, String content, String businessType,String extend) {
		String imAddr = im_host + "api/v2/sessions/" + sessionId + "/messages";
		System.out.println("im地址"+imAddr);
		JSONObject params = new JSONObject();
		params.put("sender_id", from);
		params.put("sender_name", fromName);
		params.put("content_type", contentType);
		params.put("content", content);
		params.put("session_id", sessionId);
		params.put("business_type", businessType);
		params.put("extend",extend);
		String response = HttpClientUtil.postBody(imAddr, params);
		return response;
	}
	
	/**
	 * 更新会话状态
	 *
	 * @param sessionId 会话ID
	 * @param status    状态
	 */
	public String updateSessionStatus(String sessionId, String status) {
		String imAddr = im_host + "api/v2/sessions/" + sessionId + "/status?status=" + status + "&sessionId=" + sessionId;
		JSONObject params = new JSONObject();
		String response = HttpClientUtil.postBody(imAddr, params);
		return response;
	}
	
	/**
	 * 更新会话状态
	 *
	 * @param sessionId 会话ID
	 * @param status    状态
	 */
	public String updateTopicEvaluate(String sessionId, String status) {
		String imAddr = im_host + "api/v2/sessions/" + sessionId + "/status?status=" + status + "&sessionId=" + sessionId;
		JSONObject params = new JSONObject();
		String response = HttpClientUtil.postBody(imAddr, params);
		return response;
	}
	/**
	 * 发送消息给IM
	 *
	 * @param from        来自
	 * @param contentType 1文字 2图片消息
	 * @param content     内容
	 */
	public String sendTopicIM(String from, String fromName, String topicId, String contentType, String content, String agent) {
		String url = im_host + "api/v2/sessions/topic/" + topicId + "/messages";
		JSONObject params = new JSONObject();
		params.put("sender_id", from);
		params.put("sender_name", fromName);
		params.put("content_type", contentType);
		params.put("content", content);
		params.put("topic_id", topicId);
		params.put("agent", agent);
		String response = HttpClientUtil.postBody(url, params);
		return response;
	}
	
	/**
	 * 发送消息给IM
	 *
	 * @param from        来自
	 * @param contentType 1文字 2图片消息
	 * @param content     内容
	 */
	public String sendTopicIM(String from, String fromName, String topicId, String contentType, String content, String agent,String patient_name,int patient_sex,int patient_age) {
		String url = im_host + "api/v2/sessions/topic/" + topicId + "/messages";
		JSONObject params = new JSONObject();
		params.put("sender_id", from);
		params.put("sender_name", fromName);
		params.put("patient_name", patient_name);
		params.put("patient_sex", patient_sex);
		params.put("patient_age", patient_age);
		params.put("content_type", contentType);
		params.put("content", content);
		params.put("topic_id", topicId);
		params.put("agent", agent);
		String response = HttpClientUtil.postBody(url, params);
		return response;
	}
	
	/**
	 * 发送进入im消息
	 * IM: ParticipantUpdate:'/:session_id/participant/update'
	 *
	 * @param from
	 * @param sessionId
	 * @param topicId
	 * @return
	 */
	public String sendIntoTopicIM(String from, String sessionId, String topicId, String content, String intoUser, String intoUserName) {
		String url = im_host + "api/v2/sessions/" + sessionId + "/topics/" + topicId + "/into";
		JSONObject params = new JSONObject();
		params.put("sender_id", from);
		params.put("topic_id", topicId);
		params.put("into_user", intoUser);
		params.put("into_user_name", intoUserName);
		params.put("content", content);
		String response = HttpClientUtil.postBody(url, params);
		return response;
	}
	
	
	/**
	 * 更新会话成员(新增或删除)
	 * @param sessionId 会话id
	 * @param user 新增的成员id
	 * @param oldUserId  删除的成员id
	 */
	public String updateParticipant(String sessionId, String user,String oldUserId) {
		String imAddr = im_host + "api/v2/sessions/" + sessionId + "/participant/update";
		JSONObject params = new JSONObject();
		params.put("session_id", sessionId );
		params.put("user_id", user );
		if(!StringUtils.isEmpty(oldUserId)){
			params.put("old_user_id", oldUserId);
		}
		return HttpClientUtil.postBody(imAddr, params);
	}
	/**
	 * 更新会话成员(新增或删除) 活跃成员
	 * @param sessionId 会话id
	 * @param user 新增的成员id
	 * @param oldUserId  删除的成员id
	 */
	public String updateParticipantNew(String sessionId, String user,String oldUserId) {
		String imAddr = im_host + "api/v2/sessions/" + sessionId + "/participant/updateNew";
		JSONObject params = new JSONObject();
		params.put("session_id", sessionId );
		params.put("user_id", user );
		if(!StringUtils.isEmpty(oldUserId)){
			params.put("old_user_id", oldUserId);
		}
		return HttpClientUtil.postBody(imAddr, params);
	}
	
	/**
	 * 更新消息内容
	 * @param sessionId 会话id
	 * @param sessionType 会话类型
	 * @param msgId  消息id
	 * @param content  消息内容
	 */
	public String updateMessage(String sessionId, String sessionType,String msgId,String content) {
		String imAddr = im_host + "api/v2/sessions/" + sessionId + "/messages/"+ msgId +"/update";
		JSONObject params = new JSONObject();
		params.put("session_id", sessionId );
		params.put("session_type", sessionType );
		params.put("message_id", msgId );
		params.put("content", content );
		return HttpClientUtil.postBody(imAddr, params);
	}
	
	/**
	 * 结束议题
	 *
	 * @param topicId     议题ID
	 * @param endUser     结束人
	 * @param endUserName 结束人名字
	 * @param sessionId   会话ID
	 */
	public JSONObject endTopics(String sessionId, String endUser, String endUserName, String topicId) {
		String imAddr = im_host + "api/v2/sessions/" + sessionId + "/topics/" + topicId + "/ended";
		JSONObject params = new JSONObject();
		params.put("session_id", sessionId);
		params.put("end_user", endUser);
		params.put("end_user_name", endUserName);
		params.put("topic_id", topicId);
		String ret = HttpClientUtil.postBody(imAddr, params);
		JSONObject obj = null;
		try {
			obj = JSON.parseObject(ret);
		} catch (Exception e) {
			return null;
		}
		return obj;
	}
	
	
	/**
	 * 议题邀请人员
	 *
	 * @param user      结束人名字
	 * @param sessionId 会话ID
	 */
	public void updateTopicUser(String sessionId, String user) {
		String imAddr = im_host + "api/v2/sessions/" + sessionId + "/participants/" + user;
		JSONObject params = new JSONObject();
		params.put("user", user + ":" + 0);
		HttpClientUtil.putBody(imAddr, params);
	}
	
	/**
	 * 创建议题
	 *
	 * @param topicId      议题ID
	 * @param topicName    议题名称
	 * @param participants 成员
	 */
	public JSONObject createTopics(String sessionId, String topicId, String topicName, JSONObject participants, JSONObject messages, String sessionType) {
		String imAddr = im_host + "api/v2/sessions/" + topicId + "/topics";
		JSONObject params = new JSONObject();
		params.put("topic_id", topicId);
		params.put("topic_name", topicName);
		params.put("participants", participants.toString());
		params.put("messages", messages.toString());
		params.put("session_id", sessionId);
		params.put("session_type", sessionType);
		String ret = HttpClientUtil.postBody(imAddr, params);
		JSONObject obj = null;
		try {
			obj = JSON.parseObject(ret);
		} catch (Exception e) {
			return null;
		}
		return obj;
	}
	
	/**
	 * 判断会话是否存在
	 */
	public Boolean sessionIsExist(String sessionId) {
		Boolean re = false;
		String url = im_host + "api/v2/sessions/isExist?session_id="+sessionId;
		JSONObject params = new JSONObject();
		String ret = HttpClientUtil.get(url, "UTF-8");
		JSONObject obj = null;
		try {
			obj = JSON.parseObject(ret);
			if(obj.getInteger("status") ==200&&sessionId.equals(obj.getString("sessionId"))){
				String sessionStatus = obj.getString("sessionId");
				if (StringUtils.isNoneBlank(sessionStatus)){
					String sessionStatusUrl = im_host + "api/v2/sessions/"+sessionId+"/status?status=0&sessionId="+sessionId;
					JSONObject object = new JSONObject();
					String rs = HttpClientUtil.postBody(sessionStatusUrl, object);
				}
				re = true;
			}
		} catch (Exception e) {
			return null;
		}
		return re;
	}
	
	/**
	 * 创建会话(system)
	 */
	public JSONObject createSession(JSONObject participants, String sessionType, String sessionName, String sessionId) {
		String imAddr = im_host + "api/v2/sessions";
		JSONObject params = new JSONObject();
		params.put("participants", participants.toString());
		params.put("session_name", sessionName);
		params.put("session_type", sessionType);
		params.put("session_id", sessionId);
		String ret = HttpClientUtil.postBody(imAddr, params);
		JSONObject obj = null;
		try {
			obj = JSON.parseObject(ret);
		} catch (Exception e) {
			return null;
		}
		return obj;
	}
	
	/**
	 * 获取会话实例的消息对象
	 *
	 * @param senderId
	 * @param senderName
	 * @param title
	 * @param description
	 * @param images
	 * @param agent
	 * @return
	 */
	public JSONObject getCreateTopicMessage(String senderId, String senderName, String title, String description, String images, String agent) {
		JSONObject messages = new JSONObject();
		messages.put("description", description);
		messages.put("title", title);
		messages.put("img", images);
		messages.put("sender_id", senderId);
		messages.put("sender_name", senderName);
		messages.put("agent", agent);
		return messages;
	}
	
	public JSONObject getTopicMessage(String topicId, String startMsgId, String endMsgId, int page, int pagesize, String uid) {
		String url = im_host
				+ "api/v2/sessions/topic/" + topicId + "/messages?topic_id=" + topicId + "&end=" + startMsgId
				+ "&start=" + (endMsgId == null ? "" : endMsgId) + "&page=" + page + "&pagesize=" + pagesize + "&user=" + uid;
		try {
			String ret = HttpClientUtil.get(url, "UTF-8");
			JSONObject obj = JSON.parseObject(ret);
			if (obj.getInteger("status") == -1) {
				throw new RuntimeException(obj.getString("message"));
			} else {
				return obj.getJSONObject("data");
			}
		} catch (Exception e) {
			return null;
		}
		
	}
	
	public JSONArray getSessionMessage(String sessionId, String startMsgId, String endMsgId, int page, int pagesize, String uid) {
		String url = im_host + "api/v2/sessions/" + sessionId + "/messages?session_id=" + sessionId + "&user=" + uid + "&start_message_id=" + startMsgId + "&end_message_id=" + endMsgId + "&page=" + page + "&pagesize=" + pagesize;
		try {
			String ret = HttpClientUtil.get(url, "UTF-8");
			JSONArray obj = JSON.parseArray(ret);
			return obj;
		} catch (Exception e) {
			return null;
		}
	}
	
	/**
	 * 删除对应的成员信息在MUC模式中
	 *
	 * @param userId
	 * @param oldUserId
	 * @param sessionId
	 * @return
	 */
	public JSONObject deleteMucUser(String userId, String oldUserId, String sessionId) throws Exception {
		String url = im_host + "api/v2/sessions/" + sessionId + "/participant/update";
		try {
			JSONObject params = new JSONObject();
			params.put("user_id", userId);
			params.put("old_user_id", oldUserId);
			params.put("session_id", sessionId);
			String ret = HttpClientUtil.postBody(url, params);
			JSONObject obj = JSON.parseObject(ret);
			if (obj.getInteger("status") == -1) {
				throw new RuntimeException("人员更换失败!");
			} else {
				return obj;
			}
		} catch (Exception e) {
			throw new RuntimeException("人员更换失败!");
		}
	}
	/**
	 * 删除会话人员
	 * @param sessionId
	 * @param participants
	 * @return
	 */
	public JSONObject deleteParticipants(String sessionId,String participants){
		String url  = im_host+"api/v2/sessions/"+sessionId+"/participants/"+participants;
		String rs = HttpClientUtil.doDelete(url,null,null);
		JSONObject obj = JSONObject.parseObject(rs);
		if (obj.getInteger("status")==-1){
			throw new RuntimeException("删除会话人员失败!");
		}else {
			return obj;
		}
	}
	
	
	/**
	 * 获取议题
	 *
	 * @param topicId
	 * @return
	 */
	public JSONObject getTopic(String topicId) throws Exception {
		String url = im_host + "api/v2/sessions/topics/" + topicId + "?topic_id=" + topicId;
		try {
			String ret = HttpClientUtil.get(url, "utf-8");
			JSONObject obj = JSON.parseObject(ret);
			if (obj.getInteger("status") == -1) {
				throw new RuntimeException("获取议题失败!");
			} else {
				return obj;
			}
		} catch (Exception e) {
			throw new RuntimeException("获取议题失败!");
		}
	}
	
	/**
	 * 获取会话成员
	 *
	 * @param sessionId
	 * @return
	 * @throws Exception
	 */
	public JSONArray getParticipants(String sessionId) {
		String url = im_host + "api/v2/sessions/" + sessionId + "/participants?session_id=" + sessionId;
		try {
			String ret = HttpClientUtil.get(url, "utf-8");
			return JSON.parseArray(ret);
		} catch (Exception e) {
			throw new RuntimeException("获取会话成员!sessionId =" + sessionId);
		}
	}
	
	/**
	 * 获取会话成员
	 *
	 * @param sessionId
	 * @return
	 * @throws Exception
	 */
	public JSONArray getSessions(String sessionId) {
		String url = im_host + "api/v2/sessions/" + sessionId + "/participants?session_id=" + sessionId;
		try {
			String ret = HttpClientUtil.get(url, "utf-8");
			return JSON.parseArray(ret);
		} catch (Exception e) {
			throw new RuntimeException("获取议题失败!");
		}
	}
	
	public JSONObject cleanMessageToRedis(String sessionId){
		String url = im_host + "api/v2/message/dataMessage?sessionId="+sessionId;
		try {
			String ret = HttpClientUtil.get(url,"utf-8");
			return JSON.parseObject(ret);
		} catch (Exception e) {
			throw new RuntimeException("操作失败!");
		}
	}
	
	public JSONObject cleanMessageLastFetchTime(String sessionId,String userId){
		String url = im_host + "api/v2/message/cleanMessageLastFetchTimeToRedis?sessionId="+sessionId+"&userId="+userId;
		try {
			String ret = HttpClientUtil.get(url,"utf-8");
			return JSON.parseObject(ret);
		} catch (Exception e) {
			throw new RuntimeException("操作失败!");
		}
	}
	
	
	/**
	 * 根据session和userid获取单个会话
	 * @param sessionId
	 * @param userId
	 * @return
	 */
	public JSONObject getSingleSessionInfo(String sessionId,String userId){
		String url = im_host + "api/v2/sessions/" + sessionId + "/session?user_id=" + userId;
		try {
			String ret = HttpClientUtil.get(url,"utf-8");
			return JSON.parseObject(ret);
		} catch (Exception e) {
			throw new RuntimeException("操作失败!");
		}
	}
	
	/**
	 * 发送消息给IM
	 *
	 * @param from        来自
	 * @param to
	 * @param contentType 1文字 2图片消息
	 * @param content     内容
	 */
	public String sendIM(String from, String to, String contentType, String content) {
		String imAddr = im_host + "api/v1/chats/pm";
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("from", from));
		params.add(new BasicNameValuePair("to", to));
		params.add(new BasicNameValuePair("contentType", contentType));
		params.add(new BasicNameValuePair("content", content));
		String response = HttpClientUtil.post(imAddr, params, "UTF-8");
		return response;
	}
	
	
	public static final String SESSION_TYPE_MUC = "1";
	public static final String SESSION_TYPE_P2P = "2";
	public static final String SESSION_TYPE_GROUP = "3";
	public static final String SESSION_TYPE_SYSTEM = "0";
	public static final String SESSION_TYPE_PRESCRIPTION = "8";//续方
	public static final String SESSION_TYPE_KANGFU = "18";//续方
	public static final String SESSION_TYPE_EXAMINATION = "9";//在线复诊-图文
	public static final String SESSION_TYPE_ONDOOR_NURSING = "11";//上门护理
	public static final String SESSION_TYPE_COLLABORATION_HOSPITAL = "12";///互联网医院协同门诊
	public static final String SESSION_TYPE_GUIDANCE_HOSPITAL = "14";//互联网医院居民导诊聊天
	public static final String SESSION_TYPE_GENERAL_EXPERT = "15";//全科医生发起求助专科医生的专家咨询
	public static final String SESSION_TYPE_EXAMINATION_VIDEO = "16";//在线复诊-视频
	public static final String SESSION_TYPE_MUC_VIDEO = "17";//专家-视频
	public static final String SESSION_TYPE_GUIDANCE_ASSISTANT = "18";//导诊助手
	public static final String SESSION_STATUS_PROCEEDINGS = "0";
	public static final String SESSION_STATUS_END = "1";
	public static final String SESSION_TYPE_EMERGENCY_ASSISTANCE = "20";//紧急救助
	public static final String SESSION_TYPE_DOOR_COACH = "21";//上门辅导(上门预约)
	public static final String SESSION_TYPE_SECURITY_WARN = "22";//安防咨询
	public static final String SESSION_TYPE_ONLINE = "23";//新生儿在线咨询
	public static final String SESSION_TYPE_ONLINEAged = "24";//老人在线咨询
	public static final String CONTENT_TYPE_TEXT = "1";
	
	
	/**
	 *按会话类型获取会话总数
	 * @param userid
	 * @param type
	 * @param status
	 * @return
	 */
	public Integer sessionCountByType(String userid,Integer type,Integer status){
		String url = im_host + "api/v2/sessions/sessionCountByType?user_id="+userid+"&type="+type+"&status="+status;
		String ret = HttpClientUtil.get(url,"utf-8");
		JSONObject obj = JSON.parseObject(ret);
		if(obj.getInteger("status") ==200){
			return obj.getInteger("count");
		}else{
			return 0;
		}
	}
	public Integer SessionsUnreadMessageCountByUserId(String userid){
		String url = im_host + "api/v2/sessions/unread_message_count?user_id="+userid;
//		String url = "http://ehr.yihu.com/api/v2/sessions/unread_message_count?user_id="+userid;
		String ret = HttpClientUtil.get(url,"utf-8");
		JSONObject obj = JSON.parseObject(ret);
//		if(obj.getInteger("count") ==200){
		return obj.getInteger("count");
//		}else{
//			return 0;
//		}
	}
	/**
	 *获取所有会话未读消息数。
	 * @param userid
	 * @param type
	 * @return
	 */
	public Integer SessionsUnreadMessageCount(String userid,String type){
		String url = im_host + "api/v2/sessions/unread_message_count?user_id="+userid+"&type="+type;
		String ret = HttpClientUtil.get(url,"utf-8");
		JSONObject obj = JSON.parseObject(ret);
//		if(obj.getInteger("count") ==200){
		return obj.getInteger("count");
//		}else{
//			return 0;
//		}
	}
	/**
	 *获取某个会话某个对象的未读消息数。
	 * @param
	 * @return
	 */
	public Integer UserSessionsUnreadMessageCount(String session,String userid){
		String url = im_host + "api/v2/sessions/"+session+"/unread_message_count?user_id="+userid;
		String ret = HttpClientUtil.get(url,"utf-8");
		JSONObject obj = JSON.parseObject(ret);
//		if(obj.getInteger("count") ==200){
		return obj.getInteger("count");
//		}else{
//			return 0;
//		}
	}
	/**
	 * 获取会话未读消息数量
	 * @param sessionId
	 * @param userId
	 * @return
	 */
	public JSONObject getSessionUnreadMessageCount(String sessionId, String userId) {
		String url = im_host + "api/v2/sessions/" + sessionId + "/unread_message_count?user_id=" + userId;
		try {
			String ret = HttpClientUtil.get(url, "utf-8");
			return  JSONObject.parseObject(ret);
		} catch (Exception e) {
			throw new RuntimeException("获取会话成员!sessionId =" + sessionId);
		}
	}
	/**
	 * 获取在线人数
	 * helper 助老员,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
	 */
	public String getOnlineCountByType(String type) {
		String url = im_host + "api/v2/sessions/getOnlineCountByType?type="+type;
		String ret = HttpClientUtil.get(url, "UTF-8");
		return ret;
	}
	/**
	 * 获取在线人数列表
	 * helper 助老员,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
	 */
	public String getOnlineListByType(String type) {
		String url = im_host + "api/v2/sessions/getOnlineListByType?type="+type;
		String ret = HttpClientUtil.get(url, "UTF-8");
		return ret;
	}
	/**
	 * 获取在线状态
	 * helper 助老员,teacher 教师,child 幼儿,older 老人
	 * 返回 {"status":200,"data":1} data>0 说明在线 data =0 不在线
	 */
	public String findByUserIdAndType(String userId,String type) {
		String url = im_host + "api/v2/sessions/findByUserIdAndType?userId="+userId+"&type="+type;
		String ret = HttpClientUtil.get(url, "UTF-8");
		return ret;
	}
}

+ 63 - 9
server/svr-authentication/src/main/resources/application.yml

@ -54,9 +54,6 @@ fast-dfs:
    max-size: 20
    wait-time: 500
kick:
    ##互踢 1开通 0关闭
    eachOther: 1
---
spring:
  profiles: jwdev
@ -82,6 +79,11 @@ wlyy:
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
kick:
    ##互踢 1开通 0关闭
    eachOther: 1
im:
  im_list_get: http://172.26.0.105:3000/
wechat:
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段
@ -114,6 +116,11 @@ testPattern:
wechat:
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段
im:
  im_list_get: http://172.26.0.105:3000/
kick:
    ##互踢 1开通 0关闭
    eachOther: 0
---
spring:
  profiles: jwOracleTest
@ -153,7 +160,11 @@ testPattern:
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
im:
  im_list_get: http://172.26.0.105:3000/
kick:
    ##互踢 1开通 0关闭
    eachOther: 1
---
spring:
  profiles: iottest
@ -182,7 +193,11 @@ testPattern:
wechat:
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段
im:
  im_list_get: http://172.26.0.105:3000/
kick:
    ##互踢 1开通 0关闭
    eachOther: 1
---
spring:
  profiles: iotyanshi
@ -210,6 +225,11 @@ testPattern:
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段
im:
  im_list_get: http://172.26.0.105:3000/
kick:
    ##互踢 1开通 0关闭
    eachOther: 1
---
spring:
  profiles: jwprod
@ -237,6 +257,11 @@ testPattern:
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段
im:
  im_list_get: http://172.26.0.105:3000/
kick:
    ##互踢 1开通 0关闭
    eachOther: 1
---
## 心脏中心外网
spring:
@ -265,6 +290,11 @@ testPattern:
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: xm_xzzx_wx  # base库中,wx_wechat 的id字段
im:
  im_list_get: http://172.26.0.105:3000/
kick:
    ##互踢 1开通 0关闭
    eachOther: 1
---
## 卫计委
spring:
@ -293,7 +323,11 @@ testPattern:
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: xm_ihealth_wx  # base库中,wx_wechat 的id字段
im:
  im_list_get: http://172.26.0.105:3000/
kick:
    ##互踢 1开通 0关闭
    eachOther: 1
---
spring:
  profiles: iotprod
@ -320,7 +354,11 @@ testPattern:
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
im:
  im_list_get: http://172.26.0.105:3000/
kick:
    ##互踢 1开通 0关闭
    eachOther: 1
---
spring:
@ -350,7 +388,11 @@ testPattern:
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
im:
  im_list_get: http://172.26.0.105:3000/
kick:
    ##互踢 1开通 0关闭
    eachOther: 1
---
spring:
@ -379,7 +421,11 @@ testPattern:
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: sd_tnzyy_wx  # base库中,wx_wechat 的id字段
im:
  im_list_get: http://172.26.0.105:3000/
kick:
    ##互踢 1开通 0关闭
    eachOther: 1
---
spring:
  profiles: hzprod
@ -410,6 +456,9 @@ testPattern:
wechat:
  id: hz_yyyzh_wx  # base库中,wx_wechat 的id字段
im:
  im_list_get: http://10.18.43.41:3000/
kick:
    ##互踢 1开通 0关闭
    eachOther: 0
@ -439,3 +488,8 @@ testPattern:
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: wjw
im:
  im_list_get: http://172.26.0.105:3000/
kick:
    ##互踢 1开通 0关闭
    eachOther: 1

+ 14 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictIcd10Dao.java

@ -33,4 +33,18 @@ public interface DictIcd10Dao extends PagingAndSortingRepository<DictIcd10DO, In
    List<DictIcd10DO> findBySaasId(String saasId);
    Long countBySaasId(String saasId);
    List<DictIcd10DO>  findByCodeAndName(String code, String name);
    @Query("from DictIcd10DO t where t.is_del='1' and t.status ='1' order by t.createTime desc")
    List<DictIcd10DO> findByDel(Pageable pageRequest);
    @Query("select  count(1) from DictIcd10DO t where t.is_del='1' and t.status='1'")
    Integer getconuntByDel();
    @Query("from DictIcd10DO t where t.is_del='1' and t.status='1' and t.code=?1")
    DictIcd10DO findByCode(String code);
    @Query("from DictIcd10DO t where t.code=?1 and t.is_del='1'")
    List<DictIcd10DO>  findByIcdCode(String code);
}

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

@ -15,6 +15,15 @@ public abstract class AExcelReader {
    protected List errorLs = new ArrayList<>();
    protected List correctLs = new ArrayList<>();
    protected Map<String, Set> repeat = new HashMap<>();
    protected String templateId ="";
    public String getTemplateId() {
        return templateId;
    }
    public void setTemplateId(String templateId) {
        this.templateId = templateId;
    }
    public abstract void read(Workbook rwb) throws Exception;

+ 86 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/BaseDrugUseEndpoint.java

@ -0,0 +1,86 @@
package com.yihu.jw.base.endpoint.dict;
import com.yihu.jw.base.service.dict.BaseDrugDictService;
import com.yihu.jw.base.service.dict.BaseDrugUseService;
import com.yihu.jw.entity.base.dict.BaseDrugDictDO;
import com.yihu.jw.entity.base.dict.BaseDrugUseDictDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
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.*;
@RestController
@RequestMapping(value = "/baseDrugUse")
@Api(value = "药品使用方式字典", description = "药品使用方式字典", tags = {"药品使用方式字典"})
public class BaseDrugUseEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseDrugUseService baseDrugUseService;
    @PostMapping("/saveDrugUse")
    @ApiOperation(value = "保存")
    public Envelop saveDrugUse(@ApiParam(name = "jsonData", value = "药品json串")
                                       @RequestParam(name = "jsonData", required = true) String jsonData) throws Exception {
        try {
            BaseDrugUseDictDO baseDrugUseDictDO = objectMapper.readValue(jsonData, BaseDrugUseDictDO.class);
            baseDrugUseService.saveBaseDrugUse(baseDrugUseDictDO);
            return success("操作成功");
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping("/findDrugUseList")
    @ApiOperation(value = "列表")
    public MixEnvelop findDrugDict(@ApiParam(name = "name", value = "药品名称")
                                   @RequestParam(name = "name", required = false) String name,
                                   @ApiParam(name = "status", value = "状态")
                                   @RequestParam(name = "status", required = false) String status,
                                   @ApiParam(name = "page", value = "当前页")
                                   @RequestParam(name = "page", required = false) Integer page,
                                   @ApiParam(name = "pageSize", value = "页面大小")
                                   @RequestParam(name = "pageSize", required = false) Integer pageSize) throws Exception {
        try {
            return baseDrugUseService.findDrugUseList(name,status, page, pageSize);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping("/findOneDrug")
    @ApiOperation(value = "根据id查询")
    public Envelop findOneDrug(@ApiParam(name = "id", value = "药品id")
                               @RequestParam(name = "id", required = true) String id){
        try {
            return success(baseDrugUseService.findOneUseDict(id));
        }catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping("/updateDruguseStatus")
    @ApiOperation(value = "修改状态")
    public Envelop updateDruguseStatus(@ApiParam(name = "id", value = "id")
                               @RequestParam(name = "id", required = true) String id,
                               @ApiParam(name = "status", value = "状态1使用0作废")
                               @RequestParam(name = "status", required = false) String status,
                               @ApiParam(name = "del", value = "0删除")
                               @RequestParam(name = "del", required = false) String del){
        try {
            baseDrugUseService.updateDrugUseStatus(id,status,del);
            return success("操作成功");
        }catch (Exception e) {
            return failedException(e);
        }
    }
}

+ 85 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/BaseFollowUpDictEndpoint.java

@ -0,0 +1,85 @@
package com.yihu.jw.base.endpoint.dict;
import com.yihu.jw.base.service.dict.BaseDrugUseService;
import com.yihu.jw.dict.service.FollowUpDictService;
import com.yihu.jw.entity.base.dict.BaseDrugUseDictDO;
import com.yihu.jw.entity.base.dict.BaseFollowUpDictDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
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.*;
@RestController
@RequestMapping(value = "/baseFollowUpDict")
@Api(value = "随访字典", description = "随访字典", tags = {"随访字典"})
public class BaseFollowUpDictEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private FollowUpDictService followUpDictService;
    @PostMapping("/saveFollowUpDict")
    @ApiOperation(value = "保存")
    public Envelop saveFollowUpDict(@ApiParam(name = "jsonData", value = "随访json")
                                       @RequestParam(name = "jsonData", required = true) String jsonData) throws Exception {
        try {
            BaseFollowUpDictDO baseFollowUpDictDO = objectMapper.readValue(jsonData, BaseFollowUpDictDO.class);
            followUpDictService.saveFollowUp(baseFollowUpDictDO);
            return success("操作成功");
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping("/findFollowUpDict")
    @ApiOperation(value = "列表")
    public MixEnvelop findFollowUpDict(@ApiParam(name = "name", value = "药品名称")
                                   @RequestParam(name = "name", required = false) String name,
                                   @ApiParam(name = "status", value = "状态")
                                   @RequestParam(name = "status", required = false) String status,
                                   @ApiParam(name = "page", value = "当前页")
                                   @RequestParam(name = "page", required = false) Integer page,
                                   @ApiParam(name = "pageSize", value = "页面大小")
                                   @RequestParam(name = "pageSize", required = false) Integer pageSize) throws Exception {
        try {
            return followUpDictService.findList(name,status, page, pageSize);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping("/findOneFollowUp")
    @ApiOperation(value = "根据id查询")
    public Envelop findOneFollowUp(@ApiParam(name = "id", value = "药品id")
                               @RequestParam(name = "id", required = true) String id){
        try {
            return success(followUpDictService.findOneDict(id));
        }catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping("/updateDruguseStatus")
    @ApiOperation(value = "修改状态")
    public Envelop updateDruguseStatus(@ApiParam(name = "id", value = "id")
                               @RequestParam(name = "id", required = true) String id,
                               @ApiParam(name = "status", value = "状态1使用0作废")
                               @RequestParam(name = "status", required = false) String status,
                               @ApiParam(name = "del", value = "0删除")
                               @RequestParam(name = "del", required = false) String del){
        try {
            followUpDictService.updateFollowUpStatus(id,status,del);
            return success("操作成功");
        }catch (Exception e) {
            return failedException(e);
        }
    }
}

+ 84 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/BaseFrequencyEndpoint.java

@ -0,0 +1,84 @@
package com.yihu.jw.base.endpoint.dict;
import com.yihu.jw.base.service.dict.BaseDrugUseService;
import com.yihu.jw.base.service.dict.BaseFrequencyService;
import com.yihu.jw.entity.base.dict.BaseDrugUseDictDO;
import com.yihu.jw.entity.base.dict.BaseFrequencyDictDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
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.*;
@RestController
@RequestMapping(value = "/baseFrequency")
@Api(value = "药品使用方式字典", description = "药品使用方式字典", tags = {"药品使用方式字典"})
public class BaseFrequencyEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseFrequencyService baseFrequencyService;
    @PostMapping("/saveFrequency")
    @ApiOperation(value = "保存")
    public Envelop saveDrugUse(@ApiParam(name = "jsonData", value = "药品json串")
                                       @RequestParam(name = "jsonData", required = true) String jsonData) throws Exception {
        try {
            BaseFrequencyDictDO baseFrequencyDictDO = objectMapper.readValue(jsonData, BaseFrequencyDictDO.class);
            baseFrequencyService.saveFrequency(baseFrequencyDictDO);
            return success("操作成功");
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping("/findFrequencyList")
    @ApiOperation(value = "获取列表接口")
    public MixEnvelop findDrugDict(@ApiParam(name = "name", value = "药品名称")
                                   @RequestParam(name = "name", required = false) String name,
                                   @ApiParam(name = "status", value = "状态")
                                   @RequestParam(name = "status", required = false) String status,
                                   @ApiParam(name = "page", value = "当前页")
                                   @RequestParam(name = "page", required = false) Integer page,
                                   @ApiParam(name = "pageSize", value = "页面大小")
                                   @RequestParam(name = "pageSize", required = false) Integer pageSize) throws Exception {
        try {
            return baseFrequencyService.findFrequencyList(name,status, page, pageSize);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping("/findOneFrequency")
    @ApiOperation(value = "根据id查询")
    public Envelop findOneDrug(@ApiParam(name = "id", value = "药品id")
                               @RequestParam(name = "id", required = true) String id){
        try {
            return success(baseFrequencyService.findOneFrequency(id));
        }catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping("/updateFrequencyStatus")
    @ApiOperation(value = "修改状态")
    public Envelop updateFrequencyStatus(@ApiParam(name = "id", value = "id")
                               @RequestParam(name = "id", required = true) String id,
                               @ApiParam(name = "status", value = "状态1使用0作废")
                               @RequestParam(name = "status", required = false) String status,
                               @ApiParam(name = "del", value = "0删除")
                                   @RequestParam(name = "del", required = false) String del){
        try {
            baseFrequencyService.updateFrequencyStatus(id,status,del);
            return success("操作成功");
        }catch (Exception e) {
            return failedException(e);
        }
    }
}

+ 88 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/DictDrugEndpoint.java

@ -0,0 +1,88 @@
package com.yihu.jw.base.endpoint.dict;
import com.yihu.jw.base.service.dict.BaseDrugDictService;
import com.yihu.jw.entity.base.dict.BaseDrugDictDO;
import com.yihu.jw.entity.hospital.prescription.BaseNationalDrugDictDO;
import com.yihu.jw.hospital.prescription.service.NationalDrugDictService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
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.*;
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.Prescription.PREFIX)
@Api(value = "药品字典维护", description = "药品字典维护", tags = {"药品字典维护"})
public class DictDrugEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseDrugDictService nationalDrugDictService;
    @PostMapping("/saveNationalDrug")
    @ApiOperation(value = "保存药品字典接口")
    public ObjEnvelop saveNationalDrug(@ApiParam(name = "jsonData", value = "药品json串")
                                       @RequestParam(name = "jsonData", required = true) String jsonData) throws Exception {
        try {
            BaseDrugDictDO nationalDrugDictDO = objectMapper.readValue(jsonData, BaseDrugDictDO.class);
            return success(nationalDrugDictService.saveNationalDrug(nationalDrugDictDO));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping("/findDrugDictList")
    @ApiOperation(value = "获取药品字典接口")
    public MixEnvelop findDrugDict(@ApiParam(name = "name", value = "药品名称")
                                          @RequestParam(name = "name", required = false) String name,
                                          @ApiParam(name = "status", value = "状态")
                                          @RequestParam(name = "status", required = false) String status,
                                          @ApiParam(name = "page", value = "当前页")
                                          @RequestParam(name = "page", required = false) Integer page,
                                          @ApiParam(name = "pageSize", value = "页面大小")
                                          @RequestParam(name = "pageSize", required = false) Integer pageSize) throws Exception {
        try {
            return nationalDrugDictService.findDrugDict(name,status, page, pageSize);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping("/findOneDrug")
    @ApiOperation(value = "根据药品id查询")
    public Envelop findOneDrug(@ApiParam(name = "id", value = "药品id")
                                            @RequestParam(name = "id", required = true) String id){
        try {
            return success(nationalDrugDictService.findOneDrug(id));
        }catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping("/updateDrugStatus")
    @ApiOperation(value = "修改状态")
    public Envelop updateDruguseStatus(@ApiParam(name = "id", value = "id")
                                       @RequestParam(name = "id", required = true) String id,
                                       @ApiParam(name = "status", value = "状态1使用0作废")
                                       @RequestParam(name = "status", required = false) String status,
                                       @ApiParam(name = "del", value = "0删除")
                                       @RequestParam(name = "del", required = false) String del){
        try {
            nationalDrugDictService.updateDrugStatus(id,status,del);
            return success("操作成功");
        }catch (Exception e) {
            return failedException(e);
        }
    }
}

+ 50 - 34
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/DictIcd10Endpoint.java

@ -2,10 +2,7 @@ package com.yihu.jw.base.endpoint.dict;
import com.yihu.jw.base.service.dict.DictIcd10Service;
import com.yihu.jw.restmodel.base.dict.DictIcd10VO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.*;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
@ -37,14 +34,20 @@ public class DictIcd10Endpoint extends EnvelopRestEndpoint {
    @Autowired
    private DictIcd10Service dictIcd10Service;
    @PostMapping(value = BaseRequestMapping.DictIcd10.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping("/icd1oCreateUpdate")
    @ApiOperation(value = "创建")
    public ObjEnvelop<DictIcd10VO> create(
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
        DictIcd10DO dictIcd10 = toEntity(jsonData, DictIcd10DO.class);
        dictIcd10 = dictIcd10Service.save(dictIcd10);
        return success(dictIcd10, DictIcd10VO.class);
    public ObjEnvelop<DictIcd10VO> createOrupdate(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam(value = "jsonData") String jsonData) throws Exception {
        try {
            System.out.println(jsonData);
            DictIcd10DO dictIcd10 = toEntity(jsonData, DictIcd10DO.class);
            dictIcd10Service.saveIcd10(dictIcd10);
            return success(dictIcd10, DictIcd10VO.class);
        }catch (Exception e){
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = BaseRequestMapping.DictIcd10.DELETE)
@ -56,19 +59,6 @@ public class DictIcd10Endpoint extends EnvelopRestEndpoint {
        return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.DictIcd10.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<DictIcd10VO> update(
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
        DictIcd10DO dictIcd10 = toEntity(jsonData, DictIcd10DO.class);
        if (null == dictIcd10.getId()) {
            return failed("ID不能为空", ObjEnvelop.class);
        }
        dictIcd10 = dictIcd10Service.save(dictIcd10);
        return success(dictIcd10, DictIcd10VO.class);
    }
    @GetMapping(value = BaseRequestMapping.DictIcd10.PAGE)
    @ApiOperation(value = "获取分页")
    public PageEnvelop<DictIcd10VO> page(
@ -87,17 +77,43 @@ public class DictIcd10Endpoint extends EnvelopRestEndpoint {
        return success(dictIcd10s, count, page, size, DictIcd10VO.class);
    }
    @GetMapping(value = BaseRequestMapping.DictIcd10.LIST)
    @GetMapping("/findIcd10List")
    @ApiOperation(value = "获取列表")
    public ListEnvelop<DictIcd10VO> list(
            @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) throws Exception {
        List<DictIcd10DO> dictIcd10s = dictIcd10Service.search(fields, filters, sorts);
        return success(dictIcd10s, DictIcd10VO.class);
    public MixEnvelop list(
            @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 = "")
            @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "pageSize", value = "")
            @RequestParam(value = "pageSize", required = false) Integer pageSize) throws Exception {
        return dictIcd10Service.findIcd10List(name, status, page,pageSize);
    }
    @GetMapping("/findIcd10One")
    @ApiOperation(value = "获取单条")
    public Envelop findIcd10One(
            @ApiParam(name = "id", value = "")
            @RequestParam(value = "id", required = false) Integer id) throws Exception {
        return success(dictIcd10Service.findOneIcd10(id));
    }
    @GetMapping("/updateIcd10Status")
    @ApiOperation(value = "修改状态")
    public Envelop updateIcd10Status(@ApiParam(name = "id", value = "id")
                                       @RequestParam(name = "id", required = true) Integer id,
                                       @ApiParam(name = "status", value = "状态1使用0作废")
                                       @RequestParam(name = "status", required = false) String status,
                                       @ApiParam(name = "del", value = "0删除")
                                       @RequestParam(name = "del", required = false) String del){
        try {
            dictIcd10Service.updateIcd10Status(id,status,del);
            return success("操作成功");
        }catch (Exception e) {
            return failedException(e);
        }
    }
}

+ 468 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/TemplateManageEndpoint.java

@ -0,0 +1,468 @@
package com.yihu.jw.base.endpoint.dict;
import com.yihu.jw.base.service.dict.*;
import com.yihu.jw.base.service.dict.importManage.*;
import com.yihu.jw.base.service.doctor.excelImport.BaseDoctorExcelDO;
import com.yihu.jw.base.service.doctor.excelImport.BaseDoctorExcelDOReader;
import com.yihu.jw.entity.base.dict.DictDiseaseDO;
import com.yihu.jw.entity.base.dict.DiseaseManageDO;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.jw.restmodel.base.dict.DictDiseaseVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
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.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
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.*;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/templateManage")
@Api(value = "字典模板维护", description = "字典模板维护", tags = {"字典模板维护"})
public class TemplateManageEndpoint  extends EnvelopRestEndpoint {
    @Autowired
    private TemplateManageService templateManageService;
    @Autowired
    private BaseDrugDictService baseDrugDictService;
    @Autowired
    private BaseDrugExcelDOReader baseDrugExcelDOReader;
    @Autowired
    private BaseDrugUseExcelDOReader baseDrugUseExcelDOReader;
    @Autowired
    private BaseDrugUseService baseDrugUseService;
    @Autowired
    private BaseFrequencyExcelDOReader baseFrequencyExcelDOReader;
    @Autowired
    private BaseFrequencyService baseFrequencyService;
    @Autowired
    private BaseIcd10ExcelDOReader icd10ExcelDOReader;
    @Autowired
    private DictIcd10Service dictIcd10Service;
    @PostMapping("/excelControl/importDrug")
    @Transactional(rollbackFor = Exception.class)
    @ApiOperation(value = "基础药品字典信息列表导入")
    public Envelop importData(
            @ApiParam(name = "file", value = "文件", required = true)
            @RequestPart(value = "file") MultipartFile file,
            @ApiParam(name = "templateId", value = "templateId", required = false)
            @RequestPart(value = "templateId" ,required = false) String  templateId,
            HttpServletRequest request) throws IOException, ManageException {
        try {
            request.setCharacterEncoding("UTF-8");
//            AExcelReader excelReader = new BaseDoctorExcelDOReader();
            InputStream inputStream = file.getInputStream();
            Workbook workbook = getWorkbook(inputStream,file.getOriginalFilename());
            baseDrugExcelDOReader.setTemplateId(templateId);
            baseDrugExcelDOReader.read(workbook);
            //验证未通过(暂无验证)
            List<BasDrugExcelDO> errorLs = baseDrugExcelDOReader.getErrorLs();
            List<BasDrugExcelDO> correctLs = baseDrugExcelDOReader.getCorrectLs();
            Map<String, Object> result =new HashMap<>();
            String msg ="";
            if(correctLs.size()>0){
                result = baseDrugDictService.batchInsertDrugs(correctLs,templateId);
                result.put("errorLs", errorLs);
                int errors = errorLs==null?0:errorLs.size();
                int corrects = correctLs==null?0:correctLs.size();
                msg = "当前导入成功"+corrects+"条数据"+";失败"+errors+"条数据";
            }
            return success(msg, result);
        }catch (Exception e){
            e.printStackTrace();
            return failed("导入异常,请检查导入文件格式" + e.getMessage());
        }
    }
    /**
     * 判断文件格式
     * @param in
     * @param fileName
     * @return
     */
    private static Workbook getWorkbook(InputStream in, String fileName) throws Exception {
        Workbook book = null;
        String filetype = fileName.substring(fileName.lastIndexOf("."));
        if(".xls".equals(filetype)) {
            book = new HSSFWorkbook(in);
        } else if (".xlsx".equals(filetype)) {
            book = new XSSFWorkbook(in);
        } else {
            throw new Exception("请上传excel文件!");
        }
        return book;
    }
    @GetMapping("/getTemplateList")
    @ApiOperation(value = "获取列表")
    public MixEnvelop list (
            @ApiParam(name = "templateType", value = "模板类型")
            @RequestParam(value = "templateType", required = false) String templateType,
            @ApiParam(name = "code", value = "")
            @RequestParam(value = "code", required = false) String code,
            @ApiParam(name = "name", value = "")
            @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "diseaseName", value = "")
            @RequestParam(value = "diseaseName", required = false) String diseaseName,
            @ApiParam(name = "diseaseId", value = "")
            @RequestParam(value = "diseaseId", required = false) String diseaseId,
            @ApiParam(name = "page", value = "")
            @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "pageSize", value = "")
            @RequestParam(value = "pageSize", required = false) Integer pageSize) throws Exception {
        try {
            return templateManageService.findTempalte(templateType,code,name,diseaseName,diseaseId,page,pageSize);
        }catch (Exception e){
            e.printStackTrace();
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping("/addOrRemoveChild")
    @ApiOperation(value = "")
    public Envelop addOrRemoveChild (
            @ApiParam(name = "templateId", value = "模板id")
            @RequestParam(value = "templateId", required = false) String templateId,
            @ApiParam(name = "dictId", value = "")
            @RequestParam(value = "dictId", required = false) String  dictId,
            @ApiParam(name = "del", value = "")
            @RequestParam(value = "del", required = false) String  del) throws Exception {
        try {
            templateManageService.addOrRemoveChildrenDict(templateId,dictId,del);
            return success("操作成功");
        }catch (Exception e){
            e.printStackTrace();
            return failedException(e);
        }
    }
    @GetMapping("/saveOrUpdateTemplate")
    @ApiOperation(value = "")
    public Envelop saveOrUpdateTemplate (
            @ApiParam(name = "templateId", value = "模板id")
            @RequestParam(value = "templateId", required = false) String templateId,
            @ApiParam(name = "diseaseId", value = "diseaseId")
            @RequestParam(value = "diseaseId", required = false) String diseaseId,
            @ApiParam(name = "diseaseName", value = "diseaseName")
            @RequestParam(value = "diseaseName", required = false) String diseaseName,
            @ApiParam(name = "code", value = "")
            @RequestParam(value = "code", required = false) String  code,
            @ApiParam(name = "name", value = "")
            @RequestParam(value = "name", required = false) String  name,
            @ApiParam(name = "templateType", value = "")
            @RequestParam(value = "templateType", required = false) String  templateType) throws Exception {
        try {
            if (!StringUtils.isNoneBlank(templateId)){
                templateId="1";
            }
            templateManageService.saveOrUpdateTemplate(templateId,code,name,getUID(),getUNAME(),templateType,diseaseId,diseaseName);
            return success("操作成功");
        }catch (Exception e){
            e.printStackTrace();
            return failedException(e);
        }
    }
    @GetMapping("/getTemplateChildList")
    @ApiOperation(value = "获取列表")
    public MixEnvelop getTemplateChildList (
            @ApiParam(name = "templateId", value = "模板id")
            @RequestParam(value = "templateId", required = false) String templateId,
            @ApiParam(name = "name", value = "模板id")
            @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "code", value = "")
            @RequestParam(value = "code", required = false) String code,
            @ApiParam(name = "isSelectUse", value = "1查询已添加的2查询未添加")
            @RequestParam(value = "isSelectUse", required = false) String isSelectUse,
            @ApiParam(name = "page", value = "")
            @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "pageSize", value = "")
            @RequestParam(value = "pageSize", required = false) Integer pageSize) throws Exception {
        try {
            if(StringUtils.isNoneBlank(isSelectUse)&&"1".equalsIgnoreCase(isSelectUse)){
                return templateManageService.findTemlateAddChildList(templateId,name,code,page,pageSize);
            }else if(StringUtils.isNoneBlank(isSelectUse)&&"2".equalsIgnoreCase(isSelectUse)){
                return templateManageService.findTemlateNotAddChildList(templateId,name,code,page,pageSize);
            } else {
                return templateManageService.findTemlateChildList(templateId,name,code,page,pageSize);
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping("/saveOrgTemplate")
    @ApiOperation(value = "保存租户模板")
    public Envelop saveSaasTemplate (
            @ApiParam(name = "orgCode", value = "orgCode")
            @RequestParam(value = "orgCode", required = false) String orgCode,
            @ApiParam(name = "templateIds", value = "")
            @RequestParam(value = "templateIds", required = false) String templateIds) throws Exception {
        try {
            templateManageService.saveUserTemplateRelation(orgCode,templateIds);
            return success("保存成功");
        }catch (Exception e){
            e.printStackTrace();
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping("/findOrgTemplate")
    @ApiOperation(value = "保存机构模板")
    public Envelop saveSaasTemplate (
            @ApiParam(name = "orgCode", value = "orgCode")
            @RequestParam(value = "orgCode", required = false) String orgCode) throws Exception {
        try {
            return success(templateManageService.findUseTemplate(orgCode));
        }catch (Exception e){
            e.printStackTrace();
            return failedMixEnvelopException(e);
        }
    }
    @PostMapping("/excelControl/importDrugUse")
    @Transactional(rollbackFor = Exception.class)
    @ApiOperation(value = "基础药品用法列表导入")
    public Envelop importDrugUse(
            @ApiParam(name = "file", value = "文件", required = true)
            @RequestPart(value = "file") MultipartFile file,
            @ApiParam(name = "templateId", value = "templateId", required = false)
            @RequestPart(value = "templateId" ,required = false) String  templateId,
            HttpServletRequest request) throws IOException, ManageException {
        try {
            request.setCharacterEncoding("UTF-8");
//            AExcelReader excelReader = new BaseDoctorExcelDOReader();
            InputStream inputStream = file.getInputStream();
            Workbook workbook = getWorkbook(inputStream,file.getOriginalFilename());
            baseDrugExcelDOReader.setTemplateId(templateId);
            baseDrugUseExcelDOReader.read(workbook);
            //验证未通过(暂无验证)
            List<BasDrugUseExcelDO> errorLs = baseDrugUseExcelDOReader.getErrorLs();
            List<BasDrugUseExcelDO> correctLs = baseDrugUseExcelDOReader.getCorrectLs();
            Map<String, Object> result =new HashMap<>();
            String msg ="";
            if(correctLs.size()>0){
                result = baseDrugUseService.batchInsertDrugs(correctLs,templateId);
                result.put("errorLs", errorLs);
                int errors = errorLs==null?0:errorLs.size();
                int corrects = correctLs==null?0:correctLs.size();
                msg = "当前导入成功"+corrects+"条数据"+";失败"+errors+"条数据";
                return success(msg, result);
            }
            return success(msg, result);
        }catch (Exception e){
            e.printStackTrace();
            return failed("导入异常,请检查导入文件格式" + e.getMessage());
        }
    }
    @PostMapping("/excelControl/importfrequency")
    @Transactional(rollbackFor = Exception.class)
    @ApiOperation(value = "基础药品频次信息列表导入")
    public Envelop importfrequency(
            @ApiParam(name = "file", value = "文件", required = true)
            @RequestPart(value = "file") MultipartFile file,
            @ApiParam(name = "templateId", value = "templateId", required = false)
            @RequestPart(value = "templateId" ,required = false) String  templateId,
            HttpServletRequest request) throws IOException, ManageException {
        try {
            request.setCharacterEncoding("UTF-8");
//            AExcelReader excelReader = new BaseDoctorExcelDOReader();
            InputStream inputStream = file.getInputStream();
            Workbook workbook = getWorkbook(inputStream,file.getOriginalFilename());
            baseDrugExcelDOReader.setTemplateId(templateId);
            baseFrequencyExcelDOReader.read(workbook);
            //验证未通过(暂无验证)
            List<BasFrequencyExcelDO> errorLs = baseFrequencyExcelDOReader.getErrorLs();
            List<BasFrequencyExcelDO> correctLs = baseFrequencyExcelDOReader.getCorrectLs();
            Map<String, Object> result =new HashMap<>();
            String msg ="";
            if(correctLs.size()>0){
                 result = baseFrequencyService.batchInsertDrugs(correctLs,templateId);
                result.put("errorLs", errorLs);
                int errors = errorLs==null?0:errorLs.size();
                int corrects = correctLs==null?0:correctLs.size();
                msg = "当前导入成功"+corrects+"条数据"+";失败"+errors+"条数据";
            }
            return success(msg, result);
        }catch (Exception e){
            e.printStackTrace();
            return failed("导入异常,请检查导入文件格式" + e.getMessage());
        }
    }
    @PostMapping("/excelControl/importIcd10")
    @Transactional(rollbackFor = Exception.class)
    @ApiOperation(value = "基础诊断信息列表导入")
    public Envelop importIcd10(
            @ApiParam(name = "file", value = "文件", required = true)
            @RequestPart(value = "file") MultipartFile file,
            @ApiParam(name = "templateId", value = "templateId", required = false)
            @RequestPart(value = "templateId" ,required = false) String  templateId,
            HttpServletRequest request) throws IOException, ManageException {
        try {
            request.setCharacterEncoding("UTF-8");
//            AExcelReader excelReader = new BaseDoctorExcelDOReader();
            InputStream inputStream = file.getInputStream();
            Workbook workbook = getWorkbook(inputStream,file.getOriginalFilename());
            baseDrugExcelDOReader.setTemplateId(templateId);
            icd10ExcelDOReader.read(workbook);
            //验证未通过(暂无验证)
            List<BasIcd10ExcelDO> errorLs = icd10ExcelDOReader.getErrorLs();
            List<BasIcd10ExcelDO> correctLs = icd10ExcelDOReader.getCorrectLs();
            Map<String, Object> result =new HashMap<>();
            String msg ="";
            if(correctLs.size()>0){
                result = dictIcd10Service.batchInsertDrugs(correctLs,templateId);
                result.put("errorLs", errorLs);
                int errors = errorLs==null?0:errorLs.size();
                int corrects = correctLs==null?0:correctLs.size();
                msg = "当前导入成功"+corrects+"条数据"+";失败"+errors+"条数据";
            }
            return success(msg, result);
        }catch (Exception e){
            e.printStackTrace();
            return failed("导入异常,请检查导入文件格式" + e.getMessage());
        }
    }
    @GetMapping("/excelControl/exportExcel")
    public void exportExcel(HttpServletRequest request, HttpServletResponse response,@ApiParam(name = "templateType", value = "templateType", required = true)
    @RequestParam   (value = "templateType") String  templateType) {
        try {
            String filePath="";
            String fileName="";
            if ("frequencyDict".equalsIgnoreCase(templateType)){
                filePath="/home/频次模板.xls";
                fileName="频次模板.xls";
            }else if ("drugUseDict".equalsIgnoreCase(templateType)){
                filePath="/home/用药类型模板.xls";
                fileName="用药类型模板.xls";
            }else if ("drugListDict".equalsIgnoreCase(templateType)){
                filePath="/home/药品字典模板.xls";
                fileName="药品字典模板.xls";
            }else if ("icd10ListDict".equalsIgnoreCase(templateType)){
                filePath="/home/诊断模板.xls";
                fileName="诊断模板.xls";
            }
            HSSFWorkbook wb = new HSSFWorkbook(new FileInputStream(filePath));
// 根据页面index 获取sheet页
            HSSFSheet sheet = wb.getSheet("Sheet1");
            /*for (int i = 0; i < 2; i++) {
// 创建HSSFRow对象
                HSSFRow row = sheet.createRow(i + 1);
// 创建HSSFCell对象 设置单元格的值
                row.createCell(0).setCellValue("张三" + i);
                row.createCell(1).setCellValue("1");
                row.createCell(2).setCellValue("1");
                row.createCell(3).setCellValue("210503199507250333");
                row.createCell(4).setCellValue("18841409773");
                row.createCell(5).setCellValue("350211A1002/0000001/1303");
                row.createCell(6).setCellValue("1302");
                row.createCell(7).setCellValue("admin");
                row.createCell(8).setCellValue("1");
            }*/
// 输出Excel文件
            OutputStream output = new BufferedOutputStream(response.getOutputStream());
            response.reset();
// 设置文件头
            /*response.setHeader("Content-Disposition",
                    "attchement;filename=" + new String("人员信息.xls".getBytes("gb2312"), "ISO8859-1"));
            response.setContentType("application/msexcel");*/
            response.setCharacterEncoding("UTF-8");
            response.setContentType("application/x-msdownload");
            /*response.setHeader("Content-Disposition", "attachment; filename="
                    + new String( "医生模板信息".getBytes("gb2312"), "ISO8859-1" )+".xls");*/
            response.setHeader("Content-Disposition", "attachment; filename="
                    + URLEncoder.encode(fileName,"UTF-8"));
            wb.write(output);
            /*ByteArrayOutputStream bos = new ByteArrayOutputStream();
            try {
                wb.write(bos);
            } finally {
                bos.close();
            }
            byte[] bytes = bos.toByteArray();
            output.write(bytes);
            output.close();*/
            wb.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @GetMapping("/findOneTemplate")
    @ApiOperation(value = "根据药品id查询")
    public Envelop findOneTemplate(@ApiParam(name = "id", value = "药品id")
                               @RequestParam(name = "id", required = true) String id){
        try {
            return success(templateManageService.findOneTemplateById(id));
        }catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping("/getTemplateListByDiseaseId")
    @ApiOperation(value = "获取列表")
    public Envelop getTemplateListByDiseaseId (
            @ApiParam(name = "diseaseId", value = "id")
            @RequestParam(value = "diseaseId", required = false) String diseaseId) throws Exception {
        try {
            return success(templateManageService.findTemplateByDisease(diseaseId));
        }catch (Exception e){
            e.printStackTrace();
            return failedMixEnvelopException(e);
        }
    }
}

+ 198 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/BaseDrugDictService.java

@ -0,0 +1,198 @@
package com.yihu.jw.base.service.dict;
import com.yihu.jw.base.service.dict.importManage.BasDrugExcelDO;
import com.yihu.jw.base.service.doctor.excelImport.BaseDoctorExcelDO;
import com.yihu.jw.dict.dao.BaseDrugDictDao;
import com.yihu.jw.dict.dao.BaseTemplateDictDao;
import com.yihu.jw.entity.base.dict.*;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import static com.yihu.jw.util.common.BeanUtils.getNullPropertyNames;
@Service
public class BaseDrugDictService extends BaseJpaService<BaseDrugDictDO, BaseDrugDictDao> {
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private BaseDrugDictDao baseDrugDictDao;
    @Autowired
    private BaseTemplateDictDao baseTemplateDictDao;
    public BaseDrugDictDO saveNationalDrug(BaseDrugDictDO nationalDrugDictDO)  throws  Exception{
        BaseDrugDictDO baseDrugDictDO=baseDrugDictDao.findByCode(nationalDrugDictDO.getCharge_code());
        //判断新增或编辑
        if (!StringUtils.isNoneBlank(nationalDrugDictDO.getId())) {
            if (baseDrugDictDO!=null){
                throw  new Exception("该药品编码已存在");
            }
            nationalDrugDictDO.setCreate_time(new Date());
            nationalDrugDictDO.setUpdate_time(new Date());
            nationalDrugDictDO.setIs_del("1");
            return baseDrugDictDao.save(nationalDrugDictDO);
        }else {
            if (baseDrugDictDO!=null){
                if (!nationalDrugDictDO.getId().equalsIgnoreCase(baseDrugDictDO.getId())){
                    throw  new Exception("该药品编码已被使用");
                }
            }
            System.out.println("===="+nationalDrugDictDO.getId());
            BaseDrugDictDO oldDurgDictDO =  baseDrugDictDao.findOne(nationalDrugDictDO.getId());
            BeanUtils.copyProperties(nationalDrugDictDO, oldDurgDictDO, getNullPropertyNames(nationalDrugDictDO));
            oldDurgDictDO.setUpdate_time(new Date());
            return baseDrugDictDao.save(oldDurgDictDO);
        }
    }
    public MixEnvelop  findDrugDict(String name,String status,Integer page,Integer pageSize){
        String sql = "select t.id as \"id\"," +
                " t.charge_code as \"charge_code\"," +
                " t.drugname as \"drugname\"," +
                " t.specification as \"specification\"," +
                " t.py_code as \"py_code\"," +
                " t.supply_code as \"supply_code\"," +
                " t.supply_name as \"supply_name\"," +
                " t.retprice as \"retprice\"," +
                " t.manu_name as \"manu_name\"," +
                " t.weigh_unit as \"weigh_unit\"," +
                " t.mini_unit_name as \"mini_unit_name\"," +
                " t.pack_unit_name as \"pack_unit_name\"," +
                " t.weigh_unit_name as \"weigh_unit_name\"," +
                " t.vol_unit_name as \"vol_unit_name\"," +
                " t.win_no as \"win_no\"," +
                " t.pack_retprice as \"pack_retprice\"," +
                " t.mini_unit as \"mini_unit\"," +
                " t.pack_size as \"pack_size\"," +
                " t.action as \"action\"," +
                " t.serial as \"serial\"," +
                " t.group_no as \"group_no\"," +
                " t.stock_amount as \"stock_amount\"," +
                " t.visible_flag as \"visible_flag\"," +
                " t.drug_flag as \"drug_flag\"," +
                " t.create_time as \"create_time\"," +
                " t.update_time as \"update_time\"," +
                " t.status as \"status\"," +
                " t.mini_stock_amount as \"mini_stock_amount\"," +
                " t.dosage as \"dosage\"," +
                " t.max_stock_amount as \"max_stock_amount\"," +
                " t.pack_unit as \"pack_unit\"," +
                " t.manufactory as \"manufactory\"," +
                " t.vol_unit as \"vol_unit\"," +
                " t.is_del as \"is_del\"" +
                " from base_drug_dict t " +
                " where t.is_del='1' ";
        String sqlCount = "select count(1) as \"count\" from base_drug_dict t where t.is_del='1' ";
        if (StringUtils.isNoneBlank(name)){
            sql+=" and t.drugname like '%"+name+"%'";
            sqlCount+=" and t.drugname like '%"+name+"%'";
        }
        if (StringUtils.isNoneBlank(status)){
            sql+=" and t.status = '"+status+"'";
            sqlCount+=" and t.status = '"+status+"'";
        }
        List<Map<String,Object>> coutList=hibenateUtils.createSQLQuery(sqlCount);
        Integer count=0 ;
        if (coutList!=null&&coutList.size()>0){
            count=Integer.valueOf(coutList.get(0).get("count").toString());
        }
        List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
        for (Map<String,Object> map:list){
            if (map.get("status")!=null&&"1".equalsIgnoreCase(map.get("status").toString())){
                map.put("statusName","生效中");
            }else {
                map.put("statusName","已失效");
            }
        }
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setDetailModelList(list);
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setTotalCount(count);
        return mixEnvelop;
    }
    public BaseDrugDictDO findOneDrug(String id){
        return baseDrugDictDao.findOne(id);
    }
    public Map<String, Object> batchInsertDrugs(List<BasDrugExcelDO> drugs,String templateId) throws ManageException {
        Map<String, Object> result = new HashMap<>();
        //批量存储的集合
//        int correctCount = 0;
//        List<BasDrugExcelDO> corrects = new ArrayList<>();
        BaseDrugDictDO baseDrugDictDO;
        //批量存储
        for(BasDrugExcelDO one:drugs) {
            baseDrugDictDO = new BaseDrugDictDO();
            baseDrugDictDO.setCreate_time(new Date());
            baseDrugDictDO.setIs_del("1");
            baseDrugDictDO.setCharge_code(one.getCharge_code());
            baseDrugDictDO.setDosage(one.getDosage());
            baseDrugDictDO.setDrug_flag(one.getDrug_flag());
            baseDrugDictDO.setDrugname(one.getDrugname());
            baseDrugDictDO.setPack_retprice(one.getPack_retprice());
            baseDrugDictDO.setPack_size(one.getPack_size());
            baseDrugDictDO.setPack_unit_name(one.getPack_unit_name());
            baseDrugDictDO.setPack_unit(one.getPack_unit());
            baseDrugDictDO.setWin_no(one.getWin_no());
            baseDrugDictDO.setRetprice(one.getRetprice());
            baseDrugDictDO.setGroup_no(one.getGroup_no());
            baseDrugDictDO.setSerial(one.getSerial());
            baseDrugDictDO.setManu_name(one.getManu_name());
            baseDrugDictDO.setMax_stock_amount(one.getMax_stock_amount());
            baseDrugDictDO.setMini_stock_amount(one.getMini_stock_amount());
            baseDrugDictDO.setMini_unit(one.getMini_unit());
            baseDrugDictDO.setMini_unit_name(one.getMini_unit_name());
            baseDrugDictDO.setPy_code(one.getPy_code());
            baseDrugDictDO.setStock_amount(one.getStock_amount());
            baseDrugDictDO.setVisible_flag(one.getVisible_flag());
            baseDrugDictDO.setSpecification(one.getSpecification());
            baseDrugDictDO.setVol_unit_name(one.getVol_unit_name());
            baseDrugDictDO.setWeigh_unit(one.getWeigh_unit());
            baseDrugDictDO.setWeigh_unit_name(one.getWeigh_unit_name());
            baseDrugDictDO.setManufactory(one.getWeigh_unit_name());
            baseDrugDictDO.setStatus(one.getStatus());
            baseDrugDictDO=baseDrugDictDao.save(baseDrugDictDO);
            if (StringUtils.isNoneBlank(templateId)){
                BaseTemplateDictDO baseTemplateDictDO = new BaseTemplateDictDO();
                baseTemplateDictDO.setTemplateId(templateId);
                baseTemplateDictDO.setIsDel("1");
                baseTemplateDictDO.setDictId(baseDrugDictDO.getId());
                baseTemplateDictDO.setCreateTime(new Date());
                baseTemplateDictDao.save(baseTemplateDictDO);
            }
        }
        result.put("correctCount", drugs.size());
        return result;
    }
    public void updateDrugStatus(String id,String status,String del) throws  Exception{
        BaseDrugDictDO baseDrugDictDO = baseDrugDictDao.findOne(id);
        if (baseDrugDictDO!=null){
            if (StringUtils.isNoneBlank(status)){
                baseDrugDictDO.setStatus(status);
            }
            if (StringUtils.isNoneBlank(del)){
                List<BaseTemplateDictDO> baseTemplateDictDO = baseTemplateDictDao.findByDictId(id);
                if (baseTemplateDictDO!=null&&baseTemplateDictDO.size()>0){
                    throw  new Exception("该药品已存在现有模板之中不允许删除");
                }
                baseDrugDictDO.setIs_del(del);
            }
            baseDrugDictDao.save(baseDrugDictDO);
        }
    }
}

+ 158 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/BaseDrugUseService.java

@ -0,0 +1,158 @@
package com.yihu.jw.base.service.dict;
import com.yihu.jw.base.service.dict.importManage.BasDrugExcelDO;
import com.yihu.jw.base.service.dict.importManage.BasDrugUseExcelDO;
import com.yihu.jw.dict.dao.BaseDrugDictDao;
import com.yihu.jw.dict.dao.BaseDrugUseDictDao;
import com.yihu.jw.dict.dao.BaseTemplateDictDao;
import com.yihu.jw.entity.base.dict.BaseDrugDictDO;
import com.yihu.jw.entity.base.dict.BaseDrugUseDictDO;
import com.yihu.jw.entity.base.dict.BaseTemplateDictDO;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.yihu.jw.util.common.BeanUtils.getNullPropertyNames;
@Service
public class BaseDrugUseService extends BaseJpaService<BaseDrugUseDictDO, BaseDrugUseDictDao> {
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private BaseDrugUseDictDao baseDrugUseDictDao;
    @Autowired
    private BaseTemplateDictDao baseTemplateDictDao;
    public void saveBaseDrugUse(BaseDrugUseDictDO baseDrugUseDictDO) throws  Exception{
        BaseDrugUseDictDO baseDrugUseDictDO1=baseDrugUseDictDao.findByCode(baseDrugUseDictDO.getSupply_code());
        if (StringUtils.isNotBlank(baseDrugUseDictDO.getId())){
            if (baseDrugUseDictDO1!=null){
                throw  new Exception("该使用方式code已存在");
            }
            BaseDrugUseDictDO oldDurgDictDO= baseDrugUseDictDao.findOne(baseDrugUseDictDO.getId());
            BeanUtils.copyProperties(baseDrugUseDictDO, oldDurgDictDO, getNullPropertyNames(baseDrugUseDictDO));
            baseDrugUseDictDao.save(oldDurgDictDO);
        }else {
            if (baseDrugUseDictDO1!=null){
                if (!baseDrugUseDictDO1.getId().equalsIgnoreCase(baseDrugUseDictDO.getId())){
                    throw  new Exception("该使用方式code已被使用");
                }
            }
            baseDrugUseDictDO.setCreateTime(new Date());
            baseDrugUseDictDO.setDel_flag("1");
            baseDrugUseDictDao.save(baseDrugUseDictDO);
        }
    }
    public MixEnvelop findDrugUseList(String name,String status,Integer page ,Integer pageSize){
        String sql="select t.id as \"id\"," +
                " t.supply_code as \"supply_code\"," +
                " t.supply_name as \"supply_name\"," +
                " t.supply_occ as \"supply_occ\"," +
                " t.del_flag as \"del_flag\"," +
                " t.sort_code as \"sort_code\"," +
                " t.print_name as \"print_name\"," +
                " t.py_code as \"py_code\"," +
                " t.d_code as \"d_code\"," +
                " t.yb_name as \"yb_name\"," +
                " t.yb_code as \"yb_code\"," +
                " t.status as \"status\"," +
                " t.create_time as \"create_time\" " +
                "from base_drug_use_dict t " +
                " where t.del_flag='1'";
        String sqlCount =" select count(1) as \"count\" from base_drug_use_dict t where t.del_flag='1'";
        if (StringUtils.isNoneBlank(name)){
            sql+=" and t.supply_name like '%"+name+"%'";
            sqlCount+=" and t.supply_name like '%"+name+"%'";
        }
        if (StringUtils.isNoneBlank(status)){
            sql+=" and t.status ='"+status+"'";
            sqlCount+=" and t.status ='"+status+"'";
        }
        List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
        for (Map<String,Object> map:list){
            if (map.get("status")!=null&&"1".equalsIgnoreCase(map.get("status").toString())){
                map.put("statusName","生效中");
            }else {
                map.put("statusName","已失效");
            }
        }
        List<Map<String,Object>> countList=hibenateUtils.createSQLQuery(sqlCount);
        Integer count=0;
        if (countList!=null&&countList.size()>0) {
            count = Integer.valueOf(countList.get(0).get("count").toString());
        }
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setDetailModelList(list);
        mixEnvelop.setTotalCount(count);
        return mixEnvelop;
    }
    public BaseDrugUseDictDO findOneUseDict(String dictId){
        return baseDrugUseDictDao.findOne(dictId);
    }
    public Map<String, Object> batchInsertDrugs(List<BasDrugUseExcelDO> drugs, String templateId) throws ManageException {
        Map<String, Object> result = new HashMap<>();
        //批量存储的集合
//        int correctCount = 0;
//        List<BasDrugExcelDO> corrects = new ArrayList<>();
        BaseDrugUseDictDO baseDrugUseDictDO;
        //批量存储
        for(BasDrugUseExcelDO one:drugs) {
            baseDrugUseDictDO = new BaseDrugUseDictDO();
            baseDrugUseDictDO.setCreateTime(new Date());
            baseDrugUseDictDO.setStatus(one.getStatus());
            baseDrugUseDictDO.setDel_flag("1");
            baseDrugUseDictDO.setD_code(one.getD_code());
            baseDrugUseDictDO.setPrint_name(one.getPrint_name());
            baseDrugUseDictDO.setPy_code(one.getPy_code());
            baseDrugUseDictDO.setSort_code(one.getSort_code());
            baseDrugUseDictDO.setSupply_code(one.getSupply_code());
            baseDrugUseDictDO.setSupply_name(one.getSupply_name());
            baseDrugUseDictDO.setSupply_occ(one.getSupply_occ());
            baseDrugUseDictDO.setYb_code(one.getYb_code());
            baseDrugUseDictDO.setYb_name(one.getYb_name());
            baseDrugUseDictDO=baseDrugUseDictDao.save(baseDrugUseDictDO);
            if (StringUtils.isNoneBlank(templateId)){
                BaseTemplateDictDO baseTemplateDictDO = new BaseTemplateDictDO();
                baseTemplateDictDO.setTemplateId(templateId);
                baseTemplateDictDO.setIsDel("1");
                baseTemplateDictDO.setDictId(baseDrugUseDictDO.getId());
                baseTemplateDictDO.setCreateTime(new Date());
                baseTemplateDictDao.save(baseTemplateDictDO);
            }
        }
        result.put("correctCount", drugs.size());
        return result;
    }
    public void updateDrugUseStatus(String id,String status,String del) throws  Exception{
        BaseDrugUseDictDO baseDrugUseDictDO = baseDrugUseDictDao.findOne(id);
        if (baseDrugUseDictDO!=null){
            if (StringUtils.isNoneBlank(status)){
                baseDrugUseDictDO.setStatus(status);
            }
            if (StringUtils.isNoneBlank(del)){
                baseDrugUseDictDO.setDel_flag(del);
                List<BaseTemplateDictDO> baseTemplateDictDO = baseTemplateDictDao.findByDictId(id);
                if (baseTemplateDictDO!=null&&baseTemplateDictDO.size()>0){
                    throw  new Exception("该使用方式已存在现有模板之中不允许删除");
                }
            }
            baseDrugUseDictDao.save(baseDrugUseDictDO);
        }
    }
}

+ 150 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/BaseFrequencyService.java

@ -0,0 +1,150 @@
package com.yihu.jw.base.service.dict;
import com.yihu.jw.base.service.dict.importManage.BasDrugUseExcelDO;
import com.yihu.jw.base.service.dict.importManage.BasFrequencyExcelDO;
import com.yihu.jw.dict.dao.BaseDrugUseDictDao;
import com.yihu.jw.dict.dao.BaseFrequencyDictDao;
import com.yihu.jw.dict.dao.BaseTemplateDictDao;
import com.yihu.jw.entity.base.dict.BaseDrugUseDictDO;
import com.yihu.jw.entity.base.dict.BaseFrequencyDictDO;
import com.yihu.jw.entity.base.dict.BaseTemplateDictDO;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.yihu.jw.util.common.BeanUtils.getNullPropertyNames;
@Service
public class BaseFrequencyService extends BaseJpaService<BaseFrequencyDictDO, BaseFrequencyDictDao> {
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private BaseFrequencyDictDao baseFrequencyDictDao;
    @Autowired
    private BaseTemplateDictDao baseTemplateDictDao;
    public void saveFrequency(BaseFrequencyDictDO baseFrequencyDictDO) throws Exception{
        BaseFrequencyDictDO baseFrequencyDictDO1=baseFrequencyDictDao.findByCode(baseFrequencyDictDO.getFreq_code());
        if (StringUtils.isNotBlank(baseFrequencyDictDO.getId())){
            if (baseFrequencyDictDO1!=null){
                throw  new Exception("该频次code已存在");
            }
            BaseFrequencyDictDO oldFrequency= baseFrequencyDictDao.findOne(baseFrequencyDictDO.getId());
            BeanUtils.copyProperties(baseFrequencyDictDO, oldFrequency, getNullPropertyNames(baseFrequencyDictDO));
            baseFrequencyDictDao.save(oldFrequency);
        }else {
            if (baseFrequencyDictDO1!=null){
                if (!baseFrequencyDictDO1.getId().equalsIgnoreCase(baseFrequencyDictDO.getId())){
                    throw  new Exception("该频次code已被使用");
                }
            }
            baseFrequencyDictDO.setCreateTime(new Date());
            baseFrequencyDictDO.setIs_del("1");
            baseFrequencyDictDao.save(baseFrequencyDictDO);
        }
    }
    public MixEnvelop findFrequencyList(String name, String status, Integer page , Integer pageSize){
        String sql="select t.id as \"id\"," +
                " t.freq_code as \"freq_code\"," +
                " t.freq_name as \"freq_name\"," +
                " t.freq_sp as \"freq_sp\"," +
                " t.daily_times as \"daily_times\"," +
                " t.weekly_times as \"weekly_times\"," +
                " t.hosp_code as \"hosp_code\"," +
                " t.is_del as \"is_del\"," +
                " t.is_op_ip as \"is_op_ip\"," +
                " t.status as \"status\"," +
                " t.create_time as \"create_time\"" +
                "from base_frequency_dict t " +
                " where t.is_del='1'";
        String sqlCount =" select count(1) as \"count\" from base_frequency_dict t where t.is_del='1'";
        if (StringUtils.isNoneBlank(name)){
            sql+=" and (t.freq_code like '%"+name+"%' or t.freq_name like '%"+name+"%')";
            sqlCount+=" and (t.freq_code like '%"+name+"%' or t.freq_name like '%"+name+"%')";
        }
        if (StringUtils.isNoneBlank(status)){
            sql+=" and t.status ='"+status+"'";
            sqlCount+=" and t.status ='"+status+"'";
        }
        List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
        for (Map<String,Object> map:list){
            if (map.get("status")!=null&&"1".equalsIgnoreCase(map.get("status").toString())){
                map.put("statusName","生效中");
            }else {
                map.put("statusName","已失效");
            }
        }
        List<Map<String,Object>> countList=hibenateUtils.createSQLQuery(sqlCount);
        Integer count=0;
        if (countList!=null&&countList.size()>0) {
            count = Integer.valueOf(countList.get(0).get("count").toString());
        }
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setDetailModelList(list);
        mixEnvelop.setTotalCount(count);
        return mixEnvelop;
    }
    public BaseFrequencyDictDO findOneFrequency(String id){
        return baseFrequencyDictDao.findOne(id);
    }
    public Map<String, Object> batchInsertDrugs(List<BasFrequencyExcelDO> drugs, String templateId) throws ManageException {
        Map<String, Object> result = new HashMap<>();
        //批量存储的集合
//        int correctCount = 0;
//        List<BasDrugExcelDO> corrects = new ArrayList<>();
        BaseFrequencyDictDO baseFrequencyDictDO;
        //批量存储
        for(BasFrequencyExcelDO one:drugs) {
            baseFrequencyDictDO = new BaseFrequencyDictDO();
            baseFrequencyDictDO.setCreateTime(new Date());
            baseFrequencyDictDO.setIs_del("1");
            baseFrequencyDictDO.setDaily_times(one.getDaily_times());
            baseFrequencyDictDO.setFreq_code(one.getFreq_code());
            baseFrequencyDictDO.setFreq_name(one.getFreq_name());
            baseFrequencyDictDO.setFreq_sp(one.getFreq_sp());
            baseFrequencyDictDO.setHosp_code(one.getHosp_code());
            baseFrequencyDictDO.setIs_op_ip(one.getIs_op_ip());
            baseFrequencyDictDO.setStatus(one.getStatus());
            baseFrequencyDictDO.setWeekly_times(one.getWeekly_times());
            baseFrequencyDictDO=baseFrequencyDictDao.save(baseFrequencyDictDO);
            if (StringUtils.isNoneBlank(templateId)){
                BaseTemplateDictDO baseTemplateDictDO = new BaseTemplateDictDO();
                baseTemplateDictDO.setTemplateId(templateId);
                baseTemplateDictDO.setIsDel("1");
                baseTemplateDictDO.setDictId(baseFrequencyDictDO.getId());
                baseTemplateDictDO.setCreateTime(new Date());
                baseTemplateDictDao.save(baseTemplateDictDO);
            }
        }
        result.put("correctCount", drugs.size());
        return result;
    }
    public void updateFrequencyStatus(String id,String status,String del) throws  Exception{
        BaseFrequencyDictDO baseFrequencyDictDO = baseFrequencyDictDao.findOne(id);
        if (baseFrequencyDictDO!=null){
            if (StringUtils.isNotBlank(status)){
                baseFrequencyDictDO.setStatus(status);
            }
            if (StringUtils.isNotBlank(del)){
                baseFrequencyDictDO.setIs_del(del);
                List<BaseTemplateDictDO> baseTemplateDictDO = baseTemplateDictDao.findByDictId(id);
                if (baseTemplateDictDO!=null&&baseTemplateDictDO.size()>0){
                    throw  new Exception("该使频次已存在现有模板之中不允许删除");
                }
            }
            baseFrequencyDictDao.save(baseFrequencyDictDO);
        }
    }
}

+ 136 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictIcd10Service.java

@ -3,16 +3,26 @@ package com.yihu.jw.base.service.dict;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.base.dao.dict.DictIcd10Dao;
import com.yihu.jw.base.enums.SystemDictEnum;
import com.yihu.jw.base.service.dict.importManage.BasDrugUseExcelDO;
import com.yihu.jw.base.service.dict.importManage.BasIcd10ExcelDO;
import com.yihu.jw.dict.dao.BaseTemplateDictDao;
import com.yihu.jw.entity.base.dict.BaseDrugUseDictDO;
import com.yihu.jw.entity.base.dict.BaseFrequencyDictDO;
import com.yihu.jw.entity.base.dict.BaseTemplateDictDO;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.dict.DictIcd10DO;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
import static com.yihu.jw.util.common.BeanUtils.getNullPropertyNames;
/**
 * 
@ -31,6 +41,10 @@ public class DictIcd10Service extends BaseJpaService<DictIcd10DO, DictIcd10Dao>
    @Autowired
    private DictIcd10Dao dictIcd10Dao;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private BaseTemplateDictDao baseTemplateDictDao;
    /**
     * 查询某一租户下的Icd10字典信息,如果saadId为空表示当前用户角色为超级管理员,超级管理员可以看到所有数据
@ -56,4 +70,123 @@ public class DictIcd10Service extends BaseJpaService<DictIcd10DO, DictIcd10Dao>
        dictIcd10Dao.delete(id);
    }
    public MixEnvelop findIcd10List(String name,String status,Integer page ,Integer pageSize){
        String sql="select t.id as \"id\"," +
                " t.code as \"code\"," +
                " t.name as \"name\"," +
                " t.description as \"description\"," +
                " t.create_time as \"create_time\"," +
                " t.disea_reason as \"disea_reason\"," +
                " t.death_reason as \"death_reason\"," +
                " t.py_code as \"py_code\"," +
                " t.d_code as \"d_code\"," +
                " t.flag as \"flag\"," +
                " t.is_del as \"is_del\"," +
                " t.status as \"status\" " +
                "from dict_icd10 t " +
                " where t.is_del='1'";
        String sqlCount =" select count(1) as \"count\" from dict_icd10 t where t.is_del='1'";
        if (StringUtils.isNoneBlank(name)){
            sql+=" and t.name like '%"+name+"%'";
            sqlCount+=" and t.name like '%"+name+"%'";
        }
        if (StringUtils.isNoneBlank(status)){
            sql+=" and t.status ='"+status+"'";
            sqlCount+=" and t.status ='"+status+"'";
        }
        List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
        for (Map<String,Object> map:list){
            if (map.get("status")!=null&&"1".equalsIgnoreCase(map.get("status").toString())){
                map.put("statusName","生效中");
            }else {
                map.put("statusName","已失效");
            }
        }
        List<Map<String,Object>> countList=hibenateUtils.createSQLQuery(sqlCount);
        Integer count=0;
        if (countList!=null&&countList.size()>0) {
            count = Integer.valueOf(countList.get(0).get("count").toString());
        }
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setDetailModelList(list);
        mixEnvelop.setTotalCount(count);
        return mixEnvelop;
    }
    public void saveIcd10(DictIcd10DO icd10DO) throws Exception{
        DictIcd10DO icd10DO2=dictIcd10Dao.findByCode(icd10DO.getCode());
        if (icd10DO.getId()!=null){
            if (icd10DO2!=null){
                if (icd10DO2.getId()!=icd10DO.getId()){
                    throw  new Exception("该诊断已被使用");
                }
            }
            DictIcd10DO icd10DO1= dictIcd10Dao.findOne(icd10DO.getId());
            BeanUtils.copyProperties(icd10DO, icd10DO1, getNullPropertyNames(icd10DO));
            dictIcd10Dao.save(icd10DO1);
        }else {
            if (icd10DO2!=null){
                throw  new Exception("该诊断已存在");
            }
            icd10DO.setCreateTime(new Date());
            icd10DO.setIs_del("1");
            dictIcd10Dao.save(icd10DO);
        }
    }
    public DictIcd10DO findOneIcd10(Integer id){
        return dictIcd10Dao.findOne(id);
    }
    public Map<String, Object> batchInsertDrugs(List<BasIcd10ExcelDO> drugs, String templateId) throws ManageException {
        Map<String, Object> result = new HashMap<>();
        //批量存储的集合
//        int correctCount = 0;
//        List<BasDrugExcelDO> corrects = new ArrayList<>();
        DictIcd10DO dictIcd10DO;
        //批量存储
        for(BasIcd10ExcelDO one:drugs) {
            dictIcd10DO = new DictIcd10DO();
            dictIcd10DO.setCreateTime(new Date());
            dictIcd10DO.setIs_del("1");
            dictIcd10DO.setCode(one.getCode());
            dictIcd10DO.setD_code(one.getD_code());
            dictIcd10DO.setName(one.getName());
            dictIcd10DO.setPy_code(one.getPy_code());
            dictIcd10DO.setDeath_reason(one.getDeath_reason());
            dictIcd10DO.setDescription(one.getDescription());
            dictIcd10DO.setDisea_reason(one.getDisea_reason());
            dictIcd10DO.setFlag(one.getFlag());
            dictIcd10DO.setStatus(one.getStatus());
            dictIcd10DO=dictIcd10Dao.save(dictIcd10DO);
            if (StringUtils.isNoneBlank(templateId)){
                BaseTemplateDictDO baseTemplateDictDO = new BaseTemplateDictDO();
                baseTemplateDictDO.setTemplateId(templateId);
                baseTemplateDictDO.setIsDel("1");
                baseTemplateDictDO.setDictId(dictIcd10DO.getId().toString());
                baseTemplateDictDO.setCreateTime(new Date());
                baseTemplateDictDao.save(baseTemplateDictDO);
            }
        }
        result.put("correctCount", drugs.size());
        return result;
    }
    public void updateIcd10Status(Integer id,String status,String del) throws Exception{
        DictIcd10DO dictIcd10DO = dictIcd10Dao.findOne(id);
        if (dictIcd10DO!=null){
            if (StringUtils.isNoneBlank(status)){
                dictIcd10DO.setStatus(status);
            }
            if (StringUtils.isNoneBlank(del)){
                dictIcd10DO.setIs_del(del);
                List<BaseTemplateDictDO> baseTemplateDictDO = baseTemplateDictDao.findByDictId(id.toString());
                if (baseTemplateDictDO!=null&&baseTemplateDictDO.size()>0){
                    throw  new Exception("该诊断已存在现有模板之中不允许删除");
                }
            }
            dictIcd10Dao.save(dictIcd10DO);
        }
    }
}

+ 943 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/TemplateManageService.java

@ -0,0 +1,943 @@
package com.yihu.jw.base.service.dict;
import com.yihu.jw.base.dao.saas.SaasDao;
import com.yihu.jw.dict.dao.*;
import com.yihu.jw.entity.base.dict.*;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.xerces.dom.PSVIAttrNSImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
public class TemplateManageService {
    @Autowired
    private BaseDrugDictDao baseDrugDictDao;
    @Autowired
    private BaseTemplateDao baseTemplateDao;
    @Autowired
    private BaseTemplateDictDao baseTemplateDictDao;
    @Autowired
    private BaseTemplateOrgDao baseTemplateOrgDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private BaseDrugUseDictDao baseDrugUseDictDao;
    @Autowired
    private BaseFrequencyDictDao baseFrequencyDictDao;
    @Autowired
    private BaseDictIcd10Dao baseDictIcd10Dao;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Autowired
    private BaseOrgDao baseOrgDao;
    @Autowired
    private BaseFollowUpDictDao baseFollowUpDictDao;
    public MixEnvelop findTempalte(String templateType,String code,String name,String diseaseName,String diseaseId, Integer page ,Integer pageSize){
        String sql =" select t.id as \"id\" ," +
                " t.name as \"name\"," +
                " t.code as \"code\"," +
                " t.children_count as \"childrenCount\"," +
                " t.update_user as \"updateUser\"," +
                " t.update_user_name as \"updateUserName\"," +
                " t.update_time as \"updateTime\"," +
                " t.disease_name as \"diseaseName\"," +
                " t.disease_id as \"diseaseId\"," +
                " t.template_type as \"templateType\"," +
                " t.is_del as \"isDel\" " +
                " from base_template t " +
                " where t.is_del='1' ";
        String sqlCount=" select count(1) as \"count\" from base_template t where t.is_del='1'";
        if (StringUtils.isNotBlank(templateType)){
            sql+= " and t.template_type='"+templateType+"'";
            sqlCount+= " and t.template_type='"+templateType+"'";
        }
        if (StringUtils.isNotBlank(code)){
            sql+= " and t.code like '%"+code+"%'";
            sqlCount+= " and t.code like '%"+code+"%'";
        }
        if (StringUtils.isNotBlank(diseaseName)){
            sql+= " and t.disease_name like '%"+diseaseName+"%'";
            sqlCount+= " and t.disease_name like '%"+diseaseName+"%'";
        }
        if (StringUtils.isNotBlank(diseaseId)){
            sql+= " and t.disease_id like '%"+diseaseId+"%'";
            sqlCount+= " and t.disease_id like '%"+diseaseId+"%'";
        }
        if (StringUtils.isNotBlank(name)){
            sql+= " and t.name like '%"+name+"%'";
            sqlCount+= " and t.name like '%"+name+"%'";
        }
        sql+=" order by t.update_time desc";
        Integer count=0;
        List<Map<String,Object>> countList=hibenateUtils.createSQLQuery(sqlCount);
        if (countList!=null&&countList.size()>0){
            count = Integer.parseInt(countList.get(0).get("count").toString());
        }
        List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
        for (Map<String,Object> map:list){
            List<BaseTemplateOrgDO> orgTemplate=baseTemplateOrgDao.findByTemplateId(map.get("id").toString());
            List<String> orgNames= new ArrayList<>();
            int i=0;
            for (BaseTemplateOrgDO baseTemplateOrgDO :orgTemplate){
                orgNames.add(baseTemplateOrgDO.getOrgName());
            }
            map.put("orgNames",orgNames.toString());
        }
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setDetailModelList(list);
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setTotalCount(count);
        return mixEnvelop;
    }
   public void addOrRemoveChildrenDict(String templateId,String dictIds,String isDel){
        String[] dictArr=dictIds.split(",");
        for (int i=0;i<dictArr.length;i++){
            String dictId=dictArr[i];
            BaseTemplateDictDO baseTemplateDictDO = baseTemplateDictDao.findByDictIdAndTemplateId(dictId,templateId);
            if ("1".equalsIgnoreCase(isDel)){
                if (baseTemplateDictDO!=null){
                    baseTemplateDictDO.setIsDel("1");
                }else {
                    baseTemplateDictDO = new BaseTemplateDictDO();
                    baseTemplateDictDO.setTemplateId(templateId);
                    baseTemplateDictDO.setDictId(dictId);
                    baseTemplateDictDO.setCreateTime(new Date());
                    baseTemplateDictDO.setIsDel("1");
                }
            }else {
                if (baseTemplateDictDO!=null){
                    baseTemplateDictDO.setIsDel("0");
                }else {
                    return;
                }
            }
            baseTemplateDictDao.save(baseTemplateDictDO);
            BaseTemplateDO baseTemplateDO = baseTemplateDao.findOne(templateId);
            Integer chuildrenCount =  baseTemplateDictDao.getCountByTemplateId(templateId);
            if (baseTemplateDO !=null ){
                baseTemplateDO.setChildrenCount(chuildrenCount.toString());
            }
            baseTemplateDao.save(baseTemplateDO);
        }
   }
   public void saveOrUpdateTemplate(String templateId,String code,String name,String user,String userName,String templateType,String diseaseId,String diseaseName){
       BaseTemplateDO baseTemplateDO = baseTemplateDao.findOne(templateId);
       String localCode="MD"+new Date().getTime();
       System.out.println("templatType"+templateType);
       if (baseTemplateDO!=null){
           baseTemplateDO.setCode(localCode);
           baseTemplateDO.setName(name);
           baseTemplateDO.setUpdateTime(new Date());
           baseTemplateDO.setUpdateUser(user);
           baseTemplateDO.setUpdateUserName(userName);
           baseTemplateDO.setDiseaseId(diseaseId);
           baseTemplateDO.setDiseaseName(diseaseName);
           baseTemplateDO.setTemplateType(templateType);
       }else {
           baseTemplateDO = new BaseTemplateDO();
           baseTemplateDO.setCode(localCode);
           baseTemplateDO.setName(name);
           baseTemplateDO.setCreateTime(new Date());
           baseTemplateDO.setCreateUser(user);
           baseTemplateDO.setCreateUserName(userName);
           baseTemplateDO.setTemplateType(templateType);
           baseTemplateDO.setDiseaseId(diseaseId);
           baseTemplateDO.setDiseaseName(diseaseName);
           baseTemplateDO.setIsDel("1");
       }
       baseTemplateDao.save(baseTemplateDO);
   }
   public MixEnvelop findTemlateChildList(String templateId,String name,String code,Integer page,Integer pageSize){
        BaseTemplateDO baseTemplateDictDO = baseTemplateDao.findOne(templateId);
        PageRequest pageRequest = new PageRequest(page-1, pageSize);
        List<Map<String,Object>> returnList= new ArrayList<>();
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        if (baseTemplateDictDO!=null){
            if ("frequencyDict".equalsIgnoreCase(baseTemplateDictDO.getTemplateType())){
                List<BaseFrequencyDictDO> list= new ArrayList<>();
                if (StringUtils.isNoneBlank(name)){
                    list= baseFrequencyDictDao.findByNameDel(name,code,pageRequest);
                }else {
                    list= baseFrequencyDictDao.findByDel(pageRequest);
                }
                Integer count = baseFrequencyDictDao.getconuntByDel();
                for (BaseFrequencyDictDO baseFrequencyDictDO:list){
                    Map<String,Object> map = new HashMap<>();
                    map.put("templateDetail",baseTemplateDictDO);
                    map.put("id",baseFrequencyDictDO.getId());
                    map.put("code",baseFrequencyDictDO.getFreq_code());
                    map.put("name",baseFrequencyDictDO.getFreq_name());
                    map.put("py_code",baseFrequencyDictDO.getFreq_sp());
                    map.put("daily_times",baseFrequencyDictDO.getDaily_times());
                    map.put("weekly_times",baseFrequencyDictDO.getWeekly_times());
                    BaseTemplateDictDO baseTemplateDictDO1= baseTemplateDictDao.findByDictIdAndTemplateId(baseFrequencyDictDO.getId(),templateId);
                    if (baseTemplateDictDO1!=null){
                        map.put("isAdd",1);
                    }else {
                        map.put("isAdd",0);
                    }
                    returnList.add(map);
                }
                mixEnvelop.setDetailModelList(returnList);
                mixEnvelop.setTotalCount(count);
                return mixEnvelop;
            }else if ("drugUseDict".equalsIgnoreCase(baseTemplateDictDO.getTemplateType())){
                List<BaseDrugUseDictDO> list= new ArrayList<>();
                if (StringUtils.isNoneBlank(name)){
                    list= baseDrugUseDictDao.findByNameDel(name,code,pageRequest);
                }else {
                    list= baseDrugUseDictDao.findByDel(pageRequest);
                }
                Integer count = baseDrugUseDictDao.getconuntByDel();
                for (BaseDrugUseDictDO baseDrugUseDictDO:list){
                    Map<String,Object> map = new HashMap<>();
                    map.put("id",baseDrugUseDictDO.getId());
                    map.put("templateDetail",baseTemplateDictDO);
                    map.put("code",baseDrugUseDictDO.getSupply_code());
                    map.put("name",baseDrugUseDictDO.getSupply_name());
                    map.put("py_code",baseDrugUseDictDO.getPy_code());
                    BaseTemplateDictDO baseTemplateDictDO1= baseTemplateDictDao.findByDictIdAndTemplateId(baseDrugUseDictDO.getId(),templateId);
                    if (baseTemplateDictDO1!=null){
                        map.put("isAdd",1);
                    }else {
                        map.put("isAdd",0);
                    }
                    returnList.add(map);
                }
                mixEnvelop.setDetailModelList(returnList);
                mixEnvelop.setTotalCount(count);
                return mixEnvelop;
            }else if ("drugListDict".equalsIgnoreCase(baseTemplateDictDO.getTemplateType())){
                List<BaseDrugDictDO> list= new ArrayList<>();
                if (StringUtils.isNoneBlank(name)){
                    list= baseDrugDictDao.findByNameDel(name,code,pageRequest);
                }else {
                    list= baseDrugDictDao.findByDel(pageRequest);
                }
                Integer count = baseDrugDictDao.getconuntByDel();
                for (BaseDrugDictDO baseDrugDictDO:list){
                    Map<String,Object> map = new HashMap<>();
                    map.put("id",baseDrugDictDO.getId());
                    map.put("templateDetail",baseTemplateDictDO);
                    map.put("code",baseDrugDictDO.getCharge_code());
                    map.put("name",baseDrugDictDO.getDrugname());
                    map.put("dosage",baseDrugDictDO.getDosage());
                    map.put("specification",baseDrugDictDO.getSpecification());
                    map.put("stock_amount",baseDrugDictDO.getStock_amount());
                    map.put("manu_name",baseDrugDictDO.getManu_name());
                    BaseTemplateDictDO baseTemplateDictDO1= baseTemplateDictDao.findByDictIdAndTemplateId(baseDrugDictDO.getId(),templateId);
                    if (baseTemplateDictDO1!=null){
                        map.put("isAdd",1);
                    }else {
                        map.put("isAdd",0);
                    }
                    returnList.add(map);
                }
                mixEnvelop.setDetailModelList(returnList);
                mixEnvelop.setTotalCount(count);
                return mixEnvelop;
            }else if ("icd10ListDict".equalsIgnoreCase(baseTemplateDictDO.getTemplateType())){
                List<DictIcd10DO> list= new ArrayList<>();
                if (StringUtils.isNoneBlank(name)){
                    list= baseDictIcd10Dao.findByNameDel(name,code,pageRequest);
                }else {
                    list= baseDictIcd10Dao.findByDel(pageRequest);
                }
                Integer count = baseDrugDictDao.getconuntByDel();
                for (DictIcd10DO dictIcd10DO:list){
                    Map<String,Object> map = new HashMap<>();
                    map.put("templateDetail",baseTemplateDictDO);
                    map.put("id",dictIcd10DO.getId());
                    map.put("code",dictIcd10DO.getCode());
                    map.put("name",dictIcd10DO.getName());
                    map.put("disea_reason",dictIcd10DO.getDisea_reason());
                    map.put("death_reason",dictIcd10DO.getDeath_reason());
                    map.put("py_code",dictIcd10DO.getPy_code());
                    map.put("d_code",dictIcd10DO.getD_code());
                    map.put("flag",dictIcd10DO.getFlag());
                    BaseTemplateDictDO baseTemplateDictDO1= baseTemplateDictDao.findByDictIdAndTemplateId(dictIcd10DO.getId().toString(),templateId);
                    if (baseTemplateDictDO1!=null){
                        map.put("isAdd",1);
                    }else {
                        map.put("isAdd",0);
                    }
                    returnList.add(map);
                }
                mixEnvelop.setDetailModelList(returnList);
                mixEnvelop.setTotalCount(count);
                return mixEnvelop;
            }else if ("followUpDict".equalsIgnoreCase(baseTemplateDictDO.getTemplateType())){
                List<BaseFollowUpDictDO> list= new ArrayList<>();
                if (StringUtils.isNoneBlank(name)){
                    list= baseFollowUpDictDao.findByNameDel(name,code,pageRequest);
                }else {
                    list= baseFollowUpDictDao.findByDel(pageRequest);
                }
                Integer count = baseDrugDictDao.getconuntByDel();
                for (BaseFollowUpDictDO followUpDictDO:list){
                    Map<String,Object> map = new HashMap<>();
                    map.put("templateDetail",baseTemplateDictDO);
                    map.put("id",followUpDictDO.getId());
                    map.put("code",followUpDictDO.getCode());
                    map.put("name",followUpDictDO.getName());
                    map.put("project_content",followUpDictDO.getProjectContent());
                    map.put("status",followUpDictDO.getStatus());
                    map.put("is_del",followUpDictDO.getIsDel());
                    BaseTemplateDictDO baseTemplateDictDO1= baseTemplateDictDao.findByDictIdAndTemplateId(followUpDictDO.getId().toString(),templateId);
                    if (baseTemplateDictDO1!=null){
                        map.put("isAdd",1);
                    }else {
                        map.put("isAdd",0);
                    }
                    returnList.add(map);
                }
                mixEnvelop.setDetailModelList(returnList);
                mixEnvelop.setTotalCount(count);
                return mixEnvelop;
            } else {
                return null;
            }
        }  else {
            return null;
        }
   }
   public  BaseTemplateDO findOneTemplateById(String id){
        return baseTemplateDao.findOne(id);
   }
    public void saveUserTemplateRelation(String orgCode,String templateIds){
        String[] templateArray = templateIds.split(",");
        BaseOrgDO baseOrgDO= baseOrgDao.findByCode(orgCode);
        String orgName="";
        if (baseOrgDO!=null){
            orgName=baseOrgDO.getName();
        }
        List<BaseTemplateOrgDO> list= baseTemplateOrgDao.findByTemplateType("followUpDict",orgCode);
        baseTemplateOrgDao.delete(list);
        for (int i=0;i<templateArray.length;i++){
            String templateId=templateArray[i];
            BaseTemplateDO baseTemplateDO = baseTemplateDao.findOne(templateId);
            if (baseTemplateDO!=null){
                String templateType = baseTemplateDO.getTemplateType();
                if (!"followUpDict".equalsIgnoreCase(templateType)){
                    BaseTemplateOrgDO baseTemplateOrgDO=baseTemplateOrgDao.findByOrgCodeAndtemplateType(orgCode,templateType);
                    if (baseTemplateOrgDO!=null){
                        if (baseTemplateOrgDO.getTemplateId().equalsIgnoreCase(templateId)){
                            baseTemplateOrgDO.setIsDel("1");
                            baseTemplateOrgDao.save(baseTemplateOrgDO);
                        }else {
                            baseTemplateOrgDO.setIsDel("0");
                            BaseTemplateOrgDO baseTemplateOrgNew=new BaseTemplateOrgDO();
                            baseTemplateOrgNew.setOrgCode(orgCode);
                            baseTemplateOrgNew.setOrgName(orgName);
                            baseTemplateOrgNew.setIsDel("1");
                            baseTemplateOrgNew.setTemplateId(templateId);
                            baseTemplateOrgNew.setTemplateType(templateType);
                            baseTemplateOrgDao.save(baseTemplateOrgDO);
                            baseTemplateOrgDao.save(baseTemplateOrgNew);
                        }
                    }else {
                        baseTemplateOrgDO = new BaseTemplateOrgDO();
                        baseTemplateOrgDO.setOrgCode(orgCode);
                        baseTemplateOrgDO.setOrgName(orgName);
                        baseTemplateOrgDO.setIsDel("1");
                        baseTemplateOrgDO.setTemplateId(templateId);
                        baseTemplateOrgDO.setTemplateType(templateType);
                    }
                    baseTemplateOrgDao.save(baseTemplateOrgDO);
                }else {
                    BaseTemplateOrgDO baseTemplateOrgDO = new BaseTemplateOrgDO();
                    baseTemplateOrgDO.setOrgCode(orgCode);
                    baseTemplateOrgDO.setOrgName(orgName);
                    baseTemplateOrgDO.setIsDel("1");
                    baseTemplateOrgDO.setTemplateId(templateId);
                    baseTemplateOrgDO.setTemplateType(templateType);
                    baseTemplateOrgDao.save(baseTemplateOrgDO);
                }
            }
        }
    }
    public Map<String,Object> findUseTemplate(String orgCode){
        List<BaseTemplateOrgDO> list = baseTemplateOrgDao.findByOrgCode(orgCode);
        List<BaseTemplateOrgDO> followUpDictList= baseTemplateOrgDao.findByTemplateType("followUpDict",orgCode);
        List<WlyyHospitalSysDictDO> wlyyHospitalSysDictDOS = wlyyHospitalSysDictDao.findByDictName("dictManageList");
        Map map = new HashMap();
        for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:wlyyHospitalSysDictDOS){
            if ("followUpDict".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                List<Map<String,Object>> followUp= new ArrayList<>();
               for (BaseTemplateOrgDO baseTemplateOrgDO:followUpDictList){
                   Map baseTemplateOrgDOMap=new HashMap();
                   baseTemplateOrgDOMap.put("followupDict",baseTemplateOrgDO.getTemplateId());
                   followUp.add(baseTemplateOrgDOMap);
               }
                map.put(wlyyHospitalSysDictDO.getDictCode(),followUp);
            }else {
                for (BaseTemplateOrgDO baseTemplateOrgDO:list){
                    if (wlyyHospitalSysDictDO.getDictCode().equalsIgnoreCase(baseTemplateOrgDO.getTemplateType())){
                        map.put(wlyyHospitalSysDictDO.getDictCode(),baseTemplateOrgDO);
                    }
                }
            }
        }
        return  map;
    }
    public MixEnvelop findTemlateAddChildList(String templateId,String name,String code,Integer page,Integer pageSize){
        BaseTemplateDO baseTemplateDictDO = baseTemplateDao.findOne(templateId);
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        if (baseTemplateDictDO!=null){
            if ("frequencyDict".equalsIgnoreCase(baseTemplateDictDO.getTemplateType())){
                String sql="select t.id as \"id\"," +
                        " t.freq_code as \"freq_code\"," +
                        " t.freq_name as \"freq_name\"," +
                        " t.freq_sp as \"freq_sp\"," +
                        " t.daily_times as \"daily_times\"," +
                        " t.weekly_times as \"weekly_times\"," +
                        " t.hosp_code as \"hosp_code\"," +
                        " t.is_del as \"is_del\"," +
                        " t.is_op_ip as \"is_op_ip\"," +
                        " t.status as \"status\"," +
                        " t.create_time as \"create_time\"" +
                        "from base_template_dict b left join  base_frequency_dict t on b.dict_id=t.id" +
                        " where t.is_del='1' and b.is_del='1' and t.status ='1' ";
                String sqlCount =" select count(1) as \"count\" from base_template_dict b left join  base_frequency_dict t on b.dict_id=t.id" +
                        "  where t.is_del='1' and b.is_del='1' and t.status ='1' ";
                if (StringUtils.isNoneBlank(code)){
                    sql+=" and t.freq_code like '%"+code+"%'";
                    sqlCount+=" and t.freq_code like '%"+code+"%'";
                }
                if (StringUtils.isNoneBlank(name)){
                    sql+=" and t.freq_name like '%"+name+"%'";
                    sqlCount+=" and t.freq_name like '%"+name+"%'";
                }
                sql+=" and b.template_id = '"+baseTemplateDictDO.getId()+"'";
                sqlCount+=" and b.template_id = '"+baseTemplateDictDO.getId()+"'";
                List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
                for (Map<String,Object> map:list){
                    if (map.get("status")!=null&&"1".equalsIgnoreCase(map.get("status").toString())){
                        map.put("statusName","生效中");
                    }else {
                        map.put("statusName","已失效");
                    }
                }
                List<Map<String,Object>> countList=hibenateUtils.createSQLQuery(sqlCount);
                Integer count=0;
                if (countList!=null&&countList.size()>0) {
                    count = Integer.valueOf(countList.get(0).get("count").toString());
                }
                mixEnvelop.setDetailModelList(list);
                mixEnvelop.setTotalCount(count);
                return mixEnvelop;
            }else if ("drugUseDict".equalsIgnoreCase(baseTemplateDictDO.getTemplateType())){
                String sql="select t.id as \"id\"," +
                        " t.supply_code as \"supply_code\"," +
                        " t.supply_name as \"supply_name\"," +
                        " t.supply_occ as \"supply_occ\"," +
                        " t.del_flag as \"del_flag\"," +
                        " t.sort_code as \"sort_code\"," +
                        " t.print_name as \"print_name\"," +
                        " t.py_code as \"py_code\"," +
                        " t.d_code as \"d_code\"," +
                        " t.yb_name as \"yb_name\"," +
                        " t.yb_code as \"yb_code\"," +
                        " t.status as \"status\"," +
                        " t.create_time as \"create_time\" " +
                        "from  base_template_dict b left join base_drug_use_dict t on b.dict_id=t.id" +
                        " where t.del_flag='1' and b.is_del='1' and t.status ='1' ";
                String sqlCount =" select count(1) as \"count\" from  base_template_dict b left join base_drug_use_dict t on b.dict_id=t.id" +
                        " where t.del_flag='1' and b.is_del='1' and t.status ='1' ";
                if (StringUtils.isNoneBlank(code)){
                    sql+=" and t.supply_code like '%"+code+"%'";
                    sqlCount+=" and t.supply_code like '%"+code+"%'";
                }
                if (StringUtils.isNoneBlank(name)){
                    sql+=" and t.supply_name like '%"+name+"%'";
                    sqlCount+=" and t.supply_name like '%"+name+"%'";
                }
                sql+=" and b.template_id = '"+baseTemplateDictDO.getId()+"'";
                sqlCount+=" and b.template_id = '"+baseTemplateDictDO.getId()+"'";
                List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
                for (Map<String,Object> map:list){
                    if (map.get("status")!=null&&"1".equalsIgnoreCase(map.get("status").toString())){
                        map.put("statusName","生效中");
                    }else {
                        map.put("statusName","已失效");
                    }
                }
                List<Map<String,Object>> countList=hibenateUtils.createSQLQuery(sqlCount);
                Integer count=0;
                if (countList!=null&&countList.size()>0) {
                    count = Integer.valueOf(countList.get(0).get("count").toString());
                }
                mixEnvelop.setDetailModelList(list);
                mixEnvelop.setTotalCount(count);
                return mixEnvelop;
            }else if ("drugListDict".equalsIgnoreCase(baseTemplateDictDO.getTemplateType())){
                String sql = "select t.id as \"id\"," +
                        " t.charge_code as \"charge_code\"," +
                        " t.drugname as \"drugname\"," +
                        " t.specification as \"specification\"," +
                        " t.py_code as \"py_code\"," +
                        " t.supply_code as \"supply_code\"," +
                        " t.supply_name as \"supply_name\"," +
                        " t.retprice as \"retprice\"," +
                        " t.manu_name as \"manu_name\"," +
                        " t.weigh_unit as \"weigh_unit\"," +
                        " t.mini_unit_name as \"mini_unit_name\"," +
                        " t.pack_unit_name as \"pack_unit_name\"," +
                        " t.weigh_unit_name as \"weigh_unit_name\"," +
                        " t.vol_unit_name as \"vol_unit_name\"," +
                        " t.win_no as \"win_no\"," +
                        " t.pack_retprice as \"pack_retprice\"," +
                        " t.mini_unit as \"mini_unit\"," +
                        " t.pack_size as \"pack_size\"," +
                        " t.action as \"action\"," +
                        " t.serial as \"serial\"," +
                        " t.group_no as \"group_no\"," +
                        " t.stock_amount as \"stock_amount\"," +
                        " t.visible_flag as \"visible_flag\"," +
                        " t.drug_flag as \"drug_flag\"," +
                        " t.create_time as \"create_time\"," +
                        " t.update_time as \"update_time\"," +
                        " t.status as \"status\"," +
                        " t.mini_stock_amount as \"mini_stock_amount\"," +
                        " t.dosage as \"dosage\"," +
                        " t.max_stock_amount as \"max_stock_amount\"," +
                        " t.pack_unit as \"pack_unit\"," +
                        " t.is_del as \"is_del\"" +
                        " from base_template_dict b left join base_drug_dict t on b.dict_id = t.id " +
                        " where t.is_del='1' and b.is_del='1' and t.status ='1' ";
                String sqlCount = "select count(1) as \"count\" from base_template_dict b left join base_drug_dict t on b.dict_id = t.id " +
                        " where t.is_del='1' and b.is_del='1' and t.status ='1' ";
                if (StringUtils.isNoneBlank(code)){
                    sql+=" and t.charge_code like '%"+code+"%'";
                    sqlCount+=" and t.charge_code like '%"+code+"%'";
                }
                if (StringUtils.isNoneBlank(name)){
                    sql+=" and t.drugname like '%"+name+"%'";
                    sqlCount+=" and t.drugname like '%"+name+"%'";
                }
                sql+=" and b.template_id = '"+baseTemplateDictDO.getId()+"'";
                sqlCount+=" and b.template_id = '"+baseTemplateDictDO.getId()+"'";
                List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
                for (Map<String,Object> map:list){
                    if (map.get("status")!=null&&"1".equalsIgnoreCase(map.get("status").toString())){
                        map.put("statusName","生效中");
                    }else {
                        map.put("statusName","已失效");
                    }
                }
                List<Map<String,Object>> countList=hibenateUtils.createSQLQuery(sqlCount);
                Integer count=0;
                if (countList!=null&&countList.size()>0) {
                    count = Integer.valueOf(countList.get(0).get("count").toString());
                }
                mixEnvelop.setDetailModelList(list);
                mixEnvelop.setTotalCount(count);
                return mixEnvelop;
            }else if ("icd10ListDict".equalsIgnoreCase(baseTemplateDictDO.getTemplateType())){
                String sql="select t.id as \"id\"," +
                        " t.code as \"code\"," +
                        " t.name as \"name\"," +
                        " t.description as \"description\"," +
                        " t.create_time as \"create_time\"," +
                        " t.disea_reason as \"disea_reason\"," +
                        " t.death_reason as \"death_reason\"," +
                        " t.py_code as \"py_code\"," +
                        " t.d_code as \"d_code\"," +
                        " t.flag as \"flag\"," +
                        " t.is_del as \"is_del\"," +
                        " t.status as \"status\" " +
                        " from base_template_dict b left join dict_icd10 t on b.dict_id=t.id" +
                        " where t.is_del='1' and b.is_del='1' and t.status ='1' ";
                String sqlCount =" select count(1) as \"count\" from base_template_dict b left join dict_icd10 t on b.dict_id=t.id" +
                        " where t.is_del='1' and b.is_del='1' and t.status ='1' ";
                if (StringUtils.isNoneBlank(code)){
                    sql+=" and t.code like '%"+code+"%'";
                    sqlCount+=" and t.code like '%"+code+"%'";
                }
                if (StringUtils.isNoneBlank(name)){
                    sql+=" and t.name like '%"+name+"%'";
                    sqlCount+=" and t.name like '%"+name+"%'";
                }
                sql+=" and b.template_id = '"+baseTemplateDictDO.getId()+"'";
                sqlCount+=" and b.template_id = '"+baseTemplateDictDO.getId()+"'";
                List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
                for (Map<String,Object> map:list){
                    if (map.get("status")!=null&&"1".equalsIgnoreCase(map.get("status").toString())){
                        map.put("statusName","生效中");
                    }else {
                        map.put("statusName","已失效");
                    }
                }
                List<Map<String,Object>> countList=hibenateUtils.createSQLQuery(sqlCount);
                Integer count=0;
                if (countList!=null&&countList.size()>0) {
                    count = Integer.valueOf(countList.get(0).get("count").toString());
                }
                mixEnvelop.setDetailModelList(list);
                mixEnvelop.setTotalCount(count);
                return mixEnvelop;
            }else if ("followUpDict".equalsIgnoreCase(baseTemplateDictDO.getTemplateType())){
                String sql="select t.id as \"id\"," +
                        " t.code as \"code\"," +
                        " t.name as \"name\"," +
                        " t.is_required as \"isRequired\"," +
                        " t.project_content as \"projectContent\"," +
                        " t.status as \"status\"," +
                        " t.is_del as \"isDel\"," +
                        " t.create_time as \"createTime\"" +
                        " from base_template_dict b left join base_follow_up_dict t on b.dict_id=t.id" +
                        " where t.is_del='1' and b.is_del='1' and t.status ='1' ";
                String sqlCount =" select count(1) as \"count\" from base_template_dict b left join base_follow_up_dict t on b.dict_id=t.id" +
                        " where t.is_del='1' and b.is_del='1' and t.status ='1' ";
                if (StringUtils.isNoneBlank(code)){
                    sql+=" and t.code like '%"+code+"%'";
                    sqlCount+=" and t.code like '%"+code+"%'";
                }
                if (StringUtils.isNoneBlank(name)){
                    sql+=" and t.name like '%"+name+"%'";
                    sqlCount+=" and t.name like '%"+name+"%'";
                }
                sql+=" and b.template_id = '"+baseTemplateDictDO.getId()+"'";
                sqlCount+=" and b.template_id = '"+baseTemplateDictDO.getId()+"'";
                List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
                for (Map<String,Object> map:list){
                    if (map.get("status")!=null&&"1".equalsIgnoreCase(map.get("status").toString())){
                        map.put("statusName","生效中");
                    }else {
                        map.put("statusName","已失效");
                    }
                    if (map.get("isRequired")!=null&&"1".equalsIgnoreCase(map.get("isRequired").toString())){
                        map.put("requiredName","必填");
                    }else {
                        map.put("requiredName","非必填");
                    }
                }
                List<Map<String,Object>> countList=hibenateUtils.createSQLQuery(sqlCount);
                Integer count=0;
                if (countList!=null&&countList.size()>0) {
                    count = Integer.valueOf(countList.get(0).get("count").toString());
                }
                mixEnvelop.setDetailModelList(list);
                mixEnvelop.setTotalCount(count);
                return mixEnvelop;
            }else {
                return null;
            }
        }else {
            return null;
        }
    }
    public MixEnvelop findTemlateNotAddChildList(String templateId,String name,String code,Integer page,Integer pageSize){
        BaseTemplateDO baseTemplateDictDO = baseTemplateDao.findOne(templateId);
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        if (baseTemplateDictDO!=null){
            if ("frequencyDict".equalsIgnoreCase(baseTemplateDictDO.getTemplateType())){
                String sql="select DISTINCT t.id as \"id\"," +
                        " t.freq_code as \"freq_code\"," +
                        " t.freq_name as \"freq_name\"," +
                        " t.freq_sp as \"freq_sp\"," +
                        " t.daily_times as \"daily_times\"," +
                        " t.weekly_times as \"weekly_times\"," +
                        " t.hosp_code as \"hosp_code\"," +
                        " t.is_del as \"is_del\"," +
                        " t.is_op_ip as \"is_op_ip\"," +
                        " t.status as \"status\"," +
                        " t.create_time as \"create_time\"" +
                        " from  base_frequency_dict t where t.id not in ( SELECT DISTINCT g.id from base_frequency_dict g left join base_template_dict " +
                        "m on g.id = m.dict_id " +
                        "where m.template_id ='"+templateId+"' and m.is_del ='1') and t.is_del='1' and t.status='1' ";
                String sqlCount =" select count(1) as \"count\" from  base_frequency_dict t where t.id not in ( SELECT DISTINCT g.id from base_frequency_dict g left join base_template_dict " +
                        "m on g.id = m.dict_id " +
                        "where m.template_id ='"+templateId+"' and m.is_del ='1') and t.is_del='1' and t.status='1' ";
                if (StringUtils.isNoneBlank(code)){
                    sql+=" and t.freq_code like '%"+code+"%'";
                    sqlCount+=" and t.freq_code like '%"+code+"%'";
                }
                if (StringUtils.isNoneBlank(name)){
                    sql+=" and t.freq_name like '%"+name+"%'";
                    sqlCount+=" and t.freq_name like '%"+name+"%'";
                }
                List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
                for (Map<String,Object> map:list){
                    if (map.get("status")!=null&&"1".equalsIgnoreCase(map.get("status").toString())){
                        map.put("statusName","生效中");
                    }else {
                        map.put("statusName","已失效");
                    }
                }
                List<Map<String,Object>> countList=hibenateUtils.createSQLQuery(sqlCount);
                Integer count=0;
                if (countList!=null&&countList.size()>0) {
                    count = Integer.valueOf(countList.get(0).get("count").toString());
                }
                mixEnvelop.setDetailModelList(list);
                mixEnvelop.setTotalCount(count);
                return mixEnvelop;
            }else if ("drugUseDict".equalsIgnoreCase(baseTemplateDictDO.getTemplateType())){
                String sql="select DISTINCT t.id as \"id\"," +
                        " t.supply_code as \"supply_code\"," +
                        " t.supply_name as \"supply_name\"," +
                        " t.supply_occ as \"supply_occ\"," +
                        " t.del_flag as \"del_flag\"," +
                        " t.sort_code as \"sort_code\"," +
                        " t.print_name as \"print_name\"," +
                        " t.py_code as \"py_code\"," +
                        " t.d_code as \"d_code\"," +
                        " t.yb_name as \"yb_name\"," +
                        " t.yb_code as \"yb_code\"," +
                        " t.status as \"status\"," +
                        " t.create_time as \"create_time\" " +
                        " from  base_drug_use_dict t where t.id not in ( SELECT DISTINCT g.id from base_drug_use_dict g left join base_template_dict " +
                        "m on g.id = m.dict_id " +
                        "where m.template_id ='"+templateId+"' and m.is_del ='1') and t.del_flag='1' and t.status='1'";
                String sqlCount =" select count(1) as \"count\" from  base_drug_use_dict t where t.id not in ( SELECT DISTINCT g.id from base_drug_use_dict g left join base_template_dict " +
                        "m on g.id = m.dict_id " +
                        "where m.template_id ='"+templateId+"' and m.is_del ='1') and t.del_flag='1' and t.status='1'";
                if (StringUtils.isNoneBlank(code)){
                    sql+=" and t.supply_code like '%"+code+"%'";
                    sqlCount+=" and t.supply_code like '%"+code+"%'";
                }
                if (StringUtils.isNoneBlank(name)){
                    sql+=" and t.supply_name like '%"+name+"%'";
                    sqlCount+=" and t.supply_name like '%"+name+"%'";
                }
                List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
                for (Map<String,Object> map:list){
                    if (map.get("status")!=null&&"1".equalsIgnoreCase(map.get("status").toString())){
                        map.put("statusName","生效中");
                    }else {
                        map.put("statusName","已失效");
                    }
                }
                List<Map<String,Object>> countList=hibenateUtils.createSQLQuery(sqlCount);
                Integer count=0;
                if (countList!=null&&countList.size()>0) {
                    count = Integer.valueOf(countList.get(0).get("count").toString());
                }
                mixEnvelop.setDetailModelList(list);
                mixEnvelop.setTotalCount(count);
                return mixEnvelop;
            }else if ("drugListDict".equalsIgnoreCase(baseTemplateDictDO.getTemplateType())){
                String sql = "select DISTINCT t.id as \"id\"," +
                        " t.charge_code as \"charge_code\"," +
                        " t.drugname as \"drugname\"," +
                        " t.specification as \"specification\"," +
                        " t.py_code as \"py_code\"," +
                        " t.supply_code as \"supply_code\"," +
                        " t.supply_name as \"supply_name\"," +
                        " t.retprice as \"retprice\"," +
                        " t.manu_name as \"manu_name\"," +
                        " t.weigh_unit as \"weigh_unit\"," +
                        " t.mini_unit_name as \"mini_unit_name\"," +
                        " t.pack_unit_name as \"pack_unit_name\"," +
                        " t.weigh_unit_name as \"weigh_unit_name\"," +
                        " t.vol_unit_name as \"vol_unit_name\"," +
                        " t.win_no as \"win_no\"," +
                        " t.pack_retprice as \"pack_retprice\"," +
                        " t.mini_unit as \"mini_unit\"," +
                        " t.pack_size as \"pack_size\"," +
                        " t.action as \"action\"," +
                        " t.serial as \"serial\"," +
                        " t.group_no as \"group_no\"," +
                        " t.stock_amount as \"stock_amount\"," +
                        " t.visible_flag as \"visible_flag\"," +
                        " t.drug_flag as \"drug_flag\"," +
                        " t.create_time as \"create_time\"," +
                        " t.update_time as \"update_time\"," +
                        " t.status as \"status\"," +
                        " t.mini_stock_amount as \"mini_stock_amount\"," +
                        " t.dosage as \"dosage\"," +
                        " t.max_stock_amount as \"max_stock_amount\"," +
                        " t.pack_unit as \"pack_unit\"," +
                        " t.is_del as \"is_del\"" +
                        " from  base_drug_dict t where t.id not in ( SELECT DISTINCT g.id from base_drug_dict g left join base_template_dict " +
                        " m on g.id = m.dict_id " +
                        "where m.template_id ='"+templateId+"' and m.is_del ='1') and t.is_del='1' and t.status='1'";
                String sqlCount = "select count(1) as \"count\"  from  base_drug_dict t where t.id not in ( SELECT DISTINCT g.id from base_drug_dict g left join base_template_dict " +
                        "m on g.id = m.dict_id " +
                        "where m.template_id ='"+templateId+"' and m.is_del ='1') and t.is_del='1' and t.status='1'";
                if (StringUtils.isNoneBlank(code)){
                    sql+=" and t.charge_code like '%"+code+"%'";
                    sqlCount+=" and t.charge_code like '%"+code+"%'";
                }
                if (StringUtils.isNoneBlank(name)){
                    sql+=" and t.drugname like '%"+name+"%'";
                    sqlCount+=" and t.drugname like '%"+name+"%'";
                }
                List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
                for (Map<String,Object> map:list){
                    if (map.get("status")!=null&&"1".equalsIgnoreCase(map.get("status").toString())){
                        map.put("statusName","生效中");
                    }else {
                        map.put("statusName","已失效");
                    }
                }
                List<Map<String,Object>> countList=hibenateUtils.createSQLQuery(sqlCount);
                Integer count=0;
                if (countList!=null&&countList.size()>0) {
                    count = Integer.valueOf(countList.get(0).get("count").toString());
                }
                mixEnvelop.setDetailModelList(list);
                mixEnvelop.setTotalCount(count);
                return mixEnvelop;
            }else if ("icd10ListDict".equalsIgnoreCase(baseTemplateDictDO.getTemplateType())){
                String sql="select DISTINCT t.id as \"id\"," +
                        " t.code as \"code\"," +
                        " t.name as \"name\"," +
                        " t.description as \"description\"," +
                        " t.create_time as \"create_time\"," +
                        " t.disea_reason as \"disea_reason\"," +
                        " t.death_reason as \"death_reason\"," +
                        " t.py_code as \"py_code\"," +
                        " t.d_code as \"d_code\"," +
                        " t.flag as \"flag\"," +
                        " t.is_del as \"is_del\"," +
                        " t.status as \"status\" " +
                        " from  dict_icd10 t where t.id not in ( SELECT DISTINCT g.id from dict_icd10 g left join base_template_dict " +
                        "m on g.id = m.dict_id " +
                        "where m.template_id ='"+templateId+"' and m.is_del ='1') and t.is_del='1' and t.status='1'";
                String sqlCount =" select count(1) as \"count\" from  dict_icd10 t where t.id not in ( SELECT DISTINCT g.id from dict_icd10 g left join base_template_dict " +
                        "m on g.id = m.dict_id " +
                        "where m.template_id ='"+templateId+"' and m.is_del ='1') and t.is_del='1' and t.status='1'";
                if (StringUtils.isNoneBlank(code)){
                    sql+=" and t.code like '%"+code+"%'";
                    sqlCount+=" and t.code like '%"+code+"%'";
                }
                if (StringUtils.isNoneBlank(name)){
                    sql+=" and t.name like '%"+name+"%'";
                    sqlCount+=" and t.name like '%"+name+"%'";
                }
                List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
                for (Map<String,Object> map:list){
                    if (map.get("status")!=null&&"1".equalsIgnoreCase(map.get("status").toString())){
                        map.put("statusName","生效中");
                    }else {
                        map.put("statusName","已失效");
                    }
                }
                List<Map<String,Object>> countList=hibenateUtils.createSQLQuery(sqlCount);
                Integer count=0;
                if (countList!=null&&countList.size()>0) {
                    count = Integer.valueOf(countList.get(0).get("count").toString());
                }
                mixEnvelop.setDetailModelList(list);
                mixEnvelop.setTotalCount(count);
                return mixEnvelop;
            }else if ("followUpDict".equalsIgnoreCase(baseTemplateDictDO.getTemplateType())){
                String sql="select DISTINCT t.id as \"id\"," +
                        " t.code as \"code\"," +
                        " t.name as \"name\"," +
                        " t.is_required as \"isRequired\"," +
                        " t.project_content as \"projectContent\"," +
                        " t.status as \"status\"," +
                        " t.is_del as \"isDel\"," +
                        " t.create_time as \"createTime\"" +
                        " from  base_follow_up_dict t where t.id not in ( SELECT DISTINCT g.id from base_follow_up_dict g left join base_template_dict " +
                        "m on g.id = m.dict_id " +
                        "where m.template_id ='"+templateId+"' and m.is_del ='1') and t.is_del='1' and t.status='1'";
                String sqlCount =" select count(1) as \"count\" from  base_follow_up_dict t where t.id not in ( SELECT DISTINCT g.id from base_follow_up_dict g left join base_template_dict " +
                        "m on g.id = m.dict_id " +
                        "where m.template_id ='"+templateId+"' and m.is_del ='1') and t.is_del='1' and t.status='1'";
                if (StringUtils.isNoneBlank(code)){
                    sql+=" and t.code like '%"+code+"%'";
                    sqlCount+=" and t.code like '%"+code+"%'";
                }
                if (StringUtils.isNoneBlank(name)){
                    sql+=" and t.name like '%"+name+"%'";
                    sqlCount+=" and t.name like '%"+name+"%'";
                }
                List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,page,pageSize);
                for (Map<String,Object> map:list){
                    if (map.get("status")!=null&&"1".equalsIgnoreCase(map.get("status").toString())){
                        map.put("statusName","生效中");
                    }else {
                        map.put("statusName","已失效");
                    }
                    if (map.get("isRequired")!=null&&"1".equalsIgnoreCase(map.get("isRequired").toString())){
                        map.put("requiredName","必填");
                    }else {
                        map.put("requiredName","非必填");
                    }
                }
                List<Map<String,Object>> countList=hibenateUtils.createSQLQuery(sqlCount);
                Integer count=0;
                if (countList!=null&&countList.size()>0) {
                    count = Integer.valueOf(countList.get(0).get("count").toString());
                }
                mixEnvelop.setDetailModelList(list);
                mixEnvelop.setTotalCount(count);
                return mixEnvelop;
            }else {
                return null;
            }
        }else {
            return null;
        }
    }
    public List<Map<String,Object>> findTemplateByDisease(String diseaseId){
        String sql =" select t.id as \"id\" ," +
                " t.name as \"name\"," +
                " t.code as \"code\"," +
                " t.children_count as \"childrenCount\"," +
                " t.update_user as \"updateUser\"," +
                " t.update_user_name as \"updateUserName\"," +
                " t.update_time as \"updateTime\"," +
                " t.disease_name as \"diseaseName\"," +
                " t.disease_id as \"diseaseId\"," +
                " t.template_type as \"templateType\"," +
                " t.is_del as \"isDel\" " +
                " from base_template t " +
                " where t.is_del='1' and t.template_type='followUpDict' ";
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        List<Map<String,Object>> resultList = new ArrayList<>();
        for (Map<String,Object> map:list){
            if (map.get("status")!=null&&"1".equalsIgnoreCase(map.get("status").toString())){
                map.put("statusName","生效中");
            }else {
                map.put("statusName","已失效");
            }
            if (map.get("disease_id")!=null){
                String[] diseaseIds=map.get("disease_id").toString().split(",");
                for (int i=0;i<diseaseIds.length;i++){
                    if (diseaseIds[i].equalsIgnoreCase(diseaseId)){
                        resultList.add(map);
                    }
                }
            }
        }
        return resultList;
    }
}

+ 322 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/importManage/BasDrugExcelDO.java

@ -0,0 +1,322 @@
package com.yihu.jw.base.service.dict.importManage;
import com.yihu.jw.util.date.DateUtil;
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.Date;
import java.util.Map;
import java.util.Set;
@Row(start = 1)
public class BasDrugExcelDO extends ExcelUtil implements Validation {
    @Location(x=0)
    @ValidRepeat
    String charge_code;
    @Location(x=1)
    @ValidRepeat
    String serial;
    @Location(x=2)
    @ValidRepeat
    String  group_no;//
    @Location(x=3)
    @ValidRepeat
    String drugname;
    @Location(x=4)
    @ValidRepeat
    String dosage;//
    @Location(x=5)
    @ValidRepeat
    String mini_unit;
    @Location(x=6)
    @ValidRepeat
    String pack_size;
    @Location(x=7)
    @ValidRepeat
    String specification;//
    @Location(x=8)
    @ValidRepeat
    String retprice;
    @Location(x=9)
    @ValidRepeat
    String pack_retprice;
    @Location(x=10)
    @ValidRepeat
    String stock_amount;
    @Location(x=11)
    @ValidRepeat
    String  visible_flag;
    @Location(x=12)
    @ValidRepeat
    String  drug_flag;
    @Location(x=13)
    @ValidRepeat
    String  py_code;
    @Location(x=14)
    @ValidRepeat
    String  pack_unit;
    @Location(x=15)
    @ValidRepeat
    String  manu_name;
    @Location(x=16)
    @ValidRepeat
    String  weigh_unit;
    @Location(x=17)
    @ValidRepeat
    String  vol_unit;
    @Location(x=18)
    @ValidRepeat
    String  mini_unit_name;
    @Location(x=19)
    @ValidRepeat
    String  pack_unit_name;
    @Location(x=20)
    @ValidRepeat
    String  weigh_unit_name;
    @Location(x=21)
    @ValidRepeat
    String  vol_unit_name;
    @Location(x=22)
    @ValidRepeat
    String  win_no;
    @Location(x=23)
    @ValidRepeat
    String  max_stock_amount;
    @Location(x=24)
    @ValidRepeat
    String  mini_stock_amount;
    @Location(x=25)
    @ValidRepeat
    String  manufactory;
    @Location(x=26)
    @ValidRepeat
    String  status;
    public String getManufactory() {
        return manufactory;
    }
    public void setManufactory(String manufactory) {
        this.manufactory = manufactory;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    @Override
    public int validate(Map<String, Set> repeatMap) {
        int rs = 1;
        return rs;
    }
    public String getCharge_code() {
        return charge_code;
    }
    public void setCharge_code(String charge_code) {
        this.charge_code = charge_code;
    }
    public String getSerial() {
        return serial;
    }
    public void setSerial(String serial) {
        this.serial = serial;
    }
    public String getGroup_no() {
        return group_no;
    }
    public void setGroup_no(String group_no) {
        this.group_no = group_no;
    }
    public String getDrugname() {
        return drugname;
    }
    public void setDrugname(String drugname) {
        this.drugname = drugname;
    }
    public String getDosage() {
        return dosage;
    }
    public void setDosage(String dosage) {
        this.dosage = dosage;
    }
    public String getMini_unit() {
        return mini_unit;
    }
    public void setMini_unit(String mini_unit) {
        this.mini_unit = mini_unit;
    }
    public String getPack_size() {
        return pack_size;
    }
    public void setPack_size(String pack_size) {
        this.pack_size = pack_size;
    }
    public String getSpecification() {
        return specification;
    }
    public void setSpecification(String specification) {
        this.specification = specification;
    }
    public String getRetprice() {
        return retprice;
    }
    public void setRetprice(String retprice) {
        this.retprice = retprice;
    }
    public String getPack_retprice() {
        return pack_retprice;
    }
    public void setPack_retprice(String pack_retprice) {
        this.pack_retprice = pack_retprice;
    }
    public String getStock_amount() {
        return stock_amount;
    }
    public void setStock_amount(String stock_amount) {
        this.stock_amount = stock_amount;
    }
    public String getVisible_flag() {
        return visible_flag;
    }
    public void setVisible_flag(String visible_flag) {
        this.visible_flag = visible_flag;
    }
    public String getDrug_flag() {
        return drug_flag;
    }
    public void setDrug_flag(String drug_flag) {
        this.drug_flag = drug_flag;
    }
    public String getPy_code() {
        return py_code;
    }
    public void setPy_code(String py_code) {
        this.py_code = py_code;
    }
    public String getPack_unit() {
        return pack_unit;
    }
    public void setPack_unit(String pack_unit) {
        this.pack_unit = pack_unit;
    }
    public String getManu_name() {
        return manu_name;
    }
    public void setManu_name(String manu_name) {
        this.manu_name = manu_name;
    }
    public String getWeigh_unit() {
        return weigh_unit;
    }
    public void setWeigh_unit(String weigh_unit) {
        this.weigh_unit = weigh_unit;
    }
    public String getVol_unit() {
        return vol_unit;
    }
    public void setVol_unit(String vol_unit) {
        this.vol_unit = vol_unit;
    }
    public String getMini_unit_name() {
        return mini_unit_name;
    }
    public void setMini_unit_name(String mini_unit_name) {
        this.mini_unit_name = mini_unit_name;
    }
    public String getPack_unit_name() {
        return pack_unit_name;
    }
    public void setPack_unit_name(String pack_unit_name) {
        this.pack_unit_name = pack_unit_name;
    }
    public String getWeigh_unit_name() {
        return weigh_unit_name;
    }
    public void setWeigh_unit_name(String weigh_unit_name) {
        this.weigh_unit_name = weigh_unit_name;
    }
    public String getVol_unit_name() {
        return vol_unit_name;
    }
    public void setVol_unit_name(String vol_unit_name) {
        this.vol_unit_name = vol_unit_name;
    }
    public String getWin_no() {
        return win_no;
    }
    public void setWin_no(String win_no) {
        this.win_no = win_no;
    }
    public String getMax_stock_amount() {
        return max_stock_amount;
    }
    public void setMax_stock_amount(String max_stock_amount) {
        this.max_stock_amount = max_stock_amount;
    }
    public String getMini_stock_amount() {
        return mini_stock_amount;
    }
    public void setMini_stock_amount(String mini_stock_amount) {
        this.mini_stock_amount = mini_stock_amount;
    }
}

+ 135 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/importManage/BasDrugUseExcelDO.java

@ -0,0 +1,135 @@
package com.yihu.jw.base.service.dict.importManage;
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;
@Row(start = 1)
public class BasDrugUseExcelDO extends ExcelUtil implements Validation {
    @Location(x=0)
    @ValidRepeat
    String supply_code;
    @Location(x=1)
    @ValidRepeat
    String supply_name;
    @Location(x=2)
    @ValidRepeat
    String  supply_occ;//
    @Location(x=3)
    @ValidRepeat
    String sort_code;//
    @Location(x=4)
    @ValidRepeat
    String print_name;
    @Location(x=5)
    @ValidRepeat
    String py_code;
    @Location(x=6)
    @ValidRepeat
    String d_code;//
    @Location(x=7)
    @ValidRepeat
    String yb_name;
    @Location(x=8)
    @ValidRepeat
    String yb_code;
    @Location(x=9)
    @ValidRepeat
    String status;
    public String getSupply_code() {
        return supply_code;
    }
    public void setSupply_code(String supply_code) {
        this.supply_code = supply_code;
    }
    public String getSupply_name() {
        return supply_name;
    }
    public void setSupply_name(String supply_name) {
        this.supply_name = supply_name;
    }
    public String getSupply_occ() {
        return supply_occ;
    }
    public void setSupply_occ(String supply_occ) {
        this.supply_occ = supply_occ;
    }
    public String getSort_code() {
        return sort_code;
    }
    public void setSort_code(String sort_code) {
        this.sort_code = sort_code;
    }
    public String getPrint_name() {
        return print_name;
    }
    public void setPrint_name(String print_name) {
        this.print_name = print_name;
    }
    public String getPy_code() {
        return py_code;
    }
    public void setPy_code(String py_code) {
        this.py_code = py_code;
    }
    public String getD_code() {
        return d_code;
    }
    public void setD_code(String d_code) {
        this.d_code = d_code;
    }
    public String getYb_name() {
        return yb_name;
    }
    public void setYb_name(String yb_name) {
        this.yb_name = yb_name;
    }
    public String getYb_code() {
        return yb_code;
    }
    public void setYb_code(String yb_code) {
        this.yb_code = yb_code;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    @Override
    public int validate(Map<String, Set> repeatMap) {
        int rs = 1;
        return rs;
    }
}

+ 114 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/importManage/BasFrequencyExcelDO.java

@ -0,0 +1,114 @@
package com.yihu.jw.base.service.dict.importManage;
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;
@Row(start = 1)
public class BasFrequencyExcelDO extends ExcelUtil implements Validation {
    @Location(x=0)
    @ValidRepeat
    String freq_code;
    @Location(x=1)
    @ValidRepeat
    String freq_name;
    @Location(x=2)
    @ValidRepeat
    String  freq_sp;//
    @Location(x=3)
    @ValidRepeat
    String daily_times;
    @Location(x=4)
    @ValidRepeat
    String weekly_times;//
    @Location(x=5)
    @ValidRepeat
    String hosp_code;
    @Location(x=6)
    @ValidRepeat
    String is_op_ip;
    @Location(x=7)
    @ValidRepeat
    String status;
    public String getFreq_code() {
        return freq_code;
    }
    public void setFreq_code(String freq_code) {
        this.freq_code = freq_code;
    }
    public String getFreq_name() {
        return freq_name;
    }
    public void setFreq_name(String freq_name) {
        this.freq_name = freq_name;
    }
    public String getFreq_sp() {
        return freq_sp;
    }
    public void setFreq_sp(String freq_sp) {
        this.freq_sp = freq_sp;
    }
    public String getDaily_times() {
        return daily_times;
    }
    public void setDaily_times(String daily_times) {
        this.daily_times = daily_times;
    }
    public String getWeekly_times() {
        return weekly_times;
    }
    public void setWeekly_times(String weekly_times) {
        this.weekly_times = weekly_times;
    }
    public String getHosp_code() {
        return hosp_code;
    }
    public void setHosp_code(String hosp_code) {
        this.hosp_code = hosp_code;
    }
    public String getIs_op_ip() {
        return is_op_ip;
    }
    public void setIs_op_ip(String is_op_ip) {
        this.is_op_ip = is_op_ip;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    @Override
    public int validate(Map<String, Set> repeatMap) {
        int rs = 1;
        return rs;
    }
}

+ 122 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/importManage/BasIcd10ExcelDO.java

@ -0,0 +1,122 @@
package com.yihu.jw.base.service.dict.importManage;
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.ValidRepeat;
import java.util.Map;
import java.util.Set;
@Row(start = 1)
public class BasIcd10ExcelDO extends ExcelUtil implements Validation {
    @Location(x=0)
    @ValidRepeat
    String code;
    @Location(x=1)
    @ValidRepeat
    String name;
    @Location(x=2)
    @ValidRepeat
    String  description;//
    @Location(x=3)
    @ValidRepeat
    String disea_reason;
    @Location(x=4)
    @ValidRepeat
    String death_reason;//
    @Location(x=5)
    @ValidRepeat
    String py_code;
    @Location(x=6)
    @ValidRepeat
    String d_code;
    @Location(x=7)
    @ValidRepeat
    String flag;//
    @Location(x=8)
    @ValidRepeat
    String status;
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public String getDisea_reason() {
        return disea_reason;
    }
    public void setDisea_reason(String disea_reason) {
        this.disea_reason = disea_reason;
    }
    public String getDeath_reason() {
        return death_reason;
    }
    public void setDeath_reason(String death_reason) {
        this.death_reason = death_reason;
    }
    public String getPy_code() {
        return py_code;
    }
    public void setPy_code(String py_code) {
        this.py_code = py_code;
    }
    public String getD_code() {
        return d_code;
    }
    public void setD_code(String d_code) {
        this.d_code = d_code;
    }
    public String getFlag() {
        return flag;
    }
    public void setFlag(String flag) {
        this.flag = flag;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    @Override
    public int validate(Map<String, Set> repeatMap) {
        int rs = 1;
        return rs;
    }
}

+ 148 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/importManage/BaseDrugExcelDOReader.java

@ -0,0 +1,148 @@
package com.yihu.jw.base.service.dict.importManage;
import com.yihu.jw.base.dao.dict.DictJobTitleDao;
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleDictDao;
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleInfoDao;
import com.yihu.jw.base.endpoint.common.excel.AExcelReader;
import com.yihu.jw.dict.dao.BaseDrugDictDao;
import com.yihu.jw.dict.dao.BaseTemplateDictDao;
import com.yihu.jw.dict.dao.DictDoctorDutyDao;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.dict.BaseDrugDictDO;
import com.yihu.jw.entity.base.dict.BaseTemplateDictDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.org.dao.BaseOrgDao;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@Component
public class BaseDrugExcelDOReader extends AExcelReader {
    @Autowired
    private BaseDrugDictDao baseDrugDictDao;
    @Autowired
    private BaseTemplateDictDao baseTemplateDictDao;
    @Override
    public void read(Workbook rwb) throws Exception {
        try{
            Iterator<Sheet> sheets = rwb.sheetIterator();
            int j = 0, rows;
            BasDrugExcelDO basDrugExcelDO;
            getRepeat().put("charge_code", new HashSet<>());
            getRepeat().put("serial", new HashSet<>());
            getRepeat().put("group_no", new HashSet<>());
            getRepeat().put("drugname", new HashSet<>());
            getRepeat().put("dosage", new HashSet<>());
            getRepeat().put("mini_unit", new HashSet<>());
            getRepeat().put("pack_size", new HashSet<>());
            getRepeat().put("specification", new HashSet<>());
            getRepeat().put("retprice", new HashSet<>());
            getRepeat().put("pack_retprice", new HashSet<>());
            getRepeat().put("stock_amount", new HashSet<>());
            getRepeat().put("visible_flag", new HashSet<>());
            getRepeat().put("drug_flag", new HashSet<>());
            getRepeat().put("py_code", new HashSet<>());
            getRepeat().put("pack_unit", new HashSet<>());
            getRepeat().put("manu_name", new HashSet<>());
            getRepeat().put("weigh_unit", new HashSet<>());
            getRepeat().put("vol_unit", new HashSet<>());
            getRepeat().put("mini_unit_name", new HashSet<>());
            getRepeat().put("pack_unit_name", new HashSet<>());
            getRepeat().put("weigh_unit_name", new HashSet<>());
            getRepeat().put("vol_unit_name", new HashSet<>());
            getRepeat().put("win_no", new HashSet<>());
            getRepeat().put("max_stock_amount", new HashSet<>());
            getRepeat().put("mini_stock_amount", new HashSet<>());
            getRepeat().put("manufactory", new HashSet<>());
            getRepeat().put("status", new HashSet<>());
            errorLs.clear();
            correctLs.clear();
            while (sheets.hasNext()){
                Sheet sheet = sheets.next();
                if ((rows = sheet.getLastRowNum()) == 0) {
                    continue;
                }
                for (int i = 1; i <= rows; i++) {
                    basDrugExcelDO = new BasDrugExcelDO();
                    basDrugExcelDO.setCharge_code(replaceBlank(getCellCont(sheet, i, 0)));
                    basDrugExcelDO.setSerial(replaceBlank(getCellCont(sheet, i, 1)));
                    basDrugExcelDO.setGroup_no(getCellCont(sheet, i, 2));
                    basDrugExcelDO.setDrugname(replaceBlank(getCellCont(sheet, i, 3)));
                    basDrugExcelDO.setDosage(replaceBlank(getCellCont(sheet, i, 4)));
                    basDrugExcelDO.setMini_unit(replaceBlank(getCellCont(sheet, i, 5)));
                    basDrugExcelDO.setPack_size(replaceBlank(getCellCont(sheet, i, 6)));
                    basDrugExcelDO.setSpecification(replaceBlank(getCellCont(sheet, i, 7)));
                    basDrugExcelDO.setRetprice(getCellCont(sheet, i, 8));
                    basDrugExcelDO.setPack_retprice(replaceBlank(getCellCont(sheet, i, 9)));
                    basDrugExcelDO.setStock_amount(replaceBlank(getCellCont(sheet, i, 10)));
                    basDrugExcelDO.setVisible_flag(replaceBlank(getCellCont(sheet, i, 11)));
                    basDrugExcelDO.setDrug_flag(replaceBlank(getCellCont(sheet, i, 12)));
                    basDrugExcelDO.setPy_code(replaceBlank(getCellCont(sheet, i, 13)));
                    basDrugExcelDO.setPack_unit(replaceBlank(getCellCont(sheet, i, 14)));
                    basDrugExcelDO.setManu_name(replaceBlank(getCellCont(sheet, i, 15)));
                    basDrugExcelDO.setWeigh_unit(replaceBlank(getCellCont(sheet, i, 16)));
                    basDrugExcelDO.setVol_unit(replaceBlank(getCellCont(sheet, i, 17)));
                    basDrugExcelDO.setMini_unit_name(replaceBlank(getCellCont(sheet, i, 18)));
                    basDrugExcelDO.setPack_unit_name(replaceBlank(getCellCont(sheet, i, 19)));
                    basDrugExcelDO.setWeigh_unit_name(replaceBlank(getCellCont(sheet, i, 20)));
                    basDrugExcelDO.setVol_unit_name(replaceBlank(getCellCont(sheet, i, 21)));
                    basDrugExcelDO.setWin_no(replaceBlank(getCellCont(sheet, i, 22)));
                    basDrugExcelDO.setMax_stock_amount(replaceBlank(getCellCont(sheet, i, 23)));
                    basDrugExcelDO.setMini_stock_amount(replaceBlank(getCellCont(sheet, i, 24)));
                    basDrugExcelDO.setManufactory(replaceBlank(getCellCont(sheet, i, 25)));
                    basDrugExcelDO.setStatus(replaceBlank(getCellCont(sheet, i, 26)));
                    basDrugExcelDO.setExcelSeq(i);
                    int rs = basDrugExcelDO.validate(repeat);
                    if (validate(basDrugExcelDO)== 0||rs == 0) {
                        errorLs.add(basDrugExcelDO);
                    } else if (rs == 1) {
                        correctLs.add(basDrugExcelDO);
                    }
                }
                j++;
            }
        }catch (Exception e){
            e.printStackTrace();
            throw e;
        }finally {
            if (rwb != null) {
                rwb.close();
            }
        }
    }
    public int validate(BasDrugExcelDO basDrugExcelDO) {
        int rs = 1;
        if (StringUtils.isNoneBlank(basDrugExcelDO.getCharge_code())){
            List<BaseDrugDictDO> list  = baseDrugDictDao.findByChargeCode(basDrugExcelDO.getCharge_code());
            System.out.println("当前导入数据:"+ basDrugExcelDO.getCharge_code());
            if (list!=null&&list.size()>0){
                String templateId = this.getTemplateId();
                if (StringUtils.isNoneBlank(templateId)){
                    BaseTemplateDictDO baseTemplateDictDO = new BaseTemplateDictDO();
                    baseTemplateDictDO.setTemplateId(templateId);
                    baseTemplateDictDO.setIsDel("1");
                    baseTemplateDictDO.setDictId(list.get(0).getId());
                    baseTemplateDictDO.setCreateTime(new Date());
                    baseTemplateDictDao.save(baseTemplateDictDO);
                }
                System.out.println("进验证有重复数据"+list.get(0).getCharge_code());
                return 0;
            }
        }
        return rs;
    }
}

+ 108 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/importManage/BaseDrugUseExcelDOReader.java

@ -0,0 +1,108 @@
package com.yihu.jw.base.service.dict.importManage;
import com.yihu.jw.base.endpoint.common.excel.AExcelReader;
import com.yihu.jw.dict.dao.BaseDrugDictDao;
import com.yihu.jw.dict.dao.BaseDrugUseDictDao;
import com.yihu.jw.dict.dao.BaseTemplateDictDao;
import com.yihu.jw.entity.base.dict.BaseDrugDictDO;
import com.yihu.jw.entity.base.dict.BaseDrugUseDictDO;
import com.yihu.jw.entity.base.dict.BaseTemplateDictDO;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@Component
public class BaseDrugUseExcelDOReader extends AExcelReader {
    @Autowired
    private BaseDrugUseDictDao baseDrugUseDictDao;
    @Autowired
    private BaseTemplateDictDao baseTemplateDictDao;
    @Override
    public void read(Workbook rwb) throws Exception {
        try{
            Iterator<Sheet> sheets = rwb.sheetIterator();
            int j = 0, rows;
            BasDrugUseExcelDO basDrugUseExcelDO;
            getRepeat().put("supply_code", new HashSet<>());
            getRepeat().put("supply_name", new HashSet<>());
            getRepeat().put("supply_occ", new HashSet<>());
            getRepeat().put("sort_code", new HashSet<>());
            getRepeat().put("print_name", new HashSet<>());
            getRepeat().put("py_code", new HashSet<>());
            getRepeat().put("d_code", new HashSet<>());
            getRepeat().put("yb_name", new HashSet<>());
            getRepeat().put("yb_code", new HashSet<>());
            getRepeat().put("status", new HashSet<>());
            errorLs.clear();
            correctLs.clear();
            while (sheets.hasNext()){
                Sheet sheet = sheets.next();
                if ((rows = sheet.getLastRowNum()) == 0) {
                    continue;
                }
                for (int i = 1; i <= rows; i++) {
                    basDrugUseExcelDO = new BasDrugUseExcelDO();
                    basDrugUseExcelDO.setSupply_code(replaceBlank(getCellCont(sheet, i, 0)));
                    basDrugUseExcelDO.setSupply_name(replaceBlank(getCellCont(sheet, i, 1)));
                    basDrugUseExcelDO.setSupply_occ(getCellCont(sheet, i, 2));
                    basDrugUseExcelDO.setSort_code(replaceBlank(getCellCont(sheet, i, 3)));
                    basDrugUseExcelDO.setPrint_name(replaceBlank(getCellCont(sheet, i, 4)));
                    basDrugUseExcelDO.setPy_code(replaceBlank(getCellCont(sheet, i, 5)));
                    basDrugUseExcelDO.setD_code(replaceBlank(getCellCont(sheet, i, 6)));
                    basDrugUseExcelDO.setYb_name(getCellCont(sheet, i, 7));
                    basDrugUseExcelDO.setYb_code(replaceBlank(getCellCont(sheet, i, 8)));
                    basDrugUseExcelDO.setStatus(getCellCont(sheet, i, 9));
                    basDrugUseExcelDO.setExcelSeq(i);
                    int rs = basDrugUseExcelDO.validate(repeat);
                    if (validate(basDrugUseExcelDO)== 0||rs == 0) {
                        errorLs.add(basDrugUseExcelDO);
                    } else if (rs == 1) {
                        correctLs.add(basDrugUseExcelDO);
                    }
                }
                j++;
            }
        }catch (Exception e){
            e.printStackTrace();
            throw e;
        }finally {
            if (rwb != null) {
                rwb.close();
            }
        }
    }
    public int validate(BasDrugUseExcelDO basDrugUseExcelDO) {
        int rs = 1;
        if (StringUtils.isNoneBlank(basDrugUseExcelDO.getSupply_code())){
            List<BaseDrugUseDictDO> list  = baseDrugUseDictDao.findBySupCode(basDrugUseExcelDO.getSupply_code());
            System.out.println("当前导入数据:"+ basDrugUseExcelDO.getSupply_code());
            if (list!=null&&list.size()>0){
                String templateId = this.getTemplateId();
                if (StringUtils.isNoneBlank(templateId)){
                    BaseTemplateDictDO baseTemplateDictDO = new BaseTemplateDictDO();
                    baseTemplateDictDO.setTemplateId(templateId);
                    baseTemplateDictDO.setIsDel("1");
                    baseTemplateDictDO.setDictId(list.get(0).getId());
                    baseTemplateDictDO.setCreateTime(new Date());
                    baseTemplateDictDao.save(baseTemplateDictDO);
                }
                System.out.println("进验证有重复数据"+list.get(0).getSupply_code());
                return 0;
            }
        }
        return rs;
    }
}

+ 104 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/importManage/BaseFrequencyExcelDOReader.java

@ -0,0 +1,104 @@
package com.yihu.jw.base.service.dict.importManage;
import com.yihu.jw.base.endpoint.common.excel.AExcelReader;
import com.yihu.jw.dict.dao.BaseDrugUseDictDao;
import com.yihu.jw.dict.dao.BaseFrequencyDictDao;
import com.yihu.jw.dict.dao.BaseTemplateDictDao;
import com.yihu.jw.entity.base.dict.BaseDrugUseDictDO;
import com.yihu.jw.entity.base.dict.BaseFrequencyDictDO;
import com.yihu.jw.entity.base.dict.BaseTemplateDictDO;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@Component
public class BaseFrequencyExcelDOReader extends AExcelReader {
    @Autowired
    private BaseFrequencyDictDao baseFrequencyDictDao;
    @Autowired
    private BaseTemplateDictDao baseTemplateDictDao;
    @Override
    public void read(Workbook rwb) throws Exception {
        try{
            Iterator<Sheet> sheets = rwb.sheetIterator();
            int j = 0, rows;
            BasFrequencyExcelDO basFrequencyExcelDO;
            getRepeat().put("freq_code", new HashSet<>());
            getRepeat().put("freq_name", new HashSet<>());
            getRepeat().put("freq_sp", new HashSet<>());
            getRepeat().put("daily_times", new HashSet<>());
            getRepeat().put("weekly_times", new HashSet<>());
            getRepeat().put("hosp_code", new HashSet<>());
            getRepeat().put("is_op_ip", new HashSet<>());
            getRepeat().put("status", new HashSet<>());
            errorLs.clear();
            correctLs.clear();
            while (sheets.hasNext()){
                Sheet sheet = sheets.next();
                if ((rows = sheet.getLastRowNum()) == 0) {
                    continue;
                }
                for (int i = 1; i <= rows; i++) {
                    basFrequencyExcelDO = new BasFrequencyExcelDO();
                    basFrequencyExcelDO.setFreq_code(replaceBlank(getCellCont(sheet, i, 0)));
                    basFrequencyExcelDO.setFreq_name(replaceBlank(getCellCont(sheet, i, 1)));
                    basFrequencyExcelDO.setFreq_sp(getCellCont(sheet, i, 2));
                    basFrequencyExcelDO.setDaily_times(replaceBlank(getCellCont(sheet, i, 3)));
                    basFrequencyExcelDO.setWeekly_times(replaceBlank(getCellCont(sheet, i, 4)));
                    basFrequencyExcelDO.setHosp_code(replaceBlank(getCellCont(sheet, i, 5)));
                    basFrequencyExcelDO.setIs_op_ip(replaceBlank(getCellCont(sheet, i, 6)));
                    basFrequencyExcelDO.setStatus(replaceBlank(getCellCont(sheet, i, 7)));
                    basFrequencyExcelDO.setExcelSeq(i);
                    int rs = basFrequencyExcelDO.validate(repeat);
                    if (validate(basFrequencyExcelDO)== 0||rs == 0) {
                        errorLs.add(basFrequencyExcelDO);
                    } else if (rs == 1) {
                        correctLs.add(basFrequencyExcelDO);
                    }
                }
                j++;
            }
        }catch (Exception e){
            e.printStackTrace();
            throw e;
        }finally {
            if (rwb != null) {
                rwb.close();
            }
        }
    }
    public int validate(BasFrequencyExcelDO basFrequencyExcelDO) {
        int rs = 1;
        if (StringUtils.isNoneBlank(basFrequencyExcelDO.getFreq_code())){
            List<BaseFrequencyDictDO> list  = baseFrequencyDictDao.findByFrqCode(basFrequencyExcelDO.getFreq_code());
            System.out.println("当前导入数据:"+ basFrequencyExcelDO.getFreq_code());
            if (list!=null&&list.size()>0){
                String templateId = this.getTemplateId();
                if (StringUtils.isNoneBlank(templateId)){
                    BaseTemplateDictDO baseTemplateDictDO = new BaseTemplateDictDO();
                    baseTemplateDictDO.setTemplateId(templateId);
                    baseTemplateDictDO.setIsDel("1");
                    baseTemplateDictDO.setDictId(list.get(0).getId());
                    baseTemplateDictDO.setCreateTime(new Date());
                    baseTemplateDictDao.save(baseTemplateDictDO);
                }
                System.out.println("进验证有重复数据"+list.get(0).getFreq_code());
                return 0;
            }
        }
        return rs;
    }
}

+ 106 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/importManage/BaseIcd10ExcelDOReader.java

@ -0,0 +1,106 @@
package com.yihu.jw.base.service.dict.importManage;
import com.yihu.jw.base.dao.dict.DictIcd10Dao;
import com.yihu.jw.base.endpoint.common.excel.AExcelReader;
import com.yihu.jw.dict.dao.BaseDrugDictDao;
import com.yihu.jw.dict.dao.BaseTemplateDictDao;
import com.yihu.jw.entity.base.dict.BaseDrugDictDO;
import com.yihu.jw.entity.base.dict.BaseTemplateDictDO;
import com.yihu.jw.entity.base.dict.DictIcd10DO;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@Component
public class BaseIcd10ExcelDOReader extends AExcelReader {
    @Autowired
    private DictIcd10Dao dictIcd10Dao;
    @Autowired
    private BaseTemplateDictDao baseTemplateDictDao;
    @Override
    public void read(Workbook rwb) throws Exception {
        try{
            Iterator<Sheet> sheets = rwb.sheetIterator();
            int j = 0, rows;
            BasIcd10ExcelDO basIcd10ExcelDO;
            getRepeat().put("code", new HashSet<>());
            getRepeat().put("name", new HashSet<>());
            getRepeat().put("description", new HashSet<>());
            getRepeat().put("disea_reason", new HashSet<>());
            getRepeat().put("death_reason", new HashSet<>());
            getRepeat().put("py_code", new HashSet<>());
            getRepeat().put("d_code", new HashSet<>());
            getRepeat().put("flag", new HashSet<>());
            getRepeat().put("status", new HashSet<>());
            errorLs.clear();
            correctLs.clear();
            while (sheets.hasNext()){
                Sheet sheet = sheets.next();
                if ((rows = sheet.getLastRowNum()) == 0) {
                    continue;
                }
                for (int i = 1; i <= rows; i++) {
                    basIcd10ExcelDO = new BasIcd10ExcelDO();
                    basIcd10ExcelDO.setCode(replaceBlank(getCellCont(sheet, i, 0)));
                    basIcd10ExcelDO.setName(replaceBlank(getCellCont(sheet, i, 1)));
                    basIcd10ExcelDO.setDescription(getCellCont(sheet, i, 2));
                    basIcd10ExcelDO.setDisea_reason(replaceBlank(getCellCont(sheet, i, 3)));
                    basIcd10ExcelDO.setDeath_reason(replaceBlank(getCellCont(sheet, i, 4)));
                    basIcd10ExcelDO.setPy_code(replaceBlank(getCellCont(sheet, i, 5)));
                    basIcd10ExcelDO.setD_code(replaceBlank(getCellCont(sheet, i, 6)));
                    basIcd10ExcelDO.setFlag(replaceBlank(getCellCont(sheet, i, 7)));
                    basIcd10ExcelDO.setStatus(getCellCont(sheet, i, 8));
                    basIcd10ExcelDO.setExcelSeq(i);
                    int rs = basIcd10ExcelDO.validate(repeat);
                    if (validate(basIcd10ExcelDO)== 0||rs == 0) {
                        errorLs.add(basIcd10ExcelDO);
                    } else if (rs == 1) {
                        correctLs.add(basIcd10ExcelDO);
                    }
                }
                j++;
            }
        }catch (Exception e){
            e.printStackTrace();
            throw e;
        }finally {
            if (rwb != null) {
                rwb.close();
            }
        }
    }
    public int validate(BasIcd10ExcelDO basIcd10ExcelDO) {
        int rs = 1;
        if (StringUtils.isNoneBlank(basIcd10ExcelDO.getCode())){
            List<DictIcd10DO> list  = dictIcd10Dao.findByIcdCode(basIcd10ExcelDO.getCode());
            System.out.println("当前导入数据:"+ basIcd10ExcelDO.getCode());
            if (list!=null&&list.size()>0){
                String templateId = this.getTemplateId();
                if (StringUtils.isNoneBlank(templateId)){
                    BaseTemplateDictDO baseTemplateDictDO = new BaseTemplateDictDO();
                    baseTemplateDictDO.setTemplateId(templateId);
                    baseTemplateDictDO.setIsDel("1");
                    baseTemplateDictDO.setDictId(list.get(0).getId().toString());
                    baseTemplateDictDO.setCreateTime(new Date());
                    baseTemplateDictDao.save(baseTemplateDictDO);
                }
                System.out.println("进验证有重复数据"+list.get(0).getCode());
                return 0;
            }
        }
        return rs;
    }
}

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

@ -324,7 +324,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                sql+="\t) tb" +
                "  GROUP BY\n" +
                "\ttb. ID,\n" +
                "\ttb.idcard,\n" +
                "\ttb.idcard,\n" + "\ttb.doctor_level,\n" +
                "\ttb.name,\n" +
                "\ttb.sex,\n" +
                "\ttb.mobile,\n" +
@ -1000,7 +1000,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        Map<String, Object> result = new HashMap<>();
        //批量存储的集合
//        int correctCount = 0;
//        List<BaseDoctorExcelDO> corrects = new ArrayList<>();
//        List<BasDrugExcelDO> corrects = new ArrayList<>();
        BaseDoctorDO baseDoctorDO;
        //批量存储
        for(BaseDoctorExcelDO one:doctors){

+ 3 - 3
svr/svr-base/src/main/resources/application.yml

@ -172,7 +172,7 @@ wlyy:
  url: http://ehr.yihu.com/wlyy/
wechat:
  id: hz_yyyzh_wx
  url: https://zhyzh.hzxc.gov.cn/
  url: https://zhyzh.gongshu.gov.cn/
  flag: false
pay:
  flag: false
@ -632,7 +632,7 @@ wlyy:
  url: 1
wechat:
  id: hz_yyyzh_wx
  url: https://zhyzh.hzxc.gov.cn/
  url: https://zhyzh.gongshu.gov.cn/
  flag: false
pay:
  flag: false
@ -680,7 +680,7 @@ wlyy:
  url: http://ehr.yihu.com/wlyy/
wechat:
  id: hz_yyyzh_wx
  url: https://zhyzh.hzxc.gov.cn/
  url: https://zhyzh.gongshu.gov.cn/
  flag: false
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:

+ 12 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/birthday/BirthDayWishesToPatientDao.java

@ -0,0 +1,12 @@
package com.yihu.jw.care.dao.birthday;
import com.yihu.jw.entity.care.birthday.BirthDayWishesToPatient;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Bing on 2021/7/16.
 */
public interface BirthDayWishesToPatientDao extends PagingAndSortingRepository<BirthDayWishesToPatient,Long>,
        JpaSpecificationExecutor<BirthDayWishesToPatient> {
}

+ 29 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/birthday/BirthdayWishesTemplateDao.java

@ -0,0 +1,29 @@
package com.yihu.jw.care.dao.birthday;
import com.yihu.jw.entity.care.birthday.BirthdayWishesTemplate;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by humingfen on 2018/10/26.
 */
public interface BirthdayWishesTemplateDao extends PagingAndSortingRepository<BirthdayWishesTemplate, Long> {
    @Query("SELECT t from BirthdayWishesTemplate t where t.applicableRange = ?2 and (t.createUser = ?1 or t.createUser is null ) and t.del = 1 ORDER BY t.isDefault desc,t.type, t.createTime desc ")
    List<BirthdayWishesTemplate> getTemplateByDoctorAndApplicableRange(String doctor, Integer applicableRange);
    @Query("SELECT t from BirthdayWishesTemplate t where (t.createUser = ?1 or t.createUser is null ) and t.del = 1 ORDER BY t.isDefault desc,t.type, t.createTime desc ")
    List<BirthdayWishesTemplate> getTemplateByDoctor(String doctor);
    @Query("select t from BirthdayWishesTemplate t where t.applicableRange = ?1 and t.type = 1 and t.del = 1")
    BirthdayWishesTemplate getTemplateByApplicableRange(Integer applicableRange);
    @Query("update BirthdayWishesTemplate t set t.isDefault = ?2 where t.id = ?1")
    @Modifying
    void setDefalutTemplateById(Long id, Integer isDefault);
    BirthdayWishesTemplate findByCreateUserAndApplicableRangeAndIsDefault(String doctor,Integer applicableRange, int isDefault);
}

+ 2 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/PatientDeviceController.java

@ -99,6 +99,8 @@ public class PatientDeviceController extends BaseController {
                if (flagDevice == false){
                    return write(-1,"请填写投放地址");
                }
                //注册设备地址
                deviceDetailService.registerToWlyy(device);
            }
            //修改设备表中{"1":"0", "2":"0"}的绑定次数 和其他绑定信息
            deviceDetailService.updateAfterBinding(device,new Date(),flag);

+ 281 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorBirthdayWishesEndpoint.java

@ -0,0 +1,281 @@
package com.yihu.jw.care.endpoint.doctor;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yihu.jw.care.endpoint.BaseController;
import com.yihu.jw.care.service.birthday.BirthdayWishesService;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.entity.care.birthday.BirthDayWishesToPatient;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.util.date.DateUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by Bing on 2021/7/16.
 */
@RestController
@RequestMapping(value = "doctor/birthday")
@Api(tags = "医生生日祝福", description = "医生生日祝福")
public class DoctorBirthdayWishesEndpoint extends BaseController {
    @Autowired
    private BirthdayWishesService birthdayWishesService;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private MessageUtil messageUtil;
    @Value("${wechat.id}")
    private String wxId;
    @Autowired
    private SystemMessageDao systemMessageDao;
    @Autowired
    private ImUtil imUtil;
    @RequestMapping(value = "/createTemplate", method = RequestMethod.POST)
    @ApiOperation(value = "创建模板")
    public String createTemplate(@ApiParam(name = "content", value = "医生新建的祝福语")
                                 @RequestParam(required = false) String content,
                                 @ApiParam(name = "applicableRange", value = "适用人群")
                                 @RequestParam(required = false) Integer applicableRange,
                                 @ApiParam(name = "id", value = "模板ID")
                                 @RequestParam(required = false) Long id,
                                 @ApiParam(name = "isDefault", value = "是否是默认模板")
                                 @RequestParam(required = false) Integer isDefault) {
        try {
            return write(200, "更新成功!", "data", birthdayWishesService.create(getUID(), content, applicableRange, id, isDefault));
        } catch (Exception e) {
            return errorResult(e);
        }
    }
    @RequestMapping(value = "/getTemplateByDoctor", method = RequestMethod.GET)
    @ApiOperation(value = "获取系统模板和当前医生创建的模板")
    public String getTemplateByDoctor(@ApiParam(name = "doctor", value = "医生code")
                                      @RequestParam(required = false) String doctor) {
        try {
            if(StringUtils.isBlank(doctor)){
                doctor = getUID();
            }
            return write(200, "查询成功!", "data", birthdayWishesService.getTemplateByDoctor(doctor));
        } catch (Exception e) {
            return errorResult(e);
        }
    }
    @RequestMapping(value = "/getTemplateById", method = RequestMethod.GET)
    @ApiOperation(value = "根据模板id获取祝福内容")
    public String getTemplateById(@ApiParam(name = "id", value = "模板id")
                                  @RequestParam(required = true) Long id) {
        try {
            return write(200, "查询成功!", "data", birthdayWishesService.getTemplateById(id));
        } catch (Exception e) {
            return errorResult(e);
        }
    }
    @RequestMapping(value = "/deleteTemplateById", method = RequestMethod.POST)
    @ApiOperation(value = "根据模板id删除祝福模板")
    public String deleteTemplateById(@ApiParam(name = "id", value = "模板id")
                                     @RequestParam(required = true) Long id) {
        try {
            birthdayWishesService.deleteTemplateById(id);
            return write(200, "删除成功!");
        } catch (Exception e) {
            return errorResult(e);
        }
    }
    @RequestMapping(value = "/setDefalutTemplateById", method = RequestMethod.POST)
    @ApiOperation(value = "设置默认模板")
    public String setDefalutTemplateById(
            @ApiParam(name = "id", value = "模板ID",required = true)
            @RequestParam Long id) {
        try {
            return write(200, "设置成功!", "data", birthdayWishesService.setDefalutTemplateById(getUID(), id));
        } catch (Exception e) {
            return errorResult(e);
        }
    }
    @ApiOperation("获取医生签约患者当天生日未发送")
    @RequestMapping(value = "getPatientByDoctor", method = RequestMethod.GET)
    public String getPatientByDoctor(){
        try {
            return write(200, "查询成功", "data", birthdayWishesService.getPatientByDoctor(getUID()));
        } catch (Exception e) {
            return errorResult(e);
        }
    }
    @ApiOperation("获取医生签约患者当天生日未发送数量")
    @RequestMapping(value = "getPatientByDoctorCount", method = RequestMethod.GET)
    public String getPatientByDoctorCount(){
        try {
            return write(200, "查询成功", "data", birthdayWishesService.getPatientByDoctorCount(getUID()));
        } catch (Exception e) {
            return errorResult(e);
        }
    }
    @ApiOperation("获取生日居民列表")
    @RequestMapping(value = "getBirthdayPatientList", method = RequestMethod.GET)
    public String getBirthdayPatientList(@ApiParam(name = "patientName", value = "居民姓名")
                                         @RequestParam(required = false) String patientName,
                                         @ApiParam(name = "signYear", value = "签约年度")
                                         @RequestParam(required = false) Integer signYear,
                                         @ApiParam(name = "startDate", value = "生日开始日期yyyy-MM-dd")
                                         @RequestParam String startDate,
                                         @ApiParam(name = "endDate", value = "生日截止日期yyyy-MM-dd")
                                         @RequestParam String endDate,
                                         @ApiParam(name = "status", value = "状态(1、已发送,2、未发送)")
                                         @RequestParam(required = false) Integer status,
                                         @ApiParam(name = "currentUserRole", value = "登录角色")
                                         @RequestParam(value = "currentUserRole", required = false) String currentUserRole,
                                         @ApiParam(name = "currentUserRoleLevel", value = "登录角色等级(1省2市3区4社区、机构)")
                                         @RequestParam(value = "currentUserRoleLevel", required = false)String currentUserRoleLevel,
                                         @ApiParam(name = "roleType", value = "1、普通医生,2、管理员")
                                         @RequestParam(value = "roleType") Integer roleType,
                                         @ApiParam(name = "teamId", value = "医生所在团队")
                                         @RequestParam(value = "teamId", required = false) Integer teamId,
                                         @ApiParam(name = "isLeader", value = "是否是团队长,0不是、1是")
                                         @RequestParam(value = "isLeader", required = false) Integer isLeader,
                                         @ApiParam(name = "page", value = "第几页,从1开始")
                                         @RequestParam Integer page,
                                         @ApiParam(name = "pageSize", value = "页面大小")
                                         @RequestParam Integer pageSize){
        try {
            return write(200, "查询成功", "data", birthdayWishesService.getBirthdayPatientList(getUID(), patientName, signYear, startDate, endDate, status, currentUserRole, currentUserRoleLevel, roleType, page, pageSize, teamId, isLeader));
        } catch (Exception e) {
            return errorResult(e);
        }
    }
    @RequestMapping(value = "/doctorSendBirthdayWishes", method = RequestMethod.POST)
    @ApiOperation(value = "医生发送生日祝福")
    public String pushBirthdayWishes(@ApiParam(name = "patient", value = "发送人群集合")
                                     @RequestParam(required = true) String patient,
                                     @ApiParam(name = "templateId", value = "生日祝福模板id")
                                     @RequestParam(required = false) Long templateId,
                                     @ApiParam(name = "content", value = "医生新建的祝福语")
                                     @RequestParam(required = false) String content,
                                     @ApiParam(name = "applicableRange", value = "适用人群")
                                     @RequestParam(required = false) Integer applicableRange,
                                     @ApiParam(name = "isSave", value = "是否保存")
                                     @RequestParam(required = false) Integer isSave,
                                     @RequestParam(value = "currentUserRole", required = false) String currentUserRole,
                                     @RequestParam(value = "currentUserRoleLevel", required = false)String currentUserRoleLevel) {
        try {
            Date currentTime = new Date();
            SimpleDateFormat format = new SimpleDateFormat("MM月dd日");
            String dateString = format.format(currentTime);
            if(StringUtils.isEmpty(currentUserRole)){
                currentUserRole = getCurrentRoleCode();
            }
            if(StringUtils.isEmpty(currentUserRoleLevel)){
                currentUserRoleLevel = getCurrentRoleLevel();
            }
            JSONObject json = new JSONObject();
            json.put("patient", patient);
            json.put("doctorCode", getUID());
            json.put("sendType", 1);
            json.put("birthday", dateString);
            json.put("currentUserRole", currentUserRole);
            json.put("currentUserRoleLevel", currentUserRoleLevel);
            if(templateId != null) {
                json.put("templateId", templateId);
                json.put("isSave", 1);
            }else {
                json.put("content", content);
                json.put("isSave", 0);
            }
            List<BirthDayWishesToPatient> birthDayWishesToPatientESList = birthdayWishesService.saveBirthdayWishesES(json);
            new Thread(() -> {
                sender(birthDayWishesToPatientESList);
            }).start();
            return write(200, "发送成功!");
        } catch (Exception e) {
            return errorResult(e);
        }
    }
    /**
     * 发送消息
     *
     */
    public void sender(List<BirthDayWishesToPatient> birthDayWishesToPatient) {
        //发送到队列
        birthDayWishesToPatient.stream().forEach(one -> {
            //根据openid进行发送祝福
            String patient = one.getPatientCode();
            if (StringUtils.isNotBlank(patient)){
                String sql = " select p.id as patient,p.name,we.openid from base_patient p inner join  base_patient_wechat we on p.id = we.patient_id " +
                        "and we.patient_id = '"+patient+"' " +
                        "  order by we.create_time desc  ";
                List<Map<String,Object>> patients = jdbcTemplate.queryForList(sql);
                if (patients.size()>0){//发送生日祝福
                    Map<String,Object> tmp = patients.get(0);
                    com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
                    String first = "助老员key1为您发送生日祝福,请点击查看。";
                    first = first.replace("key1",one.getDoctorName());
                    json.put("doctorName", one.getDoctorName());
                    json.put("toUser", patient);
                    json.put("name", tmp.get("name").toString());
                    json.put("content", one.getContent());
                    json.put("openid",tmp.get("openid").toString());
                    json.put("represented","");//被代理人
                    boolean success =  messageUtil.putTemplateWxMessage(wxId,"template_success_notice","srzf",tmp.get("openid").toString(),first,
                            null,one.getContent(),26,json,"已发送", DateUtil.dateToChineseTime(new Date()));
                    if (success){
                        SystemMessageDO messageDO = new SystemMessageDO();
                        messageDO.setTitle("收到来自"+one.getDoctorName()+"的关怀祝福:祝您"+tmp.get("name").toString()+"节日快乐!");
                        messageDO.setType("41");//41人文关怀
                        messageDO.setSender(one.getDoctorCode());
                        messageDO.setSenderName(one.getDoctorName());
                        messageDO.setRelationCode(one.getId()+"");
                        messageDO.setReceiver(patient);
                        messageDO.setReceiverName(tmp.get("name").toString());
                        messageDO.setOver("1");
                        messageDO.setCode("1");//1生日祝福
                        messageDO.setData(one.getContent());
                        messageDO.setDel("1");
                        messageDO.setCreateTime(new Date());
                        systemMessageDao.save(messageDO);
                        //推送socket
                        com.alibaba.fastjson.JSONObject message = new com.alibaba.fastjson.JSONObject();
                        message.put("title",messageDO.getTitle());
                        message.put("code",messageDO.getCode());
                        message.put("content",messageDO.getData());
                        message.put("relation_code",messageDO.getRelationCode());
                        message.put("content_type",41);
                        message.put("content_notice","");
                        String content_notice = null;
                        imUtil.sendPatientSystemMessage(messageDO.getReceiver(), JSON.toJSONString(message, SerializerFeature.WriteMapNullValue));
                    }
                }
            }
        });
    }
}

+ 25 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/family/FamilyMemberEndpoint.java

@ -197,6 +197,31 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
        }
    }
    /**
     * 家庭成员查询
     * @param patient
     * @return
     */
    @RequestMapping(value = "/membersWithOnLineFlag", method = RequestMethod.GET)
    @ApiOperation(value = "家庭成员查询带是否在线标识")
    public ObjEnvelop membersWithOnLineFlag(@RequestParam(required = false) String patient) {
        try {
            JSONObject data = new JSONObject();
            JSONArray result = new JSONArray();
            if (StringUtils.isNotEmpty(patient)) {
                result = familyMemberService.membersWithOnLineFlag(patient);
            } else  {
                result = familyMemberService.membersWithOnLineFlag(getUID());
            }
            data.put("normalmembers",result);//家人关系
            return ObjEnvelop.getSuccess( "查询成功", data);
        } catch (Exception e) {
            return failedObjEnvelopException2(e);
        }
    }
    @RequestMapping(value = "/authorize_members", method = RequestMethod.GET)
    @ApiOperation(value = "家庭成员(有授权)查询")
    public ObjEnvelop getAuthorizeFamilyMembers(){

+ 17 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/PatientMessageEndpoint.java

@ -76,7 +76,23 @@ public class PatientMessageEndpoint extends EnvelopRestEndpoint {
                                            @RequestParam(value = "type")String type
                                            ){
        try {
            return ListEnvelop.getSuccess("查询成功",patientMessageService.getSystemMessageList(patient,type));
            return ListEnvelop.getSuccess("查询成功",patientMessageService.getSystemMessageList(patient,type,null));
        }catch (Exception e){
            return failedListEnvelopException2(e);
        }
    }
    @GetMapping(value = "getSystemMessageListPad")
    @ApiOperation("居民平板端获取消息列表(生日祝福,体征设备)")
    public ListEnvelop getUnreadSystemMessageListPad(@ApiParam(name = "patient",required = true)
                                            @RequestParam(value = "patient")String patient,
                                            @ApiParam(name = "type",required = true)
                                            @RequestParam(value = "type",defaultValue = "41,42")String type,
                                            @ApiParam(name = "isRead",required = false,value = "1:为已读,0:未读")
                                            @RequestParam(value = "isRead",required = false)String isRead
    ){
        try {
            return ListEnvelop.getSuccess("查询成功",patientMessageService.getSystemMessageList(patient,type,isRead));
        }catch (Exception e){
            return failedListEnvelopException2(e);
        }

+ 12 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/PatientContactsEndpoint.java

@ -4,10 +4,12 @@ import com.alibaba.fastjson.JSONArray;
import com.yihu.jw.care.service.contacts.ContactsService;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import 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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@ -117,4 +119,14 @@ public class PatientContactsEndpoint extends EnvelopRestEndpoint {
        }
    }
    @RequestMapping(value = "getAllOrgListWithSignFlag",method = RequestMethod.GET)
    @ApiOperation(value = "获取所有服务站列表--带是否签约标识")
    public ListEnvelop getAllOrgList(@ApiParam(name="patient",value = "居民id")
                                     @RequestParam(value = "patient",required = false)String patient){
        try {
            return ListEnvelop.getSuccess("获取成功",contactsService.getAllOrgListWithSignFlag(patient));
        }catch (Exception e){
            return failedListEnvelopException2(e);
        }
    }
}

+ 6 - 6
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/PatientEndpoint.java

@ -104,7 +104,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
            @RequestParam(value = "size") int size) {
        try{
            return patientService.myPatientPage(name, doctorId, page, size);
        }catch (Exception e){
@ -131,7 +131,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
    public Envelop updLatLon(@ApiParam(name = "latLon", value = "经纬度24.48923061,118.10388605")
                              @RequestParam(value = "latLon", required = true)String latLon,
                              @ApiParam(name = "patientId", value = "居民id")
                              @RequestParam(value = "patientId", required = true)String patientId)throws Exception{
                              @RequestParam(value = "patientId", required = true)String patientId){
        try{
            patientService.updLatLon(latLon, patientId);
            return success("修改成功");
@ -145,7 +145,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
    public Envelop updPatient(@ApiParam(name = "jsonData", value = "json格式")
                                  @RequestParam(value = "jsonData", required = true)String jsonData,
                                  @ApiParam(name = "doctorId", value = "医生id")
                                  @RequestParam(value = "doctorId", required = false)String doctorId)throws Exception{
                                  @RequestParam(value = "doctorId", required = false)String doctorId){
        try{
            JSONObject result =  patientService.updPatient(jsonData, doctorId);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
@ -165,7 +165,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "findPatientLabel")
    @ApiOperation(value = "获取居民标签信息")
    public Envelop findPatientLabel(@ApiParam(name = "patientId", value = "居民id")
                                   @RequestParam(value = "patientId", required = true)String patientId)throws Exception{
                                   @RequestParam(value = "patientId", required = true)String patientId){
        try{
            return success("修改成功",patientLabelDao.findByPatient(patientId));
        }catch (Exception e){
@ -179,7 +179,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
    public Envelop updPatientLabel(@ApiParam(name = "jsonData", value = "json格式")
                              @RequestParam(value = "jsonData", required = true)String jsonData,
                              @ApiParam(name = "patientId", value = "居民id")
                              @RequestParam(value = "patientId", required = true)String patientId)throws Exception{
                              @RequestParam(value = "patientId", required = true)String patientId){
        try{
            patientService.updPatientLabel(jsonData, patientId);
            return success("修改成功");
@ -195,7 +195,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
                                  @ApiParam(name = "pw", value = "密码")
                                  @RequestParam(value = "pw", required = true)String pw,
                                  @ApiParam(name = "orgPw", value = "原密码")
                                  @RequestParam(value = "orgPw", required = false)String orgPw)throws Exception{
                                  @RequestParam(value = "orgPw", required = false)String orgPw){
        Boolean isSuccess = patientService.updatePatientPw(id,pw,orgPw);
        if (isSuccess){
            return success(isSuccess);

+ 5 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java

@ -51,7 +51,7 @@ public class SignEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "findSignOrg")
    @ApiOperation(value = "查找签约机构")
    public ListEnvelop findSignOrg (
            @ApiParam(name = "patient", value = "医生code", required = true)
            @ApiParam(name = "patient", value = "患者code", required = true)
            @RequestParam(value = "patient",required = true) String patient,
            @ApiParam(name = "name", value = "机构名称", required = false)
            @RequestParam(value = "name",required = false) String name,
@ -519,9 +519,11 @@ public class SignEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value="getServerDoctorAll")
    @ApiOperation(value = "获取所有服务医生")
    public ListEnvelop getServerDoctorAll(@ApiParam(name = "patient", value = "患者id", required = true)
                                          @RequestParam(value = "patient") String patient){
                                          @RequestParam(value = "patient") String patient,
                                          @ApiParam(name = "onlineFlag", value = "获取在线状态获取 0不获取 1获取", required = false)
                                          @RequestParam(value = "onlineFlag",required = false) String onlineFlag){
        try {
            return ListEnvelop.getSuccess("查询成功",servicePackageService.getServerDoctorAll(patient));
            return ListEnvelop.getSuccess("查询成功",servicePackageService.getServerDoctorAll(patient,onlineFlag));
        }catch (Exception e){
            return failedListEnvelopException2(e);
        }

+ 35 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/statistics/OpenStatisticsEndpoint.java

@ -1,12 +1,15 @@
package com.yihu.jw.care.endpoint.statistics;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.patient.CarePatientService;
import com.yihu.jw.care.service.statistics.StatisticsService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import 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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -27,6 +30,8 @@ public class OpenStatisticsEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private StatisticsService statisticsService;
    @Autowired
    private CarePatientService patientService;
    @GetMapping(value = "statisticsTotalAmount")
    @ApiOperation(value = "统计总数")
@ -61,4 +66,34 @@ public class OpenStatisticsEndpoint extends EnvelopRestEndpoint {
            return failedObjEnvelopException2(e);
        }
    }
    @GetMapping(value = "platformPeople")
    @ApiOperation(value = "平台人员实时统计")
    public ObjEnvelop platformPeople() {
        try {
            JSONObject result = statisticsService.platformPeople();
            return success(result);
        } catch (Exception e) {
            return failedObjEnvelopException2(e);
        }
    }
    @GetMapping(value = "findUserByType")
    @ApiOperation(value = "人员实时动态搜索")
    public Envelop findUserByType(@ApiParam(name = "type", value = "类型:1幼儿,2老人,3助老员,4医生。不传返回四个类型的数据")
                                    @RequestParam(value = "type", required = false)String type,
                                    @ApiParam(name = "name", value = "姓名")
                                    @RequestParam(value = "name", required = false)String name,
                                    @ApiParam(name = "residentialArea", value = "居住小区")
                                    @RequestParam(value = "residentialArea", required = false)String residentialArea,
                                    @ApiParam(name = "page", value = "第几页")
                                        @RequestParam(value = "page", required = false)Integer page,
                                    @ApiParam(name = "size", value = "页面大小")
                                        @RequestParam(value = "size", required = false)Integer size){
        try{
            return success("修改成功",patientService.findUserByType(type, name, residentialArea, page, size));
        }catch (Exception e){
            return failedException2(e);
        }
    }
}

+ 503 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/birthday/BirthdayWishesService.java

@ -0,0 +1,503 @@
package com.yihu.jw.care.service.birthday;
import com.yihu.jw.care.dao.birthday.BirthDayWishesToPatientDao;
import com.yihu.jw.care.dao.birthday.BirthdayWishesTemplateDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.birthday.BirthDayWishesToPatient;
import com.yihu.jw.entity.care.birthday.BirthdayWishesTemplate;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
 * Created by Bing on 2021/7/16.
 */
@Service
public class BirthdayWishesService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    private static LinkedBlockingQueue<JSONObject> queue = new LinkedBlockingQueue<>();
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
    private BirthdayWishesTemplateDao bwTemplateDao;
    @Autowired
    private BirthDayWishesToPatientDao bwToPatientDao;
    @Autowired
    private BaseDoctorHospitalDao hospitalDao;
    @Autowired
    private RedisTemplate redisTemplate;
//    /**
//     * 发送到mq
//     *
//     */
//    public void sender(List<BirthDayWishesToPatientES> birthDayWishesToPatientES) {
//        //发送到队列
//        birthDayWishesToPatientES.stream().forEach(one -> {
//            jmsTemplate.send(channelName, new MessageCreator() {
//                @Override
//                public Message createMessage(Session session) throws JMSException {
//                    TextMessage textMessage = session.createTextMessage();
//                    textMessage.setText(net.sf.json.JSONObject.fromObject(one).toString());
//                    return textMessage;
//                }
//            });
//        });
//    }
    /**
     * 医生端--新建祝福语模板
     * @param doctor
     * @param content
     * @param applicableRange
     * @param id
     * @param isDefault
     */
    public Long create(String doctor, String content, Integer applicableRange, Long id, Integer isDefault) {
        BaseDoctorDO doctorDO = doctorDao.findById(doctor);
        BirthdayWishesTemplate template = null;
        //判断是编辑还是创建
        if(id != null){
            template = bwTemplateDao.findOne(id);
        }else {
            template = new BirthdayWishesTemplate();
            template.setCode(UUID.randomUUID().toString().replace("-",""));
            template.setType(2);
            template.setDel(1);
            template.setCreateUser(doctor);
            template.setCreateUserName(doctorDO.getName());
        }
        template.setApplicableRange(applicableRange);
        template.setContent(content);
        template.setCreateTime(new Date());
        if(isDefault != null) {
            if(isDefault == 1){
                //先取消该医生自创的默认模板
                BirthdayWishesTemplate docTemplate = bwTemplateDao.findByCreateUserAndApplicableRangeAndIsDefault(doctor, applicableRange, 1);
                if(docTemplate != null){
                    bwTemplateDao.setDefalutTemplateById(docTemplate.getId(), 0);
                }
            }
            template.setIsDefault(isDefault);
        }else if(id == null || template.getIsDefault() == null){
            template.setIsDefault(0);
        }
        bwTemplateDao.save(template);
        return template.getId();
    }
    /**
     * 获取系统模板和医生创建模板
     * @return
     */
    public List<BirthdayWishesTemplate> getTemplateByDoctor(String doctor) {
        return bwTemplateDao.getTemplateByDoctor(doctor);
    }
    /**
     * 根据id获取模板消息
     * @param id
     * @return
     */
    public BirthdayWishesTemplate getTemplateById(Long id) {
        return bwTemplateDao.findOne(id);
    }
    public void deleteTemplateById(Long id) {
        bwTemplateDao.delete(id);
    }
    /**
     * 根据ID设置为默认模板
     *
     * @param doctor
     * @param id
     * @return
     */
    @Transactional
    public BirthdayWishesTemplate setDefalutTemplateById(String doctor, Long id) {
        BirthdayWishesTemplate template = bwTemplateDao.findOne(id);
        //先取消该医生自创的默认模板
        BirthdayWishesTemplate docTemplate = bwTemplateDao.findByCreateUserAndApplicableRangeAndIsDefault(doctor, template.getApplicableRange(), 1);
        if(docTemplate != null){
            bwTemplateDao.setDefalutTemplateById(docTemplate.getId(), 0);
        }
        //如果不是系统模板,就添加默认模板标识
        if(template.getType() != 1){
            bwTemplateDao.setDefalutTemplateById(id, 1);
        }
        return template;
    }
    /**
     * 获取医生当天未发送生日祝福居民信息
     * @param doctor
     * @return
     */
    public List<Map<String, Object>> getPatientByDoctor(String doctor) throws Exception{
        //es日期格式
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String createTime = sdf.format(new Date()) + " 00:00:00";
        //今日推送的居民
        Set<String> sendPatients = (Set<String>) redisTemplate.opsForValue().get("birthday:wish:sendPatient");
        Date currentTime = new Date();
        SimpleDateFormat format = new SimpleDateFormat("MMdd");
        String dateString = format.format(currentTime);
        //获取当天0点
        SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
        String now = f.format(new Date());
        String sql = "SELECT p.id patient, p.`name`, " +
                "CASE p.sex WHEN 1 THEN '男' WHEN 2 THEN '女' END sex," +
                "p.idcard, p.photo," +
                " CASE LENGTH(p.idcard) WHEN  18 then SUBSTR(p.idcard,11,4) when 15 then SUBSTR(p.idcard, 9,4) END date " +
                "from wlyy_archive a,base_patient p WHERE  a.patient = p.id and a.sign_status = 1 and EXISTS( " +
                "SELECT DISTINCT sr.patient from base_service_package_sign_record sr,base_service_package_record r, " +
                "base_service_package_item i,base_team_member m " +
                "WHERE  sr.id = r.sign_id and sr.patient = a.patient  and r.service_package_id = i.service_package_id " +
                "and i.del = 1 and m.team_code = i.team_code and m.doctor_code = '"+doctor+"' ) "+
                " and (p.archive_status<>2 or p.archive_status is null) " +
                "AND CASE LENGTH(p.idcard) WHEN  18 then SUBSTR(p.idcard,11,4) when 15 then SUBSTR(p.idcard, 9,4) END =  '" + dateString + "' " ;
        List<Map<String, Object>> patientInfos =  jdbcTemplate.queryForList(sql);
        //整理未发送居民信息
        for(Map<String, Object> map : patientInfos){
            if (sendPatients == null || !sendPatients.contains(map.get("patient"))) {
                int age = IdCardUtil.getAgeForIdcard(map.get("idcard") + "");
                Date birthday = IdCardUtil.getBirthdayForIdcard(map.get("idcard") + "");
                map.put("age", age);
                map.put("birthday", DateUtil.dateToStr(birthday, "yyyy-MM-dd"));
            }
        }
        return patientInfos;
    }
    /**
     * 获取医生当天未发送生日祝福居民数量
     * @param doctor
     * @return
     */
    public Integer getPatientByDoctorCount(String doctor) throws Exception{
        //es日期格式
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String createTime = sdf.format(new Date()) + " 00:00:00";
        //今日推送的居民
        Set<String> sendPatients = (Set<String>) redisTemplate.opsForValue().get("birthday:wish:sendPatient");
        Date currentTime = new Date();
        SimpleDateFormat format = new SimpleDateFormat("MMdd");
        String dateString = format.format(currentTime);
        //获取当天0点
        SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
        String now = f.format(new Date());
        String sql = "SELECT COUNT(DISTINCT p.id) " +
                "from wlyy_archive a,base_patient p WHERE  a.patient = p.id and a.sign_status = 1 and EXISTS( " +
                "SELECT DISTINCT sr.patient from base_service_package_sign_record sr,base_service_package_record r, " +
                "base_service_package_item i,base_team_member m " +
                "WHERE  sr.id = r.sign_id and sr.patient = a.patient  and r.service_package_id = i.service_package_id " +
                "and i.del = 1 and m.team_code = i.team_code and m.doctor_code = '"+doctor+"' ) "+
                " and (p.archive_status<>2 or p.archive_status is null) " +
                "AND CASE LENGTH(p.idcard) WHEN  18 then SUBSTR(p.idcard,11,4) when 15 then SUBSTR(p.idcard, 9,4) END =  '" + dateString + "'  " ;
        List<String> patientInfos =  jdbcTemplate.queryForList(sql,String.class);
        Integer count=0;
        for (String tmp:patientInfos){
            if (!sendPatients.contains(tmp)){
                count++;
            }
        }
        return count;
    }
    /**
     * 获取医生生日列表
     */
    public Map<String, Object> getBirthdayPatientList(String doctorCode, String patientName, Integer signYear, String startDate, String endDate, Integer status, String currentUserRole, String currentUserRoleLevel,
                                                      Integer roleType, Integer page, Integer pageSize, Integer teamId, Integer isLeader) throws Exception {
        Map<String, Object> resultMap = new HashMap<>();
        List<Map<String, Object>> resultList = new ArrayList();
        Long allCount = 0l;
        //判断是否筛选推送条件,若未筛选则从数据库直接查生日居民,再进行匹配是否推送,若选择已推送则从推送记录查,若未发送则从未推送表查
        //助老员签约患者
        String sql = " SELECT Distinct p.id patient,p.idcard,p.mobile,p.name,p.sex,p.id,p.photo," +
                "CASE LENGTH(p.idcard) WHEN 18 THEN SUBSTR(p.idcard, 11, 4) WHEN 15 THEN SUBSTR(p.idcard, 9, 4) END birthday  " ;
        String sqlCount = "SELECT count(distinct p.idcard) ";
        String whereSql = "from wlyy_archive a,base_patient p WHERE  a.patient = p.id and a.sign_status = 1 and EXISTS( " +
                "SELECT DISTINCT sr.patient from base_service_package_sign_record sr,base_service_package_record r, " +
                "base_service_package_item i,base_team_member m " +
                "WHERE  sr.id = r.sign_id and sr.patient = a.patient  and r.service_package_id = i.service_package_id " +
                "and i.del = 1 and m.team_code = i.team_code ";
        //根据权限获取生日居民列表
        if (roleType == 1) {
            whereSql += " and m.doctor_code = '"+doctorCode+"' ";
        } else {//管理员
            switch (currentUserRoleLevel) {
                case "1": {//省
                    whereSql += " and i.org_code in ( select org.code from base_org org where org.province_code = '"+currentUserRole+"' and org.del=1 )  ";
                    break;
                }
                case "2": {//市
                    whereSql += " and i.org_code in ( select org.code from base_org org where org.city_code = '"+currentUserRole+"' and org.del=1 )  ";
                    break;
                }
                case "3": {//区
                    whereSql += " and i.org_code in ( select org.code from base_org org where org.town_code = '"+currentUserRole+"' and org.del=1 )  ";
                    break;
                }
                case "4": {//社区机构
                    whereSql += " and i.org_code = '" + currentUserRole + "' ";
                    break;
                }
            }
        }
        if (StringUtils.isNotBlank(patientName)) {
            whereSql += "and p.name like '%" + patientName + "%' ";
        }
        //根据签约年限来获取生日居民
        if ( null==  signYear|| signYear == DateUtil.getNowYear()) {//当前年度
            whereSql += " and sr.status=1 ";
        } else {//
            whereSql += " and sr.status=-1 and sr.start_time >='" + signYear+" 01-01:00:00:00" + "' and sr.start_time <='" + signYear+" 12-31:23:59:59" + "'  ";
        }
        if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)) {
            String start = startDate.substring(4).replace("-", "");
            String end = endDate.substring(4).replace("-", "");
            Integer birStart = Integer.parseInt(start);
            Integer birEnd = Integer.parseInt(end);
            //判断生日日期
            if(birEnd > birStart) {
                whereSql += "AND CASE LENGTH(p.idcard) WHEN 18 THEN SUBSTR(p.idcard, 11, 4) WHEN 15 THEN SUBSTR(p.idcard, 9, 4) END >= '" + start + "' " +
                        "AND CASE LENGTH(p.idcard) WHEN 18 THEN SUBSTR(p.idcard, 11, 4) WHEN 15 THEN SUBSTR(p.idcard, 9, 4) END <= '" + end + "' ";
            }else if(birEnd < birStart){
                whereSql += "AND CASE LENGTH(p.idcard) WHEN 18 THEN SUBSTR(p.idcard, 11, 4) WHEN 15 THEN SUBSTR(p.idcard, 9, 4) END >= '" + end + "' " +
                        "AND CASE LENGTH(p.idcard) WHEN 18 THEN SUBSTR(p.idcard, 11, 4) WHEN 15 THEN SUBSTR(p.idcard, 9, 4) END <= '" + start + "' ";
            }else {
                whereSql += "AND CASE LENGTH(p.idcard) WHEN 18 THEN SUBSTR(p.idcard, 11, 4) WHEN 15 THEN SUBSTR(p.idcard, 9, 4) END = '" + end + "' ";
            }
        }
        whereSql += "and DATE_FORMAT(sr.create_time,'%m%d')< CASE LENGTH(p.idcard) WHEN 18 THEN SUBSTR(p.idcard, 11, 4) WHEN 15 THEN SUBSTR(p.idcard, 9, 4) END ";
        sql = sql + whereSql + " ) order by birthday limit "+(page-1)*pageSize + "," + pageSize;
        sqlCount = sqlCount + whereSql+")";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        allCount = jdbcTemplate.queryForObject(sqlCount, Long.class);
        resultMap.put("total", allCount);
        //获取生日居民code
        String patientString = "";
        for (Map<String, Object> map : list) {
            patientString += "'"+ map.get("patient") + "',";
        }
        if(patientString.length() > 0) {
            //查询该居民是否有推送过
            String es = "SELECT patient_code patientCode,doctor_name doctorName,content,birthday,create_time createTime FROM birthday_wishes_to_patient where patient_code in (" + patientString.substring(0, patientString.length() - 1) + ") and user_type =1 and create_time > '" + startDate + " 00:00:00' and create_time < '" + endDate + " 23:59:59'";
            List<Map<String, Object>> sendPatientList = jdbcTemplate.queryForList(es);
            Set<String> patientSet = new HashSet<>();
            for (Map<String, Object> map : list) {
                String patientCode = map.get("patient") + "";
                //判断是否在推送记录里
                if( null == status || 1 == status  ) {
                    for (Map<String, Object> esMap : sendPatientList) {
                        if (patientCode.equals(esMap.get("patientCode") + "")) {
                            map.put("birthday", esMap.get("birthday") + "");
                            map.put("doctorName", esMap.get("doctorName") + "");
                            map.put("content", esMap.get("content") + "");
                            map.put("createTime", (esMap.get("createTime") + "").replace("T", " ").replace("+0800", ""));
                            map.put("status", "已发送");
                            patientSet.add(patientCode);
                            resultList.add(map);
                        }
                    }
                }
            }
            if(null == status || 2 == status) {
                //存取未发送居民
                for (Map<String, Object> map : list) {
                    String patientCode = map.get("patient") + "";
                    if (!patientSet.contains(patientCode)) {
                        String birthday = map.get("birthday")+"日";
                        StringBuilder bir = new StringBuilder(birthday);
                        bir.insert(2, "月");
//                            int age = IdCardUtil.getAgeForIdcard(map.get("idcard") + "");
                        map.put("birthday", bir.toString());
//                        int age = IdCardUtil.getAgeForIdcard(map.get("idcard") + "");
//                        map.put("age", age);
                        map.put("status", "未发送");
                        resultList.add(map);
                    }
                }
            }
        }
        resultMap.put("detailModelList", resultList);
        resultMap.put("total", allCount);
        resultMap.put("pageCount", allCount%pageSize == 0 ?allCount/pageSize : allCount/pageSize +1);
        return resultMap;
    }
    /**
     * 将发送祝福的居民相关信息存到es
     * @param json
     * @return
     */
    public List<BirthDayWishesToPatient> saveBirthdayWishesES(JSONObject json) {
        List<BirthDayWishesToPatient> list = new ArrayList<>();
        List<BirthDayWishesToPatient> birthdayWishesList = new ArrayList<>();
        String p = json.get("patient") + "";
        String doctorCode = json.get("doctorCode") + "";
        Integer sendType = (Integer) json.get("sendType");
        String currentUserRole = json.has("currentUserRole")?json.get("currentUserRole") + "":null;
        String currentUserRoleLevel = json.has("currentUserRoleLevel")?json.get("currentUserRoleLevel") + "":null;
        String dateString = json.get("birthday") + "";
        Integer isSave = (Integer) json.get("isSave");
        Long templateId = null;
        String content = null;
        if(isSave == 1) {
            templateId = (Long) json.get("templateId");
            BirthdayWishesTemplate birthdayWishesTemplate = bwTemplateDao.findOne(templateId);
            content = birthdayWishesTemplate.getContent();
        }else if(isSave == 0){
            content = json.get("content") + "";
        }
        Set<String> patientSet = new HashSet<>();
        SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd");
        String createTime = f.format(new Date())+" 00:00:00";
        //医生今日推送的居民
        List<BirthDayWishesToPatient> sendPatientList = findSendPatientByCreateTime(p.toString(),createTime);
        Set<String> sendPatient = sendPatientList.stream().map(BirthDayWishesToPatient::getPatientCode).collect(Collectors.toSet());
        Set<String> openidSet = new HashSet<>();
        BaseDoctorDO doctor = doctorDao.findById(doctorCode);
        String sql = " select * from ( select p.id as patient,p.name,we.openid from base_patient p inner join  base_patient_wechat we on p.id = we.patient_id and we.patient_id in ( "+p.toString()+") " +
                "  order by we.create_time desc )A group by A.patient  ";
        List<Map<String, Object>> patientInfos = jdbcTemplate.queryForList(sql);
        //批量发送要属于同一批次
        String batchNo = UUID.randomUUID().toString();
        for (Map<String, Object> patientInfo : patientInfos) {
            String s = patientInfo.get("patient") + "";
            //已推送则不再重复推送
            if(!sendPatient.contains(s)) {
                patientSet.add(s);
                //获取已推送居民
                sendPatient.add(s);
            }else {
                continue;
            }
            openidSet.add(patientInfo.get("openid") + "");
            BirthDayWishesToPatient es = new BirthDayWishesToPatient();
            es.setBatchNo(batchNo);
            es.setPatientCode(s);
            es.setPatientName(patientInfo.get("name") + "");
            es.setDoctorCode(doctor.getId());
            es.setDoctorName(doctor.getName());
            es.setUserType(1);
            List<BaseDoctorHospitalDO> hospitalDOs = hospitalDao.findByDoctorCode(doctorCode);
            //存储发送人信息
            es.setSendPic(doctor.getPhoto());
            es.setSendSex(doctor.getSex()+"");
//            es.setAdminTeamName(patientInfo.get("teamName") + "");
//            es.setAdminTeamCode(Long.valueOf(patientInfo.get("admin_team_code")+""));
            if (hospitalDOs.size()>0){
                es.setHospital(hospitalDOs.get(0).getOrgCode());
                es.setHospitalName(hospitalDOs.get(0).getOrgName());
            }
            es.setTown(doctor.getTownCode());
            es.setTownName(doctor.getTownName());
            es.setSendType(sendType);
            es.setSendLevel(doctor.getLevel());
            if (StringUtils.isNotBlank(currentUserRole)){
                es.setCurrentUserRoleCode(currentUserRole);
            }
            if (StringUtils.isNotBlank(currentUserRoleLevel)){
                es.setCurrentUserRoleLevel(currentUserRoleLevel);
            }
            es.setAllCount(patientSet.size());
            es.setOpenidSet(openidSet.toString());
            //生日祝福信息
            es.setBirthday(dateString);
            es.setTemplateId(templateId);
            es.setContent(content);
            es.setCreateTime(DateUtil.getStringDate());
            list.add(es);
        }
        if(list.size()>0){
            //保存到ES中
//            elastricSearchSave.save(list, esIndex, esType);
            //另存一条发送祝福的医生信息,便于查询医生发送祝福的居民列表
            BirthDayWishesToPatient e = new BirthDayWishesToPatient();
            BeanUtils.copyProperties(list.get(0), e);
            e.setUserType(2);
            e.setPatientCode(null);
            e.setPatientName(null);
            list.add(e);
            bwToPatientDao.save(list);
//            System.out.println("ES保存成功!");
            //将发送生日祝福的居民code存起来
            Calendar today = Calendar.getInstance();
            today.set(Calendar.HOUR, 23);
            today.set(Calendar.MINUTE, 59);
            today.set(Calendar.SECOND, 59);
            today.set(Calendar.MILLISECOND, 999);
            redisTemplate.opsForValue().set("birthday:wish:sendPatient", sendPatient);
            redisTemplate.expire("birthday:wish:sendPatient", today.getTimeInMillis() - Calendar.getInstance().getTimeInMillis(), TimeUnit.MILLISECONDS);
        }
        return list;
    }
    /**
     * 获取今日已推送居民
     * @param
     * @return
     */
    public List<BirthDayWishesToPatient> findSendPatientByCreateTime(String patient,String createTime) {
        StringBuffer sql = new StringBuffer("select patient_code patientCode from  birthday_wishes_to_patient  "+
                " where user_type=1 and create_time>'" + createTime + "' ");
        if (StringUtils.isNotBlank(patient)){
            sql.append(" and patient_code in ( "+patient+" ) ") ;
        }
        sql.append(" limit 0,500000 ");
        List<BirthDayWishesToPatient> patientList = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper<>(BirthDayWishesToPatient.class));
        return patientList;
    }
}

+ 20 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/contacts/ContactsService.java

@ -182,4 +182,24 @@ public class ContactsService {
        return result;
    }
    /**
     * 服务站列表(平台内所有养老机构)
     *
     */
    public List<Map<String,Object>> getAllOrgListWithSignFlag(String patient){
        List<Map<String,Object>> result = new ArrayList<>();
        String sql =  "select * from base_org org  " ;
        if (StringUtils.isNotBlank(patient)){
            sql +=" LEFT JOIN ( " +
                    "SELECT  DISTINCT i.org_code,'1' as signFlag FROM  base_service_package_sign_record sr,  base_service_package_record r, " +
                    " base_service_package_item i WHERE  sr.id = r.sign_id and sr.status=1 and sr.patient = '"+patient+"'" +
                    " AND r.service_package_id = i.service_package_id " +
                    " AND i.del = 1  AND sr.`status` = 1)A on org.code = A.org_code ";
        }
        sql +=  " where org.del=1 and org.type=3 " ;
        result = jdbcTemplate.queryForList(sql);
        return result;
    }
}

+ 24 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/DeviceService.java

@ -1,13 +1,17 @@
package com.yihu.jw.care.service.device;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.device.DeviceDao;
import com.yihu.jw.entity.care.device.Device;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.stream.Collectors;
/**
 * 设备管理
@ -19,6 +23,8 @@ public class DeviceService extends BaseJpaService<Device, DeviceDao> {
	@Autowired
	private DeviceDao deviceDao;
	@Autowired
	private JdbcTemplate jdbcTemplate;
	/**
@ -35,4 +41,22 @@ public class DeviceService extends BaseJpaService<Device, DeviceDao> {
	{
		return deviceDao.findOne(Long.valueOf(id));
	}
	/**
	 * 获取用户设备绑定类型
	 * @param patient
	 * @return
	 */
	public String getPatientDeviceCategoryCode(String patient){
		if (StringUtils.isNotBlank(patient)){
			String sql = "select Distinct category_code from wlyy_patient_device where user='"+patient+"' and del=0 order by category_code asc";
			List<String> categorys = jdbcTemplate.queryForList(sql,String.class);
			if (categorys.size()>0){
				String categoryStr =  categorys.stream().map(String::valueOf).collect(Collectors.joining(","));
				return categoryStr;
			}
		}
		return "0";
	}
}

+ 4 - 11
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doctor/CareDoctorService.java

@ -2,6 +2,7 @@ package com.yihu.jw.care.service.doctor;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.doorCoach.BaseDoorCoachOrderDao;
import com.yihu.jw.care.service.device.DeviceService;
import com.yihu.jw.care.service.role.RoleService;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
@ -57,6 +58,8 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    private BaseDoorCoachOrderDao baseDoorCoachOrderDao;
    @Autowired
    private ImService imService;
    @Autowired
    private DeviceService deviceService;
    /**
     * 获取医生详情
@ -364,17 +367,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            }else {
                map.put("age", null);
            }
            if (map.get("deviceType")!=null){
                if ("1,2".equals(map.get("deviceType").toString())){
                    map.put("deviceType",3);//deviceType 设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                }
                else {
                    map.put("deviceType",Integer.valueOf(map.get("deviceType").toString()));
                }
            }
            else {
                map.put("deviceType",0);
            }
            map.put("deviceType",deviceService.getPatientDeviceCategoryCode(map.get("id").toString()));
        }
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,size,count);
    }

+ 76 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/family/PatientFamilyMemberService.java

@ -8,6 +8,7 @@ import com.yihu.jw.care.service.wechat.WeiXinAccessTokenUtils;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientFamilyMemberDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.security.MD5;
@ -37,6 +38,8 @@ public class PatientFamilyMemberService extends BaseJpaService<BasePatientFamily
    private ServicePackageSignRecordDao signRecordDao;
    @Autowired
    private WeiXinAccessTokenUtils weiXinAccessTokenUtils;
    @Autowired
    private ImUtil imUtil;
@ -444,6 +447,79 @@ public class PatientFamilyMemberService extends BaseJpaService<BasePatientFamily
        return resultArray;
    }
    /**
     * 获取居民的家庭成员
     */
    public JSONArray membersWithOnLineFlag(String patient) {
        JSONArray resultArray = new JSONArray();
        String sql = "select *,CAST(t2.archive_type as char) as archive_type " +
                " from " +
                "    base_patient_family_member t1, " +
                "    base_patient t2 " +
                " where " +
                "    t2.id in (select family_member from base_patient_family_member where patient = ? ) " +
                "    and t1.patient = ? " +
                "    and t1.family_member = t2.id ";
        List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, new Object[]{patient, patient});
        if (result != null && result.size() > 0) {
            for (Map<String, Object> map : result) {
                JSONObject obj = new JSONObject();
                List<ServicePackageSignRecordDO> signs = signRecordDao.findByStatusAndPatient(1,map.get("family_member").toString());
                boolean jtSign = false;
                int status = 0;
                if(signs.size()>0){
                    jtSign = true;
                    status = 1;
                }
                Integer isAuthorize = (Integer) map.get("is_authorize");
                obj.put("id", map.get("id"));
                obj.put("name", map.get("name"));
                obj.put("isContacts", map.get("is_contacts"));
                obj.put("sex", map.get("sex"));
                obj.put("isAuthorize", isAuthorize);//0:未授权,1:已授权
                obj.put("birthday", map.get("birthday"));
                obj.put("idcard", StringUtils.isEmpty(String.valueOf(map.get("idcard"))) ? "" : map.get("idcard").toString());
                obj.put("photo", map.get("photo"));
                obj.put("mobile", map.get("mobile"));
                obj.put("address", StringUtils.isEmpty(String.valueOf(map.get("address"))) ? "" : map.get("address"));
                obj.put("familyRelation", map.get("family_relation"));
                obj.put("familyRelationName", relations.get(map.get("family_relation")));
                if (jtSign) {
                    obj.put("signType", 1);
                } else {
                    obj.put("signType", 0);
                }
                obj.put("state", "1");//0 :未处理;1:已同意;2:已拒绝
                String archive_type = null;
                Integer onLineFlag =0;
                switch (map.get("archive_type").toString()){
                    case "1":
                        archive_type = "older";//老人
                        break;
                    case "2":
                        archive_type = "child";//新生儿
                        break;
                }
                if (StringUtils.isNotBlank(archive_type)){
                    String onLineStr = imUtil.findByUserIdAndType(map.get("id").toString(),archive_type);
                    JSONObject oneLineObj = JSONObject.parseObject(onLineStr);
                    if (200 == oneLineObj.getInteger("status")){
                        if (oneLineObj.getInteger("data")>0){
                            onLineFlag=1;
                        }
                    }
                }
                obj.put("onLineFlag", onLineFlag);
                resultArray.add(obj);
            }
        }
        return resultArray;
    }
    /**
     * 获取有授权的家庭成员
     *

+ 6 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/label/PatientLableService.java

@ -2,6 +2,7 @@ package com.yihu.jw.care.service.label;
import com.yihu.jw.care.dao.label.WlyyPatientLabelDao;
import com.yihu.jw.care.service.common.DictService;
import com.yihu.jw.care.service.device.DeviceService;
import com.yihu.jw.care.util.ConstantUtil;
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
import com.yihu.jw.restmodel.web.PageEnvelop;
@ -24,6 +25,8 @@ public class PatientLableService extends BaseJpaService<WlyyPatientLabelDO, Wlyy
    private WlyyPatientLabelDao patientLabelDao;
    @Autowired
    private DictService dictService;
    @Autowired
    private DeviceService deviceService;
    /**
     * 按团队查找签约居民的标签统计
@ -58,8 +61,8 @@ public class PatientLableService extends BaseJpaService<WlyyPatientLabelDO, Wlyy
     * @return
     */
    public PageEnvelop<List<Map<String,Object>>> findSignPatientLabelListByTeamCode(String teamCode, String labelCode, String name, int page, int size){
        String sql = "SELECT DISTINCT p.id,p.name,p.photo,p.idcard,p.mobile,p.openid,p.sex " ;
        String countSql = "SELECT count(p.id) ";
        String sql = "SELECT DISTINCT p.id,p.name,p.photo,p.idcard,p.mobile,p.openid,p.sex,p.pad_imei padImei " ;
        String countSql = "SELECT count(DISTINCT p.id) ";
        String filters = "from base_service_package_sign_record sr,base_service_package_record r,  " +
                "                base_service_package_item i,base_patient p,wlyy_patient_label l " +
                "                WHERE sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id  " +
@ -74,6 +77,7 @@ public class PatientLableService extends BaseJpaService<WlyyPatientLabelDO, Wlyy
        for (Map<String,Object> map : list){
            String idcard = map.get("idcard").toString();
            map.put("age", IdCardUtil.getAgeForIdcard(idcard));
            map.put("deviceType",deviceService.getPatientDeviceCategoryCode(map.get("id").toString()));
        }
        Long count = jdbcTemplate.queryForObject(countSql+filters,Long.class);
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);

+ 25 - 5
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/PatientMessageService.java

@ -76,16 +76,36 @@ public class PatientMessageService {
    public List<Map<String,Object>> getSystemMessage(String patient){
        String sql = " select A.*,B.notRead from " +
                "(select  count(1) as 'all',type,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') create_time " +
                "from base_system_message where receiver = '"+patient+"' and del=1 and type='50' GROUP BY type ORDER BY create_time desc)A " +
                "from base_system_message where receiver = '"+patient+"' and del=1  GROUP BY type ORDER BY create_time desc)A " +
                "LEFT JOIN (select count(1) notRead,type " +
                "from base_system_message where receiver = '"+patient+"' and is_read=0 and del=1 and type='50' GROUP BY type)B on A.type = B.type " +
                "from base_system_message where receiver = '"+patient+"' and is_read=0 and del=1  GROUP BY type)B on A.type = B.type " +
                "ORDER BY A.create_time desc ";
        return jdbcTemplate.queryForList(sql);
    }
    public List<Map<String,Object>> getSystemMessageList(String patient,String type){
        String sql = " select id,title,type,relation_code,sender,sender_name,is_read,code,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') create_time " +
                "from base_system_message where receiver = '"+patient+"' and del=1 and type='"+type+"'  ORDER BY create_time desc";
    /**
     *
     * @param patient
     * @param type
     * type=50,code:20紧急救助 22安防监护
     * type=41,code:1 生日祝福
     * type=42,code与体征类型对应 体征设备数据
     *
     * @return
     */
    public List<Map<String,Object>> getSystemMessageList(String patient,String type,String isRead){
        String typeIn = " '"+type.replace(",","','")+"' ";
        String sql = " select id,title,type,relation_code,sender,content,sender_name,is_read,code,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') create_time,data " +
                "from base_system_message where receiver = '"+patient+"' and del=1 and type in ("+typeIn+" )  " ;
        if (StringUtils.isNotBlank(isRead)){
            if ("1".equals(isRead)){
                sql += " and is_read = '1'";
            }else {
                sql += " and ( is_read = '0' or is_read is null ) ";
            }
        }
         sql +=  "ORDER BY create_time desc";
        return jdbcTemplate.queryForList(sql);
    }

+ 134 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java

@ -13,7 +13,7 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
import com.yihu.jw.entity.care.sign.CapacityAssessmentRecordDO;
import com.yihu.jw.entity.patient.Patient;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.service.BasePatientMedicardCardService;
import com.yihu.jw.restmodel.ResponseContant;
@ -60,6 +60,8 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
    private CapacityAssessmentRecordService capacityAssessmentRecordService;
    @Autowired
    private PatientFamilyMemberService familyMemberService;
    @Autowired
    private ImUtil imUtil;
    /**
     * 签约记录
@ -194,6 +196,7 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
        patientBrief.setArchiveType(patientDetail.getArchiveType());
        patientBrief.setSsc(patientDetail.getSsc());
        patientBrief.setMedicareNumber(patientDetail.getMedicareNumber());
        patientBrief.setResidentialArea(patientDetail.getResidentialArea());
        if (StringUtils.isNotBlank(patientDetail.getMobile())){
            patientBrief.setMobile(patientDetail.getMobile());
        }
@ -389,4 +392,134 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
        return result;
    }
    /**
     *
     * @param type 类型:1幼儿,2老人,3助老员,4医生。不传返回四个类型的数据
     * @param name 姓名
     * @param residentialArea 居住小区
     * @return
     */
    public JSONObject findUserByType(String type,String name,String residentialArea,Integer page,Integer size){
        JSONObject re = new JSONObject();
        if(page == null){
            page = 1;
        }
        if(size == null){
            size = 3;
        }
        String online= imUtil.getOnlineListByType(null);
        JSONObject json = JSON.parseObject(online).getJSONObject("data");
        String limit = " limit "+(page-1)*size+","+size;
        if("1".equals(type)||StringUtil.isBlank(type)){
            List<Map<String,Object>> list = findChild(name,residentialArea,limit,json.getJSONObject("child"));
            re.put("child",list);
        }
        if("2".equals(type)||StringUtil.isBlank(type)){
            List<Map<String,Object>> list = findOld(name,residentialArea,limit,json);
            re.put("old",list);
        }
        if("3".equals(type)||StringUtil.isBlank(type)){
            List<Map<String,Object>> list = findHelper(name,limit,json.getJSONObject("helper"));
            re.put("helper",list);
        }
        return re;
    }
    /**
     * 查找幼儿
     * @param name
     * @param residentialArea
     * @param limit
     * @param json
     * @return
     */
    public List<Map<String,Object>> findChild(String name,String residentialArea,String limit,JSONObject json){
        String sql = "SELECT id,name,photo from base_patient WHERE archive_type = 2 and del = '1' ";
        if(!StringUtil.isBlank(name)){
            sql+= " and name like '%"+name+"%' ";
        }
        if(!StringUtil.isBlank(residentialArea)){
            sql+= " and residential_area = '"+residentialArea+"' ";
        }
        sql+=limit;
        List<Map<String,Object>>  list = jdbcTemplate.queryForList(sql);
        String sqlCount = "SELECT COUNT(*) from base_door_coach_order where `status` = 6";
        for (Map<String,Object> map:list){
            String paientId = map.get("id").toString();
            String filter = " and patient = '"+paientId+"'";
            Integer count = jdbcTemplate.queryForObject(sqlCount+filter,Integer.class);
            map.put("online",json.containsKey(paientId));
            map.put("doorCoach",count);
        }
        return list;
    }
    /**
     * 查找老人
     * @param name
     * @param residentialArea
     * @param limit
     * @param json
     * @return
     */
    public List<Map<String,Object>> findOld(String name,String residentialArea,String limit,JSONObject json){
        String sql = "SELECT id,name,photo from base_patient WHERE archive_type = 1 and del = '1' ";
        if(!StringUtil.isBlank(name)){
            sql+= " and name like '%"+name+"%' ";
        }
        if(!StringUtil.isBlank(residentialArea)){
            sql+= " and residential_area = '"+residentialArea+"' ";
        }
        sql+=limit;
        List<Map<String,Object>>  list = jdbcTemplate.queryForList(sql);
        String sqlLife= "SELECT COUNT(*) from base_life_care_order where `status` = 2";
        String sqlEmergency= "SELECT COUNT(*) from base_emergency_assistance_order where `status` = 0";
        String sqlSecurity= "SELECT COUNT(*) from base_security_monitoring_order where `status` = 7 ";
        for (Map<String,Object> map:list){
            String paientId = map.get("id").toString();
            String filter = " and patient = '"+paientId+"'";
            Integer lifeCare = jdbcTemplate.queryForObject(sqlLife+filter,Integer.class);
            Integer emergency = jdbcTemplate.queryForObject(sqlEmergency+filter,Integer.class);
            Integer security = jdbcTemplate.queryForObject(sqlSecurity+filter,Integer.class);
            map.put("onlinePad",json.getJSONObject("olderPad").containsKey(paientId));
            map.put("onlineWx",json.getJSONObject("olderWx").containsKey(paientId));
            map.put("lifeCare",lifeCare);
            map.put("emergency",emergency);
            map.put("security",security);
        }
        return list;
    }
    /**
     * 查找助老员
     * @param name
     * @param limit
     * @param json
     * @return
     */
    public List<Map<String,Object>> findHelper(String name,String limit,JSONObject json){
        String sql = "SELECT id,name,photo from base_doctor WHERE doctor_level = 2 and del = '1' ";
        if(!StringUtil.isBlank(name)){
            sql+= " and name like '%"+name+"%' ";
        }
        sql+=limit;
        List<Map<String,Object>>  list = jdbcTemplate.queryForList(sql);
        String sqlLife= "SELECT COUNT(*) from base_life_care_order where `status` = 2";
        String sqlEmergency= "SELECT COUNT(*) from base_emergency_assistance_order where `status` = 0";
        String sqlSecurity= "SELECT COUNT(*) from base_security_monitoring_order where `status` = 7 ";
        for (Map<String,Object> map:list){
            String doctorId = map.get("id").toString();
            String filter = " and doctor = '"+doctorId+"'";
            Integer lifeCare = jdbcTemplate.queryForObject(sqlLife+filter,Integer.class);
            Integer emergency = jdbcTemplate.queryForObject(sqlEmergency+filter,Integer.class);
            Integer security = jdbcTemplate.queryForObject(sqlSecurity+filter,Integer.class);
            map.put("online",json.containsKey(doctorId));
            map.put("lifeCare",lifeCare);
            map.put("emergency",emergency);
            map.put("security",security);
        }
        return list;
    }
}

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/pay/PayService.java

@ -602,7 +602,7 @@ public class PayService {
        reqMap.put("mch_id", mchId);
        reqMap.put("nonce_str", noceStr);
        // 此路径是微信服务器调用支付结果通知路径
        reqMap.put("notify_url", "https://zhyzh.hzxc.gov.cn/cloudCare/pay/open/wxPayNotify");
        reqMap.put("notify_url", "https://zhyzh.gongshu.gov.cn/cloudCare/pay/open/wxPayNotify");
        reqMap.put("out_trade_no", businessOrderDO.getOrderNo());
        reqMap.put("spbill_create_ip", IpUtil.getOneIpAddress(request));
        reqMap.put("product_id", businessOrderDO.getOrderNo());
@ -682,7 +682,7 @@ public class PayService {
        reqMap.put("mch_id", mchId);
        reqMap.put("nonce_str", noceStr);
        // 此路径是微信服务器调用支付结果通知路径
        reqMap.put("notify_url", "https://zhyzh.hzxc.gov.cn/cloudCare/pay/open/wxPayNotify");
        reqMap.put("notify_url", "https://zhyzh.gongshu.gov.cn/cloudCare/pay/open/wxPayNotify");
        reqMap.put("out_trade_no", businessOrderDO.getOrderNo());
        reqMap.put("spbill_create_ip", IpUtil.getOneIpAddress(request));
        reqMap.put("product_id", businessOrderDO.getOrderNo());

+ 23 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageService.java

@ -15,6 +15,7 @@ import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.entity.care.apply.PatientBedApplyDo;
import com.yihu.jw.entity.care.archive.ArchiveDO;
import com.yihu.jw.entity.care.sign.CapacityAssessmentRecordDO;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.service.BasePatientMedicardCardService;
import com.yihu.jw.restmodel.ResponseContant;
@ -72,6 +73,8 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
    private StringRedisTemplate redisTemplate;
    @Autowired
    private PatientBedApplyDao bedApplyDao;
    @Autowired
    private ImUtil imUtil;
    /**
     * 查找签约机构
@ -520,8 +523,8 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
        return result;
    }
    public List<Map<String,Object>> getServerDoctorAll(String patient){
        String sql="select DISTINCT doc.id doctor,CONCAT(doc.`name`,CASE WHEN doc.doctor_level=1 THEN '(社区医生)' ELSE '(助老员)' END) as name,doc.photo,doc.mobile\n" +
    public List<Map<String,Object>> getServerDoctorAll(String patient,String onlineFlag){
        String sql="select DISTINCT doc.id doctor,CONCAT(doc.`name`,CASE WHEN doc.doctor_level=1 THEN '(社区医生)' ELSE '(助老员)' END) as name,doc.photo,doc.mobile,0 as onLineFlag\n" +
                "from base_service_package_item item ,base_service_package pack,base_team_member mem,base_doctor doc\n" +
                "where item.service_package_id in (\n" +
                "SELECT spc.service_package_id FROM base_service_package_record spc ,base_service_package_sign_record spsr\n" +
@ -529,6 +532,24 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
                ") and item.service_package_id = pack.id\n" +
                "and item.team_code = mem.team_code and mem.doctor_code = doc.id and mem.del=1 and pack.del=1 and item.del = 1";
        List<Map<String,Object>>result = jdbcTemplate.queryForList(sql);
        if ("1".equals(onlineFlag)){//展示是否在线
            String listStr = imUtil.getOnlineListByType("helper");
            JSONObject onLineObj  = JSONObject.parseObject(listStr);
            if (200 == onLineObj.getInteger("status")){
                JSONObject oneLineInfo = onLineObj.getJSONObject("helper");
                for (Map<String,Object>tmp:result){
                    String doctorCode = tmp.get("doctor").toString();
                    if (oneLineInfo.containsKey(doctorCode)){
                        if (oneLineInfo.getInteger(doctorCode)>0){
                            tmp.put("onLineFlag",1);
                        }
                    }
                }
            }
            else {
                logger.info("获取用户在线列表失败:"+patient);
            }
        }
        return result;
    }

+ 98 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/StatisticsService.java

@ -1,5 +1,6 @@
package com.yihu.jw.care.service.statistics;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.util.ConstantUtil;
@ -9,6 +10,7 @@ import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.es.util.ElasticsearchUtil;
import com.yihu.jw.es.util.SaveModel;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.collections.map.HashedMap;
@ -45,6 +47,8 @@ public class StatisticsService {
    private BaseOrgDao orgDao;
    @Autowired
    private StatisticsUtilService statisticsUtilService;
    @Autowired
    private ImUtil imUtil;
    private static final String defalutArea = "330100";
@ -156,6 +160,100 @@ public class StatisticsService {
        return json;
    }
    /**
     * 平台人员实时统计
     */
    public JSONObject platformPeople(){
        JSONObject result = new JSONObject();
        Integer olderTotal = 0;
        Integer childTotal = 0;
        Integer helperTotal = 0;
        Integer teacherTotal = 0;
        //老人 儿童注册人数
        String sql1 = "SELECT COUNT(*) c,archive_type from base_patient WHERE archive_type is  not null and del='1' GROUP BY archive_type";
        List<Map<String,Object>> list1 = jdbcTemplate.queryForList(sql1);
        for(Map<String,Object> map:list1){
            String archive_type = map.get("archive_type").toString();
            Integer num = Integer.valueOf(map.get("c").toString());
            if("1".equals(archive_type)){
                olderTotal = num;
                continue;
            }
            if("2".equals(archive_type)){
                childTotal = num;
            }
        }
        //助老员和教师注册人数
        String sql2 = "SELECT COUNT(a.id) c,a.doctor_level from base_doctor a,base_doctor_hospital h where a.id=h.doctor_code and a.del = '1' and h.del = '1' " +
                "and a.doctor_level is not null and h.org_code not in ( " +
                "SELECT dict_code from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org'  " +
                ") GROUP BY a.doctor_level";
        List<Map<String,Object>> list2 = jdbcTemplate.queryForList(sql2);
        for(Map<String,Object> map:list2){
            String archive_type = map.get("doctor_level").toString();
            Integer num = Integer.valueOf(map.get("c").toString());
            if("2".equals(archive_type)){
                helperTotal = num;
                continue;
            }
            if("3".equals(archive_type)){
                teacherTotal = num;
            }
        }
        //helper 助老员,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
        String onlineCount = imUtil.getOnlineCountByType("");
        JSONObject jsonObject = JSON.parseObject(onlineCount).getJSONObject("data");
        //olderPad":0,"olderWx":0,"child":0,"teacher":0,"helper":0
        Integer helperOn = jsonObject.getInteger("helper");
        Integer teacherOn = jsonObject.getInteger("teacher");
        Integer childOn = jsonObject.getInteger("child");
        Integer olderWxOn = jsonObject.getInteger("olderWx");
        Integer olderPadOn = jsonObject.getInteger("olderPad");
        int repeatNum = 0;
        if(olderWxOn>0&&olderPadOn>0){
            //2个都大于0 要计算重复的人数
            String onlineOlderWx = imUtil.getOnlineListByType("olderWx");
            JSONObject olderWx = JSON.parseObject(onlineOlderWx);
            List<String> list = new ArrayList(olderWx.size());
            olderWx.entrySet().stream().forEach(one->{
                list.add(one.getKey());
            });
            String onlineOlderPad = imUtil.getOnlineListByType("olderPad");
            JSONObject olderPad = JSON.parseObject(onlineOlderPad);
            for (Map.Entry<String,Object> s:olderPad.entrySet()){
                if(list.contains(s.getKey())){
                    repeatNum++;
                }
            }
        }
        Integer olderOff = olderTotal - olderWxOn - olderPadOn + repeatNum;
        olderOff = olderOff>0?olderOff:0;
        Integer childOff = childTotal - childOn;
        Integer helperOff = helperTotal - helperOn;
        Integer teacherOff = teacherTotal - teacherOn;
        result.put("olderTotal",olderTotal);
        result.put("childTotal",childTotal);
        result.put("helperTotal",helperTotal);
        result.put("teacherTotal",teacherTotal);
        result.put("helperOn",helperOn);
        result.put("teacherOn",teacherOn);
        result.put("childOn",childOn);
        result.put("olderWxOn",olderWxOn);
        result.put("olderPadOn",olderPadOn);
        result.put("childOff",childOff);
        result.put("helperOff",helperOff);
        result.put("teacherOff",teacherOff);
        result.put("olderOff",olderOff);
        return result;
    }
    /**
     * 统计总数
     * @param endDate

+ 6 - 6
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/wechat/WeiXinEventProcess.java

@ -144,36 +144,36 @@ public class WeiXinEventProcess {
    public void setUrlItems(List<Map<String, String>> articles) {
        Map<String, String> articleBooking = new HashMap<>();
        // 图文URL
        String urlBooking = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=https%3A%2F%2Fzhyzh.hzxc.gov.cn%2Fmedical-care-patient%2Fhome%2Findex&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect";
        String urlBooking = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=https%3A%2F%2Fzhyzh.gongshu.gov.cn%2Fmedical-care-patient%2Fhome%2Findex&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect";
        urlBooking = urlBooking.replace("{appId}", appId);
        articleBooking.put("Url", urlBooking);
        articleBooking.put("Title", "你好啊,欢迎来到朝晖云照护!");
        articleBooking.put("Description", "这里是智慧养老和健康管理服务社区+幼儿成长教育服务平台\n" +
                "我们陪你一起,关爱老人,呵护孩子!\n" +
                "感谢关注,点击下方菜单直接进入朝晖云照护平台");
        articleBooking.put("PicUrl", "https://zhyzh.hzxc.gov.cn/image/index.png");
        articleBooking.put("PicUrl", "https://zhyzh.gongshu.gov.cn/image/index.png");
        articles.add(articleBooking);
        Map<String, String> articleDevice = new HashMap<>();
        // 图文URL
        String urlDevice = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=https%3A%2F%2Fzhyzh.hzxc.gov.cn%2Fmedical-care-patient%2FonlineRegistration%2Findex&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect";
        String urlDevice = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=https%3A%2F%2Fzhyzh.gongshu.gov.cn%2Fmedical-care-patient%2FonlineRegistration%2Findex&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect";
        urlDevice = urlDevice.replace("{appId}", appId);
        articleDevice.put("Url", urlDevice);
        articleDevice.put("Title", "在线入园");
        articleDevice.put("Description", "申请专业托育机构入园资格");
        articleDevice.put("PicUrl", "https://zhyzh.hzxc.gov.cn/image/doorCoach.png");
        articleDevice.put("PicUrl", "https://zhyzh.gongshu.gov.cn/image/doorCoach.png");
        articles.add(articleDevice);
        Map<String, String> articleFamily = new HashMap<>();
        // 图文URL
        String urlFamily = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=https%3A%2F%2Fzhyzh.hzxc.gov.cn%2Fmedical-care-patient%2FlifeCare%2Findex&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect";
        String urlFamily = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=https%3A%2F%2Fzhyzh.gongshu.gov.cn%2Fmedical-care-patient%2FlifeCare%2Findex&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect";
        urlFamily = urlFamily.replace("{appId}", appId);
        articleFamily.put("Url", urlFamily);
        articleFamily.put("Title", "上门预约");
        articleFamily.put("Description", "预约幼儿教育专家上门育儿指导");
        articleFamily.put("PicUrl", "https://zhyzh.hzxc.gov.cn/image/online.png");
        articleFamily.put("PicUrl", "https://zhyzh.gongshu.gov.cn/image/online.png");
        articles.add(articleFamily);
    }

+ 8 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/MessageUtil.java

@ -96,7 +96,7 @@ public class MessageUtil {
     * @param json 用于对跳转连接的修改,
     * @param keywords
     */
    public void putTemplateWxMessage(String wechatId, String templateName, String scene, String openId, String first
    public boolean putTemplateWxMessage(String wechatId, String templateName, String scene, String openId, String first
            ,String url, String remark, Integer type,JSONObject json,String ...keywords) {
        try {
            System.out.println(wechatId);
@ -104,14 +104,14 @@ public class MessageUtil {
            if (wxAccessTokenDO == null) {
                logger.info("wx_access_token表获取为空,wechatId" + wechatId);
                return;
                return false;
            }
            WxTemplateConfigDO templateConfig = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, templateName, scene, 1);
            WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
            BeanUtils.copyProperties(templateConfig,newConfig);
            if (newConfig == null) {
                logger.info("微信模板不存在!请确认wechatId:" + wechatId + ",templateName:" + templateName + ",scene:" + scene);
                return;
                return false;
            }
            logger.info("微信模板推送前");
            if (StringUtils.isNoneBlank(first)){
@ -163,9 +163,11 @@ public class MessageUtil {
            //发起微信消息模板推送
            weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), openId, newConfig);
            logger.info("微信模板消息推送后");
            return true;
        } catch (Exception e) {
            logger.info("微信模板推送异常");
            e.printStackTrace();
            return false;
        }
    }
@ -207,6 +209,9 @@ public class MessageUtil {
                }
                wxTemplateConfigDO.setUrl(url + urlStr );
                break;
            case 26://生日祝福
                wxTemplateConfigDO.setUrl(wxTemplateConfigDO.getUrl()+"?openid=" + openid + "&content=" + json.getString("content") + "&doctorName=" + json.getString("doctorName") + "&toUser=" + json.getString("toUser")  + "&toName=" + json.getString("name") + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                break;
            case 30:
                //反馈通知 测试 TPbq9m0SAiVfRhXtXq17SDmYIfrJ8Whp2NpSrq9wlfI
                if(json.containsKey("consult")) {

+ 3 - 3
svr/svr-cloud-care/src/main/resources/application.yml

@ -429,7 +429,7 @@ spring:
    port: 6379  # Redis server port.
    password: Kb6wKDQP1W4
fastDFS:
  fastdfs_file_url: https://zhyzh.hzxc.gov.cn/fastdfs/
  fastdfs_file_url: https://zhyzh.gongshu.gov.cn/fastdfs/
fast-dfs:
  tracker-server: 10.18.43.40:22122 #服务器地址
# 短信验证码发送的客户端标识,居民端
@ -455,7 +455,7 @@ wechat:
  apiKey: zhongjianxinlianxiamenkejiyouxia
  mchId: 1611059985
  wechat_token: 27eb3bb24f149a7760cf1bb154b08041
  wechat_base_url: https%3A%2F%2Fzhyzh.hzxc.gov.cn%2FcloudCare%2F
  wechat_base_url: https%3A%2F%2Fzhyzh.gongshu.gov.cn%2FcloudCare%2F
  accId: gh_da06ed9e5751
  id: hz_yyyzh_wx  # base库中,wx_wechat 的id字段
  flag: true #演示环境  true走Mysql数据库  false走Oracle
@ -511,4 +511,4 @@ base:
  hospitalUrl: http://127.0.0.7:10022/
cloudCare:
  deviceUrl: https://zhyzh.hzxc.gov.cn/device/
  deviceUrl: https://zhyzh.gongshu.gov.cn/device/

+ 1 - 1
svr/svr-cloud-care/src/main/resources/wechat/weixin_menu.txt

@ -3,7 +3,7 @@
   {
	  "name":"进入云照护",
	  "type":"view",
      "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx2c55f5b7b2f3cb56&redirect_uri=https%3A%2F%2Fzhyzh.hzxc.gov.cn%2Fmedical-care-patient%2Fhome%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
      "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx2c55f5b7b2f3cb56&redirect_uri=https%3A%2F%2Fzhyzh.gongshu.gov.cn%2Fmedical-care-patient%2Fhome%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
   }
]
}

+ 1 - 1
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/endpoint/DeviceController.java

@ -226,7 +226,7 @@ public class DeviceController {
        }
    }
    @ApiOperation("柏颐设备步数接收")
    @ApiOperation("设备步数接收")
    @RequestMapping(value = "bySteps", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String bySteps(
            @ApiParam(name="imei",required = false,value="15位设备唯一序号",defaultValue = "")

+ 97 - 7
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceService.java

@ -1,7 +1,9 @@
package com.yihu.jw.care.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yihu.jw.care.config.AqgConfig;
import com.yihu.jw.care.dao.device.DevicePatientHealthIndexDao;
import com.yihu.jw.care.dao.device.DeviceSosLogDao;
@ -10,11 +12,15 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.entity.care.device.DeviceSosLogDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.common.GpsUtil;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.healthIndex.HealthIndexUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
@ -64,6 +70,12 @@ public class DeviceService {
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private GpsUtil gpsUtil;
    @Autowired
    private SystemMessageDao systemMessageDao;
    @Autowired
    private HealthIndexUtil healthIndexUtil;
    @Autowired
    private ImUtil imUtil;
    /**
     * 获取爱牵挂管理员cookie
@ -329,9 +341,9 @@ public class DeviceService {
    @Async
    public void byHeartRate(String imei,String time_begin,int heartrate,int theshold_heartrate_h,int theshold_heartrate_l) {
        try {
            if(StringUtils.isNotBlank(imei)){
            if(StringUtils.isNotBlank(imei)) {
                List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByDeviceSn(imei);
                if (devicePatientDeviceDos.size()>0){
                if (devicePatientDeviceDos.size() > 0) {
                    DevicePatientDevice devicePatientDevice = devicePatientDeviceDos.get(0);
                    BasePatientDO patientDO = patientDao.findById(devicePatientDevice.getUser());
                    DevicePatientHealthIndex patientHealthIndex = new DevicePatientHealthIndex();
@ -339,23 +351,62 @@ public class DeviceService {
                    patientHealthIndex.setDeviceSn(imei);
                    patientHealthIndex.setUser(devicePatientDevice.getUser());
                    patientHealthIndex.setIdcard(devicePatientDevice.getUserIdcard());
                    patientHealthIndex.setValue1(heartrate+"");
                    patientHealthIndex.setValue1(heartrate + "");
                    patientHealthIndex.setType(5);
                    Date recordDate = DateUtil.strToDate(time_begin);
                    patientHealthIndex.setRecordDate(recordDate);
                    patientHealthIndex.setSortDate(recordDate);
                    patientHealthIndex.setCzrq(new Date());
                    if (heartrate>=theshold_heartrate_h||heartrate<=theshold_heartrate_l){
                    if (heartrate >= theshold_heartrate_h || heartrate <= theshold_heartrate_l) {
                        patientHealthIndex.setStatus(1);
                    }
                    else {
                    } else {
                        patientHealthIndex.setStatus(0);
                    }
                    patientHealthIndex.setDel("1");
                    healthIndexDao.save(patientHealthIndex);
                    SystemMessageDO messageDO = new SystemMessageDO();
                    String typeName = "您有新的心率测量记录。心率:" + patientHealthIndex.getValue1() + "次/min";
                    messageDO.setTitle(typeName);
                    messageDO.setType("52");//52体征测量
                    messageDO.setSender("system");
                    messageDO.setSenderName("养护助手");
                    messageDO.setRelationCode(patientHealthIndex.getId() + "");
                    messageDO.setReceiver(patientDO.getId());
                    messageDO.setReceiverName(patientDO.getName());
                    messageDO.setOver("1");
                    messageDO.setCode("5");//与体征类型对应
                    JSONArray errorIndex = healthIndexUtil.verifyHealthIndex(5,patientHealthIndex.getValue1(),patientHealthIndex.getValue2(),
                            patientHealthIndex.getValue3(),patientHealthIndex.getValue4(),patientHealthIndex.getValue5(),patientHealthIndex.getValue6(),
                            patientHealthIndex.getValue7());
                    messageDO.setData(JSON.toJSONString(errorIndex,SerializerFeature.WriteNullStringAsEmpty));
                    messageDO.setDel("1");
                    messageDO.setCreateTime(new Date());
                    //推送socket
                    com.alibaba.fastjson.JSONObject message = new com.alibaba.fastjson.JSONObject();
                    message.put("title","您刚刚测量了一次心率");
                    message.put("code",messageDO.getCode());
                    message.put("content",messageDO.getData());
                    message.put("relation_code",messageDO.getRelationCode());
                    message.put("content_type",42);
                    message.put("content_notice","");
                    String content_notice = null;
                    for (int i=0;i<errorIndex.size();i++){
                        com.alibaba.fastjson.JSONObject tmp = errorIndex.getJSONObject(i);
                        if (1 == tmp.getInteger("error")){
                            content_notice += tmp.getString("indexName")+"、";
                        }
                    }
                    if (org.apache.commons.lang3.StringUtils.isNotBlank(content_notice)){
                        content_notice = content_notice.substring(0,content_notice.length()-1);
                        message.put("content_notice","您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1",content_notice));
                        messageDO.setContent("您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1",content_notice));
                    }
                    systemMessageDao.save(messageDO);
                    imUtil.sendPatientSystemMessage(messageDO.getReceiver(),JSON.toJSONString(message,SerializerFeature.WriteMapNullValue));
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
@ -398,6 +449,45 @@ public class DeviceService {
                    }
                    patientHealthIndex.setDel("1");
                    healthIndexDao.save(patientHealthIndex);
                    SystemMessageDO messageDO = new SystemMessageDO();
                    String typeName = "您有新的血压测量记录:收缩压:"+patientHealthIndex.getValue1()+"mmHg,收缩压:"
                            +patientHealthIndex.getValue2()+"mmHg,脉搏:"+patientHealthIndex.getValue3()+"次/min";
                    messageDO.setTitle(typeName);
                    messageDO.setType("52");//52体征测量
                    messageDO.setSender("system");
                    messageDO.setSenderName("养护助手");
                    messageDO.setRelationCode(patientHealthIndex.getId() + "");
                    messageDO.setReceiver(patientDO.getId());
                    messageDO.setReceiverName(patientDO.getName());
                    messageDO.setOver("1");
                    messageDO.setCode("2");//与体征类型对应
                    JSONArray errorIndex = healthIndexUtil.verifyHealthIndex(2,patientHealthIndex.getValue1(),patientHealthIndex.getValue2(),patientHealthIndex.getValue3());
                    messageDO.setData(JSON.toJSONString(errorIndex,SerializerFeature.WriteNullStringAsEmpty));
                    messageDO.setDel("1");
                    messageDO.setCreateTime(new Date());
                    //推送socket
                    com.alibaba.fastjson.JSONObject message = new com.alibaba.fastjson.JSONObject();
                    message.put("title","您刚刚测量了一次血压");
                    message.put("code",messageDO.getCode());
                    message.put("content",messageDO.getData());
                    message.put("relation_code",messageDO.getRelationCode());
                    message.put("content_type",42);
                    message.put("content_notice","");
                    String content_notice = "";
                    for (int i=0;i<errorIndex.size();i++){
                        com.alibaba.fastjson.JSONObject tmp = errorIndex.getJSONObject(i);
                        if (1 == tmp.getInteger("error")){
                            content_notice += tmp.getString("indexName")+"、";
                        }
                    }
                    if (org.apache.commons.lang3.StringUtils.isNotBlank(content_notice)){
                        content_notice = content_notice.substring(0,content_notice.length()-1);
                        message.put("content_notice","您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1",content_notice));
                        messageDO.setContent("您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1",content_notice));
                    }
                    systemMessageDao.save(messageDO);
                    imUtil.sendPatientSystemMessage(messageDO.getReceiver(),JSON.toJSONString(message,SerializerFeature.WriteMapNullValue));
                }
            }

+ 72 - 1
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceUploadService.java

@ -1,5 +1,8 @@
package com.yihu.jw.care.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.care.dao.device.DeviceDetailDao;
import com.yihu.jw.care.dao.device.DeviceInfoDao;
@ -11,9 +14,14 @@ import com.yihu.jw.entity.care.device.DeviceDetail;
import com.yihu.jw.entity.care.device.DeviceInfo;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.healthIndex.HealthIndexUtil;
import com.yihu.jw.utils.StringUtil;
import jdk.management.resource.internal.inst.FileOutputStreamRMHooks;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@ -44,8 +52,14 @@ public class DeviceUploadService {
    private PatientDeviceDao patientDeviceDao;
    @Autowired
    private DevicePatientHealthIndexDao patientHealthIndexDao;
    @Autowired
    private SystemMessageDao systemMessageDao;
    @Autowired
    private HealthIndexUtil healthIndexUtil;
    @Autowired
    private ImUtil imUtil;
    public Result uploadDevicesData(String dataJson) {
    public Result uploadDevicesData(String dataJson)throws Exception {
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            Map<String, Object> map = objectMapper.readValue(dataJson, Map.class);
@ -102,6 +116,63 @@ public class DeviceUploadService {
                logger.info("This device is not relate patient!:====="+dataJson);
                throw new Exception("This device is not relate patient!");
            }
            //保存消息
            BasePatientDO patientDO = patientDao.findById(result.getUser());
            if (null != patientDO){
                SystemMessageDO messageDO = new SystemMessageDO();
                String typeName = null;
                String typeName2 = null;
                switch (type){
                    case "1":
                        typeName = "您有新的血糖测量记录:血糖浓度:"+result.getValue1()+"mmol/L";
                        typeName2 = "您刚刚测量了一次血糖";
                        break;
                    case "2":
                        typeName = "您有新的血压测量记录:收缩压:"+result.getValue1()+"mmHg,舒张压:"
                                +result.getValue2()+"mmHg,脉搏:"+result.getValue3()+"次/min";
                        typeName2 = "您刚刚测量了一次血压";
                        break;
                }
                if (StringUtils.isNotBlank(typeName)){
                    messageDO.setTitle(typeName);
                    messageDO.setType("42");//42体征设备测量
                    messageDO.setSender("system");
                    messageDO.setSenderName("养护助手");
                    messageDO.setRelationCode(result.getId()+"");
                    messageDO.setReceiver(patientDO.getId());
                    messageDO.setReceiverName(patientDO.getName());
                    messageDO.setOver("1");
                    messageDO.setCode(type);//与体征类型对应
                    JSONArray errorIndex = healthIndexUtil.verifyHealthIndex(Integer.parseInt(type),result.getValue1(),result.getValue2(),
                            result.getValue3(),result.getValue4(),result.getValue5(),result.getValue6(),
                            result.getValue7());
                    messageDO.setData(JSON.toJSONString(errorIndex,SerializerFeature.WriteNullStringAsEmpty));
                    messageDO.setDel("1");
                    messageDO.setCreateTime(new Date());
                    //推送socket
                    com.alibaba.fastjson.JSONObject message = new com.alibaba.fastjson.JSONObject();
                    message.put("title",typeName2);
                    message.put("code",messageDO.getCode());
                    message.put("content",messageDO.getData());
                    message.put("relation_code",messageDO.getRelationCode());
                    message.put("content_type",42);
                    message.put("content_notice","");
                    String content_notice = "";
                    for (int i=0;i<errorIndex.size();i++){
                        com.alibaba.fastjson.JSONObject tmp = errorIndex.getJSONObject(i);
                        if (1 == tmp.getInteger("error")){
                            content_notice += tmp.getString("indexName")+"、";
                        }
                    }
                    if (StringUtils.isNotBlank(content_notice)){
                        content_notice = content_notice.substring(0,content_notice.length()-1);
                        message.put("content_notice","您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1",content_notice));
                        messageDO.setContent("您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1",content_notice));
                    }
                    systemMessageDao.save(messageDO);
                    imUtil.sendPatientSystemMessage(messageDO.getReceiver(),JSON.toJSONString(message,SerializerFeature.WriteMapNullValue));
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            logger.error(e.getMessage());

+ 2 - 2
svr/svr-cloud-job/src/main/resources/application.yml

@ -138,7 +138,7 @@ wechat:
  appId: wx2c55f5b7b2f3cb56
  appSecret: 0dd9927e58125ad5f0efb9299860d145
  wechat_token: 27eb3bb24f149a7760cf1bb154b08041
  wechat_base_url: https%3A%2F%2Fzhyzh.hzxc.gov.cn%2Fcityihealth%2FcloudCare%2F
  wechat_base_url: https%3A%2F%2Fzhyzh.gongshu.gov.cn%2Fcityihealth%2FcloudCare%2F
  accId: gh_da06ed9e5751
  id: hz_yyyzh_wx  # base库中,wx_wechat 的id字段
  flag: true #演示环境  true走Mysql数据库  false走Oracle
@ -196,7 +196,7 @@ wechat:
  appId: wx2c55f5b7b2f3cb56
  appSecret: 0dd9927e58125ad5f0efb9299860d145
  wechat_token: 27eb3bb24f149a7760cf1bb154b08041
  wechat_base_url: https%3A%2F%2Fzhyzh.hzxc.gov.cn%2Fcityihealth%2FcloudCare%2F
  wechat_base_url: https%3A%2F%2Fzhyzh.gongshu.gov.cn%2Fcityihealth%2FcloudCare%2F
  accId: gh_da06ed9e5751
  id: hz_yyyzh_wx  # base库中,wx_wechat 的id字段
  flag: true #演示环境  true走Mysql数据库  false走Oracle

+ 75 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/config/JDBCUtils.java

@ -0,0 +1,75 @@
package com.yihu.jw.config;
import lombok.extern.slf4j.Slf4j;
import java.io.InputStream;
import java.sql.*;
import java.util.LinkedList;
import java.util.Properties;
import java.util.Queue;
/**
 * @ClassName: JDBCUtils
 * @Description: 实现连接池效果,初始化10个JDBC连接对象并放入池中,提供方法每次返回一个对象
 * @Author: xuezhouyi
 * @Version: V1.0
 **/
@Slf4j
public class JDBCUtils {
    public static void main(String[] args) {
        update();
    }
    public static void update() {
        Connection connection=null;
        String driverName="com.microsoft.sqlserver.jdbc.SQLServerDriver";//SQL数据库引擎
        String dbURL="jdbc:sqlserver://172.26.0.89:1433;DatabaseName=testbase";//数据源  !!!注意若出现加载或者连接数据库失败一般是这里出现问题
        String Name="sa";
        String Pwd="jkzlehr@2021";
        try{
            Class.forName(driverName);
            connection=DriverManager.getConnection(dbURL,Name,Pwd);
            System.out.println("连接数据库成功");
        }catch(Exception e){
            e.printStackTrace();
            System.out.println("连接失败");
        }
        Statement stmt = null;
        try {
            stmt = connection.createStatement();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        //增删改操作
        String sql_1="insert into base_operate_log values('123','JKDA','查询健康档案','402803816babc778016babca6d540008','梁敬兴','白海灵','白海灵','2021-06-04 11:39:30','','','1')";
        int count_1 = 0;
        try {
            count_1 = stmt.executeUpdate(sql_1);
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }//返回值表示增删改几条数据
        //处理结果
        if(count_1>0){
            System.out.println("更新成功!");
        }
        //查询操作
        String sql_2="select * from student";
        //关闭
        try {
            stmt.close();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        try {
            connection.close();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

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

@ -204,10 +204,8 @@ public class SyncWlyyHospitalService {
                    }
                    WlyyAdminTeamMemberDO wlyyAdminTeamMemberDO=wlyyAdminTeamMemberDao.findOne(wlyyAdminTeamMember.getId());
                    if(wlyyAdminTeamMemberDO==null){
                        wlyyAdminTeamMemberDO.setLastModified(new Date());
                        addCount++;
                    }else{
                        wlyyAdminTeamMemberDO.setLastModified(new Date());
                        updateCount++;
                    }
                    wlyyAdminTeamMemberDao.save(wlyyAdminTeamMember);

+ 7 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/complaint/BaseComplaintEndPoint.java

@ -7,6 +7,7 @@ import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -181,10 +182,12 @@ public class BaseComplaintEndPoint  extends EnvelopRestEndpoint {
                          @RequestParam(value = "complaintId", required = false) String complaintId,
                          @ApiParam(name = "doctor", value = "doctor", required = false)
                              @RequestParam(value = "doctor", required = false) String doctor,
                          @ApiParam(name = "reason", value = "reason", required = false)
                              @RequestParam(value = "reason", required = false) String reason,
                          @ApiParam(name = "operator", value = "operator", required = false)
                              @RequestParam(value = "operator", required = false) String operator) throws Exception {
        try {
            return success(baseComplaintService.passTo(id,complaintId,doctor,operator)) ;
            return success(baseComplaintService.passTo(id,complaintId,doctor,operator,reason)) ;
        }catch (Exception e){
            return failedException(e);
        }
@ -260,6 +263,9 @@ public class BaseComplaintEndPoint  extends EnvelopRestEndpoint {
                                 @ApiParam(name = "startTime", value = "startTime", required = false)
                                 @RequestParam(value = "startTime", required = false) String startTime) throws Exception {
        try {
            if (!StringUtils.isNotBlank(doctor)){
                doctor=getUID();
            }
            return success(baseComplaintService.findComplaintList(role, doctor, status, patientName, patientId, keyWord,complaintId,
                     startTime, endTime, page , pageSize)) ;
        }catch (Exception e){

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

@ -446,7 +446,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
		try {
			logger.info("findDoctorByHospitalAndDiseaseAndDept start:"+DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
			return prescriptionService.findDoctorByHospitalAndDiseaseAndDept(iswork,patientid,
			return prescriptionService.findDoctorByHospitalAndDiseaseAndDept2(iswork,patientid,
					orgCode,dept,
					diseaseKey,doctorNameKey,
					jobTitleNameKey,outpatientType,

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

@ -27,6 +27,7 @@ import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.es.service.StatisticsEsService;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleUserDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.httplog.service.WlyyHttpLogService;
import com.yihu.jw.hospital.message.service.BaseBannerDoctorService;
@ -130,6 +131,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private BaseDictJobTitleService baseDictJobTitleService;
    @Autowired
    private BaseDoctorInfoService baseDoctorService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Autowired
    private WechatInfoService wechatInfoService;
@ -1067,6 +1070,11 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            ResponseParams<?> decryptRes = client.decryptNotifyResponse(encryptRes);
            logger.info("解密后:{}",JSON.toJSONString(decryptRes) );
            JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(decryptRes));
            String hsName="核酸";
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("natItemName");
            if (wlyyHospitalSysDictDO!=null){
                hsName=wlyyHospitalSysDictDO.getDictValue();
            }
            boolean isDecrypt = ("-1".equals(decryptRes.getRespCode()) ? false : true); // 是否解密失败
            if (!isDecrypt) {
                response.getWriter().write("DECRYPT FAILURE");
@ -1144,7 +1152,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                }
                            }
                            for (WaitPayDetailVO waitPayDetailVO:listWPD){
                                if (waitPayDetailVO.getItemName().contains("核酸检测")){
                                if (waitPayDetailVO.getItemName().contains(hsName)){
                                    System.out.println("hsName:"+hsName);
                                    //判断检查订单
                                    List<BaseNatAppointmentDO> baseNatAppointmentDOS = baseNatAppointmentDao.findByRealOrderList(waitPayDetailVO.getRecipeNo());
                                    for (BaseNatAppointmentDO natAppointmentDO:baseNatAppointmentDOS){
@ -2152,4 +2161,61 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping("/findDoctorWorkTime")
    @ApiOperation(value = "findDoctorWorkTime", notes = "findDoctorWorkTime")
    public Envelop findDoctorWorkTime(
            @ApiParam(name = "doctor", value = "doctor")
            @RequestParam(value = "doctor", required = false)String doctor,
            @ApiParam(name = "hospital", value = "hospital")
            @RequestParam(value = "hospital", required = false)String hospital,
            @ApiParam(name = "ywCode", value = "ywCode")
            @RequestParam(value = "ywCode", required = false)String ywCode)throws Exception {
        try {
            return success("操作成功", prescriptionService.findDoctorWorkTime(doctor,hospital,ywCode));
        }catch (Exception e){
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping("/findDoctorChargeType")
    @ApiOperation(value = "findDoctorChargeType", notes = "findDoctorChargeType")
    public Envelop findDoctorChargeType(
            @ApiParam(name = "doctor", value = "doctor")
            @RequestParam(value = "doctor", required = false)String doctor,
            @ApiParam(name = "chargeType", value = "chargeType")
            @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        try {
            return success("操作成功", workTimeService.findChargeTypeByDoctor(doctor,chargeType));
        }catch (Exception e){
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptByOrgCode)
    @ApiOperation(value = "查询机构下所有科室", notes = "查询机构下所有科室")
    public MixEnvelop findDeptByOrgCode(@ApiParam(name = "orgCode", value = "机构code")
                                        @RequestParam(value = "orgCode", required = true)String orgCode,
                                        @ApiParam(name = "keyName", value = "关键字")
                                        @RequestParam(value = "keyName", required = false)String keyName) {
        try {
            return prescriptionService.findDeptByOrgCode(orgCode,keyName);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptDescByDeptCodeAndOrgCode)
    @ApiOperation(value = "查询科室介绍", notes = "查询科室介绍")
    public MixEnvelop findDeptDesc(@ApiParam(name = "orgCode", value = "机构code")
                                   @RequestParam(value = "orgCode", required = true)String orgCode,
                                   @ApiParam(name = "deptCode", value = "部门code")
                                   @RequestParam(value = "deptCode", required = true)String deptCode) {
        try {
            return prescriptionService.findDeptDesc(orgCode,deptCode);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
}

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

@ -3091,4 +3091,51 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
       }
    }
    /*@GetMapping("/findDoctorChargeType")
    @ApiOperation(value = "findDoctorChargeType", notes = "findDoctorChargeType")
    public Envelop findDoctorChargeType(
            @ApiParam(name = "doctor", value = "doctor")
            @RequestParam(value = "doctor", required = false)String doctor,
            @ApiParam(name = "chargeType", value = "chargeType")
            @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        try {
            return success("操作成功", workTimeService.findChargeTypeByDoctor(doctor,chargeType));
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping("/findDoctorWorkDate")
    @ApiOperation(value = "findDoctorWorkDate", notes = "findDoctorWorkDate")
    public Envelop findDoctorWorkTime(
            @ApiParam(name = "doctor", value = "doctor")
            @RequestParam(value = "doctor", required = false)String doctor,
            @ApiParam(name = "hospital", value = "hospital")
            @RequestParam(value = "hospital", required = false)String hospital,
            @ApiParam(name = "type", value = "ywCode")
            @RequestParam(value = "type", required = false)String type)throws Exception {
        try {
            return success("操作成功", prescriptionService.findDoctorWorkTime(doctor,hospital,type));
        }catch (Exception e){
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping("/findDoctorWorkSource")
    @ApiOperation(value = "获取医生信息", notes = "获取医生信息")
    public ObjEnvelop findDoctorWordSource(@ApiParam(name = "doctor", value = "医生code")
                                     @RequestParam(value = "doctor", required = true)String doctor,
                                     @ApiParam(name = "withWork", value = "传1带排班,其他不带")
                                     @RequestParam(value = "withWork", required = false)String withWork,
                                     @ApiParam(name = "patient", value = "患者code")
                                     @RequestParam(value = "patient", required = false)String patient){
        try {
            return success(prescriptionService.findDoctorInfo(doctor,withWork,patient));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }*/
}

+ 0 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/SystemMessage/HospitalSystemMessageService.java


Some files were not shown because too many files changed in this diff