Browse Source

代码修改

LAPTOP-KB9HII50\70708 2 years ago
parent
commit
bf54706be6
18 changed files with 103 additions and 148 deletions
  1. 4 7
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/doctor/DoctorRehabilitationPlanController.java
  2. 1 1
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/GuidanceMessageLogDao.java
  3. 1 1
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/RehabilitationDetailAppointmentDao.java
  4. 1 1
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/RehabilitationOperateRecordsDao.java
  5. 2 2
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/DiagnosisInformationService.java
  6. 2 2
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/PatientRecordService.java
  7. 9 14
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationGuidanceService.java
  8. 9 14
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationInfoService.java
  9. 2 2
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationInformationService.java
  10. 20 22
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationManageService.java
  11. 2 2
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationPerformanceService.java
  12. 14 22
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationPlanService.java
  13. 2 4
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationPlanningService.java
  14. 2 2
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationTreatmentProgramService.java
  15. 10 18
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/SpecialistEvaluateSevice.java
  16. 14 25
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/consult/ConsultTeamService.java
  17. 1 1
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/followUp/FollowupDrugsService.java
  18. 7 8
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/message/RehabilitationMessageService.java

+ 4 - 7
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/doctor/DoctorRehabilitationPlanController.java

@ -3,10 +3,8 @@ package com.yihu.rehabilitation.controller.doctor;
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.patient.Patient;
import com.yihu.jw.entity.rehabilitation.SpecialDiseaseMessagesDO;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationOperateRecordsDO;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.rehabilitation.service.DoctorPatientRelationService;
import com.yihu.jw.restmodel.web.Envelop;
@ -32,7 +30,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import javax.persistence.criteria.CriteriaBuilder;
import java.text.SimpleDateFormat;
import java.util.*;
@ -76,7 +73,7 @@ public class DoctorRehabilitationPlanController extends EnvelopRestEndpoint {
            if(!StringUtils.isNotBlank(doctor)){
                doctor = getUID();
            }
            BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
            BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor).orElse(null);
            JSONObject object = new JSONObject(json);
            JSONArray array = object.getJSONArray("detail");
            Set<String> list = new HashSet<>();
@ -174,7 +171,7 @@ public class DoctorRehabilitationPlanController extends EnvelopRestEndpoint {
        try {
            JSONObject json = new JSONObject(dataJson);
            if(json.has("patientCode")){
                BasePatientDO patient = basePatientDao.findById(json.get("patientCode")+"");
                BasePatientDO patient = basePatientDao.findById(json.get("patientCode")+"").orElse(null);
                json.put("patientName",patient!=null?patient.getName():"");
                json.put("patientName",patient!=null?patient.getName():"");
                try {
@ -192,7 +189,7 @@ public class DoctorRehabilitationPlanController extends EnvelopRestEndpoint {
                }
            }
            if(json.has("doctorCode")){
                BaseDoctorDO doctor = baseDoctorDao.findById(json.get("doctorCode")+"");
                BaseDoctorDO doctor = baseDoctorDao.findById(json.get("doctorCode")+"").orElse(null);
                json.put("doctorName",doctor!=null?doctor.getName():"");
            }
            RehabilitationOperateRecordsDO rehabilitationOperateRecordsDO= toEntity(json.toString(), RehabilitationOperateRecordsDO.class);
@ -321,7 +318,7 @@ public class DoctorRehabilitationPlanController extends EnvelopRestEndpoint {
            if(!StringUtils.isNotBlank(doctor)){
                doctor = getUID();
            }
            BaseDoctorDO d = baseDoctorDao.findById(doctor);
            BaseDoctorDO d = baseDoctorDao.findById(doctor).orElse(null);
            JSONObject object = new JSONObject(json);
            JSONArray array = object.getJSONArray("detail");//获取服务内容
            Set<String> list = new HashSet<>();

+ 1 - 1
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/GuidanceMessageLogDao.java

@ -1,4 +1,4 @@
package com.yihu.jw.rehabilitation;
package com.yihu.rehabilitation.dao;
import com.yihu.jw.entity.specialist.rehabilitation.GuidanceMessageLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

+ 1 - 1
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/RehabilitationDetailAppointmentDao.java

@ -1,4 +1,4 @@
package com.yihu.jw.rehabilitation;
package com.yihu.rehabilitation.dao;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationDetailAppointmentDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

+ 1 - 1
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/RehabilitationOperateRecordsDao.java

@ -1,4 +1,4 @@
package com.yihu.jw.rehabilitation;
package com.yihu.rehabilitation.dao;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationOperateRecordsDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

+ 2 - 2
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/DiagnosisInformationService.java

@ -2,11 +2,11 @@ package com.yihu.rehabilitation.service;
import com.yihu.jw.entity.specialist.rehabilitation.PatientDiagnosisInformationDO;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.rm.specialist.SpecialistMapping;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.rehabilitation.dao.PatientDiagnosisInformationDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
@ -55,7 +55,7 @@ public class DiagnosisInformationService extends BaseJpaService<PatientDiagnosis
     * @return
     */
    public PageEnvelop findDiagnosisInformationByPatient(String patient, Integer page, Integer size) {
        PageRequest pageRequest = new PageRequest(page, size);
        PageRequest pageRequest = PageRequest.of(page, size);
        Page<PatientDiagnosisInformationDO> list = diagnosisInformationDao.findByPatient(patient,pageRequest);
        return PageEnvelop.getSuccessListWithPage(SpecialistMapping.api_success, list.getContent(), page, size,list.getTotalElements());
    }

+ 2 - 2
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/PatientRecordService.java

@ -101,7 +101,7 @@ public class PatientRecordService {
    @Transactional(propagation= Propagation.NOT_SUPPORTED)
    public List<Map<String, String>> getAllEvent_new(String patientCode, String type, String page, String pageSize, String lastTime,String hospital) throws Exception {
        //获取患者
        BasePatientDO patient = patientDao.findById(patientCode);
        BasePatientDO patient = patientDao.findById(patientCode).orElse(null);
        BaseOrgDO hos = hospitalDao.findByCode(hospital);
        //如果是中山医院,优先查找中山医院的接口
@ -137,7 +137,7 @@ public class PatientRecordService {
        List<Map<String, String>> re = new ArrayList<>();
        //获取患者
        BasePatientDO patient = patientDao.findById(patientCode);
        BasePatientDO patient = patientDao.findById(patientCode).orElse(null);
        //获取基卫数据
        String response = getResidentEventListJson(patient.getSsc(), type, page, pageSize);

+ 9 - 14
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationGuidanceService.java

@ -1,22 +1,15 @@
package com.yihu.rehabilitation.service;
import com.yihu.rehabilitation.service.message.RehabilitationMessageService;
import org.springside.modules.persistence.DynamicSpecifications;
import org.springside.modules.persistence.SearchFilter;
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.door.SignFamily;
import com.yihu.jw.entity.patient.Patient;
import com.yihu.jw.entity.rehabilitation.RehabilitationguidanceDO;
import com.yihu.jw.entity.rehabilitation.RehabilitationguidancePatientDO;
import com.yihu.jw.entity.util.TransforSqlUtl;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.rehabilitation.dao.RehabilitationGuidanceDao;
import com.yihu.rehabilitation.dao.RehabilitationGuidancePatientDao;
import com.yihu.rehabilitation.dao.SignFamilyDao;
import com.yihu.rehabilitation.service.message.RehabilitationMessageService;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@ -31,6 +24,8 @@ 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.springside.modules.persistence.DynamicSpecifications;
import org.springside.modules.persistence.SearchFilter;
import java.util.*;
@ -131,7 +126,7 @@ public class RehabilitationGuidanceService {
            temp.setContent(StringEscapeUtils.unescapeJava(contents));
//            System.out.println(StringEscapeUtils.unescapeJava(contents));
        }
        PageRequest pageRequest = new PageRequest(page, pagesize);
        PageRequest pageRequest = PageRequest.of(page, pagesize);
        if (list.size() <= 0) {
            return new PageImpl(new ArrayList<>(), pageRequest, 0);
        }
@ -152,8 +147,8 @@ public class RehabilitationGuidanceService {
            RehabilitationguidanceDO rehabilitationguidanceDO = rehabilitationGuidanceDao.findByCode(rehabilitationguidancePatientDO.getArticle());
            rehabilitationguidanceDO.setUseCount(rehabilitationguidanceDO.getUseCount()+1);
            rehabilitationGuidanceDao.save(rehabilitationguidanceDO);
            BasePatientDO patient = patientDao.findById(rehabilitationguidancePatientDO.getPatient());
            BaseDoctorDO doctor = doctorDao.findById(rehabilitationguidancePatientDO.getDoctor());
            BasePatientDO patient = patientDao.findById(rehabilitationguidancePatientDO.getPatient()).orElse(null);
            BaseDoctorDO doctor = doctorDao.findById(rehabilitationguidancePatientDO.getDoctor()).orElse(null);
            rehabilitationguidancePatientDO.setAttachedTitle(rehabilitationguidanceDO.getTitle());
            if (patient!=null){
                rehabilitationguidancePatientDO.setName(patient.getName());
@ -197,9 +192,9 @@ public class RehabilitationGuidanceService {
            pagesize = 10;
        }
        // 排序
        Sort sort = new Sort(Sort.Direction.DESC, "czrq");
        Sort sort = Sort.by(Sort.Direction.DESC, "czrq");
        // 分页信息
        PageRequest pageRequest = new PageRequest(page, pagesize, sort);
        PageRequest pageRequest = PageRequest.of(page, pagesize, sort);
        // 设置查询条件
        Map<String, SearchFilter> filters = new HashMap<String, SearchFilter>();
        // 指定患者
@ -216,7 +211,7 @@ public class RehabilitationGuidanceService {
        Specification<RehabilitationguidancePatientDO> spec = DynamicSpecifications.bySearchFilter(filters.values(), RehabilitationguidancePatientDO.class);
        Page<RehabilitationguidancePatientDO> rehabilitationguidancePatientDOS = rehabilitationGuidancePatientDao.findAll(spec,pageRequest);
        for (RehabilitationguidancePatientDO rehabilitationguidancePatientDO:rehabilitationguidancePatientDOS){
            BasePatientDO patient1 = patientDao.findById(rehabilitationguidancePatientDO.getPatient());
            BasePatientDO patient1 = patientDao.findById(rehabilitationguidancePatientDO.getPatient()).orElse(null);
            rehabilitationguidancePatientDO.setPhoto(patient1.getPhoto());
        }
        return rehabilitationguidancePatientDOS;

+ 9 - 14
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationInfoService.java

@ -3,7 +3,6 @@ package com.yihu.rehabilitation.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
@ -12,8 +11,6 @@ import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxAccessTokenDO;
import com.yihu.jw.entity.base.wx.WxPushLogDO;
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
import com.yihu.jw.entity.door.SignFamily;
import com.yihu.jw.entity.patient.Patient;
import com.yihu.jw.entity.specialist.rehabilitation.PatientMedicalRecordsDO;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationAdviceDO;
import com.yihu.jw.entity.util.TransforSqlUtl;
@ -41,9 +38,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import sun.awt.im.InputMethodJFrame;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
@ -107,7 +102,7 @@ public class RehabilitationInfoService {
        } else {
            adviceDO = new RehabilitationAdviceDO();
            adviceDO.setCode(UUID.randomUUID().toString().replaceAll("-", ""));
            BaseDoctorDO doctor = doctorDao.findById(doctorCode);
            BaseDoctorDO doctor = doctorDao.findById(doctorCode).orElse(null);
            adviceDO.setCreateUser(doctorCode);
            adviceDO.setCreateUserName(doctor.getName());
        }
@ -118,7 +113,7 @@ public class RehabilitationInfoService {
    }
    public void deleteAdvice(Long id) {
        adviceDao.delete(id);
        adviceDao.deleteById(id);
    }
    /**
@ -138,7 +133,7 @@ public class RehabilitationInfoService {
     */
    public void sendSFWxTemplate(String patient,String wechatId,String scene){
        String patienName = "";
        BasePatientDO basePatientDO = patientDao.findById(patient);
        BasePatientDO basePatientDO = patientDao.findById(patient).orElse(null);
        if (basePatientDO!=null){
            patienName = basePatientDO.getName();
        }
@ -198,7 +193,7 @@ public class RehabilitationInfoService {
     * @return
     */
    public PatientMedicalRecordsDO createMedicalRecords(String doctorCode, String patient, String patientName, PatientMedicalRecordsDO patientMedicalRecordsDO, String id) {
        BaseDoctorDO doctor = doctorDao.findById(doctorCode);
        BaseDoctorDO doctor = doctorDao.findById(doctorCode).orElse(null);
        List<BaseDoctorHospitalDO>  baseDoctorHospitalDO= baseDoctorHospitalDao.findByDoctorCode(doctor.getId());
        String hospital="";
        String hospitalName="";
@ -207,7 +202,7 @@ public class RehabilitationInfoService {
            hospitalName=baseDoctorHospitalDO.get(0).getOrgName();
        }
        if(StringUtils.isNoneBlank(id)){
            PatientMedicalRecordsDO oldRecord  = patientMedicalRecordsDao.findOne(id);
            PatientMedicalRecordsDO oldRecord  = patientMedicalRecordsDao.findById(id).orElse(null);
            patientMedicalRecordsDO.setId(id);
            patientMedicalRecordsDO.setCode(oldRecord.getCode());
        }else {
@ -228,7 +223,7 @@ public class RehabilitationInfoService {
    }
    public void sendWechatMessage(String patient,String first,String contentMsg,String remark,String msgUrl){
        BasePatientDO basePatientDO = patientDao.findById(patient);
        BasePatientDO basePatientDO = patientDao.findById(patient).orElse(null);
        if ("xm_xzzx_wx".equalsIgnoreCase(wxId)) {
            String responseMsg="";
            //String prefix="https://www.xmheart.com";
@ -317,7 +312,7 @@ public class RehabilitationInfoService {
            for(Map<String, Object> map:list2){
                String idcardNo = map.get("idcard") + "";
                JSONObject oo = this.getUnm(doctorCode,map.get("patient").toString());
                BasePatientDO patientDo = patientDao.findById(map.get("patient").toString());
                BasePatientDO patientDo = patientDao.findById(map.get("patient").toString()).orElse(null);
                Integer age = IdCardUtil.getAgeByIdcardOrBirthday(patientDo.getIdcard(),patientDo.getBirthday());
                String sex = patientDo.getSex()+"";
//                object.put("countMe",listMe.size());
@ -356,7 +351,7 @@ public class RehabilitationInfoService {
            for(Map<String, Object> map:list2){
                String idcardNo = map.get("idcard") + "";
                JSONObject oo =this.getUnm(doctorCode,map.get("patient").toString());
                BasePatientDO patientDo = patientDao.findById(map.get("patient").toString());
                BasePatientDO patientDo = patientDao.findById(map.get("patient").toString()).orElse(null);
                Integer age = IdCardUtil.getAgeByIdcardOrBirthday(patientDo.getIdcard(),patientDo.getBirthday());
                String sex = patientDo.getSex()+"";
                map.put("countMe",oo.get("countMe"));
@ -387,7 +382,7 @@ public class RehabilitationInfoService {
            for(Map<String, Object> map:list2){
                String idcardNo = map.get("idcard") + "";
                JSONObject oo = this.getUnm(doctorCode,map.get("patient").toString());
                BasePatientDO patientDo = patientDao.findById(map.get("patient").toString());
                BasePatientDO patientDo = patientDao.findById(map.get("patient").toString()).orElse(null);
                Integer age = IdCardUtil.getAgeByIdcardOrBirthday(patientDo.getIdcard(),patientDo.getBirthday());
                String sex = patientDo.getSex()+"";
                map.put("countMe",oo.get("countMe"));

+ 2 - 2
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationInformationService.java

@ -1,10 +1,10 @@
package com.yihu.rehabilitation.service;
import com.yihu.jw.entity.rehabilitation.RehabilitationInformationDO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.rehabilitation.RehabilitationInformationVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.rehabilitation.RehabilitationRequestMapping;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.rehabilitation.dao.RehabilitationInformationDao;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;

+ 20 - 22
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationManageService.java

@ -68,8 +68,6 @@ public class RehabilitationManageService {
    @Autowired
    private GuidanceMessageLogDao guidanceMessageLogDao;
    @Autowired
    private SpecialistPatientRelationDao specialistPatientRelationDao;
    @Autowired
    private RehabilitationOperateRecordsDao rehabilitationOperateRecordsDao;
    @Autowired
    private RehabilitationDetailAppointmentDao rehabilitationDetailAppointmentDao;
@ -151,7 +149,7 @@ public class RehabilitationManageService {
     */
    public MixEnvelop<Map<String,Object>, Map<String,Object>> findRehabilitationPlan(String doctorCode, String diseaseCode, Integer planType,Integer todaybacklog, String patientCondition,Integer page, Integer pageSize) throws Exception{
        Integer doctorType =null;
        BaseDoctorDO doctor = baseDoctorDao.findById(doctorCode);
        BaseDoctorDO doctor = baseDoctorDao.findById(doctorCode).orElse(null);
        List<BaseDoctorRoleDO> baseDoctorRoleDO = baseDoctorRoleDao.findByDoctorCode(doctor.getId());
        for(BaseDoctorRoleDO baseDoctorRoleDO1:baseDoctorRoleDO){
            if ("specialist".equalsIgnoreCase(baseDoctorRoleDO1.getRoleCode())){
@ -212,7 +210,7 @@ public class RehabilitationManageService {
//                resultMap.put("sex","1".equals(sex)?"男":("2".equals(sex)?"女":"未知"));
                resultMap.put("patientName",one.get("patientName"));
                resultMap.put("patientCode",one.get("patient"));
                patient = basePatientDao.findById(one.get("patient").toString());
                patient = basePatientDao.findById(one.get("patient").toString()).orElse(null);
                if (patient!=null){
                    resultMap.put("photo",patient!=null?patient.getPhoto():"");
                    Integer age = IdCardUtil.getAgeForIdcard(patient.getIdcard());
@ -398,7 +396,7 @@ public class RehabilitationManageService {
                rehabilitationPlanList.add(planMap);
            }
            resultMap.put("rehabilitationPlanList",rehabilitationPlanList);
            BasePatientDO p = basePatientDao.findById(patientCode);
            BasePatientDO p = basePatientDao.findById(patientCode).orElse(null);
            resultMap.put("patientPhoto",p.getPhoto());
            resultList.add(resultMap);
        }
@ -1067,7 +1065,7 @@ public class RehabilitationManageService {
        List<Map<String,Object>> healthyConditionList = jdbcTemplate.queryForList(healthyConditionSql);
        String healthyCondition = healthyConditionList.size()>0?healthyConditionList.get(0).get("label_name")+"":"";
        String healthyConditionType = healthyConditionList.size()>0?healthyConditionList.get(0).get("label")+"":"";
        BasePatientDO patient = basePatientDao.findById(patientCode);
        BasePatientDO patient = basePatientDao.findById(patientCode).orElse(null);
        //个人基础信息(康复机构)
        String patientInfoSql = " SELECT DISTINCT hospital_name from wlyy_rehabilitation_plan_detail d LEFT JOIN wlyy_patient_rehabilitation_plan p on d.plan_id=p.id " +
                " where p.patient='"+patientCode+"' and p.status=1 ";
@ -1133,7 +1131,7 @@ public class RehabilitationManageService {
            serviceDoctorList.add(map);
        }
        for (Map<String,Object> d:serviceDoctorList){
            BaseDoctorDO baseDoctorDO1 = baseDoctorDao.findById(d.get("doctorCode").toString());
            BaseDoctorDO baseDoctorDO1 = baseDoctorDao.findById(d.get("doctorCode").toString()).orElse(null);
            d.put("doctorPhoto",baseDoctorDO1!=null?baseDoctorDO1.getPhoto():"");
        }
        resultMap.put("serviceDoctorList",serviceDoctorList);
@ -1288,7 +1286,7 @@ public class RehabilitationManageService {
     */
    @Transactional
    public Envelop saveGuidanceMessage(String messageId,String doctor,String content,String planDetailId,Integer contentType) throws Exception{
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor).orElse(null);
        Integer doctorType =null;
        if (doctorDO!=null){
            List<BaseDoctorRoleDO> baseDoctorRoleDO = baseDoctorRoleDao.findByDoctorCode(doctor);
@ -1620,8 +1618,8 @@ public class RehabilitationManageService {
        if (evaluation == 1){
            String serviceItemId = resultMap.get("service_item_id").toString();
            String title = resultMap.get("title").toString();
            BasePatientDO p = basePatientDao.findById(patient);
            BaseDoctorDO doctor1 = baseDoctorDao.findById(doctor);
            BasePatientDO p = basePatientDao.findById(patient).orElse(null);
            BaseDoctorDO doctor1 = baseDoctorDao.findById(doctor).orElse(null);
            String patientName = p.getName();
            String openId = p.getOpenid();
            /*WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_service","fwxmpj");
@ -1773,7 +1771,7 @@ public class RehabilitationManageService {
            PatientMedicalRecordsDO patientMedicalRecordsDO = patientMedicalRecordsDao.findByCode(p.getMedicalRecordsCode());
            resultMap.put("patientMedicalRecordsDO",patientMedicalRecordsDO);
        }
        BasePatientDO basePatientDO = basePatientDao.findById(patientCode);
        BasePatientDO basePatientDO = basePatientDao.findById(patientCode).orElse(null);
        Integer age = IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard());
        String sex = IdCardUtil.getSexForIdcard_new(basePatientDO.getIdcard());
        resultMap.put("sex","1".equals(sex)?"男":("2".equals(sex)?"女":"未知"));
@ -1945,7 +1943,7 @@ public class RehabilitationManageService {
            reslutMap.put("disease_name", list.get(0).get("disease_name"));
            reslutMap.put("create_time", list.get(0).get("create_time"));
            reslutMap.put("patient_img", list.get(0).get("patient_img"));
            BasePatientDO patient = basePatientDao.findById(patientCode);
            BasePatientDO patient = basePatientDao.findById(patientCode).orElse(null);
            if (patient!=null){
                reslutMap.put("openid", patient.getOpenid());
                reslutMap.put("ssc",patient.getSsc());
@ -2055,7 +2053,7 @@ public class RehabilitationManageService {
            sql ="update wlyy_doctor_patient_relation set is_manage=1,manage_user ='"+doctor+"', manage_time ='"+DateUtil.getStringDate()+"' where id='"+tmp.get("id").toString()+"' ";
            jdbcTemplate.execute(sql);
        }
        BaseDoctorDO doctorObject = baseDoctorDao.findById(doctor);//家庭医生
        BaseDoctorDO doctorObject = baseDoctorDao.findById(doctor).orElse(null);//家庭医生
        //接收患者时,给服务医生群组发送消息
        List<String> patientRelationDoctor = new ArrayList<>();
        for (Map<String,Object> tmp:planByCreate){
@ -2107,7 +2105,7 @@ public class RehabilitationManageService {
            String doctor =map.get("create_user").toString();
            patient = map.get("patient").toString();
            JSONObject object = new JSONObject();
            BaseDoctorDO doctor1 = baseDoctorDao.findById(doctor);
            BaseDoctorDO doctor1 = baseDoctorDao.findById(doctor).orElse(null);
            object.put("code",doctor1.getId());
            object.put("name",doctor1.getName());
            object.put("level",doctor1.getLevel());
@ -2469,7 +2467,7 @@ public class RehabilitationManageService {
        Integer turnDownStateTotal_2=0;//已接受
        Integer turnDownStateTotal_3=0;//未下转
        org.json.JSONObject resultObj = new org.json.JSONObject();
        BaseDoctorDO doctorObj = baseDoctorDao.findById(doctor);
        BaseDoctorDO doctorObj = baseDoctorDao.findById(doctor).orElse(null);
        List<Map<String, Object>> result = new ArrayList<>();
        String sql = "SELECT DISTINCT pr.id,p.`name`,plan.id as planId, p.`id` as code, p.idcard,p.photo, plan.disease,plan.disease_name,YEAR (now()) - YEAR (substring(p.idcard, 7, 8)) as age," +
                "p.sex,pr.doctor AS specialist,pr.doctor_name AS specialistName,pr.disease_code,pr.doctor_name ," +
@ -2508,7 +2506,7 @@ public class RehabilitationManageService {
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
        System.out.println("mapList"+sql);
        for (Map<String,Object> map:mapList){
            BasePatientDO patientDo = basePatientDao.findById(map.get("code").toString());
            BasePatientDO patientDo = basePatientDao.findById(map.get("code").toString()).orElse(null);
            List<BaseDoctorHospitalDO> depts= baseDoctorHospitalDao.findByDoctorCode(doctor);
            if (depts!=null&&depts.size()>0){
                map.put("dept_code",depts.get(0).getDeptCode());
@ -2582,7 +2580,7 @@ public class RehabilitationManageService {
                map.put("dept_code",depts.get(0).getDeptCode());
                map.put("dept_name",depts.get(0).getDeptName());
            }
            BasePatientDO patientDo = basePatientDao.findById(map.get("code").toString());
            BasePatientDO patientDo = basePatientDao.findById(map.get("code").toString()).orElse(null);
            Integer age = IdCardUtil.getAgeByIdcardOrBirthday(patientDo.getIdcard(),patientDo.getBirthday());
            map.put("age",age);
            map.put("disease_name", "暂无");
@ -2702,7 +2700,7 @@ public class RehabilitationManageService {
        List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql,page,pageSize);
        System.out.println("mapList"+sql);
        for (Map<String,Object> map:mapList){
            BasePatientDO patientDo = basePatientDao.findById(map.get("code").toString());
            BasePatientDO patientDo = basePatientDao.findById(map.get("code").toString()).orElse(null);
            List<BaseDoctorHospitalDO> depts= baseDoctorHospitalDao.findByDoctorCode(doctor);
            if (depts!=null&&depts.size()>0){
                map.put("dept_code",depts.get(0).getDeptCode());
@ -3113,8 +3111,8 @@ public class RehabilitationManageService {
        //智业中山同步病历
        String result = "";
        List<PatientMedicalRecordsDO> query = new ArrayList<>();
        BasePatientDO patient1 = basePatientDao.findById(patient);
        BaseDoctorDO doctor = baseDoctorDao.findById(doctorCode);
        BasePatientDO patient1 = basePatientDao.findById(patient).orElse(null);
        BaseDoctorDO doctor = baseDoctorDao.findById(doctorCode).orElse(null);
        String orgCode="";
        List<BaseDoctorHospitalDO> baseDoctorHospitalDO = baseDoctorHospitalDao.findByDoctorCode(doctorCode);
        if(baseDoctorHospitalDO!=null&&baseDoctorHospitalDO.size()>0){
@ -3233,7 +3231,7 @@ public class RehabilitationManageService {
            sql +=" and p.status ="+status;
        }
        if (StringUtils.isNoneBlank(doctor)){
            BaseDoctorDO doctor1 = baseDoctorDao.findById(doctor);
            BaseDoctorDO doctor1 = baseDoctorDao.findById(doctor).orElse(null);
            if (doctor1!=null&&doctor1.getLevel()==1){
                sql +=" and p.create_user ='"+doctor+"'";
            }
@ -3303,7 +3301,7 @@ public class RehabilitationManageService {
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
        for (Map<String,Object> map:mapList){
            String doctorCode = map.get("doctor")+"";
            BaseDoctorDO doctor = baseDoctorDao.findById(doctorCode);
            BaseDoctorDO doctor = baseDoctorDao.findById(doctorCode).orElse(null);
            List<BaseDoctorHospitalDO> depts=baseDoctorHospitalDao.findByDoctorCode(doctorCode);
            if (depts!=null&&depts.size()>0){
                map.put("hospital",depts.get(0).getOrgCode());

+ 2 - 2
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationPerformanceService.java

@ -1,10 +1,10 @@
package com.yihu.rehabilitation.service;
import com.yihu.jw.entity.rehabilitation.RehabilitationPerformanceDO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.rehabilitation.RehabilitationPerformanceVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.rehabilitation.RehabilitationRequestMapping;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.rehabilitation.dao.RehabilitationPerformanceDao;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;

+ 14 - 22
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationPlanService.java

@ -14,19 +14,16 @@ import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.door.SignFamily;
import com.yihu.jw.entity.hospital.doctor.Frequency;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.patient.Message;
import com.yihu.jw.entity.rehabilitation.SpecialDiseaseMessagesDO;
import com.yihu.jw.entity.specialist.DoctorPatientRelationDO;
import com.yihu.jw.entity.specialist.HospitalServiceItemDO;
import com.yihu.jw.entity.specialist.RehabilitationServiceItemDO;
import com.yihu.jw.entity.specialist.rehabilitation.*;
import com.yihu.jw.entity.util.TransforSqlUtl;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.rehabilitation.DoctorPatientRelationDao;
import com.yihu.jw.rehabilitation.RehabilitationOperateRecordsDao;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.restmodel.specialist.PatientSignInfoVO;
import com.yihu.jw.restmodel.web.Envelop;
@ -34,20 +31,17 @@ import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.rm.specialist.SpecialistMapping;
import com.yihu.jw.sign.dao.MessagesDao;
import com.yihu.jw.team.BaseDoctorTeamMemberDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.QrcodeUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.encrypt.MD5;
import com.yihu.jw.util.network.HttpResponse;
import com.yihu.jw.util.network.HttpUtils;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.rehabilitation.dao.*;
import com.yihu.rehabilitation.vo.TemplateDetailVo;
import com.yihu.jw.util.network.HttpResponse;
import com.yihu.jw.util.network.HttpUtils;
import com.yihu.jw.util.encrypt.MD5;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
@ -67,8 +61,6 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import static com.yihu.jw.entity.base.module.ModuleDO.Type.patient;
/**
 * Created by humingfen on 2018/8/22.
 */
@ -184,7 +176,7 @@ public class RehabilitationPlanService extends BaseJpaService<PatientRehabilitat
            detail.setCreateUser(createUser);
            detail.setCreateUserName(createUserName);
        }
        return (List<RehabilitationDetailDO>)rehabilitationDetailDao.save(details);
        return (List<RehabilitationDetailDO>)rehabilitationDetailDao.saveAll(details);
    }
    //code,timeType,executeTimes
    public String createRehabilitationPlan(String json, BaseDoctorDO doctor) throws Exception {
@ -192,7 +184,7 @@ public class RehabilitationPlanService extends BaseJpaService<PatientRehabilitat
        String patient = object.getString("patient");
        String relationId=object.getString("relationId");
        String teamCode=object.getString("teamCode");
        BasePatientDO patientDo  = patientDao.findById(patient);
        BasePatientDO patientDo  = patientDao.findById(patient).orElse(null);
        if (patientDo==null){
            BasePatientDO basePatientDO = new BasePatientDO();
            basePatientDO.setName(object.getString("patientName"));
@ -268,7 +260,7 @@ public class RehabilitationPlanService extends BaseJpaService<PatientRehabilitat
            }
        }
        DoctorPatientRelationDO doctorPatientRelationDO = doctorPatientRelationDao.findOne(relationId);
        DoctorPatientRelationDO doctorPatientRelationDO = doctorPatientRelationDao.findById(relationId).orElse(null);
        if (null!=doctorPatientRelationDO){
            if (doctorPatientRelationDO.getIsManage()==null||doctorPatientRelationDO.getIsManage()==0){
                doctorPatientRelationDO.setDoctor(doctor.getId());
@ -299,7 +291,7 @@ public class RehabilitationPlanService extends BaseJpaService<PatientRehabilitat
        }
        if (StringUtils.isEmpty(fileUrl) || "null".equals(fileUrl)){
            //生成二维码图片
            WxWechatDO wxWechatDO = wechatDao.findById(wxId);
            WxWechatDO wxWechatDO = wechatDao.findById(wxId).orElse(null);
            String appId="";
            String wechat_base_url="";
            if (wxWechatDO!=null){
@ -662,7 +654,7 @@ public class RehabilitationPlanService extends BaseJpaService<PatientRehabilitat
                SystemMessageDO message = initMessage(patientName,entry.getKey(),entry.getValue(),"system","system","康复计划-中止提醒","您的居民"+patientName+",已中止"+diseaseName+"康复计划,点击查看原因。",planId,29);
                messageList.add(message);
            }
            messageDao.save(messageList);
            messageDao.saveAll(messageList);
            /*Message message = new Message();
            message.setCzrq(new Date());
            message.setCreateTime(new Date());
@ -728,7 +720,7 @@ public class RehabilitationPlanService extends BaseJpaService<PatientRehabilitat
            jsonObject.put("disease_name", jsonArray.getJSONObject(0).get("disease_name"));
            jsonObject.put("create_time", jsonArray.getJSONObject(0).get("create_time"));
            jsonObject.put("patient_img", jsonArray.getJSONObject(0).get("patient_img"));
            BasePatientDO patient = patientDao.findById(patientCode);
            BasePatientDO patient = patientDao.findById(patientCode).orElse(null);
            if (patient!=null){
                jsonObject.put("openid", patient.getOpenid());
                jsonObject.put("ssc",patient.getSsc());
@ -755,7 +747,7 @@ public class RehabilitationPlanService extends BaseJpaService<PatientRehabilitat
    }*/
    public void sendWxTemplate(String accessToken, String planId, String doctorCode, JSONObject jsonObject) {
        BaseDoctorDO d = doctorDao.findById(doctorCode);
        BaseDoctorDO d = doctorDao.findById(doctorCode).orElse(null);
        JSONObject json = new JSONObject();
        String patient = jsonObject.getString("patientCode");
        String patientName = jsonObject.get("patientName") + "";
@ -1100,7 +1092,7 @@ public class RehabilitationPlanService extends BaseJpaService<PatientRehabilitat
            detail.setStatus(0);
            detail.setUpdateTime(new Date());
        }
        return (List<RehabilitationDetailDO>)rehabilitationDetailDao.save(details);
        return (List<RehabilitationDetailDO>)rehabilitationDetailDao.saveAll(details);
    }
@ -1120,7 +1112,7 @@ public class RehabilitationPlanService extends BaseJpaService<PatientRehabilitat
            Long timeType = jsonObject.getLong("timeType");
            Frequency frequency = frequencyDao.findByCode(jsonObject.getString("frequencyCode"));
            String executeTimes = jsonObject.getString("executeTimes");
            BaseDoctorDO doctor1 = doctorDao.findById(jsonObject.getString("doctor"));
            BaseDoctorDO doctor1 = doctorDao.findById(jsonObject.getString("doctor")).orElse(null);
            if(StringUtils.isNotBlank(executeTimes)) {
                List<String> list = new ArrayList<>();
                String[] executeTime = executeTimes.split(",");
@ -1234,7 +1226,7 @@ public class RehabilitationPlanService extends BaseJpaService<PatientRehabilitat
    public JSONObject getPatient(String patient,String doctor) throws Exception {
        JSONObject json = new JSONObject();
//        Patient p = patientDao.findByCode(patient);
        BasePatientDO p = patientDao.findById(patient);
        BasePatientDO p = patientDao.findById(patient).orElse(null);
        if (p == null) {
            throw new Exception("patient info can not find");

+ 2 - 4
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationPlanningService.java

@ -1,14 +1,12 @@
package com.yihu.rehabilitation.service;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.rehabilitation.RehabilitationPlanningDO;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.rehabilitation.RehabilitationPlanningVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.rehabilitation.RehabilitationRequestMapping;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.rehabilitation.dao.RehabilitationPlanningDao;
import com.yihu.jw.util.encrypt.MD5;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

+ 2 - 2
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationTreatmentProgramService.java

@ -1,10 +1,10 @@
package com.yihu.rehabilitation.service;
import com.yihu.jw.entity.rehabilitation.RehabilitationTreatmentProgramDO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.rehabilitation.RehabilitationTreatmentProgramVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.rehabilitation.RehabilitationRequestMapping;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.rehabilitation.dao.RehabilitationTreatmentProgramDao;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;

+ 10 - 18
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/SpecialistEvaluateSevice.java

@ -6,30 +6,19 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.score.BaseEvaluateDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.patient.Message;
import com.yihu.jw.entity.patient.Patient;
import com.yihu.jw.entity.rehabilitation.RehabilitationInformationDO;
import com.yihu.jw.entity.specialist.SpecialistEvaluateLabelDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.im.dao.ConsultTeamDoctorDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.sign.dao.MessagesDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.rehabilitation.dao.RehabilitationInformationDao;
import com.yihu.rehabilitation.dao.consult.EvaluateDao;
import com.yihu.rehabilitation.dao.consult.EvaluateScoreDao;
import com.yihu.rehabilitation.service.consult.ConsultTeamService;
import com.yihu.rehabilitation.util.ClazzReflect;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -38,7 +27,10 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
 * @author wangzhinan
@ -166,7 +158,7 @@ public class SpecialistEvaluateSevice {
                for (int i=0;i<array.size();i++){
                    JSONObject object1 = array.getJSONObject(i);
                    String patient = object1.getJSONArray("patient").getString(0);
                    BasePatientDO patient1 = patientDao.findById(patient);
                    BasePatientDO patient1 = patientDao.findById(patient).orElse(null);
                    Integer age = IdCardUtil.getAgeForIdcard(patient1.getIdcard());
                    object1.put("patient1",patient1);
                    object1.put("age",age);
@ -175,7 +167,7 @@ public class SpecialistEvaluateSevice {
                for (int i=0;i<array1.size();i++){
                    JSONObject object1 = array1.getJSONObject(i);
                    String patient = object1.getJSONArray("patient").getString(0);
                    BasePatientDO patient1 = patientDao.findById(patient);
                    BasePatientDO patient1 = patientDao.findById(patient).orElse(null);
                    Integer age = IdCardUtil.getAgeForIdcard(patient1.getIdcard());
                    object1.put("patient1",patient1);
                    object1.put("age",age);
@ -184,7 +176,7 @@ public class SpecialistEvaluateSevice {
                for (int i=0;i<array2.size();i++){
                    JSONObject object1 = array2.getJSONObject(i);
                    String patient = object1.getJSONArray("patient").getString(0);
                    BasePatientDO patient1 = patientDao.findById(patient);
                    BasePatientDO patient1 = patientDao.findById(patient).orElse(null);
                    Integer age = IdCardUtil.getAgeForIdcard(patient1.getIdcard());
                    object1.put("patient1",patient1);
                    object1.put("age",age);
@ -193,7 +185,7 @@ public class SpecialistEvaluateSevice {
                for (int i=0;i<array3.size();i++){
                    JSONObject object1 = array3.getJSONObject(i);
                    String patient = object1.getJSONArray("patient").getString(0);
                    BasePatientDO patient1 = patientDao.findById(patient);
                    BasePatientDO patient1 = patientDao.findById(patient).orElse(null);
                    Integer age = IdCardUtil.getAgeForIdcard(patient1.getIdcard());
                    object1.put("patient1",patient1);
                    object1.put("age",age);
@ -221,10 +213,10 @@ public class SpecialistEvaluateSevice {
            }
            BasePatientDO patient = null;
            if (StringUtils.isNoneBlank(patientCode)){
                patient  = patientDao.findById(patientCode);
                patient  = patientDao.findById(patientCode).orElse(null);
            }
//            Doctor sendDoctor = doctorDao.findByCode(message.getSender());
            BaseDoctorDO receiverDoctor = doctorDao.findById(message.getReceiver());
            BaseDoctorDO receiverDoctor = doctorDao.findById(message.getReceiver()).orElse(null);
            if (  "19".equalsIgnoreCase(message.getType()) ){
                message.setOver("0");//未处理
                message.setType("19");

+ 14 - 25
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/consult/ConsultTeamService.java

@ -1,18 +1,13 @@
package com.yihu.rehabilitation.service.consult;
import com.alibaba.fastjson.JSON;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.im.ConsultTeamDoctorDo;
import com.yihu.jw.entity.base.im.ConsultTeamLogDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.door.SignFamily;
import com.yihu.jw.entity.followup.Followup;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.patient.Patient;
import com.yihu.jw.entity.rehabilitation.SpecialDiseaseMessagesDO;
import com.yihu.jw.entity.util.TransforSqlUtl;
import com.yihu.jw.hospital.HospitalDao;
@ -27,16 +22,12 @@ import com.yihu.jw.im.dao.ConsultTeamDao;
import com.yihu.jw.im.dao.ConsultTeamDoctorDao;
import com.yihu.jw.im.dao.ConsultTeamLogDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.message.dao.MessageDao;
import com.yihu.jw.message.service.MessageService;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.rehabilitation.dao.SignFamilyDao;
import com.yihu.rehabilitation.dao.SpecialDiseaseMessagesDao;
import com.yihu.rehabilitation.dao.followUp.FollowUpDao;
import io.swagger.models.auth.In;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
@ -44,23 +35,21 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springside.modules.persistence.DynamicSpecifications;
import org.springside.modules.persistence.SearchFilter;
import org.springside.modules.persistence.SearchFilter.Operator;
import org.springside.modules.utils.Clock;
import javax.annotation.PostConstruct;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -272,7 +261,7 @@ public class ConsultTeamService extends ConsultService {
        // 设置患者信息
        ct.setPatient(patient);
        // 查询患者信息
        BasePatientDO tempPatient = patientDao.findById(patient);
        BasePatientDO tempPatient = patientDao.findById(patient).orElse(null);
        // 设置患者姓名
        ct.setName(tempPatient.getName());
        // 设置患者生日
@ -488,7 +477,7 @@ public class ConsultTeamService extends ConsultService {
        // 设置患者信息
        ct.setPatient(patient);
        // 查询患者信息
        BasePatientDO tempPatient = patientDao.findById(patient);
        BasePatientDO tempPatient = patientDao.findById(patient).orElse(null);
        // 设置患者姓名
        ct.setName(tempPatient.getName());
        // 设置患者生日
@ -566,7 +555,7 @@ public class ConsultTeamService extends ConsultService {
        }
        String content = "进入了咨询";
        BasePatientDO p = patientDao.findById(patient);
        BasePatientDO p = patientDao.findById(patient).orElse(null);
        String intoUserName = p.getName();
        if (patient.equals(agent)) {
            content = intoUserName + content;
@ -595,9 +584,9 @@ public class ConsultTeamService extends ConsultService {
            pageSize = 10;
        }
        // 排序
        Sort sort = new Sort(Direction.DESC, "id");
        Sort sort = Sort.by(Direction.DESC, "id");
        // 分页信息
        PageRequest pageRequest = new PageRequest(0, pageSize, sort);
        PageRequest pageRequest = PageRequest.of(0, pageSize, sort);
        Page<ConsultTeamDo> list = null;
        switch (status) {
@ -641,7 +630,7 @@ public class ConsultTeamService extends ConsultService {
    public int finishConsult(String consult, String endOperator, int endType) throws Exception {
        ConsultTeamDo consultTeam = consultTeamDao.findByConsult(consult);
        ConsultDo cons = consultDao.findOne(consult);
        ConsultDo cons = consultDao.findById(consult).orElse(null);
        if (consultTeam.getStatus() == 1) {
            return -1;
@ -649,7 +638,7 @@ public class ConsultTeamService extends ConsultService {
        //新增续方咨询结束判断 (续方未审核时不可由医生或居民关闭)
        if (consultTeam.getType() == 8) {
            WlyyPrescriptionDO prescription = prescriptionDao.findOne(consultTeam.getRelationCode());
            WlyyPrescriptionDO prescription = prescriptionDao.findById(consultTeam.getRelationCode()).orElse(null);
            if (prescription.getStatus() == 0) {
                return -2;
            }
@ -659,7 +648,7 @@ public class ConsultTeamService extends ConsultService {
        String endId = "";
        //结束咨询才发送推送给IM文字消息
        if (endType == 1) {
            BasePatientDO p = patientDao.findById(endOperator);
            BasePatientDO p = patientDao.findById(endOperator).orElse(null);
            endName = p.getName();
            endId = p.getId();
        } else {
@ -667,7 +656,7 @@ public class ConsultTeamService extends ConsultService {
                endId = "system";
                endName = "咨询超时未回复,系统自动";
            } else {
                BaseDoctorDO d = doctorDao.findById(endOperator);
                BaseDoctorDO d = doctorDao.findById(endOperator).orElse(null);
                endId = d.getId();
                endName = d.getName();
            }
@ -683,7 +672,7 @@ public class ConsultTeamService extends ConsultService {
        //结束咨询才发送推送给IM文字消息
        if (endType == 1) {
            BasePatientDO p = patientDao.findById(endOperator);
            BasePatientDO p = patientDao.findById(endOperator).orElse(null);
            endName = p.getName();
            if (consultTeam.getType() == 2 || consultTeam.getType() == 8) {
                /*String openId = p.getOpenid();

+ 1 - 1
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/followUp/FollowupDrugsService.java

@ -68,7 +68,7 @@ public class FollowupDrugsService  {
				newList.add(drug);
			}
			followupDrugsDao.save(newList);
			followupDrugsDao.saveAll(newList);
		}
	}

+ 7 - 8
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/message/RehabilitationMessageService.java

@ -4,15 +4,12 @@ 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.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.patient.Patient;
import com.yihu.jw.entity.rehabilitation.RehabilitationguidanceDO;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationDetailDO;
import com.yihu.jw.entity.util.TransforSqlUtl;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.im.util.HttpClientUtil;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.rehabilitation.dao.RehabilitationGuidanceDao;
@ -20,14 +17,16 @@ import com.yihu.rehabilitation.service.RehabilitationInfoService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import javax.transaction.Transactional;
import java.util.*;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * 消息业务处理类
@ -81,7 +80,7 @@ public class RehabilitationMessageService {
    public int setSpecialistOver(String id,Integer type){
        if (type == 22 || type==23){
            int result = 0;
            SystemMessageDO message = messageDao.findOne(id);
            SystemMessageDO message = messageDao.findById(id).orElse(null);
            List<RehabilitationDetailDO>  list =selectByIds(message.getRelationCode());
            Integer count = 0;
            if (list!=null){
@ -140,8 +139,8 @@ public class RehabilitationMessageService {
     */
    public void sendSpecialistWeixinMessage(String patientCode,String doctorCode,Integer type,String relationCode,String planId,String reservationType) throws Exception {
        //康复指导
        BasePatientDO patient = patientDao.findById(patientCode);
        BaseDoctorDO doctor = doctorDao.findById(doctorCode);
        BasePatientDO patient = patientDao.findById(patientCode).orElse(null);
        BaseDoctorDO doctor = doctorDao.findById(doctorCode).orElse(null);
        String name = "";
        String doctorName="";
        String familyDoctorName = "";