Browse Source

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

# Conflicts:
#	server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java
wangzhinan 4 years ago
parent
commit
14aedb2718
100 changed files with 4704 additions and 233 deletions
  1. 1 1
      business/base-service/src/main/java/com/yihu/jw/dict/dao/PrivateDictDao.java
  2. 3 2
      business/base-service/src/main/java/com/yihu/jw/dict/service/PrivateDictService.java
  3. 3 0
      business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorHospitalDao.java
  4. 3 0
      business/base-service/src/main/java/com/yihu/jw/file_upload/FileUploadService.java
  5. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/httplog/service/WlyyHttpLogService.java
  6. 37 0
      business/base-service/src/main/java/com/yihu/jw/hospital/message/service/SystemMessageService.java
  7. 6 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/OutpatientDao.java
  8. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionExpressageService.java
  9. 456 24
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  10. 4 2
      business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java
  11. 16 13
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  12. 6 0
      business/base-service/src/main/java/com/yihu/jw/org/dao/BaseOrgDao.java
  13. 14 0
      business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientGroupDao.java
  14. 18 0
      business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientGroupDictDao.java
  15. 183 0
      business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientGroupDictService.java
  16. 311 12
      business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java
  17. 2 5
      business/base-service/src/main/java/com/yihu/jw/wechat/service/BaseSensitiveFilterWordsService.java
  18. 7 7
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java
  19. 4 2
      business/base-service/src/mqConfig/mqdata/BS15018.json
  20. 135 21
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  21. 10 0
      business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java
  22. 288 0
      common/common-entity/sql记录
  23. 38 0
      common/common-entity/src/main/java/com/yihu/jw/entity/IdEntity.java
  24. 28 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java
  25. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultTeamDo.java
  26. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgDO.java
  27. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientFamilyMemberDO.java
  28. 9 2
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/PatientMedicareCardDO.java
  29. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageItemDO.java
  30. 69 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/apply/PatientBedApplyDo.java
  31. 293 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/assistance/EmergencyAssistanceDO.java
  32. 40 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/contacts/BasePatientContactsOrgDO.java
  33. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/device/Device.java
  34. 15 3
      common/common-entity/src/main/java/com/yihu/jw/entity/care/device/PatientDevice.java
  35. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DevicePatientHealthIndex.java
  36. 114 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DeviceSosLogDO.java
  37. 11 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/lifeCare/LifeCareItemDictDO.java
  38. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/lifeCare/LifeCareOrderDO.java
  39. 5 5
      common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/SecurityMonitoringOrderDO.java
  40. 11 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/sign/CapacityAssessmentBaseInfoDo.java
  41. 72 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/sign/CapacityAssessmentRecordDO.java
  42. 41 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/sign/CapacityDoctorDO.java
  43. 25 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java
  44. 0 1
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/company/IotCompanyDO.java
  45. 76 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/copdDevice/WlyyCopdHuamiDeviceDO.java
  46. 87 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/copdDevice/WlyyCopdHuamiHealthScoreDO.java
  47. 86 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/copdDevice/WlyyCopdHuamiHeartDO.java
  48. 76 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/copdDevice/WlyyCopdHuamiPaiDO.java
  49. 66 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/copdDevice/WlyyCopdHuamiRealtimeDateDO.java
  50. 126 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/copdDevice/WlyyCopdHuamiRundateDO.java
  51. 116 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/copdDevice/WlyyCopdHuamiSleepDO.java
  52. 296 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/copdDevice/WlyyCopdXeekLungDO.java
  53. 145 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/copdDevice/WlyyCopdXeekLungDetailDO.java
  54. 90 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/copdDevice/WlyyXeekPatientDeviceDO.java
  55. 67 0
      common/common-entity/src/main/java/com/yihu/jw/entity/patient/BasePatientGroupDO.java
  56. 69 0
      common/common-entity/src/main/java/com/yihu/jw/entity/patient/BasePatientGroupDictDO.java
  57. 17 0
      common/common-entity/src/main/java/com/yihu/jw/entity/util/AesEncryptUtils.java
  58. 13 1
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java
  59. 2 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  60. 19 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/common/UploadVO.java
  61. 173 0
      common/common-util/src/main/java/com/yihu/jw/util/common/GpsUtil.java
  62. 13 9
      common/common-util/src/main/java/com/yihu/jw/util/common/LatitudeUtils.java
  63. 86 0
      common/common-util/src/main/java/com/yihu/jw/util/http/HttpClientUtil.java
  64. 1 0
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java
  65. 39 2
      server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java
  66. 65 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/WlyyTokenGranter.java
  67. 10 4
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  68. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/patient/BasePatientEndpoint.java
  69. 17 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/servicePackage/ServicePackageItemEndpoint.java
  70. 3 2
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  71. 7 6
      svr/svr-base/src/main/java/com/yihu/jw/base/service/servicePackage/ServicePackageItemService.java
  72. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java
  73. 4 2
      svr/svr-base/src/main/resources/application.yml
  74. 1 1
      svr/svr-base/src/main/resources/bootstrap.yml
  75. 4 4
      svr/svr-cloud-care/pom.xml
  76. 3 0
      svr/svr-cloud-care/readme.MD
  77. 2 1
      svr/svr-cloud-care/sql/sql
  78. 47 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/aop/BaseAop.java
  79. 1 35
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/aop/ObserverRequiredAOP.java
  80. 45 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/aop/RedisLock.java
  81. 178 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/aop/RedisLockAOP.java
  82. 3 25
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/aop/ServicesAuthAOP.java
  83. 48 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/AqgConfig.java
  84. 125 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/RedisConfig.java
  85. 27 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/apply/PatientBedApplyDao.java
  86. 21 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/assistance/EmergencyAssistanceDao.java
  87. 21 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/contacts/BasePatientContactsOrgDao.java
  88. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/device/DeviceDetailDao.java
  89. 28 24
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/device/PatientDeviceDao.java
  90. 8 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/family/PatientFamilyMemberDao.java
  91. 2 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/label/WlyyPatientLabelDao.java
  92. 2 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/security/SecurityMonitoringConclusionDao.java
  93. 5 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/security/SecurityMonitoringOrderDao.java
  94. 9 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/ArchiveDao.java
  95. 5 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/CapacityAssessmentRecordDao.java
  96. 17 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/CapacityDoctorDao.java
  97. 3 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/ServicePackageRecordDao.java
  98. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/team/BaseTeamDao.java
  99. 2 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/team/BaseTeamMemberDao.java
  100. 0 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/apply/PatientBedApplyEndPoint.java

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/dict/dao/PrivateDictDao.java

@ -14,5 +14,5 @@ public interface PrivateDictDao extends PagingAndSortingRepository<PrivateDictDO
    @Query("from PrivateDictDO t where t.isDel = 1")
    List<PrivateDictDO> findALL();
    @Query("from PrivateDictDO t where t.dictCode= ?1 and t.isDel = 1")
    List<PrivateDictDO> findoneByCode(String dictCode);
    List<PrivateDictDO> findByDictCodeAndIsDel(String dictCode);
}

+ 3 - 2
business/base-service/src/main/java/com/yihu/jw/dict/service/PrivateDictService.java

@ -23,11 +23,12 @@ public class PrivateDictService extends BaseJpaService<PrivateDictDO, PrivateDic
    private HibenateUtils hibenateUtils;
    //查找隐私策略
    public List<PrivateDictDO> findByHospitalCodeAndDictCode(String dictCode){
        if (StringUtils.isNotBlank(dictCode)){
        return privateDictDao.findByDictCodeAndIsDel(dictCode);
        /*if (StringUtils.isNotBlank(dictCode)){
            return privateDictDao.findoneByCode(dictCode);
        }else {
            return privateDictDao.findALL();
        }
        }*/
    }
    //添加隐私策略
    public MixEnvelop addPrivateDict(String id,String dictCode,String dictName, String dictValue,String hospitalCode,String hospitalName,String imgUrl){

+ 3 - 0
business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorHospitalDao.java

@ -24,6 +24,9 @@ public interface BaseDoctorHospitalDao extends PagingAndSortingRepository<BaseDo
    @Query("select bdo from BaseDoctorHospitalDO bdo where bdo.doctorCode = ?1 and bdo.del=1")
    List<BaseDoctorHospitalDO> findByDoctorCode(String doctorCode);
    @Query("select bdo from BaseDoctorHospitalDO bdo where bdo.doctorCode = ?1 and bdo.del=1 group by bdo.orgCode")
    List<BaseDoctorHospitalDO> findDistinctOrgByDoctorCode(String doctorCode);
    List<BaseDoctorHospitalDO> findByOrgCode(String orgCode);

+ 3 - 0
business/base-service/src/main/java/com/yihu/jw/file_upload/FileUploadService.java

@ -518,6 +518,9 @@ public class FileUploadService {
        inputStream = conn.getInputStream();
        return inputStream;
    }
    public void deleteFile(String groupName,String fileName) throws  Exception{
        fastDFSHelper.delete(groupName,fileName);
    }
}

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/httplog/service/WlyyHttpLogService.java

@ -64,7 +64,7 @@ public class WlyyHttpLogService  extends BaseJpaService<WlyyHttpLogDO, WlyyHttpL
        sql+=" a.name as \"patientName\"," +
                "b.name as \"doctorName\"" +
                " from wlyy_http_log t left join base_patient a on t.patient = a.id " +
                " left join base_doctor b on t.doctor = b.id where 1=1 and (t.code like '%Check%' or t.name = '合理用药审核接口')";
                " left join base_doctor b on t.doctor = b.id where 1=1 and ( t.name = '合理用药审核接口'  or t.code like '%Check%')";
        if (StringUtils.isNotBlank(startTime)){
            if("xm_ykyy_wx".equals(wxId)){
                if (flag){

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

@ -10,8 +10,10 @@ import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.YkyySMSService;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
@ -21,6 +23,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * @author zmk
@ -43,6 +47,8 @@ public class SystemMessageService extends BaseJpaService<SystemMessageDO,SystemM
    private YkyySMSService ykyySMSService;
    @Value("${wechat.id}")
    private String wechatId;
    @Autowired
    private HibenateUtils hibenateUtils;
    /**
@ -149,6 +155,37 @@ public class SystemMessageService extends BaseJpaService<SystemMessageDO,SystemM
        return msg;
    }
    /*private MixEnvelop findOutPatientMessage(String reciver ,Integer page ,Integer pageSize){
        String sql = "select b.id as \"id\"," +
                " b.content as \"content\"," +
                "b.saas_id as \"saasId\"," +
                "b.is_read as \"isRead\"," +
                "b.type as \"type\"," +
                "b.sender as \"sender\"," +
                "b.sender_name as \"senderName\"," +
                "b.receiver as \"receiver\"," +
                "b.receiver_name as \"receiverName\"," +
                "b.relation_type as \"relationType\"," +
                "b.relation_code as \"relationCode\"," +
                "b.relation_name as \"relationName\"," +
                "b.status as \"status\"," +
                "b.del as \"del\"," +
                "b.create_user as \"createUser\"," +
                "b.create_user_name as \"createUserName\"," +
                "b.create_time as \"createTime\"," +
                "b.update_user as \"updateUser\"," +
                "b.update_user_name as \"updateUserName\"," +
                "b.update_time as \"updateTime\" " +
                " from wlyy_outpatient t left join base_user_message b " +
                " on t.id = b.relation_code " +
                " where b.del=1 ";
        if (StringUtils.isNoneBlank(reciver)){
            sql+=" and b.reciver = '"+reciver+"'";
        }
        sql+=" and t.status = '0' order by b.create_time asc ";
        String sqlAppend = sql+" and t.status != '0' order by b.create_time desc";
        List<Map<String,Object>> listfront = hi
    }*/
}

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

@ -89,5 +89,11 @@ public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatient
    @Query("from WlyyOutpatientDO a where a.consumer = ?1 and a.status=1 and a.payStatus =1 order by a.createTime desc")
    List<WlyyOutpatientDO> findWlyyOutpatientDO(String patient);
    @Query("from WlyyOutpatientDO a where a.status=0 and a.payStatus =1 order by a.createTime desc")
    List<WlyyOutpatientDO> findDoctorRemindMessage();
    @Query("from WlyyOutpatientDO a where a.status = 0 and a.payStatus =1 and a.doctor=?1 and a.outpatientType =?2 and a.patient=?3")
    List<WlyyOutpatientDO> findByDoctorAndOutpatientType(String doctor,String outpatientType,String patient);
}

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

@ -576,7 +576,7 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti
            for (WlyyPrescriptionExpressageLogDO pushlog: pushSFLogs) {
                //判断是否有已收件的路由节点
                if("80".equals(pushlog.getOpCode())||"8000".equals(pushlog.getOpCode())){
                if("80".equals(pushlog.getOpCode())||"8000".equals(pushlog.getOpCode())||"130".equals(pushlog.getOpCode())){
                    isContainEndRoutInfo = true;
                }

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

@ -32,6 +32,7 @@ import com.yihu.jw.entity.base.patient.BasePatientBusinessDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import com.yihu.jw.entity.base.words.BaseSensitiveDO;
import com.yihu.jw.entity.base.wx.*;
import com.yihu.jw.entity.base.yx.YxTokenMappingDO;
import com.yihu.jw.entity.hospital.consult.WlyyDoctorClinicRoomDO;
@ -148,6 +149,8 @@ import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
 * Created by Trick on 2019/5/17.
@ -308,7 +311,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private BaseJpushTemplateDao baseJpushTemplateDao;
    @Autowired
    HikariDataSource dataSource;
    @Autowired
    private BaseSensitiveDao baseSensitiveDao;
    @Value("${demo.flag}")
    private boolean demoFlag;
@ -3703,7 +3707,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return rs.size();
    }
    @Transactional(readOnly = true)
    public Map<String, Object> findDoctorInfo(String doctor, String withWork,String patient) {
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
        Map<String, Object> rs = new HashedMap();
@ -3934,6 +3938,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    }
                }*/
                List<com.alibaba.fastjson.JSONArray> waitinglist = new ArrayList<>();
                List<BaseSensitiveDO> listSensitive = (List<BaseSensitiveDO>) baseSensitiveDao.findAll();
                if (scoreList != null && scoreList.size() > 0) {
                    List<String> stringList = new ArrayList<>();
                    for (Map<String, Object> scorepatient : scoreList) {
@ -3947,7 +3952,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        }
                        String content = (String)scorepatient.get("content");
                        if (StringUtils.isNotEmpty(content)){
                            String replace = baseSensitiveFilterWordsService.filterSensitiveWords(content);
                            String replace = baseSensitiveFilterWordsService.filterSensitiveWords(content,listSensitive);
                            scorepatient.put("content",replace);
                        }
@ -5677,6 +5682,331 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            pagesize = 10;
        }*/
        testHikar();
        long statr = new Date().getTime();
        String sql = "SELECT " +
                " d.id AS \"id\", " +
                " d.photo AS \"photo\", " +
                " d.name AS \"name\", " +
                " d.expertise AS \"expertise\"," +
                " d.introduce AS \"introduce\"," +
                " d.job_title_code AS \"jobTitleCode\", " +
                " d.job_title_name AS \"jobTitleName\"," +
                " d.charge_type AS \"chargeType\"," +
                " h.dept_name AS \"deptName\"," +
                " dw.workTotal AS \"workTotal\","+
                " d.consult_status AS \"consultStatus\"," +
                " d.outpatient_type AS \"outpatientType\"," +
                " a.total AS \"consultTotal\"," +
                " d.twfz_charge_type AS \"TWFZ_CHARGE_TYPE\"," +
                " d.spfz_charge_type AS \"SPFZ_CHARGE_TYPE\"," +
                " d.spzx_charge_type AS \"SPZX_CHARGE_TYPE\"," +
                " d.xtfz_charge_type AS \"XTFZ_CHARGE_TYPE\"," +
                " d.twzx_charge_type AS \"TWZX_CHARGE_TYPE\"," +
                " d.jyzx_charge_type AS \"JYZX_CHARGE_TYPE\"," +
                " h.org_name AS \"orgName\"," +
                " h.org_code AS \"orgCode\" " ;
        if(StringUtils.isNoneBlank(patientid)){
            sql+=" , follow.id AS \"followid\" " ;
        }
        sql+=" FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
                " Left join ( select count(id) as total,doctor from wlyy_outpatient where status = 3 GROUP BY doctor ) a on a.doctor = d.id ";
        Map<String, Object> params = new HashedMap();
        Date date = new Date();
        sql+="LEFT JOIN (SELECT  COUNT(t1.doctor) as workTotal, t1.doctor FROM  wlyy_doctor_work_time t1   WHERE   " +
                "t1.start_time <=:startTime  AND t1.end_time >=:endTime GROUP BY t1.doctor) dw ON dw.doctor=d.id ";
        sql+="LEFT JOIN (\n" +
                "\tSELECT\n" +
                "\t\tAVG(a.score) AS score,\n" +
                "\t\tb.doctor AS doctor\n" +
                "\tFROM\n" +
                "\t\tbase_evaluate a,\n" +
                "\t\tbase_evaluate_score b\n" +
                "\tWHERE\n" +
                "\t\ta.relation_code = b.id\n" +
                "\tGROUP BY\n" +
                "\t\tb.doctor\n" +
                ") evaluate ON evaluate.doctor = d.id";
        params.put("startTime", date);
        params.put("endTime", date);
        if(StringUtils.isNoneBlank(patientid)){
            if ("1".equalsIgnoreCase(isAttention)) {
                sql += " join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient ='" + patientid + "' ";
            }
            if ("0".equalsIgnoreCase(isAttention)) {
                sql += " join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient !='" + patientid + "' ";
            }
            if (StringUtils.isEmpty(isAttention)) {
                sql += " LEFT  JOIN base_doctor_patient_follow follow ON follow.patient='" + patientid + "' AND follow.doctor = d.id ";
            }
        }
        if (StringUtils.isNotBlank(diseaseKey)) {
            sql += " left join wlyy_doctor_special_disease sp on d.id = sp.doctor_code ";
        }
        if (StringUtils.isNotBlank(workingTime)) {
            sql += " JOIN wlyy_doctor_work_time wk on wk.doctor = d.id ";
        }
        sql += " WHERE  1=1 and h.del = '1' ";
        if (StringUtils.isNotBlank(chargType)) {
            if ("all".equals(chargType)) {
                //不过滤
            } else {
                sql += " AND d.charge_type = :chargType";
                params.put("chargType", chargType);
            }
        }
        List<WlyyHospitalSysDictDO> wlyyHospitalSysDictDOS  = wlyyHospitalSysDictDao.findByDictCode("isDoctorWork");
        boolean isNeedDoctorWord = true;
        if(wlyyHospitalSysDictDOS!=null&&wlyyHospitalSysDictDOS.size()>0){
            for(WlyyHospitalSysDictDO wlyyHospitalSysDictDO:wlyyHospitalSysDictDOS){
                if (!"1".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictValue())){
                    isNeedDoctorWord = false;
                    break;
                }
            }
        }
        if (StringUtils.isNotBlank(iswork) && "1".equals(iswork)&&isNeedDoctorWord) {
            logger.info("iswork:" + iswork);
            sql += " AND (" +
                    " EXISTS ( " +
                    " SELECT " +
                    "  1 " +
                    " FROM " +
                    "  wlyy_doctor_work_time t " +
                    " WHERE " +
                    "  t.doctor = d.id " +
                    " AND t.start_time <=:startTime" +
                    " AND t.end_time >=:endTime" +
                    " ) OR " +
                    " d.consult_status = '1') ";
            params.put("startTime", date);
            params.put("endTime", date);
        }
        if (StringUtils.isNotBlank(orgCode)) {
            sql += " AND  h.org_code =:orgCode";
            params.put("orgCode", orgCode);
        }
        if (StringUtils.isNotBlank(diseaseKey)) {
            sql += " AND sp.disease_name like :diseaseKey";
            params.put("diseaseKey", "%" + diseaseKey + "%");
        }
        if (StringUtils.isNotBlank(doctorNameKey)) {
            sql += " AND d.name like :doctorNameKey";
            params.put("doctorNameKey", "%" + doctorNameKey + "%");
        }
        if (StringUtils.isNotBlank(dept)) {
            sql += " AND h.dept_code =:dept ";
            params.put("dept", dept);
        }
        if (StringUtils.isNotBlank(jobTitleNameKey)) {
            sql += " AND d.job_title_name  = :jobTitleNameKey ";
            params.put("jobTitleNameKey", jobTitleNameKey);
        }
        if (StringUtils.isNotBlank(outpatientType)) {
            if (outpatientType.contains("or")) {
                String[] outpatientTypeArray = outpatientType.split("or");
                sql += " AND ( ";
                for (int i = 0; i < outpatientTypeArray.length; i++) {
                    sql += " d.outpatient_type like'%" + outpatientTypeArray[i] + "%'";
                    if (i != outpatientTypeArray.length - 1) {
                        sql += " or ";
                    }
                }
                sql += " ) ";
            } else {
                sql += " AND d.outpatient_type like'%" + outpatientType + "%'";
            }
        } else {
            sql += " AND d.outpatient_type is not null ";
        }
        if (StringUtils.isNotBlank(keyName)) {
            sql += " AND (h.dept_name like '%" + keyName + "%' or d.name like '%" + keyName + "%' or d.expertise like '%" + keyName + "%' )";
        }
        if (StringUtils.isNotBlank(workingTime)) {
            sql += " AND wk.work_date = :workingTime ";
            params.put("workingTime", workingTime);
        }
        if (StringUtils.isNotBlank(consultStatus)) {
            sql += " AND d.consult_status = :consultStatus ";
            params.put("consultStatus", consultStatus);
        }
        if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            if (flag){
                sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort;
            }else{
                sql += " and d.del='1' order by d.consult_status desc nulls last ,evaluate.score desc nulls last ,a.total " + consutlSort;
                sql+=" NULLS LAST,\n" +
                        "\tD.id DESC";
            }
        }else {
            sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort;
        }
        String sqlCount = "select count(1) as \"total\" from ( "+sql+" ) t";
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params, page, pagesize);
        List<WlyyHospitalSysDictDO> doctorFrontList = wlyyHospitalSysDictDao.findByDictNameOrderBySort("doctorFrontList",orgCode);
        List<Map<String,Object>> frontDoctor = new ArrayList<>();
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            sql= sql.replace("AS \"id\"","AS \"ID\"");
        }
        String sqlCharge = "SELECT t.id as \"id\",\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" +
                "\t  ("+sql+")  t \n" +
                "LEFT JOIN wlyy_charge_dict m ON t.twfz_charge_type = m.charge_type\n" +
                "LEFT JOIN wlyy_charge_dict a ON t.spfz_charge_type = a.charge_type\n" +
                "LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type\n" +
                "LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type\n" +
                "LEFT JOIN wlyy_charge_dict d ON t.xtfz_charge_type = d.charge_type\n" +
                " LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type\n"+
                " where t.id is not null ";
        List<Map<String,Object>> chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge, params);
        //查询医生各项评价平均分
        String sqlscore = "select t.doctor as \"id\" ,sum(t.score)/3 as\"score\" from ("+
                "SELECT " +
                "AVG(a.score) AS \"score\"," +
                "a.score_type AS \"score_type\"," +
                "b.doctor as \"doctor\" " +
                "FROM ("+sql+") m , base_evaluate a,base_evaluate_score b " +
                "WHERE " +
                " m.id = b.doctor and " +
                "a.relation_code=b.id " +
                "GROUP BY a.score_type,b.doctor ORDER BY  a.score_type ASC ) t GROUP BY  t.doctor";
        List<Map<String, Object>> listscore = hibenateUtils.createSQLQuery(sqlscore, params);
        /*list.stream().forEach(e->{
            if (null==e.get("consultStatus")){
                e.put("consultStatus",0);
            }
            if (null==e.get("workTotal")){
                e.put("workTotal",0);
            }
        });
        list.stream().sorted(Comparator.comparing((Map<String, Object> h) -> ((String) h.get("workTotal"))).reversed().thenComparing(Comparator.comparing((Map<String, Object> h) -> ((String) h.get("consultStatus")))).reversed());*/
        List<Map<String,Object>>  resultList = new ArrayList<>();
        resultList.addAll(list) ;
        for (Map<String,Object> map:list){
            String doctor = map.get("id").toString();
            /*List<Map<String,Object>> chargeDictDOLists = new ArrayList<>();
            if(null!=map.get("chargeType")){
                String chargeType = map.get("chargeType").toString();
                if (chargeType.contains(",")){
                    chargeType = chargeType.replace(",","','");
                }
                String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," +
                        "req_fee  as \"reqFee\",zj_fee  as \"zjFee\",xt_fee  as \"xtFee\",dept_type_code as \"deptTypeCode\" " +
                        " from wlyy_charge_dict where 1=1";
                sqlCharge+=" and charge_type in ( '"+chargeType+"')";
                if (StringUtils.isNoneBlank(deptTyepCode)){
                    sqlCharge+=" and dept_type_code in ( '"+deptTyepCode+"')";
                }
                chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge);
            }
            map.put("chargeTypeList",chargeDictDOLists);*/
            List<Map<String,Object>> doctorChargeDictDOLists = new ArrayList<>();
            for (Map<String ,Object> chargMap:chargeDictDOLists){
                if(doctor.equalsIgnoreCase(chargMap.get("id").toString())){
                    doctorChargeDictDOLists.add(chargMap);
                }
            }
            map.put("chargeTypeList",doctorChargeDictDOLists);
            Double doctorScore = new Double("0");
            if (listscore != null && listscore.size() > 0) {
                for (Map<String, Object> _listscore : listscore) {
                    if (_listscore.get("id").toString().equalsIgnoreCase(doctor)){
                        doctorScore = Double.parseDouble(_listscore.get("score").toString());
                    }
                }
            }
            map.put("doctorScore", doctorScore);
            if (doctorFrontList!=null&&doctorFrontList.size()>0){
                for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:doctorFrontList){
                    if(doctor.equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                        map.put("doctorFrontSort",wlyyHospitalSysDictDO.getSort());
                        logger.info("doctorFrontSort"+wlyyHospitalSysDictDO.getSort());
                        logger.info("doctorId"+wlyyHospitalSysDictDO.getDictCode());
                        frontDoctor.add(map);
                        resultList.remove(map);
                    }
                }
            }
        }
        List<Map<String, Object>> listCount = hibenateUtils.createSQLQuery(sqlCount, params);
        Long count = 0L;
        if(listCount!=null){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            count = hibenateUtils.objTransformLong(listCount.get(0).get("total"));
        }
        if (frontDoctor!=null&&frontDoctor.size()>0){
            frontDoctor.sort(Comparator.comparing((Map<String, Object> h) -> ((Integer) h.get("doctorFrontSort"))));
            logger.info("size"+frontDoctor.size());
            for (Map<String, Object> map:resultList){
                logger.info("id  =="+map.get("id").toString());
                frontDoctor.add(map);
            }
        }
        logger.info("findDoctorByHospitalAndDiseaseAndDept end:" + DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm:ss:SSS"));
        logger.info("sql:" + sql);
        MixEnvelop envelop =new MixEnvelop();
        envelop.setDetailModelList(frontDoctor);
        envelop.setTotalCount(count.intValue());
        envelop.setPageSize(pagesize);
        envelop.setCurrPage(page);
        System.out.println("new"+(new Date().getTime()-statr));
        return envelop;
    }
    /**
     * 根据疾病名称,热门部门查询医生
     *
     * @param orgCode         机构码
     * @param dept            部门CODE
     * @param diseaseKey      疾病名称
     * @param jobTitleNameKey
     * @param outpatientType
     * @param keyName
     * @param workingTime
     * @param consutlSort
     * @return
     */
    @Transactional(readOnly = true)
    public MixEnvelop findDoctorByHospitalAndDiseaseAndDept2(String iswork, String patientid, String orgCode, String dept,
                                                            String diseaseKey, String doctorNameKey,
                                                            String jobTitleNameKey, String outpatientType,
                                                            String keyName, String workingTime, String consultStatus, String chargType, String consutlSort, String isAttention, Integer page, Integer pagesize) {
      /*  if(page >=1){
            page --;
        if (pagesize <= 0) {
            pagesize = 10;
        }*/
        long statr = new Date().getTime();
        String sql = "SELECT " +
                " d.id AS \"id\", " +
                " d.photo AS \"photo\", " +
@ -5968,6 +6298,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        envelop.setTotalCount(count.intValue());
        envelop.setPageSize(pagesize);
        envelop.setCurrPage(page);
        System.out.println("old"+(new Date().getTime()-statr));
        return envelop;
    }
    /**
@ -6836,6 +7167,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            wlyyHttpLogDO.setCreateTime(new Date());
            wlyyHttpLogDao.save(wlyyHttpLogDO);
        }
        if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)&&StringUtils.isNoneBlank(wlyyOutpatientDO.getDoctor())){
            String msgUrl="https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/record?outpatientId="+wlyyOutpatientDO.getId();
            sendZsMsgFlow("OL_PAY_SUCCESS",wlyyOutpatientDO.getId(),"",msgUrl,"已支付问诊费");
        }
    }
@ -7119,31 +7454,33 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "AND outpatient.doctor='" + doctor + "' " +
                "AND outpatient.pay_status = 1 " +
                "AND outpatient.outpatient_type= '" + outpatient_type + "'  ";
        if ("1".equals(outpatient_type)||"3".equals(outpatient_type)) {//复诊
            sql = sql + " AND outpatient.type= '" + type + "' ";
            if ("2".equals(type)) {//视频复诊才需要判断时间,
        if (!"xm_ihealth_wx".contains(wxId)){
            if ("1".equals(outpatient_type)||"3".equals(outpatient_type)) {//复诊
                sql = sql + " AND outpatient.type= '" + type + "' ";
                if ("2".equals(type)) {//视频复诊才需要判断时间,
                    if ("xm_ykyy_wx".equals(wxId)) {
                        if (flag){
                            sql += " AND outpatient.register_date is not null and outpatient.register_date >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                        }else {
                            sql += " AND outpatient.register_date is not null and outpatient.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                        }
                    } else {
                        sql = sql + " AND outpatient.register_date is not null AND  outpatient.register_date >= '" + DateUtil.dateToStrShort(new Date()) + " 00:00:00' ";
                    }
                }
            } else if ("2".equals(outpatient_type)) {
                //协同门诊也需要判断时间
                if ("xm_ykyy_wx".equals(wxId)) {
                    if (flag){
                        sql += " AND outpatient.register_date is not null and outpatient.register_date >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                    }else {
                        sql += " AND outpatient.register_date is not null and outpatient.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                    }
                } else {
                    sql = sql + " AND outpatient.register_date is not null AND  outpatient.register_date >= '" + DateUtil.dateToStrShort(new Date()) + " 00:00:00' ";
                }
            }
        } else if ("2".equals(outpatient_type)) {
            //协同门诊也需要判断时间
            if ("xm_ykyy_wx".equals(wxId)) {
                if (flag){
                    sql += " AND outpatient.register_date is not null and outpatient.register_date >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                }else {
                    sql += " AND outpatient.register_date is not null and outpatient.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                }
            } else {
                sql = sql + " AND outpatient.register_date is not null AND  outpatient.register_date >= '" + DateUtil.dateToStrShort(new Date()) + " 00:00:00' ";
            }
        }
        logger.info("接口名称:doctorReviewConsultCount-->sql="+sql);
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
@ -10078,6 +10415,46 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    }
                }
            }
            if("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
                /*prescriptionDao.updateCheckStatus(prescriptionId,2,reason,20);*/
                logger.info("作废处方开始" + prescriptionDO.getCheckStatus());
                WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
                DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
                List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId, 1);
                List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId, 1);
                List<WlyyPrescriptionDiagnosisDO> prescriptionDiagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(prescriptionId,1);
                List<WlyyPrescriptionExpressageDO> expressageDOS = prescriptionExpressageDao.findByOutpatientId(outpatientDO.getId());
                com.alibaba.fastjson.JSONArray jsonData = new com.alibaba.fastjson.JSONArray();
                for (WlyyPrescriptionInfoDO info : infoDOS) {
                    //设置his药品查询条件
                    setInfoJsonParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, info, outpatientDO.getIcd10());
                }
                for (WlyyInspectionDO ins : inspectionDOS) {
                    //设置his药品查询条件
                    setInspectionParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, ins, outpatientDO.getIcd10());
                }
                if (expressageDOS!=null&&expressageDOS.size()!=0){
                    WlyyPrescriptionExpressageDO prescriptionExpressageDO = expressageDOS.get(0);
                    if (prescriptionExpressageDO!=null&&prescriptionExpressageDO.getOneselfPickupFlg()==0){
                        for (int i=0;i<jsonData.size();i++){
                            com.alibaba.fastjson.JSONObject object = jsonData.getJSONObject(i);
                            object.put("selfDelivered",0);
                        }
                    }else if (prescriptionExpressageDO!=null&&prescriptionExpressageDO.getOneselfPickupFlg()==1){
                        for (int i=0;i<jsonData.size();i++){
                            com.alibaba.fastjson.JSONObject object = jsonData.getJSONObject(i);
                            object.put("selfDelivered",1);
                        }
                    }
                }
                try {
                    net.sf.json.JSONObject jsonObject = entranceService.BS10112(jsonData.toJSONString(), demoFlag);
                }catch (Exception e){
                    e.printStackTrace();
                    return "删除失败";
                }
            }
            prescriptionDO.setStatus(-1);
            prescriptionDO.setCheckStatus(4);
            prescriptionDO.setCheckReason("已删除");
@ -11789,17 +12166,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                                .build())
                        .build())
                .build();
        if (extras.get("outpatientId")!=null){
        }
        try {
            PushResult result = jPushClient.sendPush(payload);
            logger.info("极光推送返回日志==="+result);
            WlyyHttpLogDO httpLogDO = new WlyyHttpLogDO();
            httpLogDO.setCode("JPUSH");
            httpLogDO.setCreateTime(new Date());
            /*httpLogDO.setRequest(jsonObject.toJSONString());
            httpLogDO.setResponse(result);*/
            httpLogDO.setRequest(extras==null?"":extras.toString());
            httpLogDO.setResponse(result==null?"":result.toString());
            wlyyHttpLogDao.save(httpLogDO);
            logger.info("Got result - " + result);
        } catch (APIConnectionException e) {
@ -12010,6 +12384,52 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            jsonObject.put("type",32);
            jsonObject.put("id",prescriptionId);
            jsonObject.put("outpatientId",wlyyOutpatientDO.getId());
        }else if("remind_doctor_pickup".equalsIgnoreCase(templateCode)){//接诊下消息提醒
            BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
            if(baseJpushTemplateDO!=null){
                if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文复诊").replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文复诊接诊提醒");
                    jsonObject.put("type",51);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }else if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频复诊").replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
                    content+= "视频复诊预约时间为:"+wlyyOutpatientDO.getRegisterDate();
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频复诊接诊提醒");
                    jsonObject.put("type",52);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文咨询").replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文咨询接诊提醒");
                    jsonObject.put("type",58);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频咨询").replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频咨询接诊提醒");
                    content+= "视频咨询预约时间为:"+wlyyOutpatientDO.getRegisterDate();
                    jsonObject.put("type",57);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }else if ("2".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","协同复诊").replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","协同复诊接诊提醒");
                    jsonObject.put("type",53);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"3".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","家医咨询").replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","家医咨询接诊提醒");
                    jsonObject.put("type",55);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }
                String sex = IdCardUtil.getSexNameForIdcard_new(wlyyOutpatientDO.getIdcard());
                Integer age = IdCardUtil.getAgeForIdcard(wlyyOutpatientDO.getIdcard());
                Long createTime = wlyyOutpatientDO.getCreateTime().getTime();
                Long nowTime = new Date().getTime();
                Long minusts = TimeUnit.MILLISECONDS.toMinutes(nowTime - createTime);
                content = content.replace("{{性别年龄}}",sex+age+"岁").replace("{{等待时间}}",minusts.toString());
            }
            userId = wlyyOutpatientDO.getDoctor();
            jsonObject.put("id",wlyyOutpatientDO.getId());
            isDoctor="1";
        }
        return jPushMessage(isDoctor,userId,content,title,jsonObject);
@ -12172,5 +12592,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
    }
    public String findDomainUrlInDict(){
        try {
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("domainUrl");
            if (wlyyHospitalSysDictDO!=null){
                return wlyyHospitalSysDictDO.getDictValue();
            }else {
                return "";
            }
        }catch (Exception e){
            e.printStackTrace();
            return "";
        }
    }
}

+ 4 - 2
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java

@ -1016,12 +1016,14 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
            sql =  sql +  "  and  a.id =:keyId ";
            params.put("keyId",keyId);
        }
        logger.info("sql===="+sql);
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params);
        logger.info("count===="+list.size());
        total = list.size();
        for(int i=0; i<list.size(); i++) {
            logger.info("进入循环"+list.get(i));
            Map<String,Object> info = list.get(i);
            JSONObject jb = new JSONObject();
            Boolean errorFlag = false;
@ -1589,7 +1591,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                "WHERE\n" +
                "\ta.id = b.consult\n" +
                "AND a.symptoms IS NOT NULL AND b.status=1 " +
                " and c.doctor not in ('402803816babc778016babd0dee21112')";
                " and c.id not in ('402803816babc778016babd0dee21112')";
        if(StringUtils.isNotBlank(startDate)){
            wlzxSql =  wlzxSql + "  and a.czrq >=:startDate ";

+ 16 - 13
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -280,12 +280,13 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        }
        businessOrderDO.setUploadStatus(0);
        businessOrderDO.setPayType(1);
        String baseUrl = prescriptionService.findDomainUrlInDict();
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
            businessOrderDO.setAppCallbackUrl("https://intel.yanketong.com/ims-app-web/#/yk/consult/record?consultCode="+businessOrderDO.getRelationCode()+"&verifyCode=");
            businessOrderDO.setPcCallbackUrl("https://intel.yanketong.com/ims-web/#/yk/consult/record?consultCode="+businessOrderDO.getRelationCode()+"&verifyCode=");
            businessOrderDO.setAppCallbackUrl(baseUrl+"/ims-app-web/#/yk/consult/record?consultCode="+businessOrderDO.getRelationCode()+"&verifyCode=");
            businessOrderDO.setPcCallbackUrl(baseUrl+"/ims-web/#/yk/consult/record?consultCode="+businessOrderDO.getRelationCode()+"&verifyCode=");
        }else {
            businessOrderDO.setAppCallbackUrl("https://intel.yanketong.com/ims-app-web/#/yk/consult/record?outpatientId="+businessOrderDO.getRelationCode()+"&verifyCode=");
            businessOrderDO.setPcCallbackUrl("https://intel.yanketong.com/ims-web/#/yk/consult/record?outpatientId="+businessOrderDO.getRelationCode()+"&verifyCode=");
            businessOrderDO.setAppCallbackUrl(baseUrl+"/ims-app-web/#/yk/consult/record?outpatientId="+businessOrderDO.getRelationCode()+"&verifyCode=");
            businessOrderDO.setPcCallbackUrl(baseUrl+"/ims-web/#/yk/consult/record?outpatientId="+businessOrderDO.getRelationCode()+"&verifyCode=");
        }
        List<WlyyHospitalSysDictDO> hospitalSysDictDOS = hospitalSysDictDao.findByDictName("WX_MONEY");
        if (businessOrderDO!=null&&businessOrderDO.getPayPrice()==null){
@ -1349,6 +1350,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
     */
    public BusinessOrderDO updatePayStatus(String orderNo) throws Exception {
        logger.info("入参:"+orderNo);
        String baseUrl = prescriptionService.findDomainUrlInDict();
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(orderNo);
        WlyyHospitalSysDictDO changeMethod = hospitalSysDictDao.findById("consultPay");
        String changeflag="0";
@ -1397,7 +1399,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                    String url="https://hlwyy.xmzsh.com/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_ykyy_wx")){
                    String url="https://intel.yanketong.com/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                    String url=baseUrl+"/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                    enterpriseService.sendTWMesByDoctor("xm_ykyy_wx",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();
@ -1419,7 +1421,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
           wlyyOutpatientDO.setPayStatus(1);
           WlyyOutpatientDO outpatientDO = outpatientDao.save(wlyyOutpatientDO);
           try {
               if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
               if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)&&StringUtils.isNoneBlank(wlyyOutpatientDO.getDoctor())){
                   String msgUrl="https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/record?outpatientId="+wlyyOutpatientDO.getId();
                   prescriptionService.sendZsMsgFlow("OL_PAY_SUCCESS",wlyyOutpatientDO.getId(),"",msgUrl,"已支付问诊费");
               }
@ -1457,7 +1459,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                       String url="https://hlwyy.xmzsh.com/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_ykyy_wx")){
                   String url="https://intel.yanketong.com/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                   String url=baseUrl+"/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                   enterpriseService.sendTWMesByDoctor("xm_ykyy_wx",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();
@ -1495,6 +1497,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
     */
    public BusinessOrderDO updatePayStatusByRelation(String relationCode,String wxId) throws Exception {
        logger.info("入参:"+relationCode);
        String baseUrl = prescriptionService.findDomainUrlInDict();
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
        WlyyHospitalSysDictDO changeMethod = hospitalSysDictDao.findById("consultPay");
        String changeflag="0";
@ -1504,7 +1507,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        if (businessOrderDO==null){
            throw new Exception("查不到订单!");
        }
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")&&0==businessOrderDO.getStatus()){
            if ("0".equalsIgnoreCase(changeflag)){
                ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
                consultDo.setPayStatus(1);
@ -1544,17 +1547,17 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                        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 (wxId.equalsIgnoreCase("xm_ykyy_wx")){
                        String url="https://intel.yanketong.com/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                        String url=baseUrl+"/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                        enterpriseService.sendTWMesByDoctor("xm_ykyy_wx",outpatientDO.getDoctor(),title,msg,url);
                    }
                    if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
                    if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)&&StringUtils.isNoneBlank(wlyyOutpatientDO.getDoctor())){
                        String msgUrl="https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/record?outpatientId="+wlyyOutpatientDO.getId();
                        prescriptionService.sendZsMsgFlow("OL_PAY_SUCCESS",wlyyOutpatientDO.getId(),"",msgUrl,"已支付问诊费");
                    }
                    System.out.println("发送企业模板消息成功");
                }
            }
        }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")||businessOrderDO.getOrderCategory().equalsIgnoreCase("3")){
        }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")||businessOrderDO.getOrderCategory().equalsIgnoreCase("3")&&0==businessOrderDO.getStatus()){
            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
            wlyyOutpatientDO.setPayStatus(1);
            WlyyOutpatientDO outpatientDO = outpatientDao.save(wlyyOutpatientDO);
@ -1590,10 +1593,10 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                    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 (wxId.equalsIgnoreCase("xm_ykyy_wx")){
                    String url="https://intel.yanketong.com/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                    String url=baseUrl+"/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                    enterpriseService.sendTWMesByDoctor("xm_ykyy_wx",outpatientDO.getDoctor(),title,msg,url);
                }
                if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
                if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)&&StringUtils.isNoneBlank(wlyyOutpatientDO.getDoctor())){
                    String msgUrl="https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/record?outpatientId="+wlyyOutpatientDO.getId();
                    prescriptionService.sendZsMsgFlow("OL_PAY_SUCCESS",wlyyOutpatientDO.getId(),"",msgUrl,"已支付问诊费");
                }

+ 6 - 0
business/base-service/src/main/java/com/yihu/jw/org/dao/BaseOrgDao.java

@ -61,4 +61,10 @@ public interface BaseOrgDao extends PagingAndSortingRepository<BaseOrgDO, String
    
    @Query(value="select b.* from base_org b where b.org_level= ?1 and b.del=?2 ORDER BY sort DESC",nativeQuery = true)
    List<BaseOrgDO> findByLevelAndDel(Integer level,String del);
    @Query(value="select Distinct org from BaseOrgDO org,BaseDoctorHospitalDO h where org.code = h.orgCode and h.del=1 and org.del=1 and h.doctorCode=?1 and org.type=?2 " )
    List<BaseOrgDO> findByDoctorAndType(String doctor,String type);
    @Query(value="select org from BaseOrgDO org where org.del=1  and org.type in ?1 " )
    List<BaseOrgDO> findByTypeIn(String[] type);
}

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

@ -0,0 +1,14 @@
package com.yihu.jw.patient.dao;
import com.yihu.jw.entity.patient.BasePatientGroupDO;
import com.yihu.jw.entity.patient.BasePatientGroupDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface BasePatientGroupDao extends PagingAndSortingRepository<BasePatientGroupDO, String>, JpaSpecificationExecutor<BasePatientGroupDO> {
    @Query("from BasePatientGroupDO t where t.doctor=?1 and t.patient=?2 and t.groupId=?3")
    BasePatientGroupDO findOneGroupByDoctorAndPatientAndGroupId(String doctor,String patient,String groupId);
    @Query("select count(1) from BasePatientGroupDO t where t.doctor=?1  and t.groupId=?2")
    int getCountByDoctor(String doctor,String dictId);
}

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

@ -0,0 +1,18 @@
package com.yihu.jw.patient.dao;
import com.yihu.jw.entity.patient.BasePatientGroupDictDO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface BasePatientGroupDictDao extends PagingAndSortingRepository<BasePatientGroupDictDO, String>, JpaSpecificationExecutor<BasePatientGroupDictDO> {
    Page<BasePatientGroupDictDO> findByCreateUserAndDel(String doctor,String del, Pageable pageable);
    @Query("select count(id) from BasePatientGroupDictDO where createUser=?1 and del='1'")
    int findByDoctorCount(String doctor);
}

+ 183 - 0
business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientGroupDictService.java

@ -0,0 +1,183 @@
package com.yihu.jw.patient.service;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.patient.BasePatientGroupDO;
import com.yihu.jw.entity.patient.BasePatientGroupDictDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientGroupDao;
import com.yihu.jw.patient.dao.BasePatientGroupDictDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.patient.util.ConstantUtils;
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.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
public class BasePatientGroupDictService <T, R extends CrudRepository> extends BaseJpaService<BasePatientGroupDictDO, BasePatientGroupDictDao> {
    @Autowired
    private BasePatientGroupDao basePatientGroupDao;
    @Autowired
    private BasePatientGroupDictDao basePatientGroupDictDao;
    @Autowired
    private BaseDoctorDao basedoctorDao;
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    //创建/修改分组
    public BasePatientGroupDictDO createPatientGroupDict(String dictId,String doctor,String groupCode,String groupName){
        BaseDoctorDO baseDoctorDO = basedoctorDao.findById(doctor);
        BasePatientGroupDictDO basePatientGroupDictDO=null;
        if (StringUtils.isNotBlank(dictId)){
            basePatientGroupDictDO = basePatientGroupDictDao.findOne(dictId);
        }else {
            basePatientGroupDictDO = new BasePatientGroupDictDO();
        }
        if (baseDoctorDO!=null){
            basePatientGroupDictDO.setCreateUser(doctor);
            basePatientGroupDictDO.setCreateUserName(baseDoctorDO.getName());
        }
        basePatientGroupDictDO.setDel("1");
        basePatientGroupDictDO.setCreateTime(new Date());
        basePatientGroupDictDO.setGroupCode(groupCode);
        basePatientGroupDictDO.setGroupName(groupName);
       return basePatientGroupDictDao.save(basePatientGroupDictDO);
    }
    //删除分组
    public BasePatientGroupDictDO delPatientGroupDict(String dictId,String del){
        BasePatientGroupDictDO  basePatientGroupDictDO = basePatientGroupDictDao.findOne(dictId);
        basePatientGroupDictDO.setDel(del);
        return basePatientGroupDictDao.save(basePatientGroupDictDO);
    }
    public MixEnvelop findByDoctor(String doctor,String groupName,Integer page,Integer pageSize){
        Page<BasePatientGroupDictDO> list= basePatientGroupDictDao.findByCreateUserAndDel(doctor,"1",new PageRequest(page-1,pageSize));
        int listCount= basePatientGroupDictDao.findByDoctorCount(doctor);
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page+1);
        mixEnvelop.setDetailModelList(list.getContent());
        mixEnvelop.setTotalCount(listCount);
        return mixEnvelop;
    }
    /**
     * 创建分页对象
     * @param page
     * @param size
     * @param sorts
     * @return
     */
    public Pageable creatPage(Integer page, Integer size, String sorts){
        PageRequest pageRequest = null;
        if(null == page || page <= 0){
            page = defaultPage;
        }
        if(null == size || size <= 0){
            size = defaultSize;
        }
        if(!org.apache.commons.lang3.StringUtils.isEmpty(sorts)){
            pageRequest = new PageRequest(page,size,createSort(sorts));
        }else{
            pageRequest = new PageRequest(page,size);
        }
        return pageRequest;
    }
    //将患者移动到指定分组中
    public void movePatientToGroup(String groupId,String patient,String doctor) throws Exception{
        BasePatientGroupDO basePatientGroupDO= basePatientGroupDao.findOneGroupByDoctorAndPatientAndGroupId(doctor,patient,groupId);
        if (basePatientGroupDO==null){
            basePatientGroupDO = new BasePatientGroupDO();
            basePatientGroupDO.setCreateTime(new Date());
            BasePatientDO basePatientDO = basePatientDao.findById(patient);
            if (basePatientDO!=null){
                basePatientGroupDO.setPatient(patient);
                basePatientGroupDO.setPatientName(basePatientDO.getName());
            }
            BaseDoctorDO baseDoctorDO = basedoctorDao.findById(doctor);
            if (baseDoctorDO!=null){
                basePatientGroupDO.setDoctor(doctor);
                basePatientGroupDO.setDoctorName(baseDoctorDO.getName());
            }
            basePatientGroupDO.setGroupId(groupId);
            basePatientGroupDao.save(basePatientGroupDO);
        }else {
            throw  new Exception("该患者已存在该分组中");
        }
    }
    //将患者从指定分组中删除
    public void delPatientGroup(String id) throws Exception{
        BasePatientGroupDO basePatientGroupDO= basePatientGroupDao.findOne(id);
        if (basePatientGroupDO!=null){
            basePatientGroupDao.delete(id);
        }else {
            throw  new Exception("该记录已删除");
        }
    }
    //查询患者分组
    public MixEnvelop findPatientGroup(String patientName,String doctor,String dictId,Integer page,Integer pageSize){
        String sql = "select t.id as \"id\"," +
                "  t.group_id as \"groupId\"," +
                "  t.patient as \"patient\"," +
                "  t.patient_name as \"patientName\"," +
                "  t.doctor as \"doctor\"," +
                "  b.idcard as \"idcard\"," +
                "  t.create_time as \"createTime\"" +
                " from base_patient_group t left join base_patient b " +
                " on t.patient = b.id where b.del = '1'";
        String sqlCount ="select count(1) as \"total\"" +
                " from base_patient_group t left join base_patient b " +
                " on t.patient = b.id where b.del = '1'";
        if (StringUtils.isNoneBlank(patientName)){
            sql +=" and b.name like '%"+patientName+"%'";
            sqlCount +=" and b.name like '%"+patientName+"%'";
        }
        if (StringUtils.isNoneBlank(doctor)){
            sql +=" and t.doctor ='"+doctor+"'";
            sqlCount +=" and t.doctor ='"+doctor+"'";
        }
        if (StringUtils.isNoneBlank(dictId)){
            sql +=" and t.group_id ='"+dictId+"'";
            sqlCount +=" and t.group_id ='"+dictId+"'";
        }
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql ,page,pageSize);
        List<Map<String,Object>> rstotal = hibenateUtils.createSQLQuery(sqlCount);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = Long.parseLong(rstotal.get(0).get("total").toString());
        }
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setTotalCount(count.intValue());
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setDetailModelList(list);
        return mixEnvelop;
    }
    //查询分组患者数量
    public List<Map<String,Object>> findPatientGroupNum(String doctor,String dictIds){
        List<Map<String,Object>> list = new ArrayList<>();
        if (StringUtils.isNoneBlank(dictIds)){
            String[] dictIdGroup = dictIds.split(",");
            for (int i=0;i<dictIdGroup.length;i++){
                int count = basePatientGroupDao.getCountByDoctor(doctor,dictIdGroup[i]);
                Map map = new HashMap();
                map.put(dictIdGroup[i],count);
                list.add(map);
            }
        }
        return list;
    }
}

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

@ -2,30 +2,52 @@ package com.yihu.jw.patient.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.hospital.prescription.WlyyInspectionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.dao.WlyyInspectionDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientGroupDao;
import com.yihu.jw.patient.dao.BasePatientGroupDictDao;
import com.yihu.jw.patient.util.ConstantUtils;
import com.yihu.jw.restmodel.hospital.prescription.WlyyInspectionVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
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.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.repository.CrudRepository;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
/**
 * 
@ -41,6 +63,7 @@ import java.util.Set;
 */
@Service
public class BasePatientService<T, R extends CrudRepository> extends BaseJpaService<BasePatientDO, BasePatientDao> {
    private static final Logger logger = LoggerFactory.getLogger(BasePatientService.class);
    @Autowired
    private BasePatientDao basePatientDao;
@ -59,7 +82,22 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
    private YkyyService ykyyService;
    @Value("${wechat.id}")
    private String wxId;
    @Autowired
    private OutpatientDao outpatientDao;
    @Value("${demo.flag}")
    private boolean demoFlag;
    @Value("${wechat.flag}")
    private boolean flag;
    @Autowired
    private WlyyInspectionDao wlyyInspectionDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private BasePatientGroupDao basePatientGroupDao;
    @Autowired
    private BasePatientGroupDictDao basePatientGroupDictDao;
    /**
     * 居民id
     * @param patientId
@ -74,21 +112,28 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
     * @param patientId
     * @return
     */
    public String getPatientById(String patientId) throws Exception{
        JSONObject result = new JSONObject();
    public Map getPatientById(String patientId) throws Exception{
        Map result = new HashMap();
        if(StringUtils.isEmpty(patientId)){
            result.put("result","parameter patientId is null");
            return result.toString();
            return result;
        }
        List<BasePatientDO> patientDOList = this.findByField("id",patientId);
        BasePatientDO basePatientDO = basePatientDao.findById(patientId);
        /*List<BasePatientDO> patientDOList = this.findByField("id",patientId);
        if(CollectionUtils.isEmpty(patientDOList)){
            result.put("result","not exist patient for id:"+patientId);
            return result.toString();
        }
        result.put("patient",patientDOList.get(0));
        }*/
        result.put("patient", basePatientDO);
        List<PatientMedicareCardDO> cards = basePatientMedicardCardService.findPatientCardByCode(patientId);
        if (cards==null||cards.size()==0){
            System.out.println("new一个list");
            PatientMedicareCardDO patientMedicareCardDO = new PatientMedicareCardDO();
            cards.add(patientMedicareCardDO);
        }
        result.put("medicareCard",cards);
        return result.toJSONString();
        return result;
    }
@ -263,6 +308,18 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
            basePatientDO1.setTownName(basePatientDO.getTownName());
            basePatientDO1.setCityName(basePatientDO.getCityName());
            basePatientDO1.setMobile(basePatientDO.getMobile());
            basePatientDO1.setRemark(basePatientDO.getRemark());
            basePatientDO1.setLiveCityCode(basePatientDO.getLiveCityCode());
            basePatientDO1.setLiveCityName(basePatientDO.getLiveCityName());
            basePatientDO1.setLiveProvinceCode(basePatientDO.getLiveProvinceCode());
            basePatientDO1.setLiveProvinceName(basePatientDO.getLiveProvinceName());
            basePatientDO1.setLiveStreetCode(basePatientDO.getLiveStreetCode());
            basePatientDO1.setLiveStreetName(basePatientDO.getLiveStreetName());
            basePatientDO1.setLiveTownCode(basePatientDO.getLiveTownCode());
            basePatientDO1.setLiveTownName(basePatientDO.getLiveTownName());
            basePatientDO1.setAddress(basePatientDO.getAddress());
            basePatientDO1.setCommitteeCode(basePatientDO.getCommitteeCode());
            basePatientDO1.setCommitteeName(basePatientDO.getCommitteeName());
            // 保存修改的居民信息
            this.save(basePatientDO1);
        }
@ -272,6 +329,7 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
        for (Object obj : patientMedicareCards) {
            PatientMedicareCardDO card = objectMapper.readValue(obj.toString(), PatientMedicareCardDO.class);
            card.setPatientCode(basePatientDO.getId());
            card.setDel("1");
            if(cardIdList.contains(card.getId())){
                cardIdList.remove(card.getId());
            }
@ -342,5 +400,246 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
        saveDoctorPwlimitDate(id);*/
        return true;
    }
    public Map<String,Object> getPatientCountByDoctor(String doctor,String patient) throws  Exception{
        List<WlyyOutpatientDO> fzList = outpatientDao.findByDoctorAndOutpatientType(doctor,"1",patient);
        List<WlyyOutpatientDO> xtList = outpatientDao.findByDoctorAndOutpatientType(doctor,"2",patient);
        List<WlyyOutpatientDO> zxList = outpatientDao.findByDoctorAndOutpatientType(doctor,"3",patient);
        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("fzNum",fzList==null?0:fzList.size());
        resultMap.put("xtNum",xtList==null?0:xtList.size());
        resultMap.put("zxNum",zxList==null?0:zxList.size());
        return resultMap;
    }
    //查询电子病历
        public MixEnvelop findEmrByPatientId(String patient,String doctor,Integer page ,Integer pageSize){
        String sql ="select e.id as \"id\"," +
                " e.prescription_id as \"prescriptionId\"," +
                " e.complaint as \"complaint\"," +
                " e.medical_history as \"medicalHistory\"," +
                " e.past_history as \"pastHistory\"," +
                " e.physical_examination as \"physicalExamination\"," +
                " e.assist_examination as \"assistExamination\"," +
                " p.doctor_name as \"doctorName\"," +
                " p.doctor as \"doctor\"," +
                " e.popular_history as \"popularHistory\"," +
                " e.special_history as \"specialHistory\"," +
                " e.create_time as \"createTime\"," +
                " e.allergic_history as \"allergicHistory\"" +
                " from wlyy_prescription_emr e " +
                " left join  wlyy_prescription p on e.prescription_id = p.id" +
                " where p.status >= 20";
        if (StringUtils.isNoneBlank(patient)){
            sql+=" and p.patient_code ='"+patient+"'";
        }
        if (StringUtils.isNoneBlank(doctor)){
            sql+=" and p.doctor ='"+doctor+"'";
        }
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setTotalCount(list==null?0:list.size());
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setDetailModelList(list);
        return mixEnvelop;
    }
    //查询电子病历
   /* public MixEnvelop findPrescriptionByPatientAndDoctor(String patient,String doctor,Integer page ,Integer pageSize){
        String sql ="select p.id as \"id\"," +
                " p.outpatient_id as \"outpatient_id\"," +
                " p.real_order as \"real_order\"," +
                " p.origin_real_order as \"origin_real_order\"," +
                " p.adm_no as \"adm_no\"," +
                " p.origin_adm_no as \"origin_adm_no\"," +
                " p.serial_no as \"serial_no\"," +
                " p.origin_serial_no as \"origin_serial_no\"," +
                " p.type as \"type\"," +
                " p.patient_code as \"patient_code\"," +
                " p.patient_name as \"patient_name\"," +
                " p.status as \"status\"," +
                " p.mk_fail_reason as \"mk_fail_reason\"," +
                " p.idcard as \"idcard\"," +
                " p.idcard as \"idcard\"," +
                " p.idcard as \"idcard\"," +
                " p.idcard as \"idcard\"," +
                " p.idcard as \"idcard\"," +
                " p.idcard as \"idcard\"," +
                " p.idcard as \"idcard\"," +
                " p.idcard as \"idcard\"," +
                " p.idcard as \"idcard\"," +
                " p.idcard as \"idcard\"," +
                " p.ssc as \"ssc\"" +
                " from wlyy_prescription p " +
                " where p.status >= 20";
        if (StringUtils.isNoneBlank(patient)){
            sql+=" and p.patient_code ='"+patient+"'";
        }
        if (StringUtils.isNoneBlank(doctor)){
            sql+=" and p.doctor ='"+doctor+"'";
        }
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setTotalCount(list==null?0:list.size());
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setDetailModelList(list);
        return mixEnvelop;
    }*/
    /**
     * 查询患者所有处方信息
     *
     * @param page
     * @param size
     * @return
     */
    public PageEnvelop findPatientAllPrescription(String doctor,String keyName, String status, Integer page, Integer size,String patient,String isSelectDrug) {
        BasePatientDO patientDO = basePatientDao.findById(patient);
        if (patientDO==null){
            return PageEnvelop.getError("找不到该患者",-1);
        }
        StringBuffer sql = new StringBuffer(" SELECT DISTINCT b.*, c.oneself_pickup_flg,f.job_title_code,f.job_title_name  FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id  WHERE o.consumer = '");
        StringBuffer countSql = new StringBuffer("select COUNT(DISTINCT b.id) count FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id  WHERE o.consumer = '");
        sql.append(patient).append("') b  LEFT JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id LEFT JOIN base_doctor f ON b.doctor=f.id  ");
        countSql.append(patient).append("') b  LEFT JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id LEFT JOIN base_doctor f ON b.doctor=f.id  ");
        if (StringUtils.isNoneBlank(isSelectDrug)){
            if("0".equalsIgnoreCase(isSelectDrug)){
                sql.append(" left join wlyy_inspection m on b.outpatient_id =m.outpatient_id");
                countSql.append(" left join wlyy_inspection m on b.outpatient_id =m.outpatient_id");
            }
            if ("1".equalsIgnoreCase(isSelectDrug)){
                sql.append(" left join wlyy_prescription_info m on b.id =m.prescription_id");
                countSql.append(" left join wlyy_prescription_info m on b.id =m.prescription_id");
            }
        }
        if (StringUtils.isNotEmpty(status)) {
            status = status.substring(1, status.length() - 1);
            if (StringUtils.isNoneBlank(isSelectDrug)){
                if("0".equalsIgnoreCase(isSelectDrug)){
                    sql.append(" where b.status IN( 9,").append(status).append(")");
                    countSql.append(" where b.status IN( 9,").append(status).append(")");
                }else {
                    sql.append(" where b.status IN(").append(status).append(")");
                    countSql.append(" where b.status IN(").append(status).append(")");
                }
            }else{
                sql.append(" where b.status IN(").append(status).append(")");
                countSql.append(" where b.status IN(").append(status).append(")");
            }
        } else {
            sql.append("  where b.status IN(20,21,30,31,32,100,101)");
            countSql.append(" where b.status IN(20,21,30,31,32,100,101) ");
        }
        if (StringUtils.isNoneBlank(isSelectDrug)){
            if("0".equalsIgnoreCase(isSelectDrug)){
                sql.append(" and m.del =1 ");
                countSql.append(" and m.del =1 ");
            }
            if ("1".equalsIgnoreCase(isSelectDrug)){
                sql.append(" and m.del =1");
                countSql.append(" and m.del =1");
            }
        }
        if (StringUtils.isNotEmpty(keyName)) {
            sql.append(" and (" +
                    " b.doctor_name LIKE '%" + keyName + "%' " +
                    " OR b.dept_name LIKE'%" + keyName + "%' " +
                    " OR b.hospital_name LIKE '%" + keyName + "%' " +
                    " OR d.drug_name LIKE '%" + keyName + "%' " +
                    " OR b.real_order LIKE '%" + keyName + "%' " +
                    ")");
            countSql.append(" and (" +
                    " b.doctor_name LIKE '%" + keyName + "%' " +
                    " OR b.dept_name LIKE'%" + keyName + "%' " +
                    " OR b.hospital_name LIKE '%" + keyName + "%' " +
                    " OR d.drug_name LIKE '%" + keyName + "%' " +
                    " OR b.real_order LIKE '%" + keyName + "%' " +
                    ")");
        }
        if (StringUtils.isNotEmpty(doctor)) {
            sql.append(" and  b.doctor ='" +doctor+"'");
            countSql.append(" and  b.doctor ='" +doctor+"'");
        }
        sql.append(" order by b.prescribe_time DESC ");
        List<WlyyPrescriptionVO> list = null;
        if ("xm_ykyy_wx".equalsIgnoreCase(wxId)) {
            String oracleSql = "SELECT\n" +
                    "\t*\n" +
                    "FROM\n" +
                    "\t(\n" +
                    "\t\tSELECT\n" +
                    "\t\t\tA .*\n" +
                    "\t\tFROM\n" +
                    "\t\t\t(";
            oracleSql += sql.toString();
            oracleSql += "\t\t\t) A\n" +
                    "\t\tWHERE\n" +
                    "  ROWNUM <=" + page * size +
                    "\t) \n" +
                    "WHERE\n" +
                    "\tROWNUM >= " + (page - 1) * size;
            if (flag){
                sql.append("  limit ").append((page - 1) * size).append(",").append(size);
                logger.info("MySql=" + sql.toString());
                list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
            }else {
                logger.info("oracleSql=" + oracleSql);
                list = jdbcTemplate.query(oracleSql, new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
            }
        } else {
//            sql+=" LIMIT  " + (page - 1) * size + "," + size + "";
            sql.append("  limit ").append((page - 1) * size).append(",").append(size);
            logger.info("MySql=" + sql.toString());
            list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
        }
        for (WlyyPrescriptionVO singlePre:list){
            List<WlyyPrescriptionInfoDO> infoDOs = prescriptionInfoDao.findByPrescriptionId(singlePre.getId(),1);
            logger.info("singlePreId===="+singlePre.getId());
            logger.info("infoDOs"+infoDOs);
            List<WlyyPrescriptionInfoVO> infoVOS = new ArrayList<>();
            convertToModels(infoDOs, infoVOS, WlyyPrescriptionInfoVO.class);
            logger.info("infoVOS"+infoVOS);
            singlePre.setInfoVOs(infoVOS);
            List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(singlePre.getId(),1);
            List<WlyyInspectionVO> inspectionVOS = new ArrayList<>();
            convertToModels(inspectionDOS, inspectionVOS, WlyyInspectionVO.class);
            //BeanUtils.copyProperties(inspectionDOS,inspectionVOS);
            singlePre.setInspectionVOs(inspectionVOS);
        }
//        List<WlyyPrescriptionVO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
        logger.info("countSql=" + countSql.toString());
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(countSql.toString());
        long count = Long.parseLong(mapList.get(0).get("count").toString());
        return PageEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, list, page, size, count);
    }
    public Map<String,Object>  findPatientInfoById(String patientId,String doctor){
        String sql = "select b.id as \"id\"," +
                "  b.group_code as \"groupCode\"," +
                "  b.group_name as \"groupName\"" +
                "  from base_patient_group t " +
                " left join base_patient_group_dict b on t.group_id = b.id" +
                " where b.del = '1' and t.patient ='"+patientId+"' and t.doctor ='"+doctor+"'";
        sql+=" group by b.id,b.group_code,b.group_name";
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        String patientSql= "select t.id as \"id\"," +
                " t.name as \"name\"," +
                " t.idcard as \"idcard\"," +
                " t.disease as \"disease\"" +
                "  from base_patient t where t.del = '1' and t.id='"+patientId+"'";
        List<Map<String,Object>> patientInfo = hibenateUtils.createSQLQuery(patientSql);
        if (patientInfo!=null&&patientInfo.size()>0){
            Map<String,Object> patient = patientInfo.get(0);
            String sex = IdCardUtil.getSexForIdcard_new(patient.get("idcard").toString());
            Integer age = IdCardUtil.getAgeForIdcard(patient.get("idcard").toString());
            patient.put("sex",sex);
            patient.put("age",age);
            patient.put("groupList",list);
            return patient;
        }
        return null;
    }
}

+ 2 - 5
business/base-service/src/main/java/com/yihu/jw/wechat/service/BaseSensitiveFilterWordsService.java

@ -19,8 +19,6 @@ import java.util.*;
@Service
public class BaseSensitiveFilterWordsService extends BaseJpaService<BaseSensitiveDO, BaseSensitiveDao> {
    @Autowired
    private BaseSensitiveDao baseSensitiveDao;
    @Autowired
@ -34,14 +32,13 @@ public class BaseSensitiveFilterWordsService extends BaseJpaService<BaseSensitiv
     * @param txt
     * @return
     */
    public String filterSensitiveWords(String txt){
        List<BaseSensitiveDO> list = (List<BaseSensitiveDO>) baseSensitiveDao.findAll();
    public String filterSensitiveWords(String txt, List<BaseSensitiveDO> list){
        HashSet<String> set = new HashSet<>();
        for (BaseSensitiveDO one : list) {
            set.add(one.getSensitiveWord());
        }
        SensitivewordFilter filter = new SensitivewordFilter(set);
        Set<String> words = filter.getSensitiveWord(txt, 1);
        /*Set<String> words = filter.getSensitiveWord(txt, 1);*/
        String replaceTxt = filter.replaceSensitiveWord(txt, 1, "***");
        return replaceTxt;
    }

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

@ -617,15 +617,15 @@ public class WxTemplateService {
                        config.setUrl(url);
                        weixinMessagePushUtils.putWxMsg(wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken(),basePatientWechatDo.getOpenid(),config);
                }
                List<WlyyOutpatientDO> list = outpatientDao.findWlyyOutpatientDO(basePatientDO.getId());
                if (list!=null&&list.size()>0){
                    WlyyOutpatientDO wlyyOutpatientDO = list.get(0);
                    wlyyOutpatientDO.setConsumer(basePatientDO.getId());
                    wlyyOutpatientDO.setDoctorName(senderName);
                    prescriptionService.wxTempalteJPush("consult_remind",wlyyOutpatientDO,null,"","","","");
                }
            }
            List<WlyyOutpatientDO> list = outpatientDao.findWlyyOutpatientDO(basePatientDO.getId());
            if (list!=null&&list.size()>0){
                WlyyOutpatientDO wlyyOutpatientDO = list.get(0);
                wlyyOutpatientDO.setConsumer(basePatientDO.getId());
                wlyyOutpatientDO.setDoctorName(senderName);
                prescriptionService.wxTempalteJPush("consult_remind",wlyyOutpatientDO,null,"","","","");
            }
        }else{
            throw new Exception("接收者ID错误,无法找到该账号");

+ 4 - 2
business/base-service/src/mqConfig/mqdata/BS15018.json

@ -7,7 +7,8 @@
		"OP_DATE": "2011-09-27 15:35:57",
		"CARD_TYPE": "2",
		"CARD_TYPE_NAME": "社保卡",
		"social_no": "350211198411053024"
		"social_no": "350211198411053024",
			"name":"白海灵"
		},
	{
		"PAT_NO": "P5616242-0",
@ -16,6 +17,7 @@
		"OP_DATE": "2014-07-25 08:46:40",
		"CARD_TYPE": "2",
		"CARD_TYPE_NAME": "社保卡",
		"social_no": "350211198411053024"
		"social_no": "350211198411053024",
		"name":"白海灵"
	}]
}

+ 135 - 21
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -4385,15 +4385,17 @@ public class ImService {
					sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
				}
			}else{}*/
			if("xm_ykyy_wx".equals(wxId)){
				if (flag){
					sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
			if (!"xm_ihealth_wx".equalsIgnoreCase(wxId)){
				if("xm_ykyy_wx".equals(wxId)){
					if (flag){
						sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					}else {
						sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					}
				}else {
					sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
				}
			}else {
				sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
			}
			sql =sql +" AND op.type in ('1','2') AND op.outpatient_type = 3 ";
			sql =sql +" ORDER BY op.create_time DESC";
@ -4446,27 +4448,31 @@ public class ImService {
			}else if("16".equals(type)){
				//视频复诊
				sql =sql +"AND op.type=2 AND op.outpatient_type=1 ";
				if("xm_ykyy_wx".equals(wxId)){
					if (flag){
						sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
				if (!"xm_ihealth_wx".equalsIgnoreCase(wxId)){
					if("xm_ykyy_wx".equals(wxId)){
						if (flag){
							sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
						}else {
							sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
						}
					}else {
						sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
						sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
					}
				}else {
					sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
				}
			}else if("12".equals(type)){
				//视频复诊
				sql =sql +"AND op.outpatient_type=2";
				if("xm_ykyy_wx".equals(wxId)){
					if (flag){
						sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					}else  {
						sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
				if (!"xm_ihealth_wx".equalsIgnoreCase(wxId)){
					if("xm_ykyy_wx".equals(wxId)){
						if (flag){
							sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
						}else  {
							sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
						}
					}else {
						sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
					}
				}else {
					sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
				}
			}else{}
@ -4483,4 +4489,112 @@ public class ImService {
		}
		return mapList;
	}
	/**
	 * 查询医生所有的咨询记录
	 * @param doctor 医生标识
	 * @param type 咨询会话类型 : 0 全部
	 * @param pagesize 分页大小
	 * @return
	 */
	@Transactional(readOnly = true)
	public List<Map<String,Object>>  findRecordByDoctor(String doctor,
																  String type, String patientIdCard,String patientName,
																  int page,int pagesize) throws Exception {
		String  sql = "select DISTINCT t.id as \"id\"," +
				"  t.name as \"name\"," +
				"  t.idcard as \"idcard\"," +
				"  t.mobile as \"mobile\"," +
				"  op.doctor as \"doctor\"," +
				"  op.doctor_name as \"doctorName\"," +
				"  op.outpatient_type as \"outpatientType\"" +
				" from base_patient t left join wlyy_outpatient op " +
				" on t.id = op.patient where t.del ='1' and op.status!= -1";
		if (org.apache.commons.lang3.StringUtils.isNoneBlank(doctor)){
			sql+=" and op.doctor = '"+doctor+"'";
		}
		if (org.apache.commons.lang3.StringUtils.isNoneBlank(patientIdCard)){
			sql+=" and t.idcard like '%"+patientIdCard+"%'";
		}
		if (org.apache.commons.lang3.StringUtils.isNoneBlank(patientName)){
			sql+=" and t.name like '%"+patientName+"%'";
		}
		//咨询类型
		if(!StringUtils.isEmpty(type)){
			if (type.equalsIgnoreCase("1")){
				sql +=" AND  op.outpatient_type = 1";
			}else if (type.equalsIgnoreCase("2")){
				sql +=" AND op.outpatient_type = 2";
			}else if (type.equalsIgnoreCase("3")){
				sql +=" AND  op.outpatient_type = 3";
			}else {
				sql +=" AND op.outpatient_type in (1,2,3) ";
			}
		}
		sql+=" order by op.create_time  ";
		logger.info("findRecordByDoctorSQL==="+sql);
		List<Map<String,Object>>  list = hibenateUtils.createSQLQuery(sql,page,pagesize);
		for (Map<String,Object> map:list){
			if (map.get("idcard")!=null){
				String idcard = map.get("idcard").toString();
				Integer age = IdCardUtil.getAgeForIdcard(idcard);
				String sex = IdCardUtil.getSexForIdcard(idcard);
				map.put("patientAge",age);
				map.put("patientSex",sex);
			}
		}
		return list;
	}
	@Transactional(readOnly = true)
	public List<Map<String,Object>>  findRecordCountByDoctor(String doctor,
														String type, String patientIdCard,String patientName) {
		String[] outpatientType = type.split(",");
		List<Map<String,Object>> resultList = new ArrayList<>();
		for (int i=0;i<outpatientType.length;i++){
			String  sql = "select DISTINCT t.id as \"id\"," +
					"  t.name as \"name\"," +
					"  t.idcard as \"idcard\"," +
					"  t.mobile as \"mobile\"," +
					"  op.doctor as \"doctor\"," +
					"  op.doctor_name as \"doctorName\"," +
					"  op.outpatient_type as \"outpatientType\"" +
					" from base_patient t left join wlyy_outpatient op " +
					" on t.id = op.patient where t.del ='1' and op.status!= -1";
			if (org.apache.commons.lang3.StringUtils.isNoneBlank(doctor)){
				sql+=" and op.doctor = '"+doctor+"'";
			}
			if (org.apache.commons.lang3.StringUtils.isNoneBlank(patientIdCard)){
				sql+=" and t.idcard like '%"+patientIdCard+"%'";
			}
			if (org.apache.commons.lang3.StringUtils.isNoneBlank(patientName)){
				sql+=" and t.name like '%"+patientName+"%'";
			}
			//咨询类型
			String mapKey = "";
			Map map = new HashMap();
			if(!StringUtils.isEmpty(outpatientType[i])){
				if (outpatientType[i].equalsIgnoreCase("1")){
					sql +=" AND  op.outpatient_type = 1";
					mapKey="fzNum";
				}else if (outpatientType[i].equalsIgnoreCase("2")){
					sql +=" AND op.outpatient_type = 2";
					mapKey="xtNum";
				}else if (outpatientType[i].equalsIgnoreCase("3")){
					sql +=" AND  op.outpatient_type = 3";
					mapKey="zxNum";
				}else {
					sql +=" AND op.outpatient_type in (1,2,3) ";
					mapKey="zxNum";
				}
				logger.info("findRecordCountByDoctor==="+sql);
				List<Map<String,Object>>  list = hibenateUtils.createSQLQuery(sql);
				map.put(mapKey,list==null?0:list.size());
			}
			resultList.add(map);
		}
		return resultList;
	}
}

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

@ -71,6 +71,15 @@ public class ImUtil {
			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;
	}
	
	/**
	 * 发送消息
@ -746,6 +755,7 @@ public class ImUtil {
	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 CONTENT_TYPE_TEXT = "1";
	

+ 288 - 0
common/common-entity/sql记录

@ -200,3 +200,291 @@ alter table base_patient add `archive_type` tinyint(1) DEFAULT NULL COMMENT '档
-- 2021-04-07 ysj
alter table base_doctor add `level` tinyint(4) DEFAULT NULL COMMENT '类型 1社区医生,2助老员';
-- 2021-04-08 lb
CREATE TABLE `base_patient_bed_apply` (
  `id` varchar(50) NOT NULL,
  `patient` varchar(50) NOT NULL,
  `patient_name` varchar(50) DEFAULT NULL,
  `idcard` varchar(50) DEFAULT NULL COMMENT '身份证',
   org_code varchar(50) DEFAULT NULL COMMENT '申请机构code',
   org_name varchar(50) DEFAULT NULL COMMENT '申请机构名称',
   status tinyint(4) DEFAULT '1' COMMENT '状态 -1取消 0已完成 1未处理 2未评估',
  `create_time` timestamp NULL DEFAULT NULL ,
  `create_user` varchar(50) DEFAULT NULL COMMENT '创建者id',
  `create_user_name` varchar(50) DEFAULT NULL COMMENT '创建者称名',
  `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  `update_user` varchar(50) DEFAULT NULL,
  `update_user_name` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='居民床位申请';
CREATE TABLE `base_capacity_assessment_baseinfo` (
  `id` varchar(50) NOT NULL,
  `assessment_year` varchar(4) DEFAULT NULL COMMENT '评估年份',
  `status` tinyint(5) DEFAULT '1' COMMENT '状态 0失效 1有效 ',
  `patient` varchar(50) DEFAULT NULL,
  `name` varchar(50) DEFAULT NULL,
  `sex` tinyint(2) DEFAULT NULL,
  `age` varchar(5) DEFAULT NULL,
  `nation` varchar(20) DEFAULT NULL COMMENT '名族',
  `nation_name` varchar(50) DEFAULT NULL COMMENT '名族名称',
  `religion` varchar(20) DEFAULT NULL COMMENT '宗教信仰 0无;1有',
  `idcard` varchar(20) DEFAULT NULL,
  `domicile` varchar(20) DEFAULT NULL COMMENT '户籍 0本地户口;1外地户口',
  `marriage` varchar(20) DEFAULT NULL COMMENT '婚姻状况 10.未婚 20.已婚 30.丧偶 40.离婚 90.未说明的婚姻状况',
  `marriage_remark` varchar(255) DEFAULT NULL COMMENT '婚姻状况 备注',
  `education` varchar(20) DEFAULT NULL COMMENT '文化程度 0文盲及半文盲;1小学;2初中;3高中/技校/中专;4大学专科及以上;5不详',
  `income_type` varchar(20) DEFAULT NULL COMMENT '主要经济来源 0退休金/养老金;1子女补贴;2亲友资助;3其他补贴',
  `pension_flag` varchar(20) DEFAULT NULL COMMENT '是否有养老金收入 0无 1有',
  `pension_count` varchar(20) DEFAULT NULL COMMENT '养老金收入 元/月',
  `family_type` varchar(20) DEFAULT NULL COMMENT '是否为经济困难家庭 0否 1特困 2低保 3低保边缘 ',
  `disability_certificate` varchar(20) DEFAULT NULL COMMENT '是否为持证残疾人 0否 1是 ',
  `medical_insurance` varchar(20) DEFAULT NULL COMMENT '是否购买了商业健康(医疗)保险 0否 1是 ',
  `living_type` varchar(20) DEFAULT NULL COMMENT '现住场所:1自有产权房、私房等;2各类租赁房等;3养老院或类似机构;4护理院或类似机构;5医院或类似机构',
  `living_together` varchar(20) DEFAULT NULL COMMENT '同居者类型 0独居;1与配偶/伴侣居住;2与子女居住;3与孙辈居住;4与父母居住;5与兄弟姐妹居住;6与其他亲友居住;7其他',
  `living_together_remark` varchar(255) DEFAULT NULL COMMENT '同居者备注',
  `dementia_flag` varchar(20) DEFAULT NULL COMMENT '痴呆症 0无 1有',
  `mental_illness` varchar(20) DEFAULT NULL COMMENT '精神疾病(可多选)0无;1精神分裂症;2双相情感障碍;3偏执性精神障碍;4分裂情感性障碍;5癫痫所致精神障碍;6精神发育迟滞伴发精神障碍',
  `disease_type` varchar(20) DEFAULT NULL COMMENT '患病类型可多选;0无 1肿瘤(晚期)2严重心律失常3压疮4慢性心力衰竭(心功能III-IV级)5慢性肾功能衰竭(尿毒症期)6多器官功能衰竭7蛋白质能量营养不足(重度)8慢性阻塞性肺疾病(肺心病心功能III-IV级)9呼吸衰竭10脑血管意外合并吞咽障碍11其他',
  `disease_remark` varchar(255) DEFAULT NULL COMMENT '其他疾病',
  `fall_lately` varchar(20) DEFAULT NULL COMMENT '近30天跌倒 0无;1一次;2两次;3三次及以上',
  `lost_lately` varchar(20) DEFAULT NULL COMMENT '近30天走失 0无;1一次;2两次;3三次及以上',
  `choking_lately` varchar(20) DEFAULT NULL COMMENT '近30天噎食 0无;1一次;2两次;3三次及以上',
  `suicide_lately` varchar(20) DEFAULT NULL COMMENT '近30天自杀 0无;1一次;2两次;3三次及以上',
  `remark_lately` varchar(255) DEFAULT NULL COMMENT '近30天意外 其他 0无;1一次;2两次;3三次及以上',
  `medical_services` varchar(255) DEFAULT NULL COMMENT '近7天是否接受过医疗护理服务 0无1有',
  `domicile_county` varchar(255) DEFAULT NULL COMMENT '户籍  区(县、市)',
  `domicile_county_name` varchar(255) DEFAULT NULL COMMENT '户籍  区(县、市)',
  `domicile_street` varchar(255) DEFAULT NULL COMMENT '户籍  街(镇)',
  `domicile_street_name` varchar(255) DEFAULT NULL COMMENT '户籍  街(镇)',
  `domicile_org` varchar(255) DEFAULT NULL COMMENT '户籍 社(村)',
  `domicile_org_name` varchar(255) DEFAULT NULL COMMENT '户籍 社(村)',
  `domicile_building` varchar(255) DEFAULT NULL COMMENT '户籍 xx幢',
  `domicile_room` varchar(255) DEFAULT NULL COMMENT '户籍 xx室',
  `live_county` varchar(255) DEFAULT NULL COMMENT '居住地  区(县、市)',
  `live_county_name` varchar(255) DEFAULT NULL COMMENT '居住地名称  区(县、市)',
  `live_street` varchar(255) DEFAULT NULL COMMENT '居住地  街(镇)',
  `live_street_name` varchar(255) DEFAULT NULL COMMENT '居住地名称  街(镇)',
  `live_org` varchar(255) DEFAULT NULL COMMENT '居住地 社(村)',
  `live_org_name` varchar(255) DEFAULT NULL COMMENT '居住地名称 社(村)',
  `live_building` varchar(255) DEFAULT NULL COMMENT '居住地 xx幢',
  `live_room` varchar(255) DEFAULT NULL COMMENT '居住地 xx室',
  `postcode` varchar(50) DEFAULT NULL COMMENT '邮编',
  `residence_phone` varchar(50) DEFAULT NULL COMMENT '住宅电话',
  `patient_phone` varchar(50) DEFAULT NULL COMMENT '手机',
  `proxy_name` varchar(50) DEFAULT NULL COMMENT '代理人姓名',
  `applicant_relation` varchar(50) DEFAULT NULL COMMENT '与申请人关系',
  `proxy_address` varchar(255) DEFAULT NULL COMMENT '代理人地址',
  `proxy_telephone` varchar(50) DEFAULT NULL COMMENT '代理人电话',
  `proxy_phone` varchar(50) DEFAULT NULL COMMENT '代理人手机',
  `applicant_sign` varchar(255) DEFAULT NULL COMMENT '申请人(代理人) 签字结果图片url',
  `applicant_date` varchar(50) DEFAULT NULL COMMENT '申请日期',
  `service_type` varchar(50) DEFAULT NULL COMMENT '养老服务形式 0居家养老 1机构养老',
  `acceptable_services_life1` varchar(50) DEFAULT NULL COMMENT '直接生活照顾  1穿衣;2修饰;3口腔清洁;4皮肤清洁;5喂食服务;6排泄照料 ',
  `acceptable_services_life2` varchar(50) DEFAULT NULL COMMENT '间接生活照顾  1居室清洁;2更换洗涤;3上门维修;4定期探访;5膳食服务;6文化教育;7娱乐休闲;8室外休闲(户外);9紧急呼援;10法律援助;11转介服务;12咨询服务',
  `acceptable_services_mental` varchar(50) DEFAULT NULL COMMENT '精神心理照顾 1危机干预;2沟通;3精神支持;4心理疏导;5心理咨询',
  `acceptable_services_rehabilitation` varchar(255) DEFAULT NULL COMMENT '康复护理照顾 1定期翻身;2压疮预;3防活动肢体;4肢体保健;5康复活动;6预防保健;7健康咨询;8健康管理;9健康教育;10临终关怀 ',
  `acceptable_services_other` varchar(255) DEFAULT NULL COMMENT '其他',
  `create_time` datetime DEFAULT NULL,
  `medical_insurance_type` varchar(20) DEFAULT NULL COMMENT '医保类别 1职工基本医疗保险 2城乡居民基本医疗保险 3其他医疗保障 4无任何保障',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='能力评估-基本信息表';
CREATE TABLE `base_capacity_assessment_living_ability` (
  `id` varchar(50) NOT NULL,
  `assessment_year` varchar(4) DEFAULT NULL COMMENT '评估年份',
  `status` tinyint(5) DEFAULT '1' COMMENT '状态 0失效 1有效 ',
  `patient` varchar(50) DEFAULT NULL,
  `eating_ability_score` varchar(50) DEFAULT NULL COMMENT '进食能力得分 10可独立进食;5需部分帮助;0需要极大帮助或完全依赖他人',
  `shower_ability_score` varchar(50) DEFAULT NULL COMMENT '洗澡能力得分 5可独立完成;0需要帮助',
  `washing_ability_score` varchar(50) DEFAULT NULL COMMENT '洗漱能力得分 5可独立完成;0需要帮助',
  `dressing_ability_score` varchar(50) DEFAULT NULL COMMENT '穿衣能力得分 10可独立完成;5需要部分帮助;0需要极大帮助或完全依赖他人',
  `excretion_ability_score` varchar(50) DEFAULT NULL COMMENT '排便控制能力得分 10可自主控制;5偶尔失控(每周小于一次,或需要他人提示);0完全失控',
  `urination_ability_score` varchar(50) DEFAULT NULL COMMENT '排尿控制能力得分 10可自主控制;5偶尔失控(每周小于一次,或需要他人提示);0完全失控或留置导尿管',
  `toilet_ability_score` varchar(50) DEFAULT NULL COMMENT '如厕能力得分 10可独立完成;5需部分帮助;0需要极大帮助或完全依赖他人',
  `transfer_bed_ability_score` varchar(50) DEFAULT NULL COMMENT '床椅转移能力得分 15可独立完成10需要部分帮忙5需要极大帮忙0完全依赖他人',
  `walking_ability_score` varchar(50) DEFAULT NULL COMMENT '平地行走能力得分 15可独立行走45m;10需要部分帮助;5需要极大帮助;0完全依赖他人',
  `down_stairs_ability_score` varchar(50) DEFAULT NULL COMMENT '上下楼梯能力得分10可独立上下楼梯(连续10~15个台阶);5需要部分帮忙0需要极大帮助或完全依赖他人',
  `total_score` varchar(50) DEFAULT NULL COMMENT '日常生活能力总分 上述得分和 总分100 ',
  `ability_grade` varchar(50) DEFAULT NULL COMMENT '能力等级:0能力完好(100);1轻度受损(65-95);2中度受损(45-60);3重度受损(≤40)',
  `create_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='能力评估-日常生活能力评估表';
CREATE TABLE `base_capacity_assessment_cognitive_ability` (
  `id` varchar(50) NOT NULL,
  `assessment_year` varchar(4) DEFAULT NULL COMMENT '评估年份',
  `status` tinyint(5) DEFAULT '1' COMMENT '状态 0失效 1有效 ',
  `patient` varchar(50) DEFAULT NULL,
  `question1` varchar(4) DEFAULT NULL COMMENT '问题一得分 总分3分',
  `question2` varchar(4) DEFAULT NULL COMMENT '问题二得分 总分5分',
  `question3` varchar(4) DEFAULT NULL COMMENT '问题三得分 总分5分',
  `question4` varchar(4) DEFAULT NULL COMMENT '问题四得分 总分3分',
  `total_score` varchar(50) DEFAULT NULL COMMENT '认知能力 上述得分和  ',
  `ability_grade` varchar(50) DEFAULT NULL COMMENT '能力等级:0能力完好(16);1轻度受损(13-15);2中度受损(9-12);3重度受损(≤8)',
  `create_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='能力评估-认知能力表';
CREATE TABLE `base_capacity_assessment_social_ability` (
  `id` varchar(50) NOT NULL,
  `assessment_year` varchar(4) DEFAULT NULL COMMENT '评估年份',
  `status` tinyint(5) DEFAULT '1' COMMENT '状态 0失效 1有效 ',
  `patient` varchar(50) DEFAULT NULL,
  `aggress_score` varchar(4) DEFAULT NULL COMMENT '攻击行为得分 总分3分',
  `depressed_score` varchar(4) DEFAULT NULL COMMENT '抑郁状态得分 总分5分',
  `consciousness_score` varchar(4) DEFAULT NULL COMMENT '意识水平得分 总分5分',
  `communicate_score` varchar(4) DEFAULT NULL COMMENT '沟通交流得分 总分3分',
  `social_skills_score` varchar(50) DEFAULT NULL COMMENT '社交能力得分   ',
  `vision_score` varchar(50) DEFAULT NULL COMMENT '视力功能得分   ',
  `hearing_score` varchar(50) DEFAULT NULL COMMENT '听力能力得分   ',
  `total_score` varchar(50) DEFAULT NULL COMMENT ' 精神状态与社会交流能力总分 上述得分和 总分22',
  `ability_grade` varchar(50) DEFAULT NULL COMMENT '能力等级:0能力完好(22);1轻度受损(15-21);2中度受损(7-14);3重度受损(≤6)',
  `create_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='能力评估-精神状态与社会交流能力表';
CREATE TABLE `base_security_monitoring_order_cancel_log` (
  `id` varchar(50) NOT NULL,
  `order_id` varchar(50) NOT NULL COMMENT '工单id',
  `patient` varchar(50) NOT NULL COMMENT '居民code',
  `cancel_type` int(1) NOT NULL COMMENT '取消类型:1-调度员取消,2-居民取消 3 医生取消',
  `cancel_reason` varchar(50) DEFAULT NULL COMMENT '取消理由',
  `time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '取消时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='安防工单取消记录';
CREATE TABLE `base_semoni_patient_confirm_log` (
  `id` varchar(50) NOT NULL,
  `order_id` varchar(50) NOT NULL COMMENT '工单id',
  `patient` varchar(50) NOT NULL COMMENT '居民',
  `patient_name` varchar(50) NOT NULL COMMENT '居民姓名',
  `type` int(1) NOT NULL COMMENT '确认操作类型:1-确认基础信息无误或变更,2-确认医生变更服务信息,3-同意工单转接  4同意取消工单',
  `description` varchar(200) DEFAULT NULL COMMENT '操作描述',
  `create_user` varchar(50) DEFAULT NULL COMMENT '创建者id',
  `create_user_name` varchar(50) DEFAULT NULL COMMENT '创建者称名',
  `create_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '转接时间',
  `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  `update_user` varchar(50) DEFAULT NULL,
  `update_user_name` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='安防服务工单居民确认操作日志记录';
CREATE TABLE `base_semoni_doctor_status` (
  `id` varchar(50) NOT NULL,
  `doctor` varchar(50) NOT NULL COMMENT '医生code',
  `status` int(1) NOT NULL DEFAULT '1' COMMENT '医生状态:1-待派单,2-待接单,3-待服务,4-服务中,5-停止接单',
  `create_user` varchar(50) DEFAULT NULL COMMENT '创建者id',
  `create_user_name` varchar(50) DEFAULT NULL COMMENT '创建者称名',
  `create_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '转接时间',
  `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  `update_user` varchar(50) DEFAULT NULL,
  `update_user_name` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='医生安防服务工单状态情况';
alter TABLE base.base_security_monitoring_order add COLUMN doctor_confirm_finish_img VARCHAR(3000) DEFAULT NULL COMMENT '医生确认完成照片';
alter TABLE base.base_security_monitoring_order add COLUMN doctor_confirm_finish_time timestamp NULL DEFAULT NULL COMMENT '医生确认完成时间';
-- 2021-04-09 中山消息推送
alter table wlyy_outpatient ADD last_remind_time timestamp ;
alter table wlyy_outpatient ADD remind_doctor  varchar(50) ;
-- 2021-04-10 lb
ALTER table base.base_patient_bed_apply  MODIFY `patient` varchar(50) DEFAULT NULL;
-- 2021-04-12 lb
CREATE TABLE `base_emergency_assistance_order` (
  `id` varchar(50) NOT NULL DEFAULT '',
  `patient` varchar(50) DEFAULT NULL COMMENT '发起救助的居民id',
  `patient_name` varchar(10) DEFAULT NULL COMMENT '发起救助的居民姓名',
  `patient_phone` varchar(15) DEFAULT NULL COMMENT '救助居民电话',
  `patient_idcard` varchar(200) DEFAULT NULL COMMENT '救助居民身份证',
  `org_code` varchar(100) DEFAULT NULL COMMENT '救助居民所在机构code',
  `org_name` varchar(100) DEFAULT NULL COMMENT '救助居民所在机构名称',
  `serve_address` varchar(100) DEFAULT NULL COMMENT '居民当前定位地址',
  `serve_lat` varchar(100) DEFAULT NULL COMMENT '居民当前定位地址纬度',
  `serve_lon` varchar(100) DEFAULT NULL COMMENT '居民当前定位地址经度',
  `session_id` varchar(150) DEFAULT NULL COMMENT '会话id',
  `doctor` varchar(50) DEFAULT NULL COMMENT '医生code',
  `doctor_name` varchar(50) DEFAULT NULL COMMENT '医生name',
  `doctor_address` varchar(100) DEFAULT NULL COMMENT '医生当前定位地址',
  `doctor_lat` varchar(100) DEFAULT NULL COMMENT '医生当定位地址纬度',
  `doctor_lon` varchar(100) DEFAULT NULL COMMENT '医生当前定位地址经度',
  `conclusion` varchar(100) DEFAULT NULL COMMENT '服务完成笔记',
  `conclusion_img` varchar(100) DEFAULT NULL COMMENT '服务相关附件',
  `status` tinyint(4) DEFAULT '1' COMMENT '工单状态 -1已取消 0已完成 1申请中',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  `create_user` varchar(50) DEFAULT NULL COMMENT '创建者id',
  `create_user_name` varchar(50) DEFAULT NULL COMMENT '创建者名称',
  `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  `update_user` varchar(50) DEFAULT NULL,
  `update_user_name` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='居民紧急救助服务工单';
-- 2021-04-13 lb
ALTER table base_doctor ADD COLUMN `doctor_lat` varchar(100) DEFAULT NULL COMMENT '医生当前定位地址纬度';
ALTER table base_doctor ADD COLUMN `doctor_lon` varchar(100) DEFAULT NULL COMMENT '医生当前定位地址经度';
alter TABLE base_emergency_assistance_order add COLUMN complete_time timestamp NULL DEFAULT NULL COMMENT '医生确认完成时间';
-- 2021-04-19 lb
ALTER table base.base_doctor add COLUMN `doctor_locate_address` varchar(100) DEFAULT NULL COMMENT '医生当前定位地址';
ALTER table base.base_emergency_assistance_order add COLUMN `team_code` varchar(100) DEFAULT NULL COMMENT '服务团队';
--2021-04-23
ALTER table base.base_emergency_assistance_order modify COLUMN  `conclusion_img` varchar(1000) DEFAULT NULL COMMENT '服务相关附件';
-- 2021-04-26
ALTER table base.base_emergency_assistance_order add COLUMN `proxy_patient` varchar(50) DEFAULT NULL COMMENT '代理发起工单的居民code,替父母,孩子等发起工单';
ALTER table base.base_emergency_assistance_order add COLUMN `proxy_patient_name` varchar(10) DEFAULT NULL COMMENT '代理发起工单的居民code,替父母,孩子等发起工单';
ALTER table base.base_emergency_assistance_order add COLUMN  `proxy_patient_phone` varchar(15) DEFAULT NULL COMMENT '代理发起工单的居民联系电话';
ALTER table base.base_emergency_assistance_order add COLUMN   `type` tinyint(2) DEFAULT '1' COMMENT '发起类型(1本人发起 2家人待预约 3医生代预约)';
-- 2021-04-20 wj
alter table base_doctor add doctor_level tinyint(4) DEFAULT NULL COMMENT '类型 1社区医生,2助老员';
-- 2021-04-29 wj
alter table base_patient ADD disease varchar(50) ;
alter table patient_medicare_card ADD medicare_number varchar(50) ;
-- 2021-05-07 ysj
alter table base_patient_family_member add is_contacts tinyint(1) DEFAULT NULL COMMENT '是否是一键联系人';
CREATE TABLE `base_capacity_doctor` (
  `id` varchar(50) NOT NULL,
  `capacity_id` varchar(50) DEFAULT NULL COMMENT '能力评估记录id',
  `doctor_id` varchar(50) DEFAULT NULL COMMENT '医生id',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='能力评估医生关联表';
CREATE TABLE `base_patient_contacts_org` (
  `id` varchar(50) NOT NULL,
  `patient` varchar(50) DEFAULT NULL,
  `org_code` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='居民联系服务站';
-- 2021-05-07 skj
ALTER TABLE base.wlyy_patient_device add COLUMN  `sos_address` varchar(50) DEFAULT NULL COMMENT '设备类型为报警器时,需要填写投放地址 category_code = 7';
-- 2021-05-08 skj
ALTER TABLE base.base_life_care_item_dict add COLUMN  `life_care_img` varchar(255) DEFAULT NULL COMMENT '服务项目图片';
-- 2021-05-08 lb
CREATE TABLE `base_device_sos_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `patient` varchar(50) DEFAULT NULL COMMENT '居民code',
  `patient_name` varchar(50) DEFAULT NULL COMMENT '姓名',
  `idcard` varchar(32) DEFAULT NULL COMMENT '身份证',
  `category_code` varchar(50) DEFAULT NULL COMMENT '设备类型标识1血糖仪,2.血压计,3药盒,4智能手表',
  `device_sn` varchar(50) NOT NULL COMMENT '设备SN码',
  `sos_address` varchar(100) DEFAULT NULL COMMENT '报警地址',
  `sos_lat` varchar(100) DEFAULT NULL COMMENT '报警地址纬度',
  `sos_lon` varchar(100) DEFAULT NULL COMMENT '报警地址经度',
  `sos_send_status` varchar(255) DEFAULT NULL COMMENT '紧急救助发起状态 200成功, -1 失败',
  `sos_send_message` varchar(500) DEFAULT NULL COMMENT '紧急救助发起返回消息',
  `create_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='设备紧急救助日志表';

+ 38 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/IdEntity.java

@ -0,0 +1,38 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.jw.entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
/**
 * 统一定义id的entity基类.
 * 
 * 基类统一定义id的属性名称、数据类型、列名映射及生成策略.
 * Oracle需要每个Entity独立定义id的SEQUCENCE时,不继承于本类而改为实现一个Idable的接口。
 * 
 * @author calvin
 */
// JPA 基类的标识
@MappedSuperclass
public abstract class IdEntity implements Serializable {
	private static final long serialVersionUID = 3673803562328635206L;
	protected Long id;  // 非业务主键
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
}

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

@ -287,6 +287,9 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
     * 类型 1社区医生,2助老员
     */
    private Integer level;
    private String doctorLat;//医生当前定位地址纬度
    private String doctorLon;//医生当前定位地址经度
    private String doctorLocateAddress;//医生定位地址
    @Column(name = "visit_time")
@ -755,7 +758,7 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
        this.xtfzChargeType = xtfzChargeType;
    }
    @Column(name = "level")
    @Column(name = "doctor_level")
    public Integer getLevel() {
        return level;
    }
@ -763,4 +766,28 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    public void setLevel(Integer level) {
        this.level = level;
    }
    public String getDoctorLat() {
        return doctorLat;
    }
    public void setDoctorLat(String doctorLat) {
        this.doctorLat = doctorLat;
    }
    public String getDoctorLon() {
        return doctorLon;
    }
    public void setDoctorLon(String doctorLon) {
        this.doctorLon = doctorLon;
    }
    public String getDoctorLocateAddress() {
        return doctorLocateAddress;
    }
    public void setDoctorLocateAddress(String doctorLocateAddress) {
        this.doctorLocateAddress = doctorLocateAddress;
    }
}

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

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

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgDO.java

@ -84,7 +84,7 @@ public class BaseOrgDO extends UuidIdentityEntityWithOperator {
	private String spell;
    /**
	 * 机构类型: 1. 等级医院2. 社区医院3.  养老机构
	 * 机构类型: 1. 等级医院2. 社区医院3.  养老机构 4.  托育机构
	 */
	private String type;

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientFamilyMemberDO.java

@ -17,6 +17,7 @@ public class BasePatientFamilyMemberDO extends UuidIdentityEntityWithOperator {
    private String familyMember;//家庭成员code',
    private Integer familyRelation;//家庭关系关系 1配偶 2父亲 3母亲 4公公 5婆婆 6岳父 7岳母 8子女',
    private Integer isAuthorize;//是否授权0:未授权,1:已授权,默认为1',
    private Integer isContacts;//是否是一键联系人 1是
    private Integer del;//删除标志(1正常,0删除)
    @Column(name = "patient")
@ -63,4 +64,13 @@ public class BasePatientFamilyMemberDO extends UuidIdentityEntityWithOperator {
    public void setDel(Integer del) {
        this.del = del;
    }
    @Column(name = "is_contacts")
    public Integer getIsContacts() {
        return isContacts;
    }
    public void setIsContacts(Integer isContacts) {
        this.isContacts = isContacts;
    }
}

+ 9 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/PatientMedicareCardDO.java

@ -78,7 +78,7 @@ public class PatientMedicareCardDO extends IntegerIdentityEntity {
           this.desc = desc;
       }
   }
    private String medicareNumber;
    /**
	 * 卡标识
	 */
@ -123,9 +123,16 @@ public class PatientMedicareCardDO extends IntegerIdentityEntity {
	 * 状态,0-解除绑定,1-绑定中
	 */
	private String del;
    @Column(name = "medicare_number")
    public String getMedicareNumber() {
        return medicareNumber;
    }
    public void setMedicareNumber(String medicareNumber) {
        this.medicareNumber = medicareNumber;
    }
	@Column(name = "code")
    @Column(name = "code")
    public String getCode() {
        return code;
    }

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageItemDO.java

@ -5,6 +5,7 @@ import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.math.BigDecimal;
/**
@ -23,6 +24,7 @@ public class ServicePackageItemDO extends UuidIdentityEntity implements java.io.
    private String orgName;//'机构名称'
    private String introduce;//'服务简介'
    private String del;//是否生效(1 生效,0 失效)
    private String delName;
    private String teamCode;//'服务团队code'
    private String teamName;//'服务团队名称'
    private String createTime;//
@ -143,4 +145,12 @@ public class ServicePackageItemDO extends UuidIdentityEntity implements java.io.
    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
    @Transient
    public String getDelName() {
        return delName;
    }
    public void setDelName(String delName) {
        this.delName = delName;
    }
}

+ 69 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/apply/PatientBedApplyDo.java

@ -0,0 +1,69 @@
package com.yihu.jw.entity.care.apply;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Bing on 2021/4/8.
 */
@Entity
@Table(name="base_patient_bed_apply")
public class PatientBedApplyDo extends UuidIdentityEntityWithOperator {
    private String patient;
    private String patientName;
    private String idcard;
    private String orgCode;
    private String orgName;
    private Integer status; //状态 -1取消 0已完成 1未评估 2未分配服务包
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
}

+ 293 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/assistance/EmergencyAssistanceDO.java

@ -0,0 +1,293 @@
package com.yihu.jw.entity.care.assistance;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import netscape.javascript.JSObject;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
/**
 * Created by Bing on 2021/4/12.
 */
@Entity
@Table(name="base_emergency_assistance_order")
public class EmergencyAssistanceDO extends UuidIdentityEntityWithOperator {
    private String patient; //发起救助的居民id
    private String patientName; //发起救助的居民姓名
    private String patientPhone; //救助居民电话
    private String patientIdcard; //救助居民身份证
    private String proxyPatient; //代理发起工单的居民code,替父母,孩子等发起工单
    private String proxyPatientName; //代理发起工单的居民code,替父母,孩子等发起工单
    private String proxyPatientPhone; //代理发起工单的居民联系电话
    private String orgCode; //救助居民所在机构code
    private String orgName; //救助居民所在机构名称
    private String serveAddress;
    private String serveLat; //居民当前定位地址纬度
    private String serveLon; //居民当前定位地址经度
    private String sessionId; //会话id
    private String doctor; //医生code
    private String doctorName; //医生name
    private String doctorAddress;
    private String doctorLat; //医生当定位地址纬度
    private String doctorLon; //医生当前定位地址经度
    private String conclusion; //服务完成笔记
    private String conclusionImg; //服务相关附件
    private Integer status; //工单状态 -1已取消 0已完成 1申请中
    private Date completeTime;//完成时间
    private String teamCode;
    private Integer type; //发起类型(1本人发起 2家人待预约 3医生代预约)
    private String sendMessage;//
    private Integer patientAge;
    private String patientPhoto;
    private Integer patientSex;
    private double distance;//医生与患者距离 单位km
    private String otherDoctorDistance;
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getPatientPhone() {
        return patientPhone;
    }
    public void setPatientPhone(String patientPhone) {
        this.patientPhone = patientPhone;
    }
    public String getPatientIdcard() {
        return patientIdcard;
    }
    public void setPatientIdcard(String patientIdcard) {
        this.patientIdcard = patientIdcard;
    }
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    public String getServeLat() {
        return serveLat;
    }
    public void setServeLat(String serveLat) {
        this.serveLat = serveLat;
    }
    public String getServeLon() {
        return serveLon;
    }
    public void setServeLon(String serveLon) {
        this.serveLon = serveLon;
    }
    public String getSessionId() {
        return sessionId;
    }
    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getDoctorLat() {
        return doctorLat;
    }
    public void setDoctorLat(String doctorLat) {
        this.doctorLat = doctorLat;
    }
    public String getDoctorLon() {
        return doctorLon;
    }
    public void setDoctorLon(String doctorLon) {
        this.doctorLon = doctorLon;
    }
    public String getConclusion() {
        return conclusion;
    }
    public void setConclusion(String conclusion) {
        this.conclusion = conclusion;
    }
    public String getConclusionImg() {
        return conclusionImg;
    }
    public void setConclusionImg(String conclusionImg) {
        this.conclusionImg = conclusionImg;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getServeAddress() {
        return serveAddress;
    }
    public void setServeAddress(String serveAddress) {
        this.serveAddress = serveAddress;
    }
    public String getDoctorAddress() {
        return doctorAddress;
    }
    public void setDoctorAddress(String doctorAddress) {
        this.doctorAddress = doctorAddress;
    }
    public Date getCompleteTime() {
        return completeTime;
    }
    public void setCompleteTime(Date completeTime) {
        this.completeTime = completeTime;
    }
    public String getTeamCode() {
        return teamCode;
    }
    public void setTeamCode(String teamCode) {
        this.teamCode = teamCode;
    }
    public String getProxyPatient() {
        return proxyPatient;
    }
    public void setProxyPatient(String proxyPatient) {
        this.proxyPatient = proxyPatient;
    }
    public String getProxyPatientName() {
        return proxyPatientName;
    }
    public void setProxyPatientName(String proxyPatientName) {
        this.proxyPatientName = proxyPatientName;
    }
    public String getProxyPatientPhone() {
        return proxyPatientPhone;
    }
    public void setProxyPatientPhone(String proxyPatientPhone) {
        this.proxyPatientPhone = proxyPatientPhone;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    @Transient
    public String getSendMessage() {
        return sendMessage;
    }
    public void setSendMessage(String sendMessage) {
        this.sendMessage = sendMessage;
    }
    @Transient
    public Integer getPatientAge() {
        return patientAge;
    }
    public void setPatientAge(Integer patientAge) {
        this.patientAge = patientAge;
    }
    @Transient
    public String getPatientPhoto() {
        return patientPhoto;
    }
    public void setPatientPhoto(String patientPhoto) {
        this.patientPhoto = patientPhoto;
    }
    @Transient
    public Integer getPatientSex() {
        return patientSex;
    }
    public void setPatientSex(Integer patientSex) {
        this.patientSex = patientSex;
    }
    @Transient
    public double getDistance() {
        return distance;
    }
    public void setDistance(double distance) {
        this.distance = distance;
    }
    @Transient
    public String getOtherDoctorDistance() {
        return otherDoctorDistance;
    }
    public void setOtherDoctorDistance(String otherDoctorDistance) {
        this.otherDoctorDistance = otherDoctorDistance;
    }
}

+ 40 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/contacts/BasePatientContactsOrgDO.java

@ -0,0 +1,40 @@
package com.yihu.jw.entity.care.contacts;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/7
 * @Description:
 */
@Entity
@Table(name="base_patient_contacts_org")
public class BasePatientContactsOrgDO extends UuidIdentityEntity {
    private String patient;
    private String orgCode;
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "org_code")
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
}

+ 9 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/Device.java

@ -26,6 +26,7 @@ public class Device extends IdEntity {
	private String name;
	private Date czrq;
	private String del;
	private String serviceTopic;//设备所属专题 防走失 preventLost
	@Column(name="category_code")
	public String getCategoryCode() {
@ -108,4 +109,12 @@ public class Device extends IdEntity {
	public void setDel(String del) {
		this.del = del;
	}
	public String getServiceTopic() {
		return serviceTopic;
	}
	public void setServiceTopic(String serviceTopic) {
		this.serviceTopic = serviceTopic;
	}
}

+ 15 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/PatientDevice.java

@ -9,7 +9,7 @@ import java.util.Date;
@Entity
@Table(name = "wlyy_patient_device")
@SequenceGenerator(name="id_generated", sequenceName="wlyy_patient_device")
public class PatientDevice extends IdEntity {
public class DevicePatientDevice extends IdEntity {
    // 设备ID
    private Long deviceId;
@ -65,6 +65,9 @@ public class PatientDevice extends IdEntity {
    private String applyReason;
    //医生拒绝原因
    private String refuseReason;
    //设备类型为报警器时,需要填写投放地址 category_code = 7
    private String sosAddress;
  //========================非表字段======================
    //患者居住地址
    private String address;
@ -251,6 +254,15 @@ public class PatientDevice extends IdEntity {
        this.checkDoctorName = checkDoctorName;
    }
    @Column(name = "sos_address")
    public String getSosAddress() {
        return sosAddress;
    }
    public void setSosAddress(String sosAddress) {
        this.sosAddress = sosAddress;
    }
    @Transient
    public String getAddress() {
        return address;
@ -260,7 +272,7 @@ public class PatientDevice extends IdEntity {
        this.address = address;
    }
    public PatientDevice(String address, Date czrq, String userIdcard, String deviceSn, Long deviceId) {
    public DevicePatientDevice(String address, Date czrq, String userIdcard, String deviceSn, Long deviceId) {
        this.address = address;
        this.czrq = czrq;
        this.userIdcard = userIdcard;
@ -268,7 +280,7 @@ public class PatientDevice extends IdEntity {
        this.deviceId = deviceId;
    }
    public PatientDevice() {
    public DevicePatientDevice() {
    }
    
    public Integer getApplyStatus() {

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DevicePatientHealthIndex.java

@ -35,7 +35,7 @@ public class DevicePatientHealthIndex extends IdEntity {
	private String value6;
	// 睡前
	private String value7;
	// 健康指标类型(1血糖,2血压,3体重/身高/BMI,4腰围)
	// 健康指标类型(1血糖,2血压,3体重/身高/BMI,4腰围,5心率)
	private Integer type;
	// 记录时间

+ 114 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DeviceSosLogDO.java

@ -0,0 +1,114 @@
package com.yihu.jw.entity.care.device;
import com.yihu.jw.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Bing on 2021/5/8.
 */
@Entity
@Table(name="base_device_sos_log")
public class DeviceSosLogDO extends IdEntity {
    private String patient; //居民code
    private String patientName; //姓名
    private String idcard;  //身份证
    private String categoryCode;    //设备类型标识1血糖仪,2.血压计,3药盒,4智能手表
    private String deviceSn;    //设备SN码
    private String sosAddress;  //报警地址
    private String sosLat;  //报警地址纬度
    private String sosLon;  //报警地址经度
    private String sosSendStatus;//紧急救助发起状态 200成功 -1失败
    private String sosSendMessage; //紧急救助返回消息
    private Date createTime;//
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public String getCategoryCode() {
        return categoryCode;
    }
    public void setCategoryCode(String categoryCode) {
        this.categoryCode = categoryCode;
    }
    public String getDeviceSn() {
        return deviceSn;
    }
    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }
    public String getSosAddress() {
        return sosAddress;
    }
    public void setSosAddress(String sosAddress) {
        this.sosAddress = sosAddress;
    }
    public String getSosLat() {
        return sosLat;
    }
    public void setSosLat(String sosLat) {
        this.sosLat = sosLat;
    }
    public String getSosLon() {
        return sosLon;
    }
    public void setSosLon(String sosLon) {
        this.sosLon = sosLon;
    }
    public String getSosSendStatus() {
        return sosSendStatus;
    }
    public void setSosSendStatus(String sosSendStatus) {
        this.sosSendStatus = sosSendStatus;
    }
    public String getSosSendMessage() {
        return sosSendMessage;
    }
    public void setSosSendMessage(String sosSendMessage) {
        this.sosSendMessage = sosSendMessage;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

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

@ -2,6 +2,7 @@ package com.yihu.jw.entity.care.lifeCare;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
@ -19,6 +20,7 @@ public class LifeCareItemDictDO extends UuidIdentityEntity{
    private BigDecimal price;//价格
    private Integer sort;//排序字段
    private Integer del;//删除标志 1正常,0删除
    private String lifeCareImg;//服务项目图片
    public String getCode() {
        return code;
@ -67,4 +69,13 @@ public class LifeCareItemDictDO extends UuidIdentityEntity{
    public void setDel(Integer del) {
        this.del = del;
    }
    @Column(name = "life_care_img")
    public String getLifeCareImg() {
        return lifeCareImg;
    }
    public void setLifeCareImg(String lifeCareImg) {
        this.lifeCareImg = lifeCareImg;
    }
}

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/lifeCare/LifeCareOrderDO.java

@ -254,6 +254,7 @@ public class LifeCareOrderDO extends UuidIdentityEntityWithOperator {
     * 服务机构
     */
    private String hospital;
    private String hospitalName;
    private Integer type;//发起工单类型(1本人发起 2家人待预约 3医生代预约)
    private String relationCode;//业务关联
@ -513,6 +514,15 @@ public class LifeCareOrderDO extends UuidIdentityEntityWithOperator {
        this.hospital = hospital;
    }
    @Column(name = "hospital_name")
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    @Transient
    public List<LifeCareFeeDetailDO> getFeeDetailList() {
        return feeDetailList;

+ 5 - 5
common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/SecurityMonitoringOrderDO.java

@ -323,7 +323,7 @@ public class SecurityMonitoringOrderDO extends UuidIdentityEntityWithOperator {
     * 医生确认医生结束服务时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date doctorConfirmFinishFinishTime;
    private Date doctorConfirmFinishTime;
@ -684,11 +684,11 @@ public class SecurityMonitoringOrderDO extends UuidIdentityEntityWithOperator {
        this.doctorConfirmFinishImg = doctorConfirmFinishImg;
    }
    public Date getDoctorConfirmFinishFinishTime() {
        return doctorConfirmFinishFinishTime;
    public Date getDoctorConfirmFinishTime() {
        return doctorConfirmFinishTime;
    }
    public void setDoctorConfirmFinishFinishTime(Date doctorConfirmFinishFinishTime) {
        this.doctorConfirmFinishFinishTime = doctorConfirmFinishFinishTime;
    public void setDoctorConfirmFinishTime(Date doctorConfirmFinishTime) {
        this.doctorConfirmFinishTime = doctorConfirmFinishTime;
    }
}

+ 11 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/sign/CapacityAssessmentBaseInfoDo.java

@ -5,6 +5,7 @@ import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
 * 能力评估-基本信息表
@ -79,6 +80,7 @@ public class CapacityAssessmentBaseInfoDo extends UuidIdentityEntityWithCreateTi
    private String  acceptableServicesMental; //精神心理照顾 1危机干预;2沟通;3精神支持;4心理疏导;5心理咨询
    private String  acceptableServicesRehabilitation; //康复护理照顾 1定期翻身;2压疮预;3防活动肢体;4肢体保健;5康复活动;6预防保健;7健康咨询;8健康管理;9健康教育;10临终关怀
    private String  acceptableServicesOther;  //其他
    private String  birthday;  //出生日期
    public String getAssessmentYear() {
        return assessmentYear;
@ -607,4 +609,13 @@ public class CapacityAssessmentBaseInfoDo extends UuidIdentityEntityWithCreateTi
    public void setAcceptableServicesOther(String acceptableServicesOther) {
        this.acceptableServicesOther = acceptableServicesOther;
    }
    @Transient
    public String getBirthday() {
        return birthday;
    }
    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }
}

+ 72 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/sign/CapacityAssessmentRecordDO.java

@ -30,6 +30,7 @@ public class CapacityAssessmentRecordDO extends UuidIdentityEntityWithCreateTime
     * 性别,1男,2女
     */
    private Integer sex;
    private String sexName;
    /**
     * 手机号
@ -60,26 +61,31 @@ public class CapacityAssessmentRecordDO extends UuidIdentityEntityWithCreateTime
     * 能力完好(0级) 轻度受损(1级) 中度受损(2级) 重度受损(3级)
     */
    private Integer livingAbility;
    private String livingAbilityName;
    /**
     * 认知能力
     * 能力完好(0级) 轻度受损(1级) 中度受损(2级) 重度受损(3级)
     */
    private Integer cognitiveAbility;
    private String cognitiveAbilityName;
    /**
     *精神状态与社会交流能力
     * 能力完好(0级) 轻度受损(1级) 中度受损(2级) 重度受损(3级)
     */
    private Integer socialAbility;
    private String socialAbilityName;
    /**
     * 能力总体评价
     * 能力完好(0级) 轻度失能(1级) 中度失能(2级) 重度失能(3级)
     */
    private Integer comprehensiveAbility;
    private String comprehensiveAbilityName;
    /**
     * 等级结论
     * 能力完好(0级) 轻度失能(1级) 中度失能(2级) 重度失能(3级)
     */
    private Integer levelConclusion;
    private String levelConclusionName;
    private String doctor;
    private String doctorName;
    private String orgCode;
@ -88,6 +94,7 @@ public class CapacityAssessmentRecordDO extends UuidIdentityEntityWithCreateTime
     * 认可结果(0未认可,1已认可,2不认可)
     */
    private Integer status;
    private String statusName;
    /**
     * 签字结果图片url
     */
@ -100,6 +107,7 @@ public class CapacityAssessmentRecordDO extends UuidIdentityEntityWithCreateTime
     * 是否分配服务包(0未分配,1已分配)
     */
    private Integer servicePackageStatus;
    private String servicePackageStatusName;
    /**
     * 年纪
@ -310,4 +318,68 @@ public class CapacityAssessmentRecordDO extends UuidIdentityEntityWithCreateTime
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    @Transient
    public String getSexName() {
        return sexName;
    }
    public void setSexName(String sexName) {
        this.sexName = sexName;
    }
    @Transient
    public String getLivingAbilityName() {
        return livingAbilityName;
    }
    public void setLivingAbilityName(String livingAbilityName) {
        this.livingAbilityName = livingAbilityName;
    }
    @Transient
    public String getCognitiveAbilityName() {
        return cognitiveAbilityName;
    }
    public void setCognitiveAbilityName(String cognitiveAbilityName) {
        this.cognitiveAbilityName = cognitiveAbilityName;
    }
    @Transient
    public String getSocialAbilityName() {
        return socialAbilityName;
    }
    public void setSocialAbilityName(String socialAbilityName) {
        this.socialAbilityName = socialAbilityName;
    }
    @Transient
    public String getComprehensiveAbilityName() {
        return comprehensiveAbilityName;
    }
    public void setComprehensiveAbilityName(String comprehensiveAbilityName) {
        this.comprehensiveAbilityName = comprehensiveAbilityName;
    }
    @Transient
    public String getLevelConclusionName() {
        return levelConclusionName;
    }
    public void setLevelConclusionName(String levelConclusionName) {
        this.levelConclusionName = levelConclusionName;
    }
    @Transient
    public String getStatusName() {
        return statusName;
    }
    public void setStatusName(String statusName) {
        this.statusName = statusName;
    }
    @Transient
    public String getServicePackageStatusName() {
        return servicePackageStatusName;
    }
    public void setServicePackageStatusName(String servicePackageStatusName) {
        this.servicePackageStatusName = servicePackageStatusName;
    }
}

+ 41 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/sign/CapacityDoctorDO.java

@ -0,0 +1,41 @@
package com.yihu.jw.entity.care.sign;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/8
 * @Description: 能力评估医生关联表
 */
@Entity
@Table(name = "base_capacity_doctor")
public class CapacityDoctorDO extends UuidIdentityEntity {
    private String capacityId;
    private String doctorId;
    @Column(name = "capacity_id")
    public String getCapacityId() {
        return capacityId;
    }
    public void setCapacityId(String capacityId) {
        this.capacityId = capacityId;
    }
    @Column(name = "doctor_id")
    public String getDoctorId() {
        return doctorId;
    }
    public void setDoctorId(String doctorId) {
        this.doctorId = doctorId;
    }
}

+ 25 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java

@ -279,6 +279,31 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
     * 云信房间号
     */
    private String channelId;
    /**
     * 是否提醒过医生
     */
    private String remindDoctor;
    /**
     * 上次提醒时间
     */
    private Date lastRemindTime;
    @Column(name = "last_remind_time")
    public Date getLastRemindTime() {
        return lastRemindTime;
    }
    public void setLastRemindTime(Date lastRemindTime) {
        this.lastRemindTime = lastRemindTime;
    }
    @Column(name = "remind_doctor")
    public String getRemindDoctor() {
        return remindDoctor;
    }
    public void setRemindDoctor(String remindDoctor) {
        this.remindDoctor = remindDoctor;
    }
    @Column(name = "charge_type")
    public String getChargeType() {
        return chargeType;

+ 0 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/iot/company/IotCompanyDO.java

@ -90,7 +90,6 @@ public class IotCompanyDO extends UuidIdentityEntityWithOperator implements Seri
        this.status = status;
    }
    @Convert(converter = StringFStringEncryptConverter.class)
    public String getName() {
        return name;
    }

+ 76 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/copdDevice/WlyyCopdHuamiDeviceDO.java

@ -0,0 +1,76 @@
package com.yihu.jw.entity.iot.copdDevice;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Bing on 2021/4/14.
 * 华米医疗设备信息
 */
@Entity
@Table(name="wlyy_copd_huami_device")
public class WlyyCopdHuamiDeviceDO extends UuidIdentityEntity {
    private String  patient;    //患者code
    private String  deviceSn;  //设备ID 即sn码
    private String  macAddress;    //设备MAC地址
    private String  lastDataSyncTime;    //上次同步数据的时间戳
    private String  deviceType;    //设备类型:BAND、SCALE、SHOE、WATCH
    private String  deviceName;    //设备名称
    @Column(name="patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name="device_sn")
    public String getDeviceSn() {
        return deviceSn;
    }
    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }
    @Column(name="mac_address")
    public String getMacAddress() {
        return macAddress;
    }
    public void setMacAddress(String macAddress) {
        this.macAddress = macAddress;
    }
    @Column(name="last_data_sync_time")
    public String getLastDataSyncTime() {
        return lastDataSyncTime;
    }
    public void setLastDataSyncTime(String lastDataSyncTime) {
        this.lastDataSyncTime = lastDataSyncTime;
    }
    @Column(name="device_type")
    public String getDeviceType() {
        return deviceType;
    }
    public void setDeviceType(String deviceType) {
        this.deviceType = deviceType;
    }
    @Column(name="device_name")
    public String getDeviceName() {
        return deviceName;
    }
    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }
}

+ 87 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/copdDevice/WlyyCopdHuamiHealthScoreDO.java

@ -0,0 +1,87 @@
package com.yihu.jw.entity.iot.copdDevice;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Bing on 2021/4/14.
 * 华米医疗设备健康分
 */
@Entity
@Table(name="wlyy_copd_huami_health_score")
public class WlyyCopdHuamiHealthScoreDO extends UuidIdentityEntity {
    private String  deviceSn;  //设备ID 即sn码
    private String  exportKey; //本次查询的类型  HealthScore_Week,HealthScore_Month分表表示周健康分和月健康分
    private String  exportTime;    //时间戳,和查询的exportTime对应
    private String  name;   //健康分名称,为”h5”
    private String  score;  //健康分值
    private String  total;  //健康分总分,默认100
    private String  date;//创建时间
    @Column(name="device_sn")
    public String getDeviceSn() {
        return deviceSn;
    }
    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }
    @Column(name="export_key")
    public String getExportKey() {
        return exportKey;
    }
    public void setExportKey(String exportKey) {
        this.exportKey = exportKey;
    }
    @Column(name="export_time")
    public String getExportTime() {
        return exportTime;
    }
    public void setExportTime(String exportTime) {
        this.exportTime = exportTime;
    }
    @Column(name="name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name="score")
    public String getScore() {
        return score;
    }
    public void setScore(String score) {
        this.score = score;
    }
    @Column(name="total")
    public String getTotal() {
        return total;
    }
    public void setTotal(String total) {
        this.total = total;
    }
    @Column(name="date")
    public String getDate() {
        return date;
    }
    public void setDate(String date) {
        this.date = date;
    }
}

+ 86 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/copdDevice/WlyyCopdHuamiHeartDO.java

@ -0,0 +1,86 @@
package com.yihu.jw.entity.iot.copdDevice;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Bing on 2021/4/14.
 * 华米医疗设备心率
 */
@Entity
@Table(name="wlyy_copd_huami_heart")
public class WlyyCopdHuamiHeartDO extends UuidIdentityEntity {
    private String  deviceSn;  //设备sn码
    private String  date;   //数据的本地生成日期,格式为yyyy-MM-dd
    private String  minute; //在当日中的分钟序号(0-1439)
    private String  lastSyncTime; //数据上传到华米后端的时间戳,仅在类型为AUTO时提供
    private String  timestamp;  //心率数据的生成时间戳
    private String  heartRateData;    //测量类型为MANUAL时为心率,测量类型为AUTO时则为该分钟时的平均心率。如果该分钟内未佩戴设备或者未测量心率,则心率为0
    private String  measureType;   //测量类型:AUTO、MANUAL
    @Column(name="device_sn")
    public String getDeviceSn() {
        return deviceSn;
    }
    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }
    @Column(name="date")
    public String getDate() {
        return date;
    }
    public void setDate(String date) {
        this.date = date;
    }
    @Column(name="minute")
    public String getMinute() {
        return minute;
    }
    public void setMinute(String minute) {
        this.minute = minute;
    }
    @Column(name="last_sync_time")
    public String getLastSyncTime() {
        return lastSyncTime;
    }
    public void setLastSyncTime(String lastSyncTime) {
        this.lastSyncTime = lastSyncTime;
    }
    @Column(name="timestamp")
    public String getTimestamp() {
        return timestamp;
    }
    public void setTimestamp(String timestamp) {
        this.timestamp = timestamp;
    }
    @Column(name="heart_rate_data")
    public String getHeartRateData() {
        return heartRateData;
    }
    public void setHeartRateData(String heartRateData) {
        this.heartRateData = heartRateData;
    }
    @Column(name="measure_type")
    public String getMeasureType() {
        return measureType;
    }
    public void setMeasureType(String measureType) {
        this.measureType = measureType;
    }
}

+ 76 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/copdDevice/WlyyCopdHuamiPaiDO.java

@ -0,0 +1,76 @@
package com.yihu.jw.entity.iot.copdDevice;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Bing on 2021/4/14.
 * 华米医疗设备pai
 */
@Entity
@Table(name="wlyy_copd_huami_pai")
public class WlyyCopdHuamiPaiDO extends UuidIdentityEntity {
    private String  deviceSn;  //设备ID 即sn码
    private String  calendarDay;   //PAI概况的生成日期,例如“2019-10-18”
    private String  timestamp;  //数据上传到华米后端的时间戳
    private String  totalPai;  //用户本周运动前获得的所有PAI
    private String  dailyPai;  //用户在当天获得的PAI
    private String  date;//创建时间
    @Column(name="device_sn")
    public String getDeviceSn() {
        return deviceSn;
    }
    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }
    @Column(name="calendar_day")
    public String getCalendarDay() {
        return calendarDay;
    }
    public void setCalendarDay(String calendarDay) {
        this.calendarDay = calendarDay;
    }
    @Column(name="timestamp")
    public String getTimestamp() {
        return timestamp;
    }
    public void setTimestamp(String timestamp) {
        this.timestamp = timestamp;
    }
    @Column(name="total_pai")
    public String getTotalPai() {
        return totalPai;
    }
    public void setTotalPai(String totalPai) {
        this.totalPai = totalPai;
    }
    @Column(name="daily_pai")
    public String getDailyPai() {
        return dailyPai;
    }
    public void setDailyPai(String dailyPai) {
        this.dailyPai = dailyPai;
    }
    @Column(name="date")
    public String getDate() {
        return date;
    }
    public void setDate(String date) {
        this.date = date;
    }
}

+ 66 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/copdDevice/WlyyCopdHuamiRealtimeDateDO.java

@ -0,0 +1,66 @@
package com.yihu.jw.entity.iot.copdDevice;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Bing on 2021/4/14.
 * 华米医疗设备实时数据
 */
@Entity
@Table(name="wlyy_copd_huami_realtime_date")
public class WlyyCopdHuamiRealtimeDateDO extends UuidIdentityEntity {
    private String  deviceSn;  //设备sn码
    private String  hr; //实时心率
    private String  st; //实时步数,采集开始后的累积步数
    private String  cal;    //实时卡路里,累积卡路里
    private String  date;// 创建时间
    @Column(name="device_sn")
    public String getDeviceSn() {
        return deviceSn;
    }
    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }
    @Column(name="hr")
    public String getHr() {
        return hr;
    }
    public void setHr(String hr) {
        this.hr = hr;
    }
    @Column(name="st")
    public String getSt() {
        return st;
    }
    public void setSt(String st) {
        this.st = st;
    }
    @Column(name="cal")
    public String getCal() {
        return cal;
    }
    public void setCal(String cal) {
        this.cal = cal;
    }
    @Column(name="date")
    public String getDate() {
        return date;
    }
    public void setDate(String date) {
        this.date = date;
    }
}

+ 126 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/copdDevice/WlyyCopdHuamiRundateDO.java

@ -0,0 +1,126 @@
package com.yihu.jw.entity.iot.copdDevice;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Bing on 2021/4/14.
 * 华米医疗设备运动数据
 */
@Entity
@Table(name="wlyy_copd_huami_rundate")
public class WlyyCopdHuamiRundateDO extends UuidIdentityEntity {
    private String  deviceSn;  //设备sn码
    private String  date;   //数据的本地生成日期,格式为yyyy-MM-dd
    private String  lastSyncTime; //数据上传到华米后端的时间戳
    private String  steps;  //总步数
    private String  distance;   //包含行走距离和跑步距离在内的总距离,单位为米
    private String  runDistance;   //跑步距离,单位为米,仅在时间间隔为每日的情况下使用
    private String  runTime;   //跑步时间,单位为分钟,仅在时间间隔为每日的情况下使用
    private String  walkTime;  //行走时间,单位为分钟,仅在时间间隔为每日的情况下使用
    private String  calories;   //热量总消耗,单位为千卡
    private String  runCalories;   //跑步消耗热量,单位为千卡,仅在时间间隔为每日的情况下使用
    private String  hour;   //步数分段信息(起止时间不是按照小时来的),用于记录快走慢走跑步等步数类型的数据
    @Column(name="device_sn")
    public String getDeviceSn() {
        return deviceSn;
    }
    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }
    @Column(name="date")
    public String getDate() {
        return date;
    }
    public void setDate(String date) {
        this.date = date;
    }
    @Column(name="last_sync_time")
    public String getLastSyncTime() {
        return lastSyncTime;
    }
    public void setLastSyncTime(String lastSyncTime) {
        this.lastSyncTime = lastSyncTime;
    }
    @Column(name="steps")
    public String getSteps() {
        return steps;
    }
    public void setSteps(String steps) {
        this.steps = steps;
    }
    @Column(name="distance")
    public String getDistance() {
        return distance;
    }
    public void setDistance(String distance) {
        this.distance = distance;
    }
    @Column(name="run_distance")
    public String getRunDistance() {
        return runDistance;
    }
    public void setRunDistance(String runDistance) {
        this.runDistance = runDistance;
    }
    @Column(name="run_time")
    public String getRunTime() {
        return runTime;
    }
    public void setRunTime(String runTime) {
        this.runTime = runTime;
    }
    @Column(name="walk_time")
    public String getWalkTime() {
        return walkTime;
    }
    public void setWalkTime(String walkTime) {
        this.walkTime = walkTime;
    }
    @Column(name="calories")
    public String getCalories() {
        return calories;
    }
    public void setCalories(String calories) {
        this.calories = calories;
    }
    @Column(name="run_calories")
    public String getRunCalories() {
        return runCalories;
    }
    public void setRunCalories(String runCalories) {
        this.runCalories = runCalories;
    }
    @Column(name="hour")
    public String getHour() {
        return hour;
    }
    public void setHour(String hour) {
        this.hour = hour;
    }
}

+ 116 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/copdDevice/WlyyCopdHuamiSleepDO.java

@ -0,0 +1,116 @@
package com.yihu.jw.entity.iot.copdDevice;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Bing on 2021/4/14.
 * 华米医疗设备睡眠
 */
@Entity
@Table(name="wlyy_copd_huami_sleep")
public class WlyyCopdHuamiSleepDO extends UuidIdentityEntity {
    private String  deviceSn;  //设备sn码
    private String  date;   //数据的本地生成日期,格式为yyyy-MM-dd
    private String  lastSyncTime; //数据上传到华米后端的时间戳
    private String  deepSleepTime;    //深度睡眠时长,单位为分钟
    private String  shallowSleepTime; //浅度睡眠时长,单位为分钟
    private String  wakeTime;  //睡眠期间清醒时长,单位为分钟
    private String  sleepScore;    //睡眠评分,范围为 0-100
    private String  start;  //睡眠开始时间。Amazfit设备为分钟序号(0-1439),mifit设备为时间戳
    private String  stop;   //睡眠结束时间。Amazfit设备为分钟序号(0-1439),mifit设备为时间戳
    private String  mode;   //睡眠状态。4为浅度睡眠状态;5为深度睡眠状态;7为清醒状态;8为REM(快速眼动睡眠)
    @Column(name="device_sn")
    public String getDeviceSn() {
        return deviceSn;
    }
    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }
    @Column(name="date")
    public String getDate() {
        return date;
    }
    public void setDate(String date) {
        this.date = date;
    }
    @Column(name="last_sync_time")
    public String getLastSyncTime() {
        return lastSyncTime;
    }
    public void setLastSyncTime(String lastSyncTime) {
        this.lastSyncTime = lastSyncTime;
    }
    @Column(name="deep_sleep_time")
    public String getDeepSleepTime() {
        return deepSleepTime;
    }
    public void setDeepSleepTime(String deepSleepTime) {
        this.deepSleepTime = deepSleepTime;
    }
    @Column(name="shallow_sleep_time")
    public String getShallowSleepTime() {
        return shallowSleepTime;
    }
    public void setShallowSleepTime(String shallowSleepTime) {
        this.shallowSleepTime = shallowSleepTime;
    }
    @Column(name="wake_time")
    public String getWakeTime() {
        return wakeTime;
    }
    public void setWakeTime(String wakeTime) {
        this.wakeTime = wakeTime;
    }
    @Column(name="sleep_score")
    public String getSleepScore() {
        return sleepScore;
    }
    public void setSleepScore(String sleepScore) {
        this.sleepScore = sleepScore;
    }
    @Column(name="start")
    public String getStart() {
        return start;
    }
    public void setStart(String start) {
        this.start = start;
    }
    @Column(name="stop")
    public String getStop() {
        return stop;
    }
    public void setStop(String stop) {
        this.stop = stop;
    }
    @Column(name="mode")
    public String getMode() {
        return mode;
    }
    public void setMode(String mode) {
        this.mode = mode;
    }
}

+ 296 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/copdDevice/WlyyCopdXeekLungDO.java

@ -0,0 +1,296 @@
package com.yihu.jw.entity.iot.copdDevice;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Bing on 2021/4/14.
 */
@Entity
@Table(name="wlyy_copd_xeek_lung")
public class WlyyCopdXeekLungDO extends UuidIdentityEntity {
    private String deviceType;// String Y 设备类型 设备品牌
    private String deviceSN;// String Y 设备 SN 号 设备唯一
    /**
     *  String Y 报告类型:
     *  1=吸气测试;
     * 2=呼气测试;
     * * 3=吸气训练
     *  4=呼气训练
     * 6=MVV 测试;
     * 7=慢通气测试;
     *
     类型不同时,details
     的参数也不同,参
     考 details 参数备注
     */
    private String reportType;
    /**
     * Int Y 用药标志:
     0=无;1=药前;2=药后;
     药前/后是舒张试验
     的吸气和呼气测试
     类型
     */
    private Integer drugFlag;
    private String patientName;// String Y 患者姓名
    private Integer patientGender;// Int Y 患者性别:            1 – 男;2 – 女;
    private String patientBirthday;// String Y 患者出生日期 格式:    YYYYMMDD
    private String patientNation;// String N 民族
    private String patientMobile;// String N 患者手机号
    private String idCardNo;// String N 身份证号
    private String contactAddress;// String N 联系地址
    private String occupation;// String N 职业
    private String residenceNo;// String N 门诊/住院号
    private String smoking;// String N 吸烟史
    private String disease;// String N 病史
    private String weight;// String Y 体重 单位:KG
    private String height;// String Y 身高 单位:CM
    private String inspectTime;// String Y 检查时间 格式:    YYYY-MM-DD    HH:mm:ss
    private String doctorName;// String Y 检查医生姓名
    private String itemName;// String N 检查项目
    private String finalQuality;// String Y 综合质控等级
    private String fvcQuality;// String Y FVC 质控等级
    private String fev1Quality;// String Y FEV1 质控等级
    private String doctorDiag;// String Y 医生诊断结果
    private Integer refEquations;// Int Y 采用的预计值公式 0=默认;            1=中国人 4-80 岁;            2=Standard'
    private String pdfReport;// String N 报告 Url
    @Column(name="device_type")
    public String getDeviceType() {
        return deviceType;
    }
    public void setDeviceType(String deviceType) {
        this.deviceType = deviceType;
    }
    @Column(name="device_sn")
    public String getDeviceSN() {
        return deviceSN;
    }
    public void setDeviceSN(String deviceSN) {
        this.deviceSN = deviceSN;
    }
    @Column(name="report_type")
    public String getReportType() {
        return reportType;
    }
    public void setReportType(String reportType) {
        this.reportType = reportType;
    }
    @Column(name="drug_flag")
    public Integer getDrugFlag() {
        return drugFlag;
    }
    public void setDrugFlag(Integer drugFlag) {
        this.drugFlag = drugFlag;
    }
    @Column(name="patient_name")
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    @Column(name="patient_gender")
    public Integer getPatientGender() {
        return patientGender;
    }
    public void setPatientGender(Integer patientGender) {
        this.patientGender = patientGender;
    }
    @Column(name="patient_birthday")
    public String getPatientBirthday() {
        return patientBirthday;
    }
    public void setPatientBirthday(String patientBirthday) {
        this.patientBirthday = patientBirthday;
    }
    @Column(name="patient_nation")
    public String getPatientNation() {
        return patientNation;
    }
    public void setPatientNation(String patientNation) {
        this.patientNation = patientNation;
    }
    @Column(name="patient_mobile")
    public String getPatientMobile() {
        return patientMobile;
    }
    public void setPatientMobile(String patientMobile) {
        this.patientMobile = patientMobile;
    }
    @Column(name="idcard_no")
    public String getIdCardNo() {
        return idCardNo;
    }
    public void setIdCardNo(String idCardNo) {
        this.idCardNo = idCardNo;
    }
    @Column(name="contact_address")
    public String getContactAddress() {
        return contactAddress;
    }
    public void setContactAddress(String contactAddress) {
        this.contactAddress = contactAddress;
    }
    @Column(name="occupation")
    public String getOccupation() {
        return occupation;
    }
    public void setOccupation(String occupation) {
        this.occupation = occupation;
    }
    @Column(name="residence_no")
    public String getResidenceNo() {
        return residenceNo;
    }
    public void setResidenceNo(String residenceNo) {
        this.residenceNo = residenceNo;
    }
    @Column(name="smoking")
    public String getSmoking() {
        return smoking;
    }
    public void setSmoking(String smoking) {
        this.smoking = smoking;
    }
    @Column(name="disease")
    public String getDisease() {
        return disease;
    }
    public void setDisease(String disease) {
        this.disease = disease;
    }
    @Column(name="weight")
    public String getWeight() {
        return weight;
    }
    public void setWeight(String weight) {
        this.weight = weight;
    }
    @Column(name="height")
    public String getHeight() {
        return height;
    }
    public void setHeight(String height) {
        this.height = height;
    }
    @Column(name="inspect_time")
    public String getInspectTime() {
        return inspectTime;
    }
    public void setInspectTime(String inspectTime) {
        this.inspectTime = inspectTime;
    }
    @Column(name="doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Column(name="item_name")
    public String getItemName() {
        return itemName;
    }
    public void setItemName(String itemName) {
        this.itemName = itemName;
    }
    @Column(name="final_quality")
    public String getFinalQuality() {
        return finalQuality;
    }
    public void setFinalQuality(String finalQuality) {
        this.finalQuality = finalQuality;
    }
    @Column(name="fvc_quality")
    public String getFvcQuality() {
        return fvcQuality;
    }
    public void setFvcQuality(String fvcQuality) {
        this.fvcQuality = fvcQuality;
    }
    @Column(name="fev1_quality")
    public String getFev1Quality() {
        return fev1Quality;
    }
    public void setFev1Quality(String fev1Quality) {
        this.fev1Quality = fev1Quality;
    }
    @Column(name="doctor_diag")
    public String getDoctorDiag() {
        return doctorDiag;
    }
    public void setDoctorDiag(String doctorDiag) {
        this.doctorDiag = doctorDiag;
    }
    @Column(name="ref_equations")
    public Integer getRefEquations() {
        return refEquations;
    }
    public void setRefEquations(Integer refEquations) {
        this.refEquations = refEquations;
    }
    @Column(name="pdf_report")
    public String getPdfReport() {
        return pdfReport;
    }
    public void setPdfReport(String pdfReport) {
        this.pdfReport = pdfReport;
    }
}

+ 145 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/copdDevice/WlyyCopdXeekLungDetailDO.java

@ -0,0 +1,145 @@
package com.yihu.jw.entity.iot.copdDevice;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Bing on 2021/4/14.
 */
@Entity
@Table(name="wlyy_copd_xeek_lung_detail")
public class WlyyCopdXeekLungDetailDO extends UuidIdentityEntity {
    private String code;// 关联wlyy_copd_xeek_lung 的id
    private String deviceType;// String Y 设备类型 设备品牌
    private String deviceSN;// String Y 设备 SN 号 设备唯一
    private String parameter;//  Y 指标参数
    private String unit;// String Y 指标单位
    private String preValue;// String Y 预计值
    private String bestValue;// String Y 最佳值
    private String bestPre;// String Y 最佳值/预计值*100%
    private String lln;// String Y 预计值下限 LLN
    private String zScore;// String Y 得分
    private String test1Value;// String Y 实测 1
    private String test2Value;// String Y 实测 2
    private String test3Value;// String Y 实测 3
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name="device_type")
    public String getDeviceType() {
        return deviceType;
    }
    public void setDeviceType(String deviceType) {
        this.deviceType = deviceType;
    }
    @Column(name="device_sn")
    public String getDeviceSN() {
        return deviceSN;
    }
    public void setDeviceSN(String deviceSN) {
        this.deviceSN = deviceSN;
    }
    @Column(name="parameter")
    public String getParameter() {
        return parameter;
    }
    public void setParameter(String parameter) {
        this.parameter = parameter;
    }
    @Column(name="unit")
    public String getUnit() {
        return unit;
    }
    public void setUnit(String unit) {
        this.unit = unit;
    }
    @Column(name="pre_value")
    public String getPreValue() {
        return preValue;
    }
    public void setPreValue(String preValue) {
        this.preValue = preValue;
    }
    @Column(name="best_value")
    public String getBestValue() {
        return bestValue;
    }
    public void setBestValue(String bestValue) {
        this.bestValue = bestValue;
    }
    @Column(name="best_pre")
    public String getBestPre() {
        return bestPre;
    }
    public void setBestPre(String bestPre) {
        this.bestPre = bestPre;
    }
    @Column(name="lln")
    public String getLln() {
        return lln;
    }
    public void setLln(String lln) {
        this.lln = lln;
    }
    @Column(name="z_score")
    public String getzScore() {
        return zScore;
    }
    public void setzScore(String zScore) {
        this.zScore = zScore;
    }
    @Column(name="test1_value")
    public String getTest1Value() {
        return test1Value;
    }
    public void setTest1Value(String test1Value) {
        this.test1Value = test1Value;
    }
    @Column(name="test2_value")
    public String getTest2Value() {
        return test2Value;
    }
    public void setTest2Value(String test2Value) {
        this.test2Value = test2Value;
    }
    @Column(name="test3_value")
    public String getTest3Value() {
        return test3Value;
    }
    public void setTest3Value(String test3Value) {
        this.test3Value = test3Value;
    }
}

+ 90 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/copdDevice/WlyyXeekPatientDeviceDO.java

@ -0,0 +1,90 @@
package com.yihu.jw.entity.iot.copdDevice;
import com.yihu.jw.entity.IdEntity;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by yeshijie on 2021/4/15.
 */
@Entity
@Table(name="wlyy_xeek_patient_device")
public class WlyyXeekPatientDeviceDO extends IdEntity {
    private String deviceSn;//设备sn码
    private String name;//姓名
    private Integer sex;//性别
    private String birthday;//生日
    private String mobile;//手机
    private String idcard;//身份证
    private String address;//地区
    private String patient;//居民code
    @Column(name = "device_sn")
    public String getDeviceSn() {
        return deviceSn;
    }
    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "sex")
    public Integer getSex() {
        return sex;
    }
    public void setSex(Integer sex) {
        this.sex = sex;
    }
    @Column(name = "birthday")
    public String getBirthday() {
        return birthday;
    }
    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }
    @Column(name = "mobile")
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    @Column(name = "idcard")
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    @Column(name = "address")
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
}

+ 67 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/patient/BasePatientGroupDO.java

@ -0,0 +1,67 @@
package com.yihu.jw.entity.patient;
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_patient_group")
public class BasePatientGroupDO extends UuidIdentityEntity {
    private String groupId;
    private String patient;
    private String patientName;
    private String doctor;
    private String doctorName;
    private Date createTime;
    @Column(name = "group_id")
    public String getGroupId() {
        return groupId;
    }
    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "patient_name")
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 69 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/patient/BasePatientGroupDictDO.java

@ -0,0 +1,69 @@
package com.yihu.jw.entity.patient;
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_patient_group_dict")
public class BasePatientGroupDictDO extends UuidIdentityEntity {
    private String groupCode;
    private String groupName;
    private String del;
    private Date createTime;
    private String createUser;
    private String createUserName;
    @Column(name = "group_code")
    public String getGroupCode() {
        return groupCode;
    }
    public void setGroupCode(String groupCode) {
        this.groupCode = groupCode;
    }
    @Column(name = "group_name")
    public String getGroupName() {
        return groupName;
    }
    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }
    @Column(name = "del")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @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;
    }
}

+ 17 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/util/AesEncryptUtils.java

@ -134,5 +134,22 @@ public class AesEncryptUtils {
        return decrypt(encryptStr, KEY);
    }
    /**
     * 网关解密
     * @param encryptStr
     * @return
     */
    public static String agDecrypt(String encryptStr){
        if(StringUtils.isEmpty(encryptStr)){
            return encryptStr;
        }
        return decrypt(encryptStr, AGKEY);
    }
    public static String agEncrypt(String content) throws Exception {
        return encrypt(content, AGKEY);
    }
    private static final String AGKEY = "46A61629A19AE04C";
}

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

@ -242,6 +242,8 @@ public class BaseRequestMapping {
        public static final String UPLOAD_STREAM_video  = "/upload_stream_video";
        public static final String UPLOAD_STRING  = "/upload_string";
        public static final String UPLOAD_STREAM_ATTACHMENT  = "/upload_stream_attachment";
        public static final String DELETE_FILE = "/DELETE_FILE";
    }
    /**
@ -507,7 +509,17 @@ public class BaseRequestMapping {
        public static final String GetKey = "getKey";
        public static final String Login = "login";
        public static final String updatePatientPw = "/updatePatientPw";
        public static final String getPatientCountByDoctor  = "/getPatientCountByDoctor";
        public static final String getPatientEmrByDoctor  = "/getPatientEmrByDoctor";
        public static final String findPaitentPrescription  = "/findPaitentPrescription";
        public static final String createPatientGroupDict  = "/createPatientGroupDict";
        public static final String deletePatientGroupDict  = "/deletePatientGroupDict";
        public static final String findGroupByDoctor  = "/findGroupByDoctor";
        public static final String movePatientToGroup  = "/movePatientToGroup";
        public static final String delPatientGroup  = "/delPatientGroup";
        public static final String findPatientGroup  = "/findPatientGroup";
        public static final String findPatientGroupNum  = "/findPatientGroupNum";
        public static final String findOnePatientInfo  = "/findOnePatientInfo";
    }
   /**

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

@ -1107,6 +1107,8 @@ public class BaseHospitalRequestMapping {
        public static final String findZlxm = "/findZlxm";
        public static final String findZlxmMx = "/findZlxmMx";
        public static final String getPrevious = "/getPrevious";
        public static final String findRecordByDoctor = "/findRecordByDoctor";
        public static final String findRecordCountByDoctor = "/findRecordCountByDoctor";
    }

+ 19 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/common/UploadVO.java

@ -22,6 +22,25 @@ public class UploadVO implements Serializable{
    @ApiModelProperty("完整的uri(不包含http)")
    private String fullUri; //完整的uri healthArchiveGroup/M00/00/24/rBFuH1XdQC6AP3CDAAzodQCbVVc052.jpg
    private String groupName;
    private String remoteFileName;
    public String getGroupName() {
        return groupName;
    }
    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }
    public String getRemoteFileName() {
        return remoteFileName;
    }
    public void setRemoteFileName(String remoteFileName) {
        this.remoteFileName = remoteFileName;
    }
    public String getFullUrl() {
        return fullUrl;
    }

+ 173 - 0
common/common-util/src/main/java/com/yihu/jw/util/common/GpsUtil.java

@ -0,0 +1,173 @@
package com.yihu.jw.util.common;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
/**
 * * 坐标转换工具类
 *  * WGS84: Google Earth采用,Google Map中国范围外使用
 *  * GCJ02: 火星坐标系,中国国家测绘局制定的坐标系统,由WGS84机密后的坐标。Google Map中国和搜搜地图使用,高德
 *  * BD09:百度坐标,GCJ02机密后的坐标系
 *
 * Created by Bing on 2021/5/8.
 */
@Component
public class GpsUtil {
    public static final String BAIDU_LBS_TYPE = "bd09ll";
    public static double pi = 3.1415926535897932384626;
    public static double a = 6378245.0;
    public static double ee = 0.00669342162296594323;
    /**
     * 84 to 火星坐标系 (GCJ-02) World Geodetic System ==> Mars Geodetic System
     * @param lat
     * @param lon
     */
    public  JSONObject gps84_To_Gcj02(double lat, double lon) {
        if (outOfChina(lat, lon)) {
            return null;
        }
        double dLat = transformLat(lon - 105.0, lat - 35.0);
        double dLon = transformLon(lon - 105.0, lat - 35.0);
        double radLat = lat / 180.0 * pi;
        double magic = Math.sin(radLat);
        magic = 1 - ee * magic * magic;
        double sqrtMagic = Math.sqrt(magic);
        dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
        dLon = (dLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi);
        double mgLat = lat + dLat;
        double mgLon = lon + dLon;
        return getPosition(mgLat, mgLon);
    }
    /**
     * * 火星坐标系 (GCJ-02) to 84 * * @param lon * @param lat * @return
     */
    public  JSONObject gcj_To_Gps84(double lat, double lon) {
        JSONObject gps = transform(lat, lon);
        double lontitude = lon * 2 - gps.getDouble("lon");
        double latitude = lat * 2 - gps.getDouble("lat");
        return getPosition(latitude, lontitude);
    }
    /**
     * 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 将 GCJ-02 坐标转换成 BD-09 坐标
     *
     * @param gg_lat
     * @param gg_lon
     */
    public  JSONObject gcj02_To_Bd09(double gg_lat, double gg_lon) {
        double x = gg_lon, y = gg_lat;
        double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * pi);
        double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * pi);
        double bd_lon = z * Math.cos(theta) + 0.0065;
        double bd_lat = z * Math.sin(theta) + 0.006;
        return getPosition(bd_lat, bd_lon);
    }
    public  String gcj02_To_Bd09_Str(double gg_lat, double gg_lon) {
        double x = gg_lon, y = gg_lat;
        double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * pi);
        double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * pi);
        double bd_lon = z * Math.cos(theta) + 0.0065;
        double bd_lat = z * Math.sin(theta) + 0.006;
        return bd_lon+","+bd_lat;
    }
    /**
     * * 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 * * 将 BD-09 坐标转换成GCJ-02 坐标 * * @param
     * bd_lat * @param bd_lon * @return
     */
    public  JSONObject bd09_To_Gcj02(double bd_lat, double bd_lon) {
        double x = bd_lon - 0.0065, y = bd_lat - 0.006;
        double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * pi);
        double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * pi);
        double gg_lon = z * Math.cos(theta);
        double gg_lat = z * Math.sin(theta);
        return getPosition(gg_lat, gg_lon);
    }
    public  String  bd09_To_Gcj02_str(double bd_lat, double bd_lon) {
        double x = bd_lon - 0.0065, y = bd_lat - 0.006;
        double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * pi);
        double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * pi);
        double gg_lon = z * Math.cos(theta);
        double gg_lat = z * Math.sin(theta);
        return bd_lon+","+bd_lat;
    }
    /**
     * (BD-09)-->84
     * @param bd_lat
     * @param bd_lon
     * @return
     */
    public  JSONObject bd09_To_Gps84(double bd_lat, double bd_lon) {
        JSONObject gcj02 = bd09_To_Gcj02(bd_lat, bd_lon);
        JSONObject map84 = gcj_To_Gps84(gcj02.getDouble("lat"),
                gcj02.getDouble("lon"));
        return map84;
    }
    /**
     * is or not outOfChina
     * @param lat
     * @param lon
     * @return
     */
    public  boolean outOfChina(double lat, double lon) {
        if (lon < 72.004 || lon > 137.8347)
            return true;
        if (lat < 0.8293 || lat > 55.8271)
            return true;
        return false;
    }
    public  JSONObject transform(double lat, double lon) {
        if (outOfChina(lat, lon)) {
            return getPosition(lat, lon);
        }
        double dLat = transformLat(lon - 105.0, lat - 35.0);
        double dLon = transformLon(lon - 105.0, lat - 35.0);
        double radLat = lat / 180.0 * pi;
        double magic = Math.sin(radLat);
        magic = 1 - ee * magic * magic;
        double sqrtMagic = Math.sqrt(magic);
        dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
        dLon = (dLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi);
        double mgLat = lat + dLat;
        double mgLon = lon + dLon;
        return getPosition(mgLat, mgLon);
    }
    public  double transformLat(double x, double y) {
        double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y
                + 0.2 * Math.sqrt(Math.abs(x));
        ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0;
        ret += (20.0 * Math.sin(y * pi) + 40.0 * Math.sin(y / 3.0 * pi)) * 2.0 / 3.0;
        ret += (160.0 * Math.sin(y / 12.0 * pi) + 320 * Math.sin(y * pi / 30.0)) * 2.0 / 3.0;
        return ret;
    }
    public  double transformLon(double x, double y) {
        double ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1
                * Math.sqrt(Math.abs(x));
        ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0;
        ret += (20.0 * Math.sin(x * pi) + 40.0 * Math.sin(x / 3.0 * pi)) * 2.0 / 3.0;
        ret += (150.0 * Math.sin(x / 12.0 * pi) + 300.0 * Math.sin(x / 30.0
                * pi)) * 2.0 / 3.0;
        return ret;
    }
    public JSONObject getPosition(double lat, double lon){
        JSONObject result = new JSONObject();
        result.put("lat",lat);
        result.put("lon",lon);
        return result;
    }
}

+ 13 - 9
common/common-util/src/main/java/com/yihu/jw/util/common/LatitudeUtils.java

@ -87,6 +87,10 @@ public class LatitudeUtils {
     * @return
     */
    public static String getDistance(String lat1Str, String lng1Str, String lat2Str, String lng2Str) {
        if(StringUtils.isEmpty(lat1Str)||StringUtils.isEmpty(lng1Str)
                ||StringUtils.isEmpty(lat2Str)||StringUtils.isEmpty(lng2Str)){
            return "";
        }
        double lat1 = Double.parseDouble(lat1Str);
        double lng1 = Double.parseDouble(lng1Str);
        double lat2 = Double.parseDouble(lat2Str);
@ -104,15 +108,15 @@ public class LatitudeUtils {
        return distanceStr;
    }
//    public static void main(String args[]){
//        try {
//            Map<String, String> json = LatitudeUtils.getGeocoderLatitude("浦东区张杨路1725号");
//            System.out.println("经度 : " + json.get("lng"));
//            System.out.println("纬度 : " + json.get("lat"));
//        }catch (Exception e ){
//            e.printStackTrace();
//        }
//    }
    public static void main(String args[]){
        try {
            Map<String, String> json = LatitudeUtils.getGeocoderLatitude("厦门海沧区新阳海新阳光公寓15梯304");
            System.out.println("经度 : " + json.get("lng"));
            System.out.println("纬度 : " + json.get("lat"));
        }catch (Exception e ){
            e.printStackTrace();
        }
    }
}

+ 86 - 0
common/common-util/src/main/java/com/yihu/jw/util/http/HttpClientUtil.java

@ -1,5 +1,7 @@
package com.yihu.jw.util.http;
import com.alibaba.fastjson.JSONObject;
import org.apache.http.Consts;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.ParseException;
@ -13,8 +15,10 @@ import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.io.*;
@ -111,6 +115,40 @@ public class HttpClientUtil {
        return null;
    }
    public  String get(String url,List<NameValuePair> params, String chatSet) {
        CloseableHttpClient httpclient = HttpClients.createDefault();
        try {
            // 创建httpget.
            String entityString = EntityUtils.toString(new UrlEncodedFormEntity(params, Consts.UTF_8));
            HttpGet httpget = new HttpGet(url+"?"+entityString);
            // 执行get请求.
            CloseableHttpResponse response = httpclient.execute(httpget);
            try {
                // 获取响应实体
                HttpEntity entity = response.getEntity();
                if (entity != null) {
                    return EntityUtils.toString(entity, chatSet);
                }
            } finally {
                response.close();
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            // 关闭连接,释放资源
            try {
                httpclient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
    /**
     * http调用方法,(健康之路开放平台)
     *
@ -450,4 +488,52 @@ public class HttpClientUtil {
        return null;
    }
    public String postBodyRawForm(String url, String params) throws IOException {
        CloseableHttpClient httpclient = HttpClients.createDefault();
        List<NameValuePair> pairs = new ArrayList<>(0);
        pairs.add(new BasicNameValuePair("object",params));
        UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(pairs);
        HttpPost httpPost = new HttpPost(url);
        httpPost.setEntity(formEntity);
        CloseableHttpResponse response = httpclient.execute(httpPost);
        HttpEntity entity = response.getEntity();
        String ret = EntityUtils.toString(entity);
        return ret;
    }
    /**
     * 爱牵挂请求
     * @param url
     * @param params
     * @return
     */
    public org.springframework.http.HttpEntity<JSONObject> cookiePostHttp(String url,MultiValueMap<String, String> params){
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/x-www-form-urlencoded");
        headers.setContentType(type);
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        org.springframework.http.HttpEntity<MultiValueMap<String, String>> request = new org.springframework.http.HttpEntity<>(params, headers);
        org.springframework.http.HttpEntity<JSONObject> response = restTemplate.exchange(url, HttpMethod.POST, request, JSONObject.class);
        return response;
    }
    public org.springframework.http.HttpEntity<JSONObject> aqgCookieHttp(String url, MultiValueMap<String, String> params,HttpMethod method,String cookie) {
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/x-www-form-urlencoded");
        headers.setContentType(type);
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        headers.add("Cookie",cookie);
        org.springframework.http.HttpEntity<MultiValueMap<String, String>> request = new org.springframework.http.HttpEntity<>(params, headers);
        org.springframework.http.HttpEntity<JSONObject> response = restTemplate.exchange(url, method, request, JSONObject.class);
        return response;
    }
//    public static void main(String[] args) {
//        MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
//        org.springframework.http.HttpEntity<JSONObject> response = aqgCookieHttp("http://api.aiqiangua.com:8888/api/device/868219010321351",null,HttpMethod.GET,
//                "user=2|1:0|10:1620279813|4:user|16:MTM1NTk0ODUyNzA=|9d8d1403e854d37b551b57c9e53581b2ba7c491ba394a2b3a1b83f4ebc3c2d34");
//        System.out.println(response.getBody().toString());
//    }
}

+ 1 - 0
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java

@ -131,6 +131,7 @@ public class BasicZuulFilter extends ZuulFilter {
                || url.contains("/sms_gateway/send")//发送短信
                || url.contains("/accountAppeal/create")
                || url.contains("/open/")//开放接口
                || url.contains("/cloudCare/noLogin/")//医疗云开放接口
                || url.contains("/image/")//获取默认图片
                ||url.contains("/weixin")||
                url.contains("/excelControl")) {

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

@ -2,6 +2,7 @@ package com.yihu.jw.security.core.userdetails.jdbc;
import com.alibaba.fastjson.JSONObject;
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.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.security.core.userdetails.SaltUser;
@ -64,6 +65,10 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
    private static final String UPDATE_PATIENT_CARD_TYPE = "update base_patient set card_type = ?,alipay_id = ? where id = ?";
    private static final String DEFAULT_FAMILY_STATEMENT = "SELECT * FROM base_patient_family_member p WHERE p.patient = ? and p.family_member = ?";
    private static final String DEFAULT_PATIENT_STATEMENT = "SELECT * FROM base_patient p WHERE p.id = ? ";
    private static final String BespeakRegist = "bespeakRegist:";
@ -146,7 +151,7 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
     * 用户登录判读接口
     * 判断loginType查找用户信息
     * 用户类型 1或默认为user,2:医生登录,3:患者登录,4:i健康系统-患者登录(i健康患者可以不注册直接登录互联网系统,首次使用,根据i健康居民code去i健康查询居民信息,然后保存到base.base_patient)
     * 用户类型 5 中山医院支付宝-患者登录(可以不注册直接登录)
     * 用户类型 5 中山医院支付宝-患者登录(可以不注册直接登录) 6医养项目家人登录
     * @param username
     * @return
     */
@ -154,6 +159,7 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
    public List<WlyyUserDetails> getWlyyUserDetails(String username) {
        String loginType = getLogintype();
        List<WlyyUserDetails> users = null;
        //1或默认查找user表,为平台管理员账号
        if (StringUtils.isBlank(loginType) || "1".equals(loginType)) {
@ -490,6 +496,24 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
        }else if("6".equals(loginType)) {
            //第三方登陆
            users = this.getJdbcTemplate().query(DEFAULT_PATIENT_DETAILS_STATEMENT, new BeanPropertyRowMapper(WlyyUserDetails.class), username, username);
        }else if ("7".equals(loginType)) {
            String data[] = username.split(":");
            String patientId = data[0];
            String familyPatientId = data[2];
            List<BasePatientFamilyMemberDO> familys =this.getJdbcTemplate().query(DEFAULT_FAMILY_STATEMENT, new BeanPropertyRowMapper(BasePatientFamilyMemberDO.class), patientId, familyPatientId);
            if(familys==null||familys.size()==0){
                return users;
            }
            username = data[1];
            //查找是否存在预注册 用户
            String userName = redisTemplate.opsForValue().get(BespeakRegist + username);
            if (StringUtils.isNotBlank(userName)) {
                //保存到数据库
                this.getJdbcTemplate().execute("update base_patient set del=1 where mobile='" + username + "'");
                redisTemplate.opsForValue().get(BespeakRegist + username);
                redisTemplate.delete(BespeakRegist + username);
            }
            users = this.getJdbcTemplate().query(DEFAULT_PATIENT_DETAILS_STATEMENT, new BeanPropertyRowMapper(WlyyUserDetails.class), username, username);
        }
        return users;
    }
@ -652,6 +676,10 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
            //第三方登陆
            this.getJdbcTemplate().update("update base_patient p set p.login_failure_count = 0, p.login_date = ? where p.mobile = ? or p.idcard = ?", new Date(), username, username);
            users = this.getJdbcTemplate().query(DEFAULT_PATIENT_DETAILS_STATEMENT, new BeanPropertyRowMapper(WlyyUserSimple.class), username,username);
        } else if ("7".equals(loginType)) {
            //更新登录时间
            this.getJdbcTemplate().update("update base_patient p set p.login_failure_count = 0, p.login_date = ? where p.mobile = ? or p.idcard = ?", new Date(), username, username);
            users = this.getJdbcTemplate().query(DEFAULT_PATIENT_DETAILS_STATEMENT, new BeanPropertyRowMapper(WlyyUserSimple.class), username, username);
        }
        logger.info("login:登录进入6");
@ -728,10 +756,19 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
        return idcard;
    }
    public static List<String> loginTypeList = new ArrayList<>();
    static {
        loginTypeList.add("1");
        loginTypeList.add("2");
        loginTypeList.add("3");
        loginTypeList.add("4");
        loginTypeList.add("5");
        loginTypeList.add("6");
    }
    public boolean setRolePhth(String loginType, OAuth2AccessToken token, String id, StringRedisTemplate redisTemplate) {
        if (org.apache.commons.lang.StringUtils.isBlank(loginType) || "1".equals(loginType) || "2".equals(loginType) || "3".equals(loginType) || "4".equals(loginType)|| "5".equals(loginType)) { //1或默认查找user表,为平台管理员账号
        if (org.apache.commons.lang.StringUtils.isBlank(loginType) || loginTypeList.contains(loginType)) { //1或默认查找user表,为平台管理员账号
            String key = "wlyy2:auth:token:" + token.getValue();
            redisTemplate.opsForValue().set(key, "/**");
            redisTemplate.expire(key, token.getExpiresIn(), TimeUnit.SECONDS);

+ 65 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/WlyyTokenGranter.java

@ -1,5 +1,6 @@
package com.yihu.jw.security.oauth2.provider;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.security.core.userdetails.SaltUser;
import com.yihu.jw.security.oauth2.core.redis.WlyyRedisVerifyCodeService;
import com.yihu.jw.security.utils.AES;
@ -107,6 +108,14 @@ public class WlyyTokenGranter implements TokenGranter {
                        requestFactory,
                        userDetailsService
                ));
        tokenGranters.put(FamilyTokenGranter.GRANT_TYPE,
                new FamilyTokenGranter(
                        authenticationManager,
                        tokenServices,
                        clientDetailsService,
                        requestFactory,
                        userDetailsService
                ));
    }
    public OAuth2AccessToken grant(String grantType, TokenRequest tokenRequest) {
@ -511,6 +520,62 @@ public class WlyyTokenGranter implements TokenGranter {
                throw new InvalidGrantException("User account is locked");
            }
//            parameters.put("password",userDetails.getPassword());
            Authentication userAuth = new UsernamePasswordAuthenticationToken(username,userDetails.getPassword(),  this.authoritiesMapper.mapAuthorities(userDetails.getAuthorities()));
            ((AbstractAuthenticationToken) userAuth).setDetails(parameters);
            OAuth2Request storedOAuth2Request = getRequestFactory().createOAuth2Request(client, tokenRequest);
            return new OAuth2Authentication(storedOAuth2Request, userAuth);
        }
    }
    /**
     * 家人登录
     */
    public static class FamilyTokenGranter extends AbstractTokenGranter {
        private static final String GRANT_TYPE = "family";
        private final AuthenticationManager authenticationManager;
        private final UserDetailsService userDetailsService;
        private GrantedAuthoritiesMapper authoritiesMapper = new NullAuthoritiesMapper();
        public FamilyTokenGranter(AuthenticationManager authenticationManager,
                                  AuthorizationServerTokenServices tokenServices,
                                  ClientDetailsService clientDetailsService,
                                  OAuth2RequestFactory requestFactory,
                                  UserDetailsService userDetailsService) {
            this(authenticationManager, tokenServices, clientDetailsService, requestFactory, userDetailsService, GRANT_TYPE);
        }
        protected FamilyTokenGranter(AuthenticationManager authenticationManager,
                                     AuthorizationServerTokenServices tokenServices,
                                     ClientDetailsService clientDetailsService,
                                     OAuth2RequestFactory requestFactory,
                                     UserDetailsService userDetailsService,
                                     String grantType) {
            super(tokenServices, clientDetailsService, requestFactory, grantType);
            this.authenticationManager = authenticationManager;
            this.userDetailsService = userDetailsService;
        }
        @Override
        protected OAuth2Authentication getOAuth2Authentication(ClientDetails client, TokenRequest tokenRequest) {
            Map<String, String> parameters = new LinkedHashMap<String, String>(tokenRequest.getRequestParameters());
            String encdata = parameters.get("encdata");
            encdata = AesEncryptUtils.agDecrypt(encdata);
            //居民id 家人手机号/家人身份证 家人id 以冒号组合,如:
            //6e9d7cdb05b346a3a992739b9810319c:13559485277:3ae2673512154d5280d1dcf5ffa5626d
            String data[] = encdata.split(":");
            String username = data[1];
            SaltUser userDetails = (SaltUser)userDetailsService.loadUserByUsername(encdata);
            if (!userDetails.isEnabled()) {
                throw new InvalidGrantException("User is disabled");
            }
            if (!userDetails.isAccountNonLocked()) {
                throw new InvalidGrantException("User account is locked");
            }
//            parameters.put("password",userDetails.getPassword());
            Authentication userAuth = new UsernamePasswordAuthenticationToken(username,userDetails.getPassword(),  this.authoritiesMapper.mapAuthorities(userDetails.getAuthorities()));
            ((AbstractAuthenticationToken) userAuth).setDetails(parameters);

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

@ -9,6 +9,7 @@ import com.yihu.jw.entity.base.login.BaseLoginLogDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.restmodel.ResultStatus;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -170,7 +171,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
     *                    username 用户名/手机/身份证号
     *                    key 图形验证码键值
     *                    text 用户输入的图形验证码
     *                    login_type 用户类型 1或默认为user,2:医生登录,3:患者登录,4:第三方同步账号登录,5.易联众居民健康卡授权登录
     *                    login_type 用户类型 1或默认为user,2:医生登录,3:患者登录,4:第三方同步账号登录,5.易联众居民健康卡授权登录 6医养项目家人登录
     * @param httpSession
     * @return
     * @throws Exception
@ -199,11 +200,16 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        if (StringUtils.isEmpty(client_id)) {
            throw new InvalidRequestException("client_id");
        }
        if("alipay".equals(flag)){
            //支付宝登录
        if("alipay".equals(flag)||"family".equals(flag)){
            //支付宝登录||家人登录
            parameters.put("grant_type", flag);
            String encdata = parameters.get("encdata");
            encdata = AES.decrypt(encdata);
            if("alipay".equals(flag)){
                encdata = AES.decrypt(encdata);
            }else{
                encdata = AesEncryptUtils.agDecrypt(encdata);
            }
            String data[] = encdata.split(":");
            username = data[1];
            parameters.put("username", username);

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/patient/BasePatientEndpoint.java

@ -72,8 +72,8 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
    public Envelop getPatientById(
            @ApiParam(name = "id", value = "居民id")
            @RequestParam(value = "id", required = true) String id) throws Exception {
        String result = basePatientService.getPatientById(id);
        return success(result);
        return success(basePatientService.getPatientById(id));
    }
    @GetMapping(value = "findPatientById")

+ 17 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/servicePackage/ServicePackageItemEndpoint.java

@ -1,9 +1,12 @@
package com.yihu.jw.base.endpoint.servicePackage;
import com.alibaba.fastjson.JSONObject;
import com.netflix.discovery.converters.Auto;
import com.yihu.jw.base.service.servicePackage.ServicePackageItemService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.entity.base.servicePackage.ServicePackageItemDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -12,11 +15,15 @@ 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.codec.binary.Base64;
import org.nlpcn.es4sql.domain.From;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
/**
@ -29,6 +36,8 @@ public class ServicePackageItemEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private ServicePackageItemService servicePackageItemService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @PostMapping(value = "create")
    @ApiOperation(value = "创建")
@ -79,6 +88,14 @@ public class ServicePackageItemEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        List<ServicePackageItemDO> servicePackageItemDOS = servicePackageItemService.search(fields, filters, sorts, page, size);
        for (ServicePackageItemDO servicePackageItemDO:servicePackageItemDOS){
            List<WlyyHospitalSysDictDO> wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findByDictName("isEffect");
            for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO1:wlyyHospitalSysDictDO){
                if (servicePackageItemDO.getDel().equalsIgnoreCase(wlyyHospitalSysDictDO1.getDictCode())){
                    servicePackageItemDO.setDelName(wlyyHospitalSysDictDO1.getDictValue());
                }
            }
        }
        int count = (int)servicePackageItemService.getCount(filters);
        return success(servicePackageItemDOS, count, page, size);
    }
@ -95,6 +112,4 @@ public class ServicePackageItemEndpoint extends EnvelopRestEndpoint {
        List<ServicePackageItemDO> servicePackageItemDOS = servicePackageItemService.search(fields, filters, sorts);
        return success(servicePackageItemDOS);
    }
}

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

@ -346,7 +346,8 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        List<Map<String,Object>> list=null;
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
        list = hibenateUtils.createSQLQuery(sql,page,size);
       /* if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            if (flag){
                sql+=" LIMIT  " + (page - 1) * size + "," + size + "";
@ -379,7 +380,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            sql+=" LIMIT  " + (page - 1) * size + "," + size + "";
            Logger.getAnonymousLogger().info("finalCountSql="+sql);
            list = jdbcTemplate.queryForList(sql);
        }
        }*/
        String countSql = " select " +

+ 7 - 6
svr/svr-base/src/main/java/com/yihu/jw/base/service/servicePackage/ServicePackageItemService.java

@ -38,12 +38,7 @@ public class ServicePackageItemService extends BaseJpaService<ServicePackageItem
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
       List<ServicePackageItemDO> itemDOList = servicePackageItemDao.findByTeamCode(itemDO.getTeamCode(),itemDO.getCode());
        if(itemDOList!=null&&itemDOList.size()>0){
            result.put("msg","该服务团队已存在此服务项,请勿重复添加");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        BaseOrgDO baseOrgDO = baseOrgDao.findByCode(itemDO.getOrgCode());
        if (baseOrgDO!=null){
            itemDO.setOrgName(baseOrgDO.getName());
@ -54,6 +49,12 @@ public class ServicePackageItemService extends BaseJpaService<ServicePackageItem
        }
        if(StringUtil.isEmpty(itemDO.getId())){
            //新增
            List<ServicePackageItemDO> itemDOList = servicePackageItemDao.findByTeamCode(itemDO.getTeamCode(),itemDO.getCode());
            if(itemDOList!=null&&itemDOList.size()>0){
                result.put("msg","该服务团队已存在此服务项,请勿重复添加");
                result.put("response", ConstantUtils.FAIL);
                return result;
            }
            itemDO.setPrice(new BigDecimal(0));
            itemDO.setServicePackageId("system");
            itemDO.setCreateTime(DateUtil.getStringDate());

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

@ -252,10 +252,10 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
                " g.street_code AS streetCode, " +
                " g.street_name AS streetName, " +
                " g.name, " +
                " address " +
                " g.address " +
                " FROM " +
                " base_org g " +
                " JOIN base_org_user u ON g.`code` = u.org_code " +
                " JOIN base_org_user u ON g.code = u.org_code " +
                " WHERE  " +
                " u.user_id = '" + id + "'";
        List<Map<String, Object>> org = jdbcTemplate.queryForList(sql);

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

@ -436,8 +436,10 @@ spring:
    host: 10.90.32.3 # Redis server host.
    port: 20008  # Redis server port.
    password: jkzlehr
fast-dfs:
  tracker-server: 10.90.32.3:20003 #服务器地址
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
  fastdfs_file_url: http://www.xmtyw.cn/
demo:
  flag: true
hospital:
@ -447,7 +449,7 @@ hospital:
  SourceSysCode: S60
  TargetSysCode: S01
wlyy:
  url: http://ehr.yihu.com/wlyy/
  url: http://www.xmtyw.cn/wlyy/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040
  flag: false

+ 1 - 1
svr/svr-base/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name: svr-base-ysj
    name: svr-base
  cloud:
    config:
      failFast: true

+ 4 - 4
svr/svr-cloud-care/pom.xml

@ -216,11 +216,11 @@
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-commons</artifactId>
            <version>1.3.2</version>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <!--缩略图-->
        <dependency>

+ 3 - 0
svr/svr-cloud-care/readme.MD

@ -1,3 +1,6 @@
基础微服务
    每个模块有自己独立的文件夹,这样做的好处是以后如果哪个模块需要独立成微服务,代码直接剪切到新的微服务即可。
    每个模块下面有独立的Endpoint,service,model和dao
@ObserverRequired
医生端观察者模式。医生端请求的post的接口必须加这个注解

+ 2 - 1
svr/svr-cloud-care/sql/sql

@ -19,12 +19,13 @@ CREATE TABLE base.base_capacity_assessment_baseinfo (
  `pension_count` varchar(20) DEFAULT NULL COMMENT '养老金收入 元/月',
  `family_type` varchar(20) DEFAULT NULL COMMENT '是否为经济困难家庭 0否 1特困 2低保 3低保边缘 ',
  `disability_certificate` varchar(20) DEFAULT NULL COMMENT '是否为持证残疾人 0否 1是 ',
  `medical_insurance_type` varchar(20) DEFAULT NULL COMMENT '医保类别 1职工基本医疗保险 2城乡居民基本医疗保险 3其他医疗保障 4无任何保障',
  `medical_insurance` varchar(20) DEFAULT NULL COMMENT '是否购买了商业健康(医疗)保险 0否 1是 ',
  `living_type` varchar(20) DEFAULT NULL COMMENT '现住场所:1自有产权房、私房等;2各类租赁房等;3养老院或类似机构;4护理院或类似机构;5医院或类似机构',
  `living_together` varchar(20) DEFAULT NULL COMMENT '同居者类型 0独居;1与配偶/伴侣居住;2与子女居住;3与孙辈居住;4与父母居住;5与兄弟姐妹居住;6与其他亲友居住;7其他',
  `living_together_remark` varchar(255) DEFAULT NULL COMMENT '同居者备注',
  `dementia_flag` varchar(20) DEFAULT NULL COMMENT '痴呆症 0无 1有',
  `Mental_illness` varchar(20) DEFAULT NULL COMMENT '精神疾病(可多选)0无;1精神分裂症;2双相情感障碍;3偏执性精神障碍;4分裂情感性障碍;5癫痫所致精神障碍;6精神发育迟滞伴发精神障碍',
  `mental_illness` varchar(20) DEFAULT NULL COMMENT '精神疾病(可多选)0无;1精神分裂症;2双相情感障碍;3偏执性精神障碍;4分裂情感性障碍;5癫痫所致精神障碍;6精神发育迟滞伴发精神障碍',
  `disease_type` varchar(20) DEFAULT NULL COMMENT '患病类型可多选;0无 1肿瘤(晚期)2严重心律失常3压疮4慢性心力衰竭(心功能III-IV级)5慢性肾功能衰竭(尿毒症期)6多器官功能衰竭7蛋白质能量营养不足(重度)8慢性阻塞性肺疾病(肺心病心功能III-IV级)9呼吸衰竭10脑血管意外合并吞咽障碍11其他',
  `disease_remark` varchar(255) DEFAULT NULL COMMENT '其他疾病',
  `fall_lately` varchar(20) DEFAULT NULL COMMENT '近30天跌倒 0无;1一次;2两次;3三次及以上',

+ 47 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/aop/BaseAop.java

@ -0,0 +1,47 @@
package com.yihu.jw.care.aop;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import javax.servlet.http.HttpServletRequest;
/**
 * Created by yeshijie on 2021/4/23.
 */
public class BaseAop {
    public String write(int code, String msg) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            return json.toString();
        } catch (Exception e) {
            return null;
        }
    }
    public String error(int code, String msg) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            return json.toString();
        } catch (Exception e) {
            return null;
        }
    }
    public JSONObject getAgent(HttpServletRequest request) {
        try {
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            System.out.println("userAgent:" + userAgent);
            return new JSONObject(userAgent);
        } catch (Exception e) {
            return null;
        }
    }
}

+ 1 - 35
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/aop/ObserverRequiredAOP.java

@ -19,7 +19,7 @@ import java.io.PrintWriter;
 */
@Aspect
@Component
public class ObserverRequiredAOP {
public class ObserverRequiredAOP extends BaseAop{
    //Controller层切点路径
    @Pointcut("execution(* com.yihu.jw.care.endpoint..*.*(..))")
    public void controllerAspect() {
@ -52,38 +52,4 @@ public class ObserverRequiredAOP {
        return o;
    }
    public String write(int code, String msg) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            return json.toString();
        } catch (Exception e) {
            return null;
        }
    }
    public String error(int code, String msg) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            return json.toString();
        } catch (Exception e) {
            return null;
        }
    }
    public JSONObject getAgent(HttpServletRequest request) {
        try {
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            System.out.println("userAgent:" + userAgent);
            return new JSONObject(userAgent);
        } catch (Exception e) {
            return null;
        }
    }
}

+ 45 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/aop/RedisLock.java

@ -0,0 +1,45 @@
package com.yihu.jw.care.aop;
import com.yihu.jw.care.util.RedisConstant;
import java.lang.annotation.*;
/**
 * redis分布式锁注解
 *
 * Created by yeshijie on 2021/4/23.
 */
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RedisLock {
    /**
     * 锁值
     *
     * @return {@link String}
     */
    String value() default "";
    /**
     * spel参数(#开头)
     *
     * @return {@link String}
     */
    String key() default "";
    /**
     * 上锁超时时间,单位秒
     *
     * @return long
     */
    long time() default RedisConstant.REDIS_LOCK_EXPIRE;
    /**
     * 提示
     *
     * @return {@link String}
     */
    String msg() default "请求频繁,请稍后再试";
}

+ 178 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/aop/RedisLockAOP.java

@ -0,0 +1,178 @@
package com.yihu.jw.care.aop;
import com.google.common.base.Joiner;
import com.yihu.jw.care.exception.BusinessException;
import com.yihu.jw.care.service.common.RedisService;
import com.yihu.jw.care.util.RedisConstant;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.core.annotation.Order;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.SpelEvaluationException;
import org.springframework.expression.spel.SpelParseException;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
 * redis分布式锁AOP
 *
 * @author baichuan.wu
 * @version 1.0.0
 * @date 2019-12-26 14:16
 */
@Aspect
@Order(-1)
@Component
public class RedisLockAOP {
    private static final Logger LOGGER = LoggerFactory.getLogger(RedisLockAOP.class);
    @Autowired
    private RedisService redisService;
    private static final ExpressionParser PARSER = new SpelExpressionParser();
    private static final ParameterNameDiscoverer DISCOVERER = new LocalVariableTableParameterNameDiscoverer();
    private static final String UNDERLINE = "_";
    private static final String REDIS_LOCK = "REDIS_LOCK";
    /**
     * aop切入点
     *
     * @param redisLock
     */
    @Pointcut("@annotation(redisLock)")
    public void pointCut(RedisLock redisLock) {
    }
    /**
     * aop环绕
     *
     * @param joinPoint
     * @param redisLock
     * @return {@link Object}
     */
    @Around(value = "pointCut(redisLock)", argNames = "joinPoint,redisLock")
    public Object around(ProceedingJoinPoint joinPoint, RedisLock redisLock) throws Throwable {
        return aroundRedisLock(joinPoint, redisLock);
    }
    /**
     * 分布式锁
     *
     * @param joinPoint
     * @param redisLock
     * @return {@link Object}
     */
    public Object aroundRedisLock(ProceedingJoinPoint joinPoint, RedisLock redisLock) throws Throwable {
        String lockKey = null;
        Object result;
        boolean lock = false;
        try {
            lockKey = getLockKey(joinPoint, redisLock);
            lock = redisService.tryLock(lockKey, REDIS_LOCK, redisLock.time());
            if (!lock) {
                LOGGER.error("【LOCK】{}", redisLock.msg());
                throw new BusinessException(redisLock.msg());
            }
            result = joinPoint.proceed();
        } catch (SpelParseException e) {
            LOGGER.error("【LOCK】表达式解析异常", e);
            throw new BusinessException("【LOCK】请求异常,请稍后再试");
        } catch (SpelEvaluationException e) {
            LOGGER.error("【LOCK】表达式异常:{}", e.getMessage());
            throw new BusinessException("【LOCK】请求异常,请稍后再试");
        } catch (BusinessException e) {
            LOGGER.error("【LOCK】请求异常", e);
            throw new BusinessException(e.getMessage());
        } catch (Exception e) {
            LOGGER.error("【LOCK】请求异常", e);
            throw new BusinessException("请求异常,请稍后再试");
        } finally {
            if (lock) {
                redisService.releaseLock(lockKey);
            }
        }
        return result;
    }
    /**
     * 获取分布式锁key
     *
     * @param joinPoint
     * @param redisLock
     * @return {@link String}
     */
    public String getLockKey(ProceedingJoinPoint joinPoint, RedisLock redisLock) {
        MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
        List<String> keyList = new ArrayList<>();
        keyList.add(RedisConstant.REDIS_LOCK_PREFIX);
        keyList.add(joinPoint.getTarget().getClass().getSimpleName().toUpperCase());
        // 如果配置key前缀则使用配置的,否则用方法名
        if (StringUtils.isNotBlank(redisLock.value())) {
            keyList.add(redisLock.value());
        } else {
            keyList.add(methodSignature.getName().toUpperCase());
        }
        // 解析spel表达式
        String key = getParseKey(redisLock.key(), methodSignature.getMethod(), joinPoint.getArgs());
        if (StringUtils.isNotBlank(key)) {
            keyList.add(key);
        }
        return Joiner.on(UNDERLINE).join(keyList);
    }
    /**
     * 获取缓存的key
     * key 定义在注解上,支持SPEL表达式
     *
     * @param key
     * @param method
     * @param args
     * @return {@link String}
     */
    public String getParseKey(String key, Method method, Object[] args) {
        if (StringUtils.isBlank(key)) {
            return getHexKey(args);
        }
        // 获取请求参数名
        String[] paramNames = DISCOVERER.getParameterNames(method);
        if (paramNames != null && paramNames.length > 0) {
            StandardEvaluationContext context = new StandardEvaluationContext();
            for (int i = 0; i < args.length; i++) {
                context.setVariable(paramNames[i], args[i]);
            }
            // 解析表达式
            return PARSER.parseExpression(key).getValue(context, String.class);
        } else {
            return getHexKey(args);
        }
    }
    /**
     * hex加密key
     *
     * @param args
     * @return {@link String}
     */
    public static String getHexKey(Object[] args) {
        if (args != null && args.length > 0) {
            return DigestUtils.md5Hex(Arrays.toString(args));
        } else {
            return null;
        }
    }
}

+ 3 - 25
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/aop/ServicesAuthAOP.java

@ -7,7 +7,6 @@ import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
@ -23,7 +22,7 @@ import java.util.List;
 */
@Aspect
@Component
public class ServicesAuthAOP {
public class ServicesAuthAOP extends BaseAop{
    @Autowired
    private ServicePackageService servicePackageService;
@ -54,10 +53,10 @@ public class ServicesAuthAOP {
                writer.flush();
                return o;
            }
            List<String> items =servicePackageService.getPatientServiceItems(patientId);
            List<String> items =servicePackageService.fingServiceItemsCodeByPatientId(patientId);
            if(!items.contains(item)){
                PrintWriter writer=response.getWriter();
                writer.write(error(401, "该操作没有权限"));
                writer.write(error(401, "未签约相关服务,该操作没有权限"));
                writer.flush();
                return o;
            }
@ -68,26 +67,5 @@ public class ServicesAuthAOP {
        return o;
    }
    public String write(int code, String msg) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            return json.toString();
        } catch (Exception e) {
            return null;
        }
    }
    public String error(int code, String msg) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            return json.toString();
        } catch (Exception e) {
            return null;
        }
    }
}

+ 48 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/AqgConfig.java

@ -0,0 +1,48 @@
package com.yihu.jw.care.config;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/4/29
 * @Description: 爱牵挂配置
 */
public class AqgConfig {
    /**
     * 基础url
     */
//    public static final String baseUrl = "http://120.24.56.48:8889";//测试环境
    public static final String baseUrl = "http://api.aiqiangua.com:8888";// 正式环境
    /**
     * 登录
     */
    public static final String login = baseUrl +"/api/auth/login";
    /**
     * 获取设备信息
     */
    public static final String deviceInfo = baseUrl +"/api/device/{0}";
    /**
     * 修改亲情号码
     */
    public static final String sos_numbers = baseUrl +"/api/device/{0}/sos_numbers/{1}";
    /**
     * 获取设备最新位置数据
     */
    public static final String device_last_locationdata = baseUrl +"/api/device/{0}/data/locationdata/";
    /**
     * 设置智能手环安全区域
     */
    public static final String fence_area = baseUrl +"/api/device/{0}/fences/{1}";
    public static final String username = "13559485270";
    public static final String password = "zjxl@2021";
    public static final String redisKey = "aqgCooker";
    /**
     * cookie时效24小时,吧过期时间设置为23 小时
     */
    public static final Long overTime = 23L;
}

+ 125 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/RedisConfig.java

@ -0,0 +1,125 @@
package com.yihu.jw.care.config;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.care.util.RedisConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.*;
import org.springframework.data.redis.serializer.*;
/**
 * 缓存配置
 *
 * @author baichuan.wu
 * @version 1.0
 * @date 2019/4/8 15:17
 */
@Configuration
@EnableCaching
public class RedisConfig extends CachingConfigurerSupport {
    @Autowired
    private RedisConnectionFactory factory;
    @Bean
    public CacheManager cacheManager(RedisTemplate redisTemplate) {
        RedisCacheManager rcm = new RedisCacheManager(redisTemplate);
        rcm.setDefaultExpiration(RedisConstant.REDIS_LOCK_EXPIRE_30);
        return rcm;
    }
    @Bean
    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
        RedisTemplate<String, Object> redisTemplate = new RedisTemplate<String, Object>();
        redisTemplate.setConnectionFactory(factory);
        StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
        Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<Object>(Object.class);
        ObjectMapper om = new ObjectMapper();
        om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
        om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
        jackson2JsonRedisSerializer.setObjectMapper(om);
        redisTemplate.setKeySerializer(stringRedisSerializer);
        redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);
        /**hash也同样存对象数组*/
        redisTemplate.setHashKeySerializer(stringRedisSerializer);
        redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer);
        redisTemplate.afterPropertiesSet();
        return redisTemplate;
    }
    /**
     * 对hash类型的数据操作
     *
     * @param redisTemplate
     * @return {@link HashOperations <String,String,Object>}
     */
    @Bean
    public HashOperations<String, String, Object> hashOperations(RedisTemplate<String, Object> redisTemplate) {
        return redisTemplate.opsForHash();
    }
    /**
     * 对redis字符串类型数据操作
     *
     * @param redisTemplate
     * @return {@link ValueOperations <String, Object>}
     */
    @Bean
    public ValueOperations<String, Object> valueOperations(RedisTemplate<String, Object> redisTemplate) {
        return redisTemplate.opsForValue();
    }
    /**
     * 对链表类型的数据操作
     *
     * @param redisTemplate
     * @return {@link ListOperations <String, Object>}
     */
    @Bean
    public ListOperations<String, Object> listOperations(RedisTemplate<String, Object> redisTemplate) {
        return redisTemplate.opsForList();
    }
    /**
     * 对无序集合类型的数据操作
     *
     * @param redisTemplate
     * @return {@link SetOperations <String, Object>}
     */
    @Bean
    public SetOperations<String, Object> setOperations(RedisTemplate<String, Object> redisTemplate) {
        return redisTemplate.opsForSet();
    }
    /**
     * 对有序集合类型的数据操作
     *
     * @param redisTemplate
     * @return {@link ZSetOperations <String, Object>}
     */
    @Bean
    public ZSetOperations<String, Object> zSetOperations(RedisTemplate<String, Object> redisTemplate) {
        return redisTemplate.opsForZSet();
    }
    /**
     * string序列化
     *
     * @return {@link RedisSerializer <String>}
     */
    private RedisSerializer<String> keySerializer() {
        return new StringRedisSerializer();
    }
}

+ 27 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/apply/PatientBedApplyDao.java

@ -0,0 +1,27 @@
package com.yihu.jw.care.dao.apply;
import com.yihu.jw.entity.care.apply.PatientBedApplyDo;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Bing on 2021/4/8.
 */
public interface PatientBedApplyDao extends PagingAndSortingRepository<PatientBedApplyDo,String>,
        JpaSpecificationExecutor<PatientBedApplyDo> {
    PatientBedApplyDo findByIdcardAndOrgCodeAndStatus(String idcard,String orgCode,Integer status);
    PatientBedApplyDo findByIdcardAndStatus(String idcard,Integer status);
    List<PatientBedApplyDo> findByOrgCodeAndStatusIn(String orgCode,Integer[] status ,Sort sort);
    List<PatientBedApplyDo> queryByIdcardAndOrgCodeAndStatusIn(String idcard, String orgCode, Integer[] status);
    @Query("select count(1) from PatientBedApplyDo p where p.orgCode=?1 and p.status<>-1 and p.status<>0")
    Integer findUnCompleteByOrgCode(String orgCode);
}

+ 21 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/assistance/EmergencyAssistanceDao.java

@ -0,0 +1,21 @@
package com.yihu.jw.care.dao.assistance;
import com.yihu.jw.entity.care.assistance.EmergencyAssistanceDO;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Bing on 2021/4/12.
 */
public interface EmergencyAssistanceDao extends PagingAndSortingRepository<EmergencyAssistanceDO,String>,
        JpaSpecificationExecutor<EmergencyAssistanceDO> {
    List<EmergencyAssistanceDO> queryByPatientAndStatusIn(String patient, Integer[] status, Sort sort);
    EmergencyAssistanceDO findByPatientAndStatus(String patient,Integer status);
    EmergencyAssistanceDO findByProxyPatientAndStatus(String proxyPatient,Integer status);
}

+ 21 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/contacts/BasePatientContactsOrgDao.java

@ -0,0 +1,21 @@
package com.yihu.jw.care.dao.contacts;
import com.yihu.jw.entity.care.contacts.BasePatientContactsOrgDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/7
 * @Description:
 */
public interface BasePatientContactsOrgDao extends PagingAndSortingRepository<BasePatientContactsOrgDO,String>,
        JpaSpecificationExecutor<BasePatientContactsOrgDO> {
    BasePatientContactsOrgDO findByPatient(String patient);
}

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/device/DeviceDetailDao.java

@ -10,7 +10,7 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 */
public interface DeviceDetailDao extends PagingAndSortingRepository<DeviceDetail, Long>, JpaSpecificationExecutor<DeviceDetail> {
    @Query(value = "select a.* from device.wlyy_devices a where a.device_code=?1 limit 0,1",nativeQuery = true)
    @Query(value = "select a.* from wlyy_devices a where a.device_code=?1 limit 0,1",nativeQuery = true)
    DeviceDetail findBySn(String sn);
}

+ 28 - 24
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/device/PatientDeviceDao.java

@ -1,6 +1,6 @@
package com.yihu.jw.care.dao.device;
import com.yihu.jw.entity.care.device.PatientDevice;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
@ -9,46 +9,50 @@ import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface PatientDeviceDao extends PagingAndSortingRepository<PatientDevice, Long>, JpaSpecificationExecutor<PatientDevice> {
public interface PatientDeviceDao extends PagingAndSortingRepository<DevicePatientDevice, Long>, JpaSpecificationExecutor<DevicePatientDevice> {
    @Query("select a from PatientDevice a where a.user = ?1 ")
    Iterable<PatientDevice> findByUser(String user);
    @Query("select a from DevicePatientDevice a where a.user = ?1 ")
    Iterable<DevicePatientDevice> findByUser(String user);
    @Query("select a from PatientDevice a where a.user = ?1 ")
    List<PatientDevice> findByPatient(String user);
    @Query("select a from DevicePatientDevice a where a.user = ?1 ")
    List<DevicePatientDevice> findByPatient(String user);
    @Query("select a from PatientDevice a where a.user = ?1 and a.del=0 and a.deviceName like '%药盒%'")
    List<PatientDevice> findByPatientAndDel(String user);
    @Query("select a from DevicePatientDevice a where a.user = ?1 and a.del=0 and a.deviceName like '%药盒%'")
    List<DevicePatientDevice> findByPatientAndDel(String user);
    @Query("select a from PatientDevice a where a.user = ?1 and a.deviceSn=?2 ")
    List<PatientDevice> findByPatientAndDeviceSn(String user, String deviceSn);
    @Query("select a from DevicePatientDevice a where a.user = ?1 and a.deviceSn=?2 ")
    List<DevicePatientDevice> findByPatientAndDeviceSn(String user, String deviceSn);
    List<PatientDevice> findByUser(String user, Pageable pageRequest);
    List<DevicePatientDevice> findByUser(String user, Pageable pageRequest);
    List<PatientDevice> findByUserAndDoctor(String user, String doctor, Pageable pageRequest);
    List<DevicePatientDevice> findByUserAndDoctor(String user, String doctor, Pageable pageRequest);
    List<PatientDevice> findByDeviceSnAndCategoryCode(String deviceSn, String categoryCode);
    List<DevicePatientDevice> findByDeviceSnAndCategoryCode(String deviceSn, String categoryCode);
    PatientDevice findByDeviceSnAndCategoryCodeAndUserType(String deviceSn, String categoryCode, String userType);
    DevicePatientDevice findByDeviceSnAndCategoryCodeAndUserType(String deviceSn, String categoryCode, String userType);
    PatientDevice findByDeviceIdAndDeviceSnAndUserType(Long deviceId, String deviceSn, String userType);
    DevicePatientDevice findByDeviceIdAndDeviceSnAndUserType(Long deviceId, String deviceSn, String userType);
    PatientDevice findByDeviceSnAndUserType(String deviceSn, String userType);
    DevicePatientDevice findByDeviceSnAndUserType(String deviceSn, String userType);
    @Query("select pd from PatientDevice pd where pd.deviceSn = ?1 and pd.del=0")
    List<PatientDevice> findByDeviceSn(String deviceSn);
    @Query("select pd from DevicePatientDevice pd where pd.deviceSn = ?1 and pd.del=0")
    List<DevicePatientDevice> findByDeviceSn(String deviceSn);
    //更换患者绑定的血糖仪
    @Modifying
    @Query("update PatientDevice t set t.deviceSn = ?3 , t.userType = ?4,t.sim=?5,t.hospital=?6,t.hospitalName=?7,t.checkDoctorName=?8 where t.user = ?1 and t.deviceSn = ?2 ")
    @Query("update DevicePatientDevice t set t.deviceSn = ?3 , t.userType = ?4,t.sim=?5,t.hospital=?6,t.hospitalName=?7,t.checkDoctorName=?8 where t.user = ?1 and t.deviceSn = ?2 ")
    int updatePatientDevice(String user, String deviceSN, String newDeviceSN, String userType, String sim, String hospital, String hospitalName, String checkDoctorName);
    //管理员解绑居民设备
    @Modifying
    @Query("update DevicePatientDevice t set t.del = 1  where t.deviceSn = ?1 ")
    int updatePatientDevice(String deviceSN);
    @Query("select a from PatientDevice a")
    List<PatientDevice> findAll();
    @Query("select a from PatientDevice a where a.user=?1 and a.del=0")
    List<PatientDevice> findAllByUser(String user);
    @Query("select a from DevicePatientDevice a")
    List<DevicePatientDevice> findAll();
    @Query("select a from DevicePatientDevice a where a.user=?1 and a.del=0")
    List<DevicePatientDevice> findAllByUser(String user);
    List<DevicePatientDevice> findByUserAndCategoryCode(String user,String categoryCode);
}

+ 8 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/family/PatientFamilyMemberDao.java

@ -50,4 +50,12 @@ public interface PatientFamilyMemberDao extends PagingAndSortingRepository<BaseP
    BasePatientFamilyMemberDO findByPatientAndFamilyMember(String patient,String member);
    List<BasePatientFamilyMemberDO> findByFamilyMemberAndIsAuthorize(String familyMember,Integer isAuthorize);
    @Modifying
    @Query("update BasePatientFamilyMemberDO m set m.isContacts = 0 where m.patient=?1 ")
    int updateContactsByPatient(String patient);
    @Modifying
    @Query("update BasePatientFamilyMemberDO m set m.isContacts = 1 where m.id=?1 ")
    int updateContactsById(String id);
}

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/label/WlyyPatientLabelDao.java

@ -14,8 +14,8 @@ import java.util.List;
public interface WlyyPatientLabelDao extends PagingAndSortingRepository<WlyyPatientLabelDO, String>, JpaSpecificationExecutor<WlyyPatientLabelDO> {
    @Modifying
    @Query("delete WlyyPatientLabelDO a where a.patient=?1")
    int deleteByPatient(String patient) throws Exception;
    @Query("delete WlyyPatientLabelDO a where a.patient=?1 and a.labelType=?2")
    int deleteByPatientAndLabelType(String patient,String labelType) throws Exception;
    @Query("from WlyyPatientLabelDO w where  w.patient=?1 ")
    List<WlyyPatientLabelDO> findByPatient(String patient);

+ 2 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/security/SecurityMonitoringConclusionDao.java

@ -6,6 +6,8 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Bing on 2021/4/7.
 */

+ 5 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/security/SecurityMonitoringOrderDao.java

@ -21,4 +21,9 @@ public interface SecurityMonitoringOrderDao extends PagingAndSortingRepository<S
    @Transactional
    @Query("update SecurityMonitoringOrderDO o set o.conclusionStatus = 1,o.status='4' where o.id=?1")
    void updateConclusionStatus(String orderId);
    @Modifying
    @Transactional
    @Query("update SecurityMonitoringOrderDO o set o.conclusionStatus = 1 where o.id=?1")
    void updateConclusionStatus2(String orderId);
}

+ 9 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/ArchiveDao.java

@ -1,9 +1,13 @@
package com.yihu.jw.care.dao.sign;
import com.yihu.jw.entity.care.archive.ArchiveDO;
import javafx.scene.shape.Arc;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by yeshijie on 2021/2/24.
 */
@ -12,4 +16,9 @@ public interface ArchiveDao extends PagingAndSortingRepository<ArchiveDO, String
    ArchiveDO findByIdcardAndDoctorCode(String idcard, String doctorCode);
    ArchiveDO findByPatientAndDoctorCode(String patient, String doctorCode);
    List<ArchiveDO> findByPatient(String patient);
    @Query(value = "SELECT a.* FROM wlyy_archive a WHERE a.idcard=?1 order by a.create_time desc limit 1",nativeQuery = true)
    ArchiveDO findByIdcard(String idcard);
}

+ 5 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/CapacityAssessmentRecordDao.java

@ -2,13 +2,18 @@ package com.yihu.jw.care.dao.sign;
import com.yihu.jw.entity.care.sign.CapacityAssessmentRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
/**
 * Created by yeshijie on 2021/2/25.
 */
public interface CapacityAssessmentRecordDao extends PagingAndSortingRepository<CapacityAssessmentRecordDO, String>,
        JpaSpecificationExecutor<CapacityAssessmentRecordDO> {
    @Query("select c from CapacityAssessmentRecordDO c where c.patient=?1 and c.assessmentTime>=?2 ")
    CapacityAssessmentRecordDO findByPatient(String patient,Date assessmentTime);
}

+ 17 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/CapacityDoctorDao.java

@ -0,0 +1,17 @@
package com.yihu.jw.care.dao.sign;
import com.yihu.jw.entity.care.sign.CapacityDoctorDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/8
 * @Description:
 */
public interface CapacityDoctorDao extends PagingAndSortingRepository<CapacityDoctorDO, String>, JpaSpecificationExecutor<CapacityDoctorDO> {
    CapacityDoctorDO findByCapacityIdAndDoctorId(String capacityId, String doctorId);
}

+ 3 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/ServicePackageRecordDao.java

@ -4,11 +4,13 @@ import com.yihu.jw.entity.base.servicePackage.ServicePackageRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by yeshijie on 2021/2/25.
 */
public interface ServicePackageRecordDao extends PagingAndSortingRepository<ServicePackageRecordDO, String>, JpaSpecificationExecutor<ServicePackageRecordDO> {
    List<ServicePackageRecordDO> findBySignId(String signId);
}

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/team/BaseTeamDao.java

@ -31,7 +31,7 @@ public interface BaseTeamDao extends PagingAndSortingRepository<BaseTeamDO, Stri
    void delete(@Param("teamCode") String teamCode);
    @Query("SELECT t from BaseTeamDO t WHERE t.leaderCode = :leaderCode AND t.del = '1'")
    BaseTeamDO findByLeaderCode(@Param("leaderCode") String leaderCode);
    List<BaseTeamDO> findByLeaderCode(@Param("leaderCode") String leaderCode);
    @Query("SELECT t FROM BaseTeamMemberDO m, BaseTeamDO t WHERE m.doctorCode = :doctorCode " +
            "AND t.id = m.teamCode AND t.del = '1' AND m.del = '1'")

+ 2 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/team/BaseTeamMemberDao.java

@ -44,6 +44,8 @@ public interface BaseTeamMemberDao extends PagingAndSortingRepository<BaseTeamMe
    BaseTeamMemberDO findByTeamCodeAndDoctorCode(String teamCode, String doctorCode);
    BaseTeamMemberDO findByTeamCodeAndDoctorCodeAndDel(String teamCode, String doctorCode,String del);
    @Modifying
    @Query("update BaseTeamMemberDO t SET t.del = '0' where t.id = :id")
    void deleteById(@Param("id") String id);

+ 0 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/apply/PatientBedApplyEndPoint.java


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