Просмотр исходного кода

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

yeshijie 4 лет назад
Родитель
Сommit
1653c87132
44 измененных файлов с 1604 добавлено и 422 удалено
  1. 10 0
      business/base-service/pom.xml
  2. 12 0
      business/base-service/src/main/java/com/yihu/jw/dict/dao/BaseJpushTemplateDao.java
  3. 3 0
      business/base-service/src/main/java/com/yihu/jw/dict/dao/DictHospitalDeptDao.java
  4. 37 0
      business/base-service/src/main/java/com/yihu/jw/dict/service/DeptHomepageBannerService.java
  5. 63 0
      business/base-service/src/main/java/com/yihu/jw/dict/service/DiseaseHomepageBannerService.java
  6. 0 65
      business/base-service/src/main/java/com/yihu/jw/dict/service/HospitalParameterService.java
  7. 8 0
      business/base-service/src/main/java/com/yihu/jw/hospital/dict/BaseDeptHomepageBannerDao.java
  8. 8 0
      business/base-service/src/main/java/com/yihu/jw/hospital/dict/BaseDiseaseHomepageBannerDao.java
  9. 0 8
      business/base-service/src/main/java/com/yihu/jw/hospital/dict/BaseHospitalParameterDao.java
  10. 8 0
      business/base-service/src/main/java/com/yihu/jw/hospital/dict/BaseTopBannerDao.java
  11. 2 0
      business/base-service/src/main/java/com/yihu/jw/hospital/dict/WlyyHospitalSysDictDao.java
  12. 5 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/OutpatientDao.java
  13. 4 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/NationalDrugDictService.java
  14. 404 15
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  15. 9 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  16. 129 13
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  17. 159 56
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  18. 17 4
      business/base-service/src/main/java/com/yihu/jw/utils/YkyySMSService.java
  19. 16 0
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java
  20. 5 2
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  21. 3 3
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  22. 12 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictHospitalDeptDO.java
  23. 0 87
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/dict/BaseHospitalParameterDO.java
  24. 58 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/dict/BaseJpushTemplateDO.java
  25. 68 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/manage/BaseDeptHomepageBannerDO.java
  26. 68 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/manage/BaseDiseaseHomepageBannerDO.java
  27. 59 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/manage/BaseDoctorSortDO.java
  28. 86 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/manage/BaseTopBannerDO.java
  29. 23 5
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/BaseNationalDrugDictDO.java
  30. 18 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyInspectionDO.java
  31. 11 4
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  32. 18 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyInspectionVO.java
  33. 5 1
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java
  34. 5 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/UnSettledHISPrescriptionService.java
  35. 8 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  36. 37 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/dict/DeptHomepageBannerEndpoint.java
  37. 52 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/dict/DiseaseHomepageBannerEndPoint.java
  38. 0 60
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/dict/HospitalParameterEndpoint.java
  39. 50 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  40. 14 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java
  41. 14 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ykyy/YkyyController.java
  42. 1 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/analysis/AnalysisService.java
  43. 74 65
      svr/svr-internet-hospital/src/main/resources/wechat/weixin_menu.txt
  44. 21 26
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java

+ 10 - 0
business/base-service/pom.xml

@ -197,6 +197,16 @@
            <version>2.0.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>cn.jpush.api</groupId>
            <artifactId>jiguang-common</artifactId>
            <version>1.1.9</version>
        </dependency>
        <dependency>
            <groupId>cn.jpush.api</groupId>
            <artifactId>jpush-client</artifactId>
            <version>3.4.8</version>
        </dependency>
    </dependencies>
    <build>

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

@ -0,0 +1,12 @@
package com.yihu.jw.dict.dao;
import com.yihu.jw.entity.hospital.dict.BaseDeptDict;
import com.yihu.jw.entity.hospital.dict.BaseJpushTemplateDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface BaseJpushTemplateDao extends PagingAndSortingRepository<BaseJpushTemplateDO, String>, JpaSpecificationExecutor<BaseJpushTemplateDO> {
    @Query("from BaseJpushTemplateDO  where code = ?1 and isDel ='1'")
    BaseJpushTemplateDO findByCode(String code);
}

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

@ -50,4 +50,7 @@ public interface DictHospitalDeptDao extends PagingAndSortingRepository<DictHosp
    @Query("delete from DictHospitalDeptDO  where orgCode=?1")
    void deleteByOrgCode(String orgCode);
    @Query("from DictHospitalDeptDO  where usualName = ?1")
    List<DictHospitalDeptDO> findByUsuallyName(String usualName);
}

+ 37 - 0
business/base-service/src/main/java/com/yihu/jw/dict/service/DeptHomepageBannerService.java

@ -0,0 +1,37 @@
package com.yihu.jw.dict.service;
import com.yihu.jw.entity.hospital.manage.BaseDeptHomepageBannerDO;
import com.yihu.jw.entity.hospital.manage.BaseDeptHomepageBannerDO;
import com.yihu.jw.hospital.dict.BaseDeptHomepageBannerDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import static com.yihu.jw.util.common.BeanUtils.getNullPropertyNames;
@Service
public class DeptHomepageBannerService extends BaseJpaService<BaseDeptHomepageBannerDO, BaseDeptHomepageBannerDao> {
    @Autowired
    private BaseDeptHomepageBannerDao deptHomepageBannerDao;
    public BaseDeptHomepageBannerDO updateDeptHomepageBanner(BaseDeptHomepageBannerDO deptHomepageBannerDO) {
        //判断新增或编辑
        if (deptHomepageBannerDO.getId() == null) {
            deptHomepageBannerDO.setCreateTime(new Date());
            deptHomepageBannerDO.setDel(1);
            return deptHomepageBannerDao.save(deptHomepageBannerDO);
        } else {
            BaseDeptHomepageBannerDO oldDeptHomepageBanner = deptHomepageBannerDao.findOne(deptHomepageBannerDO.getId());
            BeanUtils.copyProperties(deptHomepageBannerDO, oldDeptHomepageBanner, getNullPropertyNames(deptHomepageBannerDO));
            return deptHomepageBannerDao.save(oldDeptHomepageBanner);
        }
    }
    public void delDeptHomepageBanner(Integer id) {
        deptHomepageBannerDao.delete(id);
    }
}

+ 63 - 0
business/base-service/src/main/java/com/yihu/jw/dict/service/DiseaseHomepageBannerService.java

@ -0,0 +1,63 @@
package com.yihu.jw.dict.service;
import com.yihu.jw.entity.hospital.manage.BaseDiseaseHomepageBannerDO;
import com.yihu.jw.hospital.dict.BaseDiseaseHomepageBannerDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import static com.yihu.jw.util.common.BeanUtils.getNullPropertyNames;
@Service
public class DiseaseHomepageBannerService extends BaseJpaService<BaseDiseaseHomepageBannerDO, BaseDiseaseHomepageBannerDao> {
    @Autowired
    private BaseDiseaseHomepageBannerDao diseaseHomepageBannerDao;
    public BaseDiseaseHomepageBannerDO updateDiseaseHomepageBanner(BaseDiseaseHomepageBannerDO diseaseHomepageBannerDO) {
        //判断新增或编辑
        if (diseaseHomepageBannerDO.getId() == null) {
            diseaseHomepageBannerDO.setCreateTime(new Date());
            diseaseHomepageBannerDO.setDel(1);
            return diseaseHomepageBannerDao.save(diseaseHomepageBannerDO);
        } else {
            BaseDiseaseHomepageBannerDO oldDiseaseHomepageBanner = diseaseHomepageBannerDao.findOne(diseaseHomepageBannerDO.getId());
            BeanUtils.copyProperties(diseaseHomepageBannerDO, oldDiseaseHomepageBanner, getNullPropertyNames(diseaseHomepageBannerDO));
            return diseaseHomepageBannerDao.save(oldDiseaseHomepageBanner);
        }
    }
    public void delDiseaseHomepageBanner(Integer id) {
        diseaseHomepageBannerDao.delete(id);
    }
    public MixEnvelop findDiseaseHomepageBanner(Integer id, String name, Integer page, Integer pageSize) throws Exception {
        MixEnvelop mixEnvelop = new MixEnvelop();
        String filters = "";
        if (id != null) {
            filters += "id=" + id + ";";
        }else {
            if (StringUtils.isNotBlank(name)) {
                filters += "name?" + name + ";";
            }
        }
        Integer count = this.search(null, filters, null).size();
        List<BaseDiseaseHomepageBannerDO> list;
        if(page!= null && pageSize!=null) {
            list = this.search(null, filters, null, page, pageSize);
        }else {
            list = this.search(null, filters, null);
        }
        mixEnvelop.setMessage("获取成功!");
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setTotalCount(count);
        mixEnvelop.setDetailModelList(list);
        return mixEnvelop;
    }
}

+ 0 - 65
business/base-service/src/main/java/com/yihu/jw/dict/service/HospitalParameterService.java

@ -1,65 +0,0 @@
package com.yihu.jw.dict.service;
import com.yihu.jw.entity.hospital.dict.BaseHospitalParameterDO;
import com.yihu.jw.hospital.dict.BaseHospitalParameterDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import static com.yihu.jw.util.common.BeanUtils.getNullPropertyNames;
@Service
public class HospitalParameterService extends BaseJpaService<BaseHospitalParameterDO, BaseHospitalParameterDao> {
    @Autowired
    private BaseHospitalParameterDao hospitalParameterDao;
    public BaseHospitalParameterDO createOrUpdateParameter(BaseHospitalParameterDO hospitalParameterDO) {
        //判断新增或编辑
        if (hospitalParameterDO.getId() == null) {
            hospitalParameterDO.setCreateTime(new Date());
            hospitalParameterDO.setDel(1);
            hospitalParameterDO.setUpdateTime(new Date());
            return hospitalParameterDao.save(hospitalParameterDO);
        } else {
            BaseHospitalParameterDO oldHospitalParameter = hospitalParameterDao.findOne(hospitalParameterDO.getId());
            BeanUtils.copyProperties(hospitalParameterDO, oldHospitalParameter, getNullPropertyNames(hospitalParameterDO));
            oldHospitalParameter.setUpdateTime(new Date());
            return hospitalParameterDao.save(oldHospitalParameter);
        }
    }
    public void delHospitalParameter(Integer id) {
        hospitalParameterDao.delete(id);
    }
    public MixEnvelop getHospitalParameterList(String name, String hospital, Integer del, Integer page, Integer pageSize) throws Exception {
        MixEnvelop mixEnvelop = new MixEnvelop();
        String filters = "";
        if (StringUtils.isNotBlank(name)) {
            filters += "name?" + name + ";";
        }
//        if (StringUtils.isNotBlank(number)) {
//            filters += "number?" + number + ";";
//        }
        if (StringUtils.isNotBlank(hospital)) {
            filters += "hospital=" + hospital + ";";
        }
        if (del != null) {
            filters += "del=" + del + ";";
        }
        Integer count = this.search(null, filters, null).size();
        List<BaseHospitalParameterDO> list = this.search(null, filters, null, page, pageSize);
        mixEnvelop.setMessage("获取成功!");
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setTotalCount(count);
        mixEnvelop.setDetailModelList(list);
        return mixEnvelop;
    }
}

+ 8 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/dict/BaseDeptHomepageBannerDao.java

@ -0,0 +1,8 @@
package com.yihu.jw.hospital.dict;
import com.yihu.jw.entity.hospital.manage.BaseDeptHomepageBannerDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface BaseDeptHomepageBannerDao extends PagingAndSortingRepository<BaseDeptHomepageBannerDO, Integer>, JpaSpecificationExecutor<BaseDeptHomepageBannerDO> {
}

+ 8 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/dict/BaseDiseaseHomepageBannerDao.java

@ -0,0 +1,8 @@
package com.yihu.jw.hospital.dict;
import com.yihu.jw.entity.hospital.manage.BaseDiseaseHomepageBannerDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface BaseDiseaseHomepageBannerDao extends PagingAndSortingRepository<BaseDiseaseHomepageBannerDO, Integer>, JpaSpecificationExecutor<BaseDiseaseHomepageBannerDO> {
}

+ 0 - 8
business/base-service/src/main/java/com/yihu/jw/hospital/dict/BaseHospitalParameterDao.java

@ -1,8 +0,0 @@
package com.yihu.jw.hospital.dict;
import com.yihu.jw.entity.hospital.dict.BaseHospitalParameterDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface BaseHospitalParameterDao extends PagingAndSortingRepository<BaseHospitalParameterDO, Integer>, JpaSpecificationExecutor<BaseHospitalParameterDO> {
}

+ 8 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/dict/BaseTopBannerDao.java

@ -0,0 +1,8 @@
package com.yihu.jw.hospital.dict;
import com.yihu.jw.entity.hospital.manage.BaseTopBannerDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface BaseTopBannerDao extends PagingAndSortingRepository<BaseTopBannerDO, Integer>, JpaSpecificationExecutor<BaseTopBannerDO> {
}

+ 2 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/dict/WlyyHospitalSysDictDao.java

@ -26,4 +26,6 @@ public interface WlyyHospitalSysDictDao extends PagingAndSortingRepository<WlyyH
    List<WlyyHospitalSysDictDO> findByDictCode(String dictCode);
    List<WlyyHospitalSysDictDO> findByDictNameAndDictCode(String dictName,String dictCode);
    @Query("from WlyyHospitalSysDictDO where dictName = ?1 order by sort asc")
    List<WlyyHospitalSysDictDO> findByDictNameOrderBySort(String dictName);
}

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

@ -15,9 +15,9 @@ import java.util.List;
 */
public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatientDO, String>, JpaSpecificationExecutor<WlyyOutpatientDO> {
    @Query("from WlyyOutpatientDO a where a.patient = ?1 and a.outpatientType <> '3' and a.outpatientType <> '4' and a.status in(0,1)")
    @Query("from WlyyOutpatientDO a where a.patient = ?1 and a.outpatientType <> '3' and a.outpatientType <> '4' and a.status in(0,1,2)")
    List<WlyyOutpatientDO> findByPatientList(String patient);
    @Query("from WlyyOutpatientDO a where a.patient = ?1 and  a.outpatientType = '3' and a.status in(0,1)")
    @Query("from WlyyOutpatientDO a where a.patient = ?1 and  a.outpatientType = '3' and a.status in(0,1,2)")
    List<WlyyOutpatientDO> findByPatientAndDoctorList(String patient);
    @Query("from WlyyOutpatientDO a where a.patient = ?1 and a.outpatientType <> '3' and a.status in(3) order by a.createTime desc ")
@ -86,5 +86,8 @@ public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatient
    @Query("update WlyyOutpatientDO p set p.channelId=?2 where p.id=?1")
    void updateChannelId(String id,String channelId);
    @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);
}

+ 4 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/NationalDrugDictService.java

@ -17,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
import java.util.Map;
import static com.yihu.jw.util.common.BeanUtils.getNullPropertyNames;
@ -60,7 +61,8 @@ public class NationalDrugDictService extends BaseJpaService<BaseNationalDrugDict
     */
    public MixEnvelop getNationalDrugList(String name, String number, String hospital, Integer status, Integer page, Integer pageSize) throws ParseException {
        MixEnvelop mixEnvelop = new MixEnvelop();
        String sql = "SELECT id,number,name,subject_class,subject_class_name,drug_code,drug_name,hospital,hospital_name,relation_code,`status` " +
        String sql = "SELECT id,number,name,py_name as pyName,common_name as commonName,py_common_name as pyCommonName,subject_class as subjectClass,subject_class_name as subjectClassName," +
                "drug_code as drugCode,drug_name as drugName,hospital,hospital_name as hospitalName,relation_code as relationCode,`status` " +
                "FROM `base_national_drug_dict` WHERE 1=1 ";
        if (StringUtils.isNotBlank(name)) {
            sql += "and name like '%" + name + "%' ";
@ -80,7 +82,7 @@ public class NationalDrugDictService extends BaseJpaService<BaseNationalDrugDict
        if (page != null && pageSize != null) {
            sql += "order by create_time desc limit " + (page - 1) * pageSize + "," + pageSize;
        }
        List<BaseNationalDrugDictDO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(BaseNationalDrugDictDO.class));
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        mixEnvelop.setMessage("获取成功!");
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setPageSize(pageSize);

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

@ -1,11 +1,21 @@
package com.yihu.jw.hospital.prescription.service;
import cn.jiguang.common.ClientConfig;
import cn.jiguang.common.resp.APIConnectionException;
import cn.jiguang.common.resp.APIRequestException;
import cn.jpush.api.JPushClient;
import cn.jpush.api.push.PushResult;
import cn.jpush.api.push.model.Platform;
import cn.jpush.api.push.model.PushPayload;
import cn.jpush.api.push.model.audience.Audience;
import cn.jpush.api.push.model.audience.AudienceTarget;
import cn.jpush.api.push.model.notification.AndroidNotification;
import cn.jpush.api.push.model.notification.IosNotification;
import cn.jpush.api.push.model.notification.Notification;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.dict.dao.BaseDictJobTitleDao;
import com.yihu.jw.dict.dao.BaseJobCategoryDao;
import com.yihu.jw.dict.dao.DictDeptDescDao;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.dict.dao.*;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
@ -27,6 +37,7 @@ import com.yihu.jw.entity.base.yx.YxTokenMappingDO;
import com.yihu.jw.entity.hospital.consult.WlyyDoctorClinicRoomDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
import com.yihu.jw.entity.hospital.dict.BaseJpushTemplateDO;
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorOnlineTimeDO;
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
@ -86,6 +97,7 @@ import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.utils.*;
import com.yihu.jw.utils.Pkis.PKIService_PortType;
import com.yihu.jw.utils.Pkis.PKIService_ServiceLocator;
import com.yihu.jw.utils.encode.Base64;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
@ -95,7 +107,7 @@ import com.yihu.jw.wechat.service.BaseSensitiveFilterWordsService;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import com.yihu.jw.yx.dao.YxTokenMappingDao;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.pinyin.PinyinUtil;
import com.yihu.utils.security.MD5;
import com.ylzinfo.ehc.EhcHandler;
import com.ylzinfo.ehc.common.utils.DateUtils;
@ -131,8 +143,6 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import static javafx.scene.input.KeyCode.L;
/**
 * Created by Trick on 2019/5/17.
 */
@ -288,7 +298,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private YkyySMSService ykyySMSService;
    @Autowired
    private TnyyEntranceService tnyyEntranceService;
    @Autowired
    private BaseJpushTemplateDao baseJpushTemplateDao;
    @Value("${demo.flag}")
@ -2588,6 +2599,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    ins.setCreateTime(new Date());
                    ins.setPrescriptionId(prescription.getId());
                    ins.setOutpatientId(outPatientId);
                    /*if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
                        String code = ins.getCode();
                        com.alibaba.fastjson.JSONArray jsonArray = ykyyEntranceService.findZlxm("",code,"","","");
                        if (jsonArray!=null&&jsonArray.size()>0){
                            com.alibaba.fastjson.JSONObject deptobject = jsonArray.getJSONObject(0);
                            String deptNo = deptobject.getString("dept");
                            ins.setDept(StringUtils.isNoneBlank(ins.getDept())?ins.getDept():deptNo);
                            String yqdm = deptobject.getString("yqdm");
                            ins.setOrgCode(StringUtils.isNoneBlank(ins.getOrgCode())?ins.getOrgCode():yqdm);
                            ins.setOrgName("1001".equalsIgnoreCase(ins.getOrgCode())?"思北院区":"五缘院区");
                        }
                    }*/
                    System.out.println("____outpatientId=="+outPatientId);
                }
                //保存检查检验。
@ -2604,7 +2627,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            prescription.setRegFee(outpatientDO.getFee());
            prescription.setPrescribeTime(new Date());
            //保存费用
            prescriptionDao.save(prescription);
            prescription = prescriptionDao.save(prescription);
            if (wechatId.equalsIgnoreCase("xm_ykyy_wx")) {
                outpatientDO.setStatus("2");
                outpatientDao.save(outpatientDO);
@ -2624,11 +2647,29 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        } else {
                            ykyyService.updateDrugorderInfo(businessOrderDO.getOrderNo(), wlyyPrescriptionDO.getOrderId(), wlyyPrescriptionDO.getRealOrder());
                        }
                        ykyySMSService.sendSmsByTempcode("prescription_remind", outpatientDO, wlyyPrescriptionDO, "");
                        List<WlyyPrescriptionInfoDO> list = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                        if (list!=null&&list.size()>0){
                            ykyySMSService.sendSmsByTempcode("prescription_remind", outpatientDO, wlyyPrescriptionDO, "");
                        }
                    }
                }
                if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                    if (StringUtils.isNotBlank(inspectionJson)) {
                        if (StringUtils.isNotBlank(infoJsons)) {
                            List<WlyyPrescriptionInfoDO> infoDOs = (List<WlyyPrescriptionInfoDO>) com.alibaba.fastjson.JSONArray.parseArray(infoJsons, WlyyPrescriptionInfoDO.class);
                            if (infoDOs != null && infoDOs.size() > 0) {
                            } else {
                                prescription.setStatus(20);
                            }
                        } else {
                            prescription.setStatus(20);
                            sendWxTemplateMsg(wechatId, outpatientDO.getId(), null, "", "prescriptionPayRemind", prescription.getId());
                        }
                    }
                }
                prescriptionDao.save(prescription);
                result.put("code", 1);
                result.put("mes", "诊断完成");
                result.put("prescriptionId",prescription.getId());
@ -3724,7 +3765,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                rs.put("winNo", org.getWinNo());
                rs.put("deptName", hospitalDOs.get(0).getDeptName());
                rs.put("dept", hospitalDOs.get(0).getDeptCode());
                if (StringUtils.isNotBlank(withWork) && "1".equals(withWork)) {
                    List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(doctor, hospitalDOs.get(0).getOrgCode(),"");
                    rs.put("workTime", times);
@ -4395,6 +4435,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                logger.info("眼科微信消息模板推送 医生拒诊开始");
                logger.info("极光消息推送 医生拒诊开始");
                wxTempalteJPush("cancel_remind",outpatientDO,null,"","","","");
                /*String res = wxTempalteJPush(outpatientDO.getConsumer(),newConfig.getFirst(),"医生拒绝了你的问诊",type,outpatientDO.getId());
                logger.info("JPUSH res==="+res);*/
            }else if("outPatientTimeOutRemind".equals(titelType)){
                //就诊等待过长提示
                scene="jzddgcts";
@ -4428,6 +4472,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                logger.info("眼科微信消息模板推送 就诊支付提醒开始");
                logger.info("极光消息推送 就诊支付提醒开始");
                wxTempalteJPush("outpatient_pay",outpatientDO,null,"","","","");
            } else if ("prescriptionPayRemind".equalsIgnoreCase(titelType)) {
                //处方开具支付提醒
                scene = "cfzfts";
@ -4440,6 +4486,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                logger.info("眼科微信消息模板推送 处方支付提醒开始");
                logger.info("极光消息推送 医生拒诊开始");
                wxTempalteJPush("prescription_pay",outpatientDO,null,"","","",remindMsg);
            }else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
                //视频问诊预约提醒
                scene = "spwzyytx";
@ -4469,6 +4517,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                newConfig.setKeyword3(consDoctorDO.getName());
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult());
                logger.info("极光消息推送 医生拒诊开始");
                wxTempalteJPush("give_score",null,consultTeam,"","","","");
                logger.info("眼科微信消息模板推送 服务评价提醒开始");
            } else if ("systemCancelRemind".equalsIgnoreCase(titelType)) {
                //系统24小时取消复诊提醒
@ -4664,6 +4714,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                wxPushLogDO.setScene(scene);
                wxPushLogDao.save(wxPushLogDO);
            }
            //发送极光消息推送
           wxTempalteJPush("logistics_remind",wlyyOutpatientDO,null,drugName,mailNo,remindMsg,prescriptionId);
        }else {
            first = "您好,您的处方订单物流"+remindMsg;
            contentMsg = "患者"+patienName+"的处方药品订单,"+drugName+"等,当前"+remindMsg+"。物流方:「顺丰快递」,物流单号:"+mailNo+"。";
@ -4858,7 +4910,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "room.consult_type AS \"consult_type\"," +
                "outpatient.consumer as \"consumer\", " +
                "outpatient.consumer_name as \"consumerName\"," +
                "outpatient.consumer_mobile as \"consumerMobile\", ";
                "outpatient.consumer_mobile as \"consumerMobile\", "+
                "outpatient.create_time as \"create_date\", ";
        if ("xm_ykyy_wx".equals(wechatId)) {
            if(flag){
                sql += "date_format(room.reservation_time ,'yyyy-MM-dd hh24:mi:ss' ) AS \"timedate_format\",";
@ -4908,6 +4961,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }else if (2==type) {//视频复诊
            //在线复诊
            sql += " AND room.reservation_type !=3 AND room.consult_type =2";
        } else if(0==type) {
            sql += " AND room.consult_type =1";
        } else {
            sql += " AND room.reservation_type !=2";
        }
@ -5484,7 +5539,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        sql += " WHERE  1=1 ";
        sql += " WHERE  1=1 and h.del = '1' ";
        if (StringUtils.isNotBlank(chargType)) {
@ -5685,6 +5740,36 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            count = hibenateUtils.objTransformLong(listCount.get(0).get("total"));
        }
        List<WlyyHospitalSysDictDO> doctorFrontList = wlyyHospitalSysDictDao.findByDictNameOrderBySort("doctorFrontList");
        if (doctorFrontList!=null&&doctorFrontList.size()>0){
            List<Map<String,Object>> frontDoctor = new ArrayList<>();
            if (list!=null&&list.size()>0){
                for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:doctorFrontList){
                    for(Map<String,Object> map: list){
                        if(map.get("id").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                            map.put("doctorFrontSort",wlyyHospitalSysDictDO.getSort());
                            logger.info("doctorFrontSort",wlyyHospitalSysDictDO.getSort());
                            logger.info("doctorId",wlyyHospitalSysDictDO.getDictCode());
                            frontDoctor.add(map);
                        }
                    }
                }
                for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:doctorFrontList){
                    for(Map<String,Object> map1: list){
                        if (wlyyHospitalSysDictDO.getDictCode().equalsIgnoreCase(map1.get("id").toString())){
                            list.remove(map1);
                            break;
                        }
                    }
                }
                for(Map<String,Object> map1: list){
                    frontDoctor.add(map1);
                }
                list = frontDoctor;
            }
        }
        logger.info("findDoctorByHospitalAndDiseaseAndDept end:" + DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm:ss:SSS"));
        logger.info("sql:" + sql);
        MixEnvelop envelop =new MixEnvelop();
@ -5694,7 +5779,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        envelop.setCurrPage(page);
        return envelop;
    }
    /**
     * 获取常见疾病、热门部门、医生拒绝接诊原因 字典
     *
@ -8457,6 +8541,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            wlyyPrescriptionDO.setCheckReason(reason);
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                wlyyPrescriptionDO.setStatus(10);
                List<WlyyPrescriptionInfoDO> list = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                if (list!=null&&list.size()>0){
                }else {
                    if(inspectionDOS!=null&&inspectionDOS.size()>0){
                        wlyyPrescriptionDO.setStatus(20);
                        wlyyPrescriptionDO.setCheckReason("只开检查检验,不开药品无需审方");
                        wlyyPrescriptionDO.setCheckStatus(2);
                    }
                }
            }else{
                wlyyPrescriptionDO.setStatus(11);
            }
@ -8777,6 +8871,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                       content.deleteCharAt(content.length()-1);
                       icd10Code.deleteCharAt(icd10Code.length()-1);
                   }
                   wlyyOutpatientDO.setStatus("2");
                   wlyyOutpatientDO.setIcd10Name(content.toString());
                   wlyyOutpatientDO.setIcd10(icd10Code.toString());
                   outpatientDao.save(wlyyOutpatientDO);
@ -9298,9 +9393,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        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<>();
            BeanUtils.copyProperties(infoDOs,infoVOS);
            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());
@ -11395,4 +11498,290 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public  void updateChannelId(String id,String channelId){
        outpatientDao.updateChannelId(id,channelId);
    }
    /**
     *
     * @param userId 用户id 实例:["22222"]
     * @param alert 通知内容
     * @param title 通知标题
     * @param extras 扩展参数 {"type","","id":""}
     * @return
     */
    public String jPushMessage(String isDoctor,String userId, String alert, String title, com.alibaba.fastjson.JSONObject extras){
        List<WlyyHospitalSysDictDO> hospitalSysDictDOList = hospitalSysDictDao.findByDictName("JPUSH");
        String appKey = null;
        String masterSecret =null;
        for (WlyyHospitalSysDictDO hospitalSysDictDO:hospitalSysDictDOList){
            if ("1".equalsIgnoreCase(isDoctor)){
                if (hospitalSysDictDO.getDictCode().equalsIgnoreCase("appKey")){
                    appKey=hospitalSysDictDO.getDictValue();
                }
                if (hospitalSysDictDO.getDictCode().equalsIgnoreCase("masterSecret")){
                    masterSecret = hospitalSysDictDO.getDictValue();
                }
            }else {
                if (hospitalSysDictDO.getDictCode().equalsIgnoreCase("appKeyPatient")){
                    appKey=hospitalSysDictDO.getDictValue();
                }
                if (hospitalSysDictDO.getDictCode().equalsIgnoreCase("masterSecretPatient")){
                    masterSecret = hospitalSysDictDO.getDictValue();
                }
            }
        }
        logger.info("appKey"+appKey+"======"+"masterSecret"+masterSecret);
        logger.info("addExtra++++"+extras.toString());
        JPushClient jPushClient = new JPushClient(masterSecret, appKey, null, ClientConfig.getInstance());
        PushPayload payload = PushPayload.newBuilder()
                .setPlatform(Platform.all())
                .setAudience(Audience.newBuilder()
                        .addAudienceTarget(AudienceTarget.alias(userId)).build())
                .setNotification(Notification.newBuilder()
                        .addPlatformNotification(IosNotification.newBuilder()
                                .setAlert(alert)
                                .setBadge(5)
                                .setSound("default")
                                .addExtra("type", extras.getString("type"))
                                .addExtra("id", extras.getString("id"))
                                .addExtra("outpatientId", extras.getString("outpatientId"))
                                .addExtra("consultType", extras.getString("consultType"))
                                .addExtra("patientName", extras.getString("patientName"))
                                .setBadge(1)
                                .build())
                        .addPlatformNotification(AndroidNotification.newBuilder()
                                .setAlert(alert)
                                .setTitle(title)
                                .setBuilderId(1)
                                .addExtra("type", extras.getString("type"))
                                .addExtra("outpatientId", extras.getString("outpatientId"))
                                .addExtra("id", extras.getString("id"))
                                .addExtra("consultType", extras.getString("consultType"))
                                .addExtra("patientName", extras.getString("patientName"))
                                .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);*/
            wlyyHttpLogDao.save(httpLogDO);
            logger.info("Got result - " + result);
        } catch (APIConnectionException e) {
            // Connection error, should retry later
            logger.error("Connection error, should retry later", e);
        } catch (APIRequestException e) {
            // Should review the error, and fix the request
            logger.error("Should review the error, and fix the request", e);
            logger.info("HTTP Status: " + e.getStatus());
            logger.info("Error Code: " + e.getErrorCode());
            logger.info("Error Message: " + e.getErrorMessage());
        }
        return null;
    }
    public String wxTempalteJPush(String templateCode,WlyyOutpatientDO wlyyOutpatientDO ,ConsultTeamDo consultTeamDo,String drugName ,String mailNo,String mailStatus,String prescriptionId){
        String userId = "";
        String content = "";
        String title="";
        String isDoctor="0";//0患者 1医生
        com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
        if("give_score".equalsIgnoreCase(templateCode)){//评分
            BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
            if(baseJpushTemplateDO!=null){
                content = baseJpushTemplateDO.getPushContent();
                if(1==consultTeamDo.getType()){
                    content= content.replace("{{咨询类型}}","图文咨询");
                }else if(9==consultTeamDo.getType()){
                    content= content.replace("{{咨询类型}}","图文复诊");
                }
                else if(16==consultTeamDo.getType()){
                    content=  content.replace("{{咨询类型}}","视频复诊");
                }
                else if(17==consultTeamDo.getType()){
                    content=  content.replace("{{咨询类型}}","视频咨询");
                }
                title=baseJpushTemplateDO.getPushHeader();
            }
            userId = consultTeamDo.getPatient();
            jsonObject.put("type",10);
            jsonObject.put("id",consultTeamDo.getConsult());
        }else if("video_invite".equalsIgnoreCase(templateCode)){//视频邀请
            BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
            if(baseJpushTemplateDO!=null){
                content = baseJpushTemplateDO.getPushContent().replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());;
                title=baseJpushTemplateDO.getPushHeader();
            }
            userId = wlyyOutpatientDO.getConsumer();
            jsonObject.put("type",30);
            jsonObject.put("id",wlyyOutpatientDO.getId());
        }else if("consult_remind".equalsIgnoreCase(templateCode)){//医生向患者发消息提醒
            BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
            if(baseJpushTemplateDO!=null){
                content = baseJpushTemplateDO.getPushContent();
                content= content.replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
                title=baseJpushTemplateDO.getPushHeader().replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
            }
            userId = wlyyOutpatientDO.getConsumer();
            jsonObject.put("type",31);
            jsonObject.put("id",wlyyOutpatientDO.getId());
        }else if("consult_remind_doctor".equalsIgnoreCase(templateCode)){//患者向医生发消息提醒
            BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
            if(baseJpushTemplateDO!=null){
                //content = baseJpushTemplateDO.getPushContent();
                content= drugName;
                title=baseJpushTemplateDO.getPushHeader().replace("{{患者姓名}}",consultTeamDo.getName());
            }
            userId = consultTeamDo.getDoctor();
            jsonObject.put("type",33);
            jsonObject.put("id",consultTeamDo.getRelationCode());
            jsonObject.put("consultType",consultTeamDo.getType());
            jsonObject.put("patientName",consultTeamDo.getName());
            isDoctor = "1";
        }  else if("prescription_pay".equalsIgnoreCase(templateCode)){//处方支付提醒
            BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
            if(baseJpushTemplateDO!=null){
                content = baseJpushTemplateDO.getPushContent();
                content= content.replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
                title=baseJpushTemplateDO.getPushHeader();
            }
            userId = wlyyOutpatientDO.getConsumer();
            jsonObject.put("type",6);
            jsonObject.put("id",prescriptionId);
            jsonObject.put("outpatientId",wlyyOutpatientDO.getId());
        } else if("outpatient_pay".equalsIgnoreCase(templateCode)){//诊查费支付提醒
            BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
            if(baseJpushTemplateDO!=null){
                if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文复诊");
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文复诊");
                    jsonObject.put("consultType",9);
                }else if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频复诊");
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频复诊");
                    jsonObject.put("consultType",16);
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文咨询");
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文咨询");
                    jsonObject.put("consultType",1);
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频咨询");
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频咨询");
                    jsonObject.put("consultType",17);
                }else if ("2".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","协同复诊");
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","协同复诊");
                    jsonObject.put("consultType",12);
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"3".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","家医咨询");
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","家医咨询");
                    jsonObject.put("consultType",15);
                }
            }
            userId = wlyyOutpatientDO.getConsumer();
            jsonObject.put("type",11);
            jsonObject.put("id",wlyyOutpatientDO.getId());
        } else if("cancel_remind".equalsIgnoreCase(templateCode)){//医生取消接诊提醒
            BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
            if(baseJpushTemplateDO!=null){
                if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文复诊");
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文复诊");
                }else if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频复诊");
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频复诊");
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文咨询");
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文咨询");
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频咨询");
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频咨询");
                }else if ("2".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","协同复诊");
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","协同复诊");
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"3".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","家医咨询");
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","家医咨询");
                }
            }
            userId = wlyyOutpatientDO.getConsumer();
            jsonObject.put("type",12);
            jsonObject.put("id",wlyyOutpatientDO.getId());
        }else if("outpatient_remind".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.getDoctorName());
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文复诊");
                    jsonObject.put("type",1);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }else if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频复诊").replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
                    content+= "视频复诊预约时间为:"+wlyyOutpatientDO.getRegisterDate();
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频复诊");
                    jsonObject.put("type",2);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文咨询").replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文咨询");
                    jsonObject.put("type",18);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频咨询").replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频咨询");
                    content+= "视频咨询预约时间为:"+wlyyOutpatientDO.getRegisterDate();
                    jsonObject.put("type",17);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }else if ("2".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","协同复诊").replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","协同复诊");
                    jsonObject.put("type",3);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"3".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","家医咨询").replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","家医咨询");
                    jsonObject.put("type",15);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }
            }
            userId = wlyyOutpatientDO.getDoctor();
            jsonObject.put("id",wlyyOutpatientDO.getId());
            isDoctor="1";
        } else if("prescription_refuse".equalsIgnoreCase(templateCode)){//处方审方失败提醒
            BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
            if(baseJpushTemplateDO!=null){
                content = baseJpushTemplateDO.getPushContent();
                content=  content.replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
                title=baseJpushTemplateDO.getPushHeader().replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
            }
            userId = wlyyOutpatientDO.getDoctor();
            jsonObject.put("type",8);
            jsonObject.put("id",prescriptionId);
            isDoctor="1";
        } else if("logistics_remind".equalsIgnoreCase(templateCode)){//物流消息提醒
            BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
            if(baseJpushTemplateDO!=null){
                content = baseJpushTemplateDO.getPushContent();
                content=  content.replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{药品名称}}",drugName)
                .replace("{{物流状态}}",mailStatus).replace("{{运单号}}",mailNo);
                title=baseJpushTemplateDO.getPushHeader();
            }
            userId = wlyyOutpatientDO.getConsumer();
            jsonObject.put("type",32);
            jsonObject.put("id",prescriptionId);
            jsonObject.put("outpatientId",wlyyOutpatientDO.getId());
        }
        return jPushMessage(isDoctor,userId,content,title,jsonObject);
    }
}

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

@ -864,6 +864,9 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        }
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(code);
        if (businessOrderDO!=null){
            if (businessOrderDO.getStatus()==1){
                throw new Exception("该处方已支付过");
            }
            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
            String openId = "";
            if (StringUtils.isNotBlank(appletCode)){
@ -881,7 +884,12 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
                    openId = patientWechatDo.get(0).getOpenid();
                }
            }
            if (businessOrderDO.getOrderNo()!=null&&businessOrderDO.getOrderNo().contains("HLWYYQD")){
                businessOrderDO.setOrderNo("HLWYYQD"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100);
            }else {
                businessOrderDO.setOrderNo("HLWYY"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100);
            }
            businessOrderDO= businessOrderDao.save(businessOrderDO);
            String url = wxWechatDO.getBaseUrl();
            String notifyUrl =url;
            String totalFee =businessOrderDO.getPayPrice().intValue()+"";

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

@ -56,6 +56,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.criteria.CriteriaBuilder;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.*;
@ -157,6 +158,8 @@ public class YkyyEntranceService {
    private YkyySMSService ykyySMSService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Autowired
    private DictHospitalDeptDao dictHospitalDeptDao;
    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){
@ -179,6 +182,50 @@ public class YkyyEntranceService {
    public void updateBySql(String sql){
        hibenateUtils.updateBySql(sql);
    }
    /**
     * 同步科室信息
     * @return
     * @throws Exception
     */
    public JSONArray findDeptByYq(String yqFlag,String deptCode,String deptName)throws Exception{
        String sql = "select code AS \"code\",name as \"name\",consultdeptflag as \"consultDeptFlag\",to_char(yjsy) as \"yjsy\" ,to_char(yqdm) as \"orgCode\" from V_HLW_KSXX where 1=1 and yjsy = 'Y'";
        if (StringUtils.isNoneBlank(yqFlag)){
            sql+=" and yqdm = '"+yqFlag+"'";
        }
        if (StringUtils.isNoneBlank(deptCode)){
            sql+=" and code = '"+deptCode+"'";
        }
        if (StringUtils.isNoneBlank(deptName)){
            sql+=" and name like  '%"+deptName+"%'";
        }
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("findDeptByYq:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if(status!=null&&status == 200){
            JSONArray array = rs.getJSONArray("detailModelList");
            logger.info("dept size:"+array.size());
            if(array!=null&&array.size()>0){
                for(int i=0;i<array.size();i++){
                    JSONObject deptjson = array.getJSONObject(i);
                    String orgCode = deptjson.getString("orgCode");
                    if ("1001".equalsIgnoreCase(orgCode)){
                        deptjson.put("orgName","思北院区");
                    }else {
                        deptjson.put("orgName","五缘院区");
                    }
                }
                return array;
            }
        }
        return  null;
    }
    /**
     * 同步科室信息
     * @return
@ -406,6 +453,7 @@ public class YkyyEntranceService {
     * @throws Exception
     */
    public List<WlyyOutpatientVO> BS30025(String PAT_NO, String conNo, String startTime, String endTime, boolean demoFlag,String ksdm) throws Exception {
        String fid = "BS30025";
        logger.info("EntranceService " + fid + " PAT_NO :" + PAT_NO + " conNo:" + conNo + " startTime:" + startTime + " endTime:" + endTime);
@ -511,10 +559,17 @@ public class YkyyEntranceService {
                    String fyhj = object.getString("fyhj");//金额
                    String jzxh = object.getString("jzxh");//就诊序号
                    String zxks = object.getString("zxks");//执行科室
                    String yqdm = object.getString("yqdm");//执行科室
                    WlyyInspectionVO wlyyInspectionVO = new WlyyInspectionVO();
                    wlyyInspectionVO.setName(fymc);
                    wlyyInspectionVO.setDeptName(zxks);
                    wlyyInspectionVO.setDept(ksdm1);
                    wlyyInspectionVO.setOrgCode(yqdm);
                    if ("1001".equalsIgnoreCase(yqdm)){
                        wlyyInspectionVO.setOrgName("思北院区");
                    }else {
                        wlyyInspectionVO.setOrgName("五缘院区");
                    }
                    wlyyInspectionVO.setQuantity(Integer.parseInt(fysl));
                    inspectionVOList.add(wlyyInspectionVO);
                }
@ -574,8 +629,30 @@ public class YkyyEntranceService {
     * @throws Exception
     */
    public JSONArray findV_ZKSG_HZCX_HIS(String brid,String conNo,String startTime,String endTime,String ksdm) throws Exception{
        String sql = "SELECT to_char(h.KSSJ ,'yyyy/MM/dd hh24:mi:ss' ) as KSSJ,h.BRID,h.BRXM,h.SJHM,h.JZKH,h.SFZH,h.BRXZ,h.YSDM,h.KDYS" +
                ",h.KSDM,h.KSMC,h.ZDMC,h.JZXH from V_ZKSG_HZCX_HIS h WHERE h.BRID = "+brid+" ";
        String depts ="";
        String deptUsuaName ="";
        if (StringUtils.isNoneBlank(ksdm)){
            DictHospitalDeptDO dictHospitalDeptDO = dictHospitalDeptDao.findByCode(ksdm);
            if (dictHospitalDeptDO!=null){
                deptUsuaName = dictHospitalDeptDO.getUsualName();
            List<DictHospitalDeptDO> deptList =dictHospitalDeptDao.findByUsuallyName(deptUsuaName);
            if (deptList!=null&&deptList.size()>0){
                for (int i =0 ;i<deptList.size();i++){
                    if (i==deptList.size()-1){
                        depts +=deptList.get(i).getCode();
                    }else {
                        depts+=deptList.get(i).getCode()+",";
                    }
                }
            }else {
                depts = dictHospitalDeptDO.getCode();
            }
        }
        }
        if(!StringUtil.isBlank(conNo)){
            sql += " and h.JZXH = " + conNo;
        }
@ -584,14 +661,15 @@ public class YkyyEntranceService {
        }
        if(!StringUtil.isBlank(endTime)){
            sql += " and h.KSSJ <= to_date('"+endTime+"', 'YYYY-MM-DD HH24:MI:SS')";
        }if(!StringUtil.isBlank(ksdm)){
            sql += " and h.KSDM = " + ksdm;
        }if(!StringUtil.isBlank(depts)){
            sql += " and h.KSDM in ("+ depts+")";
        }
        sql += " order by h.KSSJ desc";
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("sqlOutpatientList"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
@ -629,9 +707,10 @@ public class YkyyEntranceService {
                "\tz.YBLB AS \"yblb\",\n" +
                "\tz.JZXH AS \"jzxh\",\n" +
                "\tz.YJXH AS \"yjxh\",\n" +
                "\tto_char(h.YQDM) AS \"yqdm\",\n" +
                "\tz.ZXKS AS \"zxks\"\n" +
                "FROM\n" +
                "\tV_ZKSG_JCCX z\n" +
                "\tV_ZKSG_JCCX z left join V_HLW_KSXX h on z.ksdm = h.code\n" +
                "WHERE\n" +
                "\tz.JZXH = '"+conNo+"'\n" +
                "AND z.brid = '"+brid+"'";
@ -845,7 +924,7 @@ public class YkyyEntranceService {
                        prescriptionInfoVO.setPackRetprice(object1.getDouble("ypdj"));
                        prescriptionInfoVO.setPackUnitName(object1.getString("yfdw"));
                        prescriptionInfoVO.setUnitName(object1.getString("yfdw"));
                        prescriptionInfoVO.setDosage(object1.getString("mrcs"));
                        prescriptionInfoVO.setDosage(object1.getString("ycjl"));
                        prescriptionInfoVO.setSupplyCode(object1.getString("gytj"));
                        JSONArray ypyfList = findYpyf("",object1.getString("gytj"));
                        if (ypyfList!=null&&ypyfList.size()>0){
@ -1853,7 +1932,10 @@ public class YkyyEntranceService {
    }
    public static void main(String[] args) {
        List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS = new ArrayList<>();
        System.out.println(wlyyPrescriptionInfoVOS.get(0).getHisCode());
    }
    public String findByRealOrder(String code,boolean demoFlag) throws Exception {
        List<WlyyPrescriptionDO>  wlyyPrescriptionDOs = prescriptionDao.findById(code);
@ -1871,8 +1953,13 @@ public class YkyyEntranceService {
            }
            //诊断
            synPrescriptionDiagnosis(prescriptionVO,code,demoFlag);
            if (wlyyPrescriptionInfoVOS!=null&&wlyyPrescriptionInfoVOS.size()>0){
                prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
            }else {
                System.out.println("=====setInfoVOs");
                prescriptionVO.setInfoVOs(null);
            }
            prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
            List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(code,1);
            synPrecriptionHis(prescriptionVO,code);
@ -1916,18 +2003,19 @@ public class YkyyEntranceService {
        for (WlyyInspectionDO wlyyInspectionDO:inspectionDOS){
            YkEmrJcsqDO ykEmrJcsqDO = new YkEmrJcsqDO();
            System.out.println("jcjy=="+wlyyInspectionDO.getOutpatientId());
            ykEmrJcsqDO.setJzhm(registNo);
            //ykEmrJcsqDO.setJzhm(registNo);
            if (StringUtils.isNotEmpty(admNo)){
                System.out.println("admno=="+admNo);
                ykEmrJcsqDO.setJzxh(Integer.parseInt(admNo));
            }
            ykEmrJcsqDO.setXmid(Integer.valueOf(wlyyInspectionDO.getCode()));
            JSONArray jsonArray = this.findZlxm(null,wlyyInspectionDO.getCode());
            JSONArray jsonArray = this.findZlxm(null,wlyyInspectionDO.getCode(),"","","");
            if (jsonArray!=null&&jsonArray.size()>0){
                JSONObject deptobject = jsonArray.getJSONObject(0);
                deptNo = deptobject.getString("dept");
            }
            ykEmrJcsqDO.setZxks(deptNo==null?0:Integer.parseInt(deptNo));
            //ykEmrJcsqDO.setZxks(deptNo==null?0:Integer.parseInt(deptNo));
            ykEmrJcsqDO.setZxks(wlyyInspectionDO.getDept()==null?0:Integer.parseInt(wlyyInspectionDO.getDept()));
            ykEmrJcsqDO.setJcxm(wlyyInspectionDO.getName());
            ykEmrJcsqDO.setXmdj(new BigDecimal(wlyyInspectionDO.getChargeAmount()));
            ykEmrJcsqDO.setSqsl(wlyyInspectionDO.getQuantity());
@ -1935,6 +2023,7 @@ public class YkyyEntranceService {
            ykEmrJcsqDO.setXmdw(wlyyInspectionDO.getTotalUnit());
            ykEmrJcsqDO.setKdsj(new Date());
            ykEmrJcsqDOS.add(ykEmrJcsqDO);
        }
        //同步his
        logger.info("开始同步检查检验");
@ -2565,7 +2654,7 @@ public class YkyyEntranceService {
    public WlyyPrescriptionVO synPrecriptionHis(WlyyPrescriptionVO wlyyPrescriptionVO,String code) throws Exception {
        HlwCf01DO hlwCf01DO = new HlwCf01DO();
        logger.info("开始===================");
        if (wlyyPrescriptionVO!=null){
        if (wlyyPrescriptionVO!=null&&wlyyPrescriptionVO.getInfoVOs()!=null){
            try {
                hlwCf01DO.setSPZT(0);
                hlwCf01DO.setFKZT(wlyyPrescriptionVO.getPayStatus());
@ -2913,18 +3002,29 @@ public class YkyyEntranceService {
    }
    //查询诊疗项目视图
    public JSONArray findZlxm(String itemName,String itemCode) throws Exception{
    public JSONArray findZlxm(String itemName,String itemCode,String deptCode,String yqdm,String pyCode) throws Exception{
        String sql = "select t.item_code as \"code\",t.item_name as \"name\"," +
                "t.price as \"chargeAmount\",t.total_unit as \"totalUnit\"," +
                "t.zxks as \"dept\" from VEMR_ORDER_ITEM t where 1=1";
        if (StringUtils.isNotEmpty(itemName)){
                "t.zxks as \"dept\" ,t.yqdm as \"yqdm\" ,m.name as \"exec_unit_name\" from VEMR_ORDER_ITEM t " +
                " left join V_HLW_KSXX m on m.code = t.zxks " +
                " where 1=1";
        /*if (StringUtils.isNotEmpty(itemName)){
            sql+=" and t.ITEM_NAME like '%"+itemName+"%'";
        }*/
        if (StringUtils.isNotEmpty(yqdm)){
            sql+=" and t.yqdm = '"+yqdm+"'";
        }
        if (StringUtils.isNoneBlank(itemName)){
            sql+=" and lower(t.kb_code) like '%"+itemName.toLowerCase()+"%'";
        }
        if (StringUtils.isNotEmpty(itemCode)){
            String[] split = itemCode.split(",|,");
            String ids = org.apache.commons.lang.StringUtils.join(split, ",");
            sql+=" and t.item_code in ("+ids+")";
        }
        if (StringUtils.isNotEmpty(deptCode)){
            sql+=" and t.zxks ="+deptCode+"";
        }
        System.out.println(sql);
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
@ -2937,6 +3037,17 @@ public class YkyyEntranceService {
        JSONArray array= new JSONArray();
        if (status==200){
            array = rs.getJSONArray("detailModelList");
            for (int i=0;i<array.size();i++){
                JSONObject jsonObject =array.getJSONObject(i);
                if (jsonObject.get("yqdm")!=null){
                    if ("1001".equalsIgnoreCase(jsonObject.get("yqdm").toString())){
                        jsonObject.put("yqmc","思北院区");
                    }
                    if ("1002".equalsIgnoreCase(jsonObject.get("yqdm").toString())){
                        jsonObject.put("yqmc","五缘院区");
                    }
                }
            }
        }
        return array;
    }
@ -2999,6 +3110,7 @@ public class YkyyEntranceService {
        String doctorHis="";
        Integer kdks = 0;
        Integer brid=0;
        String mzhm="0";
        JSONArray jsonArray = findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),patientDO.getIdcard(),demoFlag);
        Map<String,Object> resultMap = new HashMap();
        if(jsonArray!=null&&jsonArray.size()>0){
@ -3009,6 +3121,8 @@ public class YkyyEntranceService {
            csny = json.getDate("csny");
            brnl = this.getBrnl(csny);
            brid=json.getInteger("brid");
            mzhm = json.getString("mzhm");
        }
        //操作医生信息
        JSONArray jsonArray1 = findHisDoctor(doctorMappingDO.getIdcard());
@ -3029,7 +3143,9 @@ public class YkyyEntranceService {
                    ykEmrJcsqDO.setBrnl(brnl);
                    ykEmrJcsqDO.setKdys(doctorHis);
                    ykEmrJcsqDO.setBrks(kdks);
                    ykEmrJcsqDO.setJzhm(mzhm);
                    ykEmrJcsqDO.setTjys(doctorHis);
            }
            String jsonString = JSONObject.toJSONString(surveys);
            Map<String,Object> params = new HashedMap();

Разница между файлами не показана из-за своего большого размера
+ 159 - 56
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java


+ 17 - 4
business/base-service/src/main/java/com/yihu/jw/utils/YkyySMSService.java

@ -107,7 +107,10 @@ public class YkyySMSService {
                smsTemplateDO = smsTemplateDao.findByClientId("prescription_remind");
                if (smsTemplateDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}", DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime()))
                            .replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder()).replace("{{性别}}",sex);
                            .replace("{{性别}}",sex);
                    if (StringUtils.isNoneBlank(wlyyPrescriptionDO.getRealOrder())){
                        content.replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder());
                    }
                    if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                        ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                        wxPushLogDO = new WxPushLogDO();
@ -163,7 +166,7 @@ public class YkyySMSService {
            }else if ("oneself_pick".equalsIgnoreCase(temlateCode)){//病人自取
                smsTemplateDO = smsTemplateDao.findByClientId("oneself_pick");
                if (smsTemplateDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}",DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime())).replace("{{门诊号码}}",wlyyOutpatientDO.getRealOrder())
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{门诊号码}}",wlyyOutpatientDO.getRealOrder())
                    .replace("{{性别}}",sex);
                    if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                        ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
@ -246,15 +249,25 @@ public class YkyySMSService {
                    }
                    List<WlyyInspectionDO> list = inspectionDao.findByOutpatientId(wlyyOutpatientDO.getId());
                    String createTime = "";
                    String isName = "";
                    for (int i=0;i<list.size();i++){
                        if (i==list.size()-1){
                            isName+=list.get(i).getName()+"。";
                        }else {
                            isName+=list.get(i).getName()+",";
                        }
                    }
                    if (list!=null&&list.size()>0){
                        createTime = DateUtil.dateToStrLong(list.get(0).getCreateTime());
                    }
                    if (StringUtils.isNoneBlank(medicard)){
                        content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",createTime).replace("{{门诊号码}}",mzhm)
                        .replace("{{社保卡号}}","【凭社保卡/就诊卡"+medicard+"到院充值预缴金做检查】").replace("{{性别}}",sex).replace("{{时间}}",createTime);
                        .replace("{{社保卡号}}","【凭社保卡/就诊卡"+medicard+"到院充值预缴金做检查】").replace("{{性别}}",sex).replace("{{时间}}",createTime)
                        .replace("{{检查项目}}",isName);
                    }else {
                        content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}",createTime).replace("{{门诊号码}}",mzhm)
                                .replace("{{社保卡号}}","【到收费处,凭此条短信中的门诊号码换卡充值预缴金做检查】").replace("{{性别}}",sex);;
                                .replace("{{社保卡号}}","【到收费处,凭此条短信中的门诊号码换卡充值预缴金做检查】").replace("{{性别}}",sex)
                                .replace("{{检查项目}}",isName);;;
                    }
                    if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                        wxPushLogDO = new WxPushLogDO();

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

@ -15,6 +15,7 @@ import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.oauth.OauthSsoService;
@ -108,6 +109,8 @@ public class WxTemplateService {
    private OutpatientDao outpatientDao;
    @Autowired
    private YxTokenMappingDao yxTokenMappingDao;
    @Autowired
    private PrescriptionService prescriptionService;
    
@ -148,6 +151,7 @@ public class WxTemplateService {
                                "点击消息进入视频诊室接听视频通话,开始视频咨询",
                                "",miniprogramUrl,"wx53f6bb4ac081d840");
                    }else{
                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_consult_notice","spthtx",1);
                        BaseDoctorDO doctorDO = doctorDao.findById(sender_id);
                        String titleName = "";
@ -170,6 +174,8 @@ public class WxTemplateService {
                            config.setKeyword2(DateUtil.dateToStrLong(wlyyOutpatientDO.getCreateTime()));
                            config.setKeyword3(wlyyOutpatientDO.getDeptName());
                            config.setKeyword4(wlyyOutpatientDO.getDescription());
                            miniprogramUrl+="&outpatientId="+wlyyOutpatientDO.getId();
                            config.setPagepath(miniprogramUrl);
                        }
                        WxWechatDO wechatDO = wechatDao.findById(wechatId);
                        if (wechatDO!=null){
@ -177,6 +183,7 @@ public class WxTemplateService {
                        }
                        config.setKeyword1(doctorDO.getName());
                        weixinMessagePushUtils.putWxMsg(wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken(),basePatientWechatDo.getOpenid(),config);
                        prescriptionService.wxTempalteJPush("video_invite",wlyyOutpatientDO,null,"","","","");
                    }
                }
            }
@ -610,7 +617,16 @@ 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,"","","","");
                }
            }
        }else{
            throw new Exception("接收者ID错误,无法找到该账号");
        }

+ 5 - 2
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -472,11 +472,14 @@ public class ImService {
	public List<String> append(String consult, String content, Integer type, Integer times,String patientcode,String wechat_appid) throws Exception {
		List<ConsultTeamLogDo> logs = new ArrayList<ConsultTeamLogDo>();
		ConsultTeamDo consultModel = consultTeamDao.findByConsult(consult);
		if (consultModel == null) {
			throw new Exception("咨询记录不存在!");
		}
		try {
			prescriptionService.wxTempalteJPush("consult_remind_doctor",null,consultModel,content,"","","");
		}catch (Exception e){
			e.printStackTrace();
		}
		if (consultModel.getEndMsgId() != null) {
			throw new Exception("咨询已结束!");
		}

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

@ -19,13 +19,13 @@ public abstract class IntegerIdentityEntity implements Serializable {
    @Id
//==========mysql 环境 id策略======================================================
    /*@GeneratedValue(generator = "generator")
    @GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "identity")
    @Column(name = "id", unique = true, nullable = false)*/
    @Column(name = "id", unique = true, nullable = false)
//==========mysql 环境 id策略 end======================================================
//==========Oracle 环境id策略 =========================================================
   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
//   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
        return id;

+ 12 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictHospitalDeptDO.java

@ -84,6 +84,18 @@ public class DictHospitalDeptDO extends IntegerIdentityEntity {
     * 科室描述
     */
    private String deptDescription;
    /**
     * 科室通用名
     */
    private String usualName;
    @Column(name = "usual_name")
    public String getUsualName() {
        return usualName;
    }
    public void setUsualName(String usualName) {
        this.usualName = usualName;
    }
    @Column(name = "org_name")
    public String getOrgName() {
        return orgName;

+ 0 - 87
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/dict/BaseHospitalParameterDO.java

@ -1,87 +0,0 @@
package com.yihu.jw.entity.hospital.dict;
import com.yihu.jw.entity.IntegerIdentityEntityWithOperator;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@Table(name = "base_hospital_parameter")
@Entity
@SequenceGenerator(name="id_generated", sequenceName="BASE_HOSPITAL_PARAMETER_SEQ")
public class BaseHospitalParameterDO extends IntegerIdentityEntityWithOperator {
    private String number;//参数编码
    private String name;//参数名称
    private String value;//参数值
    private String hospital;//所属机构
    private String hospitalName;//所属机构名称
    private String description;//参数描述
    private String explain;//参数值说明
    private Integer del;//是否有效(1是 0否)
    public String getNumber() {
        return number;
    }
    public void setNumber(String number) {
        this.number = number;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public String getExplain() {
        return explain;
    }
    public void setExplain(String explain) {
        this.explain = explain;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 58 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/dict/BaseJpushTemplateDO.java

@ -0,0 +1,58 @@
package com.yihu.jw.entity.hospital.dict;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "base_jpush_template")
public class BaseJpushTemplateDO extends UuidIdentityEntityWithOperator {
    private String code;
    private String name;
    private String pushHeader;
    private String pushContent;
    private String isDel;
    @Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "push_header")
    public String getPushHeader() {
        return pushHeader;
    }
    public void setPushHeader(String pushHeader) {
        this.pushHeader = pushHeader;
    }
    @Column(name = "push_content")
    public String getPushContent() {
        return pushContent;
    }
    public void setPushContent(String pushContent) {
        this.pushContent = pushContent;
    }
    @Column(name = "is_del")
    public String getIsDel() {
        return isDel;
    }
    public void setIsDel(String isDel) {
        this.isDel = isDel;
    }
}

+ 68 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/manage/BaseDeptHomepageBannerDO.java

@ -0,0 +1,68 @@
package com.yihu.jw.entity.hospital.manage;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.util.Date;
@Entity
@Table(name = "base_dept_homepage_banner")
@SequenceGenerator(name="id_generated", sequenceName="BASE_DEPT_HOMEPAGE_BANNER_SEQ")
public class BaseDeptHomepageBannerDO  extends IntegerIdentityEntity {
    private String deptCode;//科室code
    private String deptName;//科室名称
    private String image;//图标
    private Integer sort;//排序
    private Integer del;//是否删除(1是 0否)
    private Date createTime;//创建时间
    public String getDeptCode() {
        return deptCode;
    }
    public void setDeptCode(String deptCode) {
        this.deptCode = deptCode;
    }
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    public String getImage() {
        return image;
    }
    public void setImage(String image) {
        this.image = image;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 68 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/manage/BaseDiseaseHomepageBannerDO.java

@ -0,0 +1,68 @@
package com.yihu.jw.entity.hospital.manage;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.util.Date;
@Entity
@Table(name = "base_disease_homepage_banner")
@SequenceGenerator(name="id_generated", sequenceName="BASE_DISEASE_HOMEPAGE_BANNER_SEQ")
public class BaseDiseaseHomepageBannerDO  extends IntegerIdentityEntity {
    private String diseaseCode;//
    private String diseaseName;//
    private String image;//图标
    private Integer sort;//排序
    private Integer del;//是否删除(1是 0否)
    private Date createTime;//创建时间
    public String getDiseaseCode() {
        return diseaseCode;
    }
    public void setDiseaseCode(String diseaseCode) {
        this.diseaseCode = diseaseCode;
    }
    public String getDiseaseName() {
        return diseaseName;
    }
    public void setDiseaseName(String diseaseName) {
        this.diseaseName = diseaseName;
    }
    public String getImage() {
        return image;
    }
    public void setImage(String image) {
        this.image = image;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 59 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/manage/BaseDoctorSortDO.java

@ -0,0 +1,59 @@
package com.yihu.jw.entity.hospital.manage;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.util.Date;
@Entity
@Table(name = "base_doctor_sort")
@SequenceGenerator(name="id_generated", sequenceName="BASE_DOCTOR_SORT_SEQ")
public class BaseDoctorSortDO extends IntegerIdentityEntity {
    private String doctorCode;//医生code
    private String doctorName;//医生名称
    private Integer sort;//排序
    private Integer del;//是否删除(1是 0否)
    private Date createTime;//创建时间
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 86 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/manage/BaseTopBannerDO.java

@ -0,0 +1,86 @@
package com.yihu.jw.entity.hospital.manage;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.util.Date;
@Entity
@Table(name = "base_top_banner")
@SequenceGenerator(name="id_generated", sequenceName="BASE_NATIONAL_DRUG_DICT_SEQ")
public class BaseTopBannerDO extends IntegerIdentityEntity {
    private String saasId;//激励id
    private String name;//名称
    private String image;//图片
    private String url;//url地址
    private Integer sort;//排序
    private Integer status;//上线状态(1上线 2下线)
    private Integer del;//是否有效(1是 0否)
    private Date createTime;//创建时间
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getImage() {
        return image;
    }
    public void setImage(String image) {
        this.image = image;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
}

+ 23 - 5
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/BaseNationalDrugDictDO.java

@ -22,6 +22,8 @@ public class BaseNationalDrugDictDO extends IntegerIdentityEntity {
    private String hospital;//机构id
    private String hospitalName;//机构名称
    private String relationCode;//国家药品编码saasId(机构药品时该字段才有值)
    private String relationName;//关联的国家药品通用名
    private String relationPyName;//关联的国家药品通用名拼音码
    private String gyzz;//国药准字
    private String unit;//包装单位
    private String packingSpecifications;//包装规格
@ -38,7 +40,7 @@ public class BaseNationalDrugDictDO extends IntegerIdentityEntity {
    private String medicareSpecifications;//医保规格
    private String medicareUnit;//医保单位
    private String toxicology;//毒理分类
    private String toxicology_name;//毒理分类名称
    private String toxicologyName;//毒理分类名称
    private String prescription;//处方用药
    private String gmp;//gmp药品
    private String antimicrobial;//抗菌药分类id
@ -267,12 +269,12 @@ public class BaseNationalDrugDictDO extends IntegerIdentityEntity {
        this.toxicology = toxicology;
    }
    public String getToxicology_name() {
        return toxicology_name;
    public String getToxicologyName() {
        return toxicologyName;
    }
    public void setToxicology_name(String toxicology_name) {
        this.toxicology_name = toxicology_name;
    public void setToxicologyName(String toxicologyName) {
        this.toxicologyName = toxicologyName;
    }
    public String getPrescription() {
@ -426,4 +428,20 @@ public class BaseNationalDrugDictDO extends IntegerIdentityEntity {
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getRelationName() {
        return relationName;
    }
    public void setRelationName(String relationName) {
        this.relationName = relationName;
    }
    public String getRelationPyName() {
        return relationPyName;
    }
    public void setRelationPyName(String relationPyName) {
        this.relationPyName = relationPyName;
    }
}

+ 18 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyInspectionDO.java

@ -57,6 +57,24 @@ public class WlyyInspectionDO extends UuidIdentityEntity {
    private String totalUnit;//单位
    private String hisCode;
    private String orgCode;//园区code
    private String orgName;
    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 getTotalUnit() {
        return totalUnit;

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

@ -38,6 +38,8 @@ public class BaseHospitalRequestMapping {
        public static final String PREFIX  = "/prescription";
        public static final String findDoctorByIdCard = "/findDoctorByIdCard";
        public static final String testJpush = "/testJpush";
        public static final String findYkCardCharge = "/findYkCardCharge";
        public static final String updateChannelId = "/updateChannelId";
        //=====================start=======================================
@ -564,6 +566,7 @@ public class BaseHospitalRequestMapping {
        public static final String yktPay ="/yktPay";
        public static final String getSql = "/getSql";
        public static final String findDeptByOrgCode = "/findDeptByOrgCode";
        /**
         * 获取门诊记录
         */
@ -1465,10 +1468,14 @@ public class BaseHospitalRequestMapping {
        public static final String updateDictGroup = "/updateDictGroup";
        public static final String delDictGroup = "/delDictGroup";
        //系统参数配置
        public static final String getHospitalParameterList = "/getHospitalParameterList";
        public static final String createOrUpdateParameter = "createOrUpdateParameter";
        public static final String delHospitalParameter = "delHospitalParameter";
        //疾病首页标签配置
        public static final String findDiseaseHomepageBanner = "/findDiseaseHomepageBanner";
        public static final String updateDiseaseHomepageBanner = "/updateDiseaseHomepageBanner";
        public static final String delDiseaseHomepageBanner = "/delDiseaseHomepageBanner";
        //科室首页标签配置
        public static final String findDeptHomepageBanner = "/findDeptHomepageBanner";
        public static final String updateDeptHomepageBanner = "/updateDeptHomepageBanner";
        public static final String delDeptHomepageBanner = "/delDeptHomepageBanner";
    }
    /**

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

@ -59,6 +59,24 @@ public class WlyyInspectionVO extends UuidIdentityVO {
    private String checkbox;//是否拆分 1是,0否
    private String mzpg;//麻醉评估 0否,1有
    private String sfzg;//是否做过 0 否 和 1是
    private String orgCode ;
    private String orgName;
    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 getChargeAmount() {
        return chargeAmount;

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

@ -341,7 +341,11 @@ public class YkyyController extends EnvelopRestEndpoint {
                        List<Map<String,Object>> fyxhList = hibenateUtils.createSQLQuery(fyxhSql);
                        if (fyxhList.size()>0){
                            ykMsYj02DO.setXmlx(Integer.valueOf(fyxhList.get(0).get("xmlx").toString()));
                            Integer xmlx = 0;
                            if (fyxhList.get(0).get("xmlx")!=null){
                                xmlx = Integer.valueOf(fyxhList.get(0).get("xmlx").toString());
                            }
                            ykMsYj02DO.setXmlx(xmlx);
                            ykMsYj02DO.setFygb(Integer.valueOf(fyxhList.get(0).get("fygb").toString()));
                            ykMsYj02DO.setYldj(new BigDecimal(fyxhList.get(0).get("fydj").toString()));
                            ykMsYj02DO.setHjje(totalprice);

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

@ -21,6 +21,7 @@ import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDiagnosisDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.im.service.ImService;
@ -123,6 +124,8 @@ public class UnSettledHISPrescriptionService {
    private BaseSmsTemplateDao smsTemplateDao;
    @Autowired
    private YkyySMSService ykyySMSService;
    @Autowired
    private PrescriptionService prescriptionService;
    
    
    /**
@ -212,6 +215,8 @@ public class UnSettledHISPrescriptionService {
                        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findByRealOrder(cfsb);
                        BaseDoctorDO baseDoctorDO = doctorDao.findById(doctor);
                        ykyySMSService.sendSmsByTempcode("check_failed",wlyyOutpatientDO,prescriptionDO,baseDoctorDO.getMobile());
                        logger.info("极光推送处方驳回消息");
                       prescriptionService.wxTempalteJPush("prescription_refuse",wlyyOutpatientDO,null,"","","",prescriptionDO.getId());
                    }
                }

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

@ -1220,9 +1220,15 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	public ObjEnvelop findZlxm(@ApiParam(name = "itemName", value = "itemName")
								   @RequestParam(value = "itemName", required = false)String itemName,
							   @ApiParam(name = "itemCode", value = "itemCode")
							   @RequestParam(value = "itemCode", required = false)String itemCode)throws Exception {
							   @RequestParam(value = "itemCode", required = false)String itemCode,
                               @ApiParam(name = "deptCode", value = "deptCode")
                                   @RequestParam(value = "deptCode", required = false)String deptCode,
                               @ApiParam(name = "yqdm", value = "yqdm")
                                   @RequestParam(value = "yqdm", required = false)String yqdm,
                               @ApiParam(name = "pyCode", value = "pyCode")
                                   @RequestParam(value = "pyCode", required = false)String pyCode)throws Exception {
		JSONArray array= ykyyEntranceService.findZlxm(itemName,itemCode);
		JSONArray array= ykyyEntranceService.findZlxm(itemName,itemCode,deptCode,yqdm,pyCode);
		ObjEnvelop objEnvelop = new ObjEnvelop();
		objEnvelop.setObj(array);
		return objEnvelop;

+ 37 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/dict/DeptHomepageBannerEndpoint.java

@ -0,0 +1,37 @@
package com.yihu.jw.hospital.endpoint.dict;
import com.yihu.jw.dict.service.DeptHomepageBannerService;
import com.yihu.jw.entity.hospital.manage.BaseDeptHomepageBannerDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.PatientNoLogin.PREFIX)
@Api(value = "科室首页图标管理",tags = "科室首页图标")
public class DeptHomepageBannerEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private DeptHomepageBannerService deptHomepageBannerService;
    @ApiOperation("删除疾病首页图标")
    @PostMapping(value = BaseHospitalRequestMapping.PatientNoLogin.delDeptHomepageBanner)
    public Envelop delDeptHomepageBanner(@ApiParam(name = "id", value = "id", required = true)
                                            @RequestParam(value = "id", required = true) Integer id) {
        deptHomepageBannerService.delDeptHomepageBanner(id);
        return success();
    }
    @ApiOperation("新增/修改疾病首页图标")
    @PostMapping(value = BaseHospitalRequestMapping.PatientNoLogin.updateDeptHomepageBanner)
    public Envelop updateDeptHomepageBanner(@ApiParam(name = "json", value = "json", required = true)
                                               @RequestParam(value = "json", required = true) String json) throws Exception {
        BaseDeptHomepageBannerDO deptHomepageBannerDO = objectMapper.readValue(json, BaseDeptHomepageBannerDO.class);
        return success(deptHomepageBannerService.updateDeptHomepageBanner(deptHomepageBannerDO));
    }
}

+ 52 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/dict/DiseaseHomepageBannerEndPoint.java

@ -0,0 +1,52 @@
package com.yihu.jw.hospital.endpoint.dict;
import com.yihu.jw.dict.service.DiseaseHomepageBannerService;
import com.yihu.jw.entity.hospital.manage.BaseDiseaseHomepageBannerDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.PatientNoLogin.PREFIX)
@Api(value = "疾病首页图标管理",tags = "疾病首页图标管理")
public class DiseaseHomepageBannerEndPoint extends EnvelopRestEndpoint {
    @Autowired
    private DiseaseHomepageBannerService diseaseHomepageBannerService;
    @ApiOperation("查询疾病首页图标")
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDiseaseHomepageBanner)
    public MixEnvelop findDiseaseHomepageBanner(@ApiParam(name = "id", value = "id", required = false)
                                                 @RequestParam(value = "id", required = false) Integer id,
                                                @ApiParam(name = "name", value = "name", required = false)
                                                 @RequestParam(value = "name", required = false) String name,
                                                @ApiParam(name = "page", value = "page", required = false)
                                                 @RequestParam(value = "page", required = false) Integer page,
                                                @ApiParam(name = "pageSize", value = "pageSize", required = false)
                                                 @RequestParam(value = "pageSize", required = false) Integer pageSize) throws Exception {
        return diseaseHomepageBannerService.findDiseaseHomepageBanner(id, name, page, pageSize);
    }
    @ApiOperation("删除疾病首页图标")
    @PostMapping(value = BaseHospitalRequestMapping.PatientNoLogin.delDiseaseHomepageBanner)
    public Envelop delDiseaseHomepageBanner(@ApiParam(name = "id", value = "id", required = true)
                           @RequestParam(value = "id", required = true) Integer id) {
        diseaseHomepageBannerService.delDiseaseHomepageBanner(id);
        return success();
    }
    @ApiOperation("新增/修改疾病首页图标")
    @PostMapping(value = BaseHospitalRequestMapping.PatientNoLogin.updateDiseaseHomepageBanner)
    public Envelop updateDiseaseHomepageBanner(@ApiParam(name = "json", value = "json", required = true)
                                      @RequestParam(value = "json", required = true) String json) throws Exception {
        BaseDiseaseHomepageBannerDO diseaseHomepageBannerDO = objectMapper.readValue(json, BaseDiseaseHomepageBannerDO.class);
        return success(diseaseHomepageBannerService.updateDiseaseHomepageBanner(diseaseHomepageBannerDO));
    }
}

+ 0 - 60
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/dict/HospitalParameterEndpoint.java

@ -1,60 +0,0 @@
package com.yihu.jw.hospital.endpoint.dict;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.dict.service.HospitalParameterService;
import com.yihu.jw.entity.hospital.dict.BaseHospitalParameterDO;
import com.yihu.jw.entity.hospital.prescription.BaseNationalDrugDictDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.PatientNoLogin.PREFIX)
@Api(value = "系统参数配置", description = "系统参数配置", tags = {"系统参数配置"})
public class HospitalParameterEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private HospitalParameterService hospitalParameterService;
    @Autowired
    private ObjectMapper objectMapper;
    @PostMapping(value = BaseHospitalRequestMapping.PatientNoLogin.createOrUpdateParameter)
    @ApiOperation(value = "保存编辑系统参数")
    public ObjEnvelop createOrUpdateParameter(@ApiParam(name = "jsonData", value = "系统参数json串")
                                       @RequestParam(name = "jsonData", required = true) String jsonData) throws Exception {
        BaseHospitalParameterDO hospitalParameterDO = objectMapper.readValue(jsonData, BaseHospitalParameterDO.class);
        return success(hospitalParameterService.createOrUpdateParameter(hospitalParameterDO));
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.getHospitalParameterList)
    @ApiOperation(value = "获取系统参数列表")
    public MixEnvelop getHospitalParameterList(@ApiParam(name = "name", value = "参数名称或编码")
                                          @RequestParam(name = "name", required = false) String name,
//                                          @ApiParam(name = "number", value = "药品编码")
//                                          @RequestParam(name = "number", required = false) String number,
                                          @ApiParam(name = "hospital", value = "所属机构")
                                          @RequestParam(name = "hospital", required = false) String hospital,
                                          @ApiParam(name = "del", value = "状态")
                                          @RequestParam(name = "del", required = false) Integer del,
                                          @ApiParam(name = "page", value = "当前页")
                                          @RequestParam(name = "page", required = false) Integer page,
                                          @ApiParam(name = "pageSize", value = "页面大小")
                                          @RequestParam(name = "pageSize", required = false) Integer pageSize) throws Exception {
        return hospitalParameterService.getHospitalParameterList(name, hospital, del, page, pageSize);
    }
    @PostMapping(value = BaseHospitalRequestMapping.PatientNoLogin.delHospitalParameter)
    @ApiOperation(value = "删除系统参数")
    public Envelop delHospitalParameter(@ApiParam(name = "id", value = "药品id")
                                            @RequestParam(name = "id", required = true) Integer id){
        hospitalParameterService.delHospitalParameter(id);
        return success();
    }
}

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

@ -11,6 +11,7 @@ import com.yihu.jw.entity.base.dict.DictJobTitleDO;
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.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
@ -39,6 +40,7 @@ import com.yihu.jw.hospital.service.consult.KnowledgeCategoryService;
import com.yihu.jw.hospital.service.consult.QrcodeService;
import com.yihu.jw.hospital.service.consult.SysDictService;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.dao.ConsultTeamDao;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
@ -203,6 +205,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private FileUtil fileUtil;
    @Value("${fastDFS.fastdfs_file_url}")
    private String fastdfs_file_url;
    @Autowired
    private ConsultTeamDao consultTeamDao;
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorByHospitalAndDiseaseAndDept)
    @ApiOperation(value = "根据疾病名称,热门部门查询医生", notes = "根据疾病名称,热门部门查询医生")
@ -1674,4 +1678,50 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        }
        return success(object);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.testJpush)
    @ApiOperation(value = "根据身份证号查询医生", notes = "")
    public Envelop testJPush(@ApiParam(name = "outpatientId", value = "")
                                      @RequestParam(value = "outpatientId", required = false)String outpatientId,
                             @ApiParam(name = "templateCode", value = "")
                             @RequestParam(value = "templateCode", required = false)String templateCode,
                             @ApiParam(name = "drugName", value = "")
                                 @RequestParam(value = "drugName", required = false)String drugName,
                             @ApiParam(name = "mailNo", value = "")
                                 @RequestParam(value = "mailNo", required = false)String mailNo,
                             @ApiParam(name = "mailStatus", value = "")
                                 @RequestParam(value = "mailStatus", required = false)String mailStatus,
                             @ApiParam(name = "prescriptionId", value = "")
                                 @RequestParam(value = "prescriptionId", required = false)String prescriptionId) {
       WlyyOutpatientDO wlyyOutpatientDO =  outpatientDao.findById(outpatientId);
        ConsultTeamDo consultTeamDo = consultTeamDao.queryByRelationCode(outpatientId);
        return success(prescriptionService.wxTempalteJPush(templateCode,wlyyOutpatientDO,consultTeamDo,drugName,mailNo,mailStatus,prescriptionId));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findYkCardCharge)
    @ApiOperation(value = "查询眼科通充值记录", notes = "")
    public MixEnvelop findYkCardCharge(@ApiParam(name = "startTime", value = "")
                             @RequestParam(value = "startTime", required = false)String startTime,
                             @ApiParam(name = "endTime", value = "")
                             @RequestParam(value = "endTime", required = false)String endTime,
                             @ApiParam(name = "orderNo", value = "")
                             @RequestParam(value = "orderNo", required = false)String orderNo,
                             @ApiParam(name = "yktOrderNo", value = "")
                             @RequestParam(value = "yktOrderNo", required = false)String yktOrderNo,
                             @ApiParam(name = "patientName", value = "")
                             @RequestParam(value = "patientName", required = false)String patientName,
                             @ApiParam(name = "idCard", value = "")
                             @RequestParam(value = "idCard", required = false)String idCard,
                                       @ApiParam(name = "medicard", value = "")
                                           @RequestParam(value = "medicard", required = false)String medicard,
                                       @ApiParam(name = "status", value = "")
                                           @RequestParam(value = "status", required = false)Integer status,
                                       @ApiParam(name = "page", value = "")
                                           @RequestParam(value = "page", required = false)Integer page,
                                       @ApiParam(name = "pageSize", value = "")
                                           @RequestParam(value = "pageSize", required = false)Integer pageSize) {
        return businessOrderService.findYktCardCharge(startTime,endTime,orderNo,yktOrderNo,patientName,idCard,medicard,status,page,pageSize);
    }
}

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

@ -299,4 +299,18 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.YkyyPrescription.findDeptByOrgCode)
    @ApiOperation(value = "查询眼科科室信息", notes = "查询眼科科室信息")
    public ListEnvelop findDeptByOrgCode(@ApiParam(name = "orgCode", value = "orgCode")
                                    @RequestParam(value = "orgCode", required = false)String orgCode,
                                        @ApiParam(name = "deptCode", value = "deptCode")
                                        @RequestParam(value = "deptCode", required = false)String deptCode,
                                        @ApiParam(name = "deptName", value = "deptName")
                                            @RequestParam(value = "deptName", required = false)String deptName)throws Exception {
        return success("ok",ykyyEntranceService.findDeptByYq(orgCode,deptCode,deptName));
    }
}

+ 14 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ykyy/YkyyController.java

@ -8,6 +8,7 @@ import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.wechat.enterprise.EnterpriseService;
import com.yihu.jw.wechat.service.WxTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.Map;
/**
@ -40,6 +42,8 @@ public class YkyyController extends EnvelopRestEndpoint {
    private YkyyEntranceService ykyyEntranceService;
    @Autowired
    private WxTemplateService wxTemplateService;
    @Autowired
    private EnterpriseService enterpriseService;
    @Value("${demo.flag}")
    private boolean demoFlag;
@ -429,7 +433,16 @@ public class YkyyController extends EnvelopRestEndpoint {
            @ApiParam(name = "patient", value = "居民code", required = true)
            @RequestParam(value = "patient")String patient,
            @ApiParam(name = "orderType", value = "订单类型(1图文、2电话 3视频)", required = true)
            @RequestParam(value = "orderType")String orderType) throws Exception{
            @RequestParam(value = "orderType")String orderType,
            @ApiParam(name = "enterpriseId", value = "企业号", required = true)
            @RequestParam(value = "enterpriseId")String enterpriseId,
            @ApiParam(name = "content", value = "内容", required = true)
            @RequestParam(value = "content")String content) throws Exception{
        System.out.println("content======"+content);
        content = content.replace("#","%23");
        System.out.println("转换后content"+content);
        String response = enterpriseService.sendMKMesByDoctor(enterpriseId,doctor,content);
        System.out.println("企业模板消息"+response);
        return success(ykyyEntranceService.sendMesToYkt(doctor,patient,orderType));
    }
}

+ 1 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/analysis/AnalysisService.java

@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

+ 74 - 65
svr/svr-internet-hospital/src/main/resources/wechat/weixin_menu.txt

@ -1,67 +1,76 @@
{
"button":[
   {
	  "name":"掌上医院",
	  "type":"miniprogram",
      "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FzsIndex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect",
      "appid":"wx5329829ab3d77bc2",
      "pagepath":"pages/patient/index"
   },
   {
	  "name":"就医问诊",
	  "sub_button":[
	    {
               		"type":"view",
               		"name":"核酸预约申请",
               		"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3a%2f%2fintel.yanketong.com%2fims-wx%2f%23%2fpersonal%2ffamilyMember%2findex%3ftype%3dnucleicTest&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
               },
		 {
         		"type":"view",
         		"name":"预约挂号",
         		"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2Fappointment%2FhospitalList&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
		 {
            	"type":"view",
         	    "name":"充值缴费",
         		"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FmedicalCard%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
		 {
                "type":"view",
               	"name":"专家咨询",
               	"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FnDocList%3Fzjzx%3D2&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
         {
                "type":"view",
                "name":"在线复诊",
                "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FnDocList%3FisFz%3D1&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         }
	  ]
   },
   {
	  "name":"我",
	  "sub_button":[
		 {
                "type":"view",
                "name":"个人中心",
                "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2Fpersonal%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
         {
        		"type":"view",
        		"name":"APP下载",
        		"url":"http://www.yanketong.com/app/yk.htm"
         },
         {
                "type":"view",
                "name":"报告查询",
                "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FonlineCheck%2Findex&response_type=code&scope=snsapi_base&state=1#wechat_redirect"
         },
         {
               	"type":"view",
                "name":"家庭成员管理",
                "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FfamilyControl%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         }
	 ]
  }
]
    "button":[
        {
            "name":"掌上医院",
            "sub_button":[
                {
                    "type":"miniprogram",
                    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FzsIndex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect",
                    "appid":"wx5329829ab3d77bc2",
                    "pagepath":"pages/patient/index",
                    "name":"互联网医院"
                },
                {
                    "type":"view",
                    "url":"https://shop.yanketong.com",
                    "name":"药品商城"
                }
            ]
        },
        {
            "name":"就医问诊",
            "sub_button":[
                {
                    "type":"view",
                    "name":"核酸预约申请",
                    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3a%2f%2fintel.yanketong.com%2fims-wx%2f%23%2fpersonal%2ffamilyMember%2findex%3ftype%3dnucleicTest&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
                },
                {
                    "type":"view",
                    "name":"预约挂号",
                    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2Fappointment%2FhospitalList&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
                },
                {
                    "type":"view",
                    "name":"充值缴费",
                    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FmedicalCard%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
                },
                {
                    "type":"view",
                    "name":"专家咨询",
                    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FnDocList%3Fzjzx%3D2&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
                },
                {
                    "type":"view",
                    "name":"在线复诊",
                    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FnDocList%3FisFz%3D1&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
                }
            ]
        },
        {
            "name":"我",
            "sub_button":[
                {
                    "type":"view",
                    "name":"个人中心",
                    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2Fpersonal%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
                },
                {
                    "type":"view",
                    "name":"APP下载",
                    "url":"http://www.yanketong.com/app/yk.htm"
                },
                {
                    "type":"view",
                    "name":"报告查询",
                    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FonlineCheck%2Findex&response_type=code&scope=snsapi_base&state=1#wechat_redirect"
                },
                {
                    "type":"view",
                    "name":"家庭成员管理",
                    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FfamilyControl%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
                }
            ]
        }
    ]
}

+ 21 - 26
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java

@ -89,48 +89,43 @@ public class RehabilitationManageService {
     */
    public MixEnvelop<Map<String,Object>, Map<String,Object>> findRehabilitationPlan(Integer doctorType,String doctorCode, String diseaseCode, Integer planType,Integer todaybacklog, String patientCondition,Integer page, Integer pageSize) throws Exception{
        String leftSql = "";
        String sql = " select p.*  from wlyy_specialist.wlyy_patient_rehabilitation_plan p  " ;
        String sql = " select DISTINCT p.* " +
                " from wlyy_specialist.wlyy_rehabilitation_plan_detail a INNER JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p " +
                " on a.plan_id = p.id  " ;
        if(doctorType==2){//家医是根据签约关系过滤
            leftSql =" join "+basedb+".wlyy_sign_family f on f.patient=p.patient and f.expenses_status='1' and f.status=1 ";
            leftSql+=" and (f.doctor='"+doctorCode+"' or f.doctor_health='"+doctorCode+"') ";
            sql.replace("from", ",f.idcard,f.hospital_name from");
            sql += leftSql;
            sql+=" INNER JOIN wlyy.wlyy_sign_family f ON f.patient = p.patient \n" +
                    "\tand f.expenses_status=1\n" +
                    "\tAND f.STATUS >= 1 \n" +
                    "\tAND ( f.doctor = '"+doctorCode+"' OR f.doctor_health = '"+doctorCode+"' )  ";
        }
        sql += " where 1=1 ";
        if(todaybacklog!=null&&todaybacklog==1){
            String todayStart = DateUtil.getStringDateShort()+" "+"00:00:00";
            String todayEnd = DateUtil.getStringDateShort()+" "+"23:59:59";
            sql += " and a.execute_time>='"+todayStart+"' and a.execute_time<='"+todayEnd+"'";
        }
        if(planType!=null){
            sql += " and p.plan_type="+planType;
        }
        if(StringUtils.isNotEmpty(diseaseCode)){
            sql+=" and p.disease='"+diseaseCode+"'";
        }
        if(StringUtils.isNotEmpty(patientCondition)){
            sql += " and " + AesEncryptUtils.decryptMysqlNo("p.name") + " like '%"+patientCondition+"%' ";
        if(StringUtils.isNotEmpty(patientCondition)){//姓名idcard模糊查询
            sql +=" AND EXISTS (select code from wlyy.wlyy_patient where  `code` = p.patient and ( `name` LIKE '%"+patientCondition+"%' or idcard like '%"+patientCondition+"%') )";
        }
        if (doctorType==1){
            sql +=" AND (p.create_user = '"+doctorCode+"' \n" +
                    "\tOR a.doctor = '"+doctorCode+"' ) ";
        }
        sql = TransforSqlUtl.wlyy_patient_rehabilitation_planAll2(sql);
        String finalSql = "";
        String todayStart = DateUtil.getStringDateShort()+" "+"00:00:00";
        String todayEnd = DateUtil.getStringDateShort()+" "+"23:59:59";
        String condition ="";
        if(todaybacklog!=null&&todaybacklog==1){
            condition += " and execute_time>='"+todayStart+"' and execute_time<='"+todayEnd+"'";
        }
        finalSql =" select DISTINCT b.* from (select  plan_id,doctor from wlyy_specialist.wlyy_rehabilitation_plan_detail where  1=1 "+condition+") a " +
                " JOIN ("+sql+") b on a.plan_id=b.id ";
        if(doctorType==1){//专科医生是根据计划的创建者字段过滤
            finalSql += " where  b.create_user = '"+doctorCode+"' or a.doctor ='"+doctorCode+"'";
        }
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(finalSql);
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
        int count = 0;
        if(rstotal!=null&&rstotal.size()>0&&rstotal.get(0).get("id")!=null){
            count = rstotal.size();
        }
        finalSql += " ORDER BY b.create_time DESC LIMIT "+(page-1)*pageSize+","+pageSize;
        List<Map<String,Object>> patientRehabilitationPlanDOList = jdbcTemplate.queryForList(finalSql);
        sql += " ORDER BY p.create_time DESC LIMIT "+(page-1)*pageSize+","+pageSize;
        List<Map<String,Object>> patientRehabilitationPlanDOList = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> resultList = new ArrayList<>();
        if(patientRehabilitationPlanDOList.size()>0&&patientRehabilitationPlanDOList.get(0).get("id")!=null){