Sfoglia il codice sorgente

Merge branch '2.0' of http://27.154.233.186:10080/Amoy2/wlyy2.0 into 2.0

wangzhinan 1 anno fa
parent
commit
a6538898e6
21 ha cambiato i file con 612 aggiunte e 424 eliminazioni
  1. 50 33
      business/base-service/src/main/java/com/yihu/jw/article/service/BaseMenuManageService.java
  2. 2 2
      business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java
  3. 2 2
      business/base-service/src/main/java/com/yihu/jw/hospital/integrate/service/BaseHospitalActivityService.java
  4. 25 4
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  5. 4 0
      business/base-service/src/main/java/com/yihu/jw/rehabilitation/ServiceItemPlanDao.java
  6. 26 0
      business/base-service/src/main/java/com/yihu/jw/utils/DmDBUtl.java
  7. 35 1
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  8. 18 0
      common/common-entity/src/db/2024.sql
  9. 36 37
      common/common-entity/src/main/java/com/yihu/jw/entity/base/complaint/BaseComplaintDO.java
  10. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/menu/BaseMenuDictDO.java
  11. 21 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java
  12. 1 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/suggest/BaseSuggestionDO.java
  13. 3 1
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java
  14. 4 3
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/menu/BaseMenuNoLoginEndpoint.java
  15. 18 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/article/ArticleEndpoint.java
  16. 4 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/article/BaseMenuNoLoginEndpoint.java
  17. 2 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  18. 3 3
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/statistics/EsStatisticsEndpoint.java
  19. 5 3
      svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/door/controller/DoorOrderController.java
  20. 2 4
      svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/door/service/DoorOrderService.java
  21. 341 327
      svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/service/RehabilitationInfoService.java

+ 50 - 33
business/base-service/src/main/java/com/yihu/jw/article/service/BaseMenuManageService.java

@ -19,9 +19,11 @@ import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.utils.DmDBUtl;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
@ -60,7 +62,8 @@ public class BaseMenuManageService {
    private KnowledgeArticleDoctorDao knowledgeArticleDoctorDao;
    private KnowledgeArticleDoctorDao knowledgeArticleDoctorDao;
    @Autowired
    @Autowired
    private KnowledgeArticleBrowseDao knowledgeArticleBrowseDao;
    private KnowledgeArticleBrowseDao knowledgeArticleBrowseDao;
    @Value("${wechat.id}")
    private String wxId;
    /**
    /**
     *
     *
@ -743,7 +746,7 @@ public class BaseMenuManageService {
        return list;
        return list;
    }
    }
    public MixEnvelop findArticleByMenuId(String menuId,String title,Integer page,Integer pageSize,String isContent){
    public MixEnvelop findArticleByMenuId(String menuId,String title,Integer page,Integer pageSize,String isContent,String articleType){
        List<String> menuIds = new ArrayList<>();
        List<String> menuIds = new ArrayList<>();
        if (StringUtils.isNoneBlank(menuId)){
        if (StringUtils.isNoneBlank(menuId)){
            String str[]= menuId.split(",");
            String str[]= menuId.split(",");
@ -751,6 +754,20 @@ public class BaseMenuManageService {
                menuIds.add(str[i]);
                menuIds.add(str[i]);
            }
            }
        }
        }
        if(StringUtils.isNotBlank(articleType)){
            if(StringUtils.isBlank(menuId)){
                menuId = "";
            }
            String sqlType = "select * from base_menu_dict where article_type='"+articleType+"' and is_del='1' and status=1";
            List<BaseMenuDictDO> menuDictDOS = jdbcTemplate.query(sqlType,new BeanPropertyRowMapper<>(BaseMenuDictDO.class));
            if(menuDictDOS.size()>0){
                for (BaseMenuDictDO menuDictDO:menuDictDOS){
                    menuIds.add(menuDictDO.getId());
                    menuId +=",";
                }
                menuId = menuId.substring(0,menuId.length()-1);
            }
        }
        System.out.print("menuId"+menuId);
        System.out.print("menuId"+menuId);
        Integer count;
        Integer count;
@ -789,7 +806,7 @@ public class BaseMenuManageService {
                "  read_count,\n" +
                "  read_count,\n" +
                "  collection,\n" +
                "  collection,\n" +
                "  fabulous,\n" +
                "  fabulous,\n" +
                "  comment,\n" +
                DmDBUtl.changeField("comment",wxId)+"  ," +
                "  is_share,\n" +
                "  is_share,\n" +
                "  create_user_name   ,\n" +
                "  create_user_name   ,\n" +
                "  create_user_dept   ,\n" +
                "  create_user_dept   ,\n" +
@ -988,10 +1005,10 @@ public class BaseMenuManageService {
     */
     */
    public List<Map<String,Object>> selectMenuList(String userCode,Integer flag,Integer status){
    public List<Map<String,Object>> selectMenuList(String userCode,Integer flag,Integer status){
        String sql = "SELECT\n" +
        String sql = "SELECT\n" +
                "\tkad.category_first as categoryFirst,\n" +
                "\tkad.category_first_name as categoryFirstName,\n" +
                "\tkad.category_second as categorySecond,\n" +
                "\tkad.category_second_name as categorySecondName \n" +
                "\tkad.category_first as \"categoryFirst\",\n" +
                "\tkad.category_first_name as \"categoryFirstName\",\n" +
                "\tkad.category_second as \"categorySecond\",\n" +
                "\tkad.category_second_name as \"categorySecondName\" \n" +
                "FROM\n" +
                "FROM\n" +
                "\twlyy_knowledge_article_user kau\n" +
                "\twlyy_knowledge_article_user kau\n" +
                "LEFT JOIN wlyy_knowledge_article_dict kad ON kad.id = kau.relation_code\n" +
                "LEFT JOIN wlyy_knowledge_article_dict kad ON kad.id = kau.relation_code\n" +
@ -1013,7 +1030,7 @@ public class BaseMenuManageService {
        if (flag==5){
        if (flag==5){
            condition+=" and kau.is_read = "+status;
            condition+=" and kau.is_read = "+status;
        }
        }
        condition += "  GROUP BY kad.category_first ";
        condition += "  GROUP BY kad.category_first,kad.category_first_name,kad.category_second,kad.category_second_name ";
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql+condition);
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql+condition);
        return mapList;
        return mapList;
    }
    }
@ -1028,22 +1045,22 @@ public class BaseMenuManageService {
     * @return
     * @return
     */
     */
    public JSONObject selectArticleListByCategory(String categoryFirst,String categorySecond,String userCode,Integer flag,Integer status,Integer page,Integer size){
    public JSONObject selectArticleListByCategory(String categoryFirst,String categorySecond,String userCode,Integer flag,Integer status,Integer page,Integer size){
        String sql = "SELECT kad.category_first as categoryFirst,\n" +
                "\tkad.category_first_name as categoryFirstName,\n" +
                "\tkad.category_second as categorySecond,\n" +
                "\tkad.category_second_name as categorySecondName,\n" +
                "\tkad.id as id,\n" +
                "\tkad.title as title,\n" +
                "\tkad.intro as intro,\n" +
                "\tkad.content as content,\n" +
                "\tkad.image as image,\n" +
                "\tkad.img as img,\n" +
                "\tkad.puplish_type as puplishType,\n" +
                "\tkad.puplish_type_name as puplishTypeName,\n" +
                "\tkad.vedio_url as vedioUrl,\n" +
                "\tkad.create_user as createUser,\n" +
                "\tkad.create_user_name as createUserName,\n" +
                "\tkad.source as source \n" +
        String sql = "SELECT kad.category_first as \"categoryFirst\",\n" +
                "\tkad.category_first_name as \"categoryFirstName\",\n" +
                "\tkad.category_second as \"categorySecond\",\n" +
                "\tkad.category_second_name as \"categorySecondName\",\n" +
                "\tkad.id as \"id\",\n" +
                "\tkad.title as \"title\",\n" +
                "\tkad.intro as \"intro\",\n" +
                "\tkad.content as \"content\",\n" +
                "\tkad.image as \"image\",\n" +
                "\tkad.img as \"img\",\n" +
                "\tkad.puplish_type as \"puplishType\",\n" +
                "\tkad.puplish_type_name as \"puplishTypeName\",\n" +
                "\tkad.vedio_url as \"vedioUrl\",\n" +
                "\tkad.create_user as \"createUser\",\n" +
                "\tkad.create_user_name as \"createUserName\",\n" +
                "\tkad.source as \"source\" \n" +
                "FROM\n" +
                "FROM\n" +
                "\twlyy_knowledge_article_user kau\n" +
                "\twlyy_knowledge_article_user kau\n" +
                "LEFT JOIN wlyy_knowledge_article_dict kad ON kad.id = kau.relation_code  \n" +
                "LEFT JOIN wlyy_knowledge_article_dict kad ON kad.id = kau.relation_code  \n" +
@ -1143,18 +1160,18 @@ public class BaseMenuManageService {
        String orderBy = "  order by create_time desc  ";
        String orderBy = "  order by create_time desc  ";
        String condition = " ";
        String condition = " ";
        String sql = "SELECT\n" +
        String sql = "SELECT\n" +
                "\tid,\n" +
                "\tbase_article_doctor_id baseArticleDoctorId,\n" +
                "\trelation_code AS relationCode,\n" +
                "\trelation_type AS relationType,\n" +
                "\tuser,\n" +
                "\tuser_name AS userName,\n" +
                "\ttype,\n" +
                "\tid as \"id\",\n" +
                "\tbase_article_doctor_id as \"baseArticleDoctorId\",\n" +
                "\trelation_code AS \"relationCode\",\n" +
                "\trelation_type AS \"relationType\",\n" +
                "\tuser as \"user\",\n" +
                "\tuser_name AS \"userName\",\n" +
                "\ttype as \"type\",\n" +
                "\tdate_format(\n" +
                "\tdate_format(\n" +
                "\t\tcreate_time,\n" +
                "\t\tcreate_time,\n" +
                "\t\t'%Y-%m-%d %H:%i:%S'\n" +
                "\t\t'%Y-%m-%d %H:%i:%S'\n" +
                "\t) AS createTime,\n" +
                "\tcontent\n" +
                "\t) AS \"createTime\",\n" +
                "\tcontent as \"content\"\n" +
                "FROM\n" +
                "FROM\n" +
                "\tbase_knowledge_article_doctor\n" +
                "\tbase_knowledge_article_doctor\n" +
                "WHERE\n" +
                "WHERE\n" +

+ 2 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java

@ -933,7 +933,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
    public List<Map<String,Object>> findFamilyByPatientId(String patientId) throws ParseException {
    public List<Map<String,Object>> findFamilyByPatientId(String patientId) throws ParseException {
        if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
        if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
            String sql = "select t.id as \"id\",t.card_type as \"cardType\", " +
            String sql = "select t.id as \"id\",t.card_type as \"cardType\", " +
                    "t.patient as \"patient\",b.name as \"name\",b.sex as \"sex\","+
                    "t.patient as \"patient\",b.name as \"name\",b.sex as \"sex\",b.mobile as \"mobile\","+
                    "to_char(b.birthday,'yyyy-MM-dd') as\"birthday\",b.idcard as \"idcard\",t.clinicid as \"clinicid\"," +
                    "to_char(b.birthday,'yyyy-MM-dd') as\"birthday\",b.idcard as \"idcard\",t.clinicid as \"clinicid\"," +
                    "t.family_member as \"familyMember\",c.relation_name as \"relationName\" "+
                    "t.family_member as \"familyMember\",c.relation_name as \"relationName\" "+
                    " from wlyy_patient_family_member t left join base_patient b" +
                    " from wlyy_patient_family_member t left join base_patient b" +
@ -967,7 +967,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
        }else {
        }else {
            String sql = "select t.id as \"id\",t.card_type as \"cardType\", " +
            String sql = "select t.id as \"id\",t.card_type as \"cardType\", " +
                    "t.patient as \"patient\",b.name as \"name\",b.sex as \"sex\","+
                    "t.patient as \"patient\",b.name as \"name\",b.sex as \"sex\","+
                    "b.birthday as\"birthday\",b.idcard as \"idcard\",b.mobile," +
                    "b.birthday as\"birthday\",b.idcard as \"idcard\",b.mobile as \"mobile\"," +
                    "t.family_member as \"familyMember\",c.relation_name as \"relationName\" "+
                    "t.family_member as \"familyMember\",c.relation_name as \"relationName\" "+
                    " from wlyy_patient_family_member t left join base_patient b" +
                    " from wlyy_patient_family_member t left join base_patient b" +
                    " on t.family_member = b.id left join base_patient_member_dict c on t.family_relation=c.id where 1=1 and t.is_del=1 ";
                    " on t.family_member = b.id left join base_patient_member_dict c on t.family_relation=c.id where 1=1 and t.is_del=1 ";

+ 2 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/integrate/service/BaseHospitalActivityService.java

@ -6,7 +6,6 @@ import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.hospital.integrate.BaseHospitalActivityDO;
import com.yihu.jw.entity.hospital.integrate.BaseHospitalActivityDO;
import com.yihu.jw.entity.hospital.integrate.BaseHospitalGoodsDO;
import com.yihu.jw.entity.hospital.integrate.BaseHospitalIntegrateDO;
import com.yihu.jw.entity.hospital.integrate.BaseHospitalIntegrateDO;
import com.yihu.jw.entity.hospital.integrate.BaseHospitalUserActivityDO;
import com.yihu.jw.entity.hospital.integrate.BaseHospitalUserActivityDO;
import com.yihu.jw.hospital.integrate.dao.BaseHospitalActivityDao;
import com.yihu.jw.hospital.integrate.dao.BaseHospitalActivityDao;
@ -169,7 +168,8 @@ public class BaseHospitalActivityService extends BaseJpaService<BaseHospitalActi
     * 查询活动列表
     * 查询活动列表
     */
     */
    public MixEnvelop selectByCondition(String title, Integer page, Integer size,Integer flag,Integer status,String startTime,String endTime,String user,String userId){
    public MixEnvelop selectByCondition(String title, Integer page, Integer size,Integer flag,Integer status,String startTime,String endTime,String user,String userId){
        String orderBy = "  order by sort asc,create_time desc  ";
//        String orderBy = "  order by sort asc,create_time desc  ";
        String orderBy = "  order by create_time desc  ";
        String condition = " ";
        String condition = " ";
        String sql = "SELECT\n" +
        String sql = "SELECT\n" +
                "\tid,\n" +
                "\tid,\n" +

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

@ -31,6 +31,7 @@ import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.servicePackage.ServiceItemPlanDO;
import com.yihu.jw.entity.base.words.BaseSensitiveDO;
import com.yihu.jw.entity.base.words.BaseSensitiveDO;
import com.yihu.jw.entity.base.wx.*;
import com.yihu.jw.entity.base.wx.*;
import com.yihu.jw.entity.base.yx.YxTokenMappingDO;
import com.yihu.jw.entity.base.yx.YxTokenMappingDO;
@ -76,6 +77,7 @@ import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.*;
import com.yihu.jw.hospital.prescription.service.entrance.*;
import com.yihu.jw.hospital.prescription.service.useragent.BaseUserAgent;
import com.yihu.jw.hospital.prescription.service.useragent.BaseUserAgent;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.pay.ylz.YlzPayService;
import com.yihu.jw.order.pay.ylz.YlzPayService;
@ -83,6 +85,7 @@ import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BaseDoctorPatientFollowDao;
import com.yihu.jw.patient.dao.BaseDoctorPatientFollowDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.rehabilitation.ServiceItemPlanDao;
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
import com.yihu.jw.restmodel.base.org.BaseOrgVO;
import com.yihu.jw.restmodel.base.org.BaseOrgVO;
import com.yihu.jw.restmodel.hospital.archive.ArchiveVO;
import com.yihu.jw.restmodel.hospital.archive.ArchiveVO;
@ -96,6 +99,7 @@ import com.yihu.jw.sms.service.ZhongShanSMSService;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.encrypt.MD5;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.utils.*;
import com.yihu.jw.utils.*;
@ -111,9 +115,6 @@ import com.yihu.jw.wechat.enterprise.EnterpriseService;
import com.yihu.jw.wechat.service.BaseSensitiveFilterWordsService;
import com.yihu.jw.wechat.service.BaseSensitiveFilterWordsService;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import com.yihu.jw.yx.dao.YxTokenMappingDao;
import com.yihu.jw.yx.dao.YxTokenMappingDao;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.util.encrypt.MD5;
import com.ylzinfo.ehc.EhcHandler;
import com.ylzinfo.ehc.EhcHandler;
import com.ylzinfo.ehc.common.utils.DateUtils;
import com.ylzinfo.ehc.common.utils.DateUtils;
import com.ylzinfo.ehc.trans.TransRequest;
import com.ylzinfo.ehc.trans.TransRequest;
@ -338,6 +339,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private ZhongShanSMSService zhongShanSMSService;
    private ZhongShanSMSService zhongShanSMSService;
    @Autowired
    @Autowired
    private BaseDictIcd10Dao dictIcd10Dao;
    private BaseDictIcd10Dao dictIcd10Dao;
    @Autowired
    private ServiceItemPlanDao serviceItemPlanDao;
    public static String entranceUrl = "http://172.16.100.240:10023/xzzx/";
    public static String entranceUrl = "http://172.16.100.240:10023/xzzx/";
@ -1167,6 +1170,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }else if ("3".equalsIgnoreCase(outpatient.getOutpatientType())){
        }else if ("3".equalsIgnoreCase(outpatient.getOutpatientType())){
            BusinessOrderDO businessOrderDO = businessOrderService.recharge(outpatient.getId(), "专家咨询费", "1", "专家咨询费", outpatient.getConsumer(), outpatient.getConsumerName(), outpatient.getDoctor(), price);
            BusinessOrderDO businessOrderDO = businessOrderService.recharge(outpatient.getId(), "专家咨询费", "1", "专家咨询费", outpatient.getConsumer(), outpatient.getConsumerName(), outpatient.getDoctor(), price);
        }else if ("4".equalsIgnoreCase(outpatient.getOutpatientType())){
        }else if ("4".equalsIgnoreCase(outpatient.getOutpatientType())){
            ServiceItemPlanDO serviceItemPlanDO = serviceItemPlanDao.findById(outpatient.getPlanId()).orElse(null);
            if(serviceItemPlanDO!=null){
                if(!org.springframework.util.StringUtils.isEmpty(serviceItemPlanDO.getRelationCode())){
                    throw new RuntimeException("该计划已发起过咨询,请选择其他计划发起!");
                }
                serviceItemPlanDO.setStatus("3");
                serviceItemPlanDO.setRelationCode(outpatient.getId());
                serviceItemPlanDao.save(serviceItemPlanDO);
            }
            BusinessOrderDO businessOrderDO = businessOrderService.recharge(outpatient.getId(), "康复咨询费", "6", "康复咨询费", outpatient.getConsumer(), outpatient.getConsumerName(), outpatient.getDoctor(), price);
            BusinessOrderDO businessOrderDO = businessOrderService.recharge(outpatient.getId(), "康复咨询费", "6", "康复咨询费", outpatient.getConsumer(), outpatient.getConsumerName(), outpatient.getDoctor(), price);
        }
        }
@ -7024,6 +7036,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if(StringUtils.isNoneBlank(patientid)){
        if(StringUtils.isNoneBlank(patientid)){
            sql+=" , follow.id AS \"followid\" " ;
            sql+=" , follow.id AS \"followid\" " ;
        }
        }
        sql += ",evaluate.score,a.total";
        sql+=" FROM " +
        sql+=" FROM " +
                " base_doctor d " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
@ -7167,7 +7180,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            params.put("consultStatus", consultStatus);
            params.put("consultStatus", consultStatus);
        }
        }
        String groupBy = " group by d.id ";//同一个医生在不同科室的时候只展示一个
        String groupBy = " group by d.id,d.photo , d.name, d.expertise ,d.introduce ," +
                "d.job_title_code ,  d.job_title_name , d.charge_type ," +
                "h.dept_name , dw.workTotal , d.consult_status ," +
                "d.outpatient_type , a.total , h.org_name ," +
                "h.org_code ";//同一个医生在不同科室的时候只展示一个
        if(StringUtils.isNoneBlank(patientid)){
            groupBy+=" , follow.id" ;
        }
        groupBy += ", evaluate.score,a.total";
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("isSort").orElse(null);//isSort:1按照后台顺序,0按照系统排序
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("isSort").orElse(null);//isSort:1按照后台顺序,0按照系统排序
        if (hospitalSysDictDO!=null&&hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
        if (hospitalSysDictDO!=null&&hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
            sql +=" and d.del='1' "+groupBy+" order by d.sort asc  ";
            sql +=" and d.del='1' "+groupBy+" order by d.sort asc  ";

+ 4 - 0
business/base-service/src/main/java/com/yihu/jw/rehabilitation/ServiceItemPlanDao.java

@ -29,4 +29,8 @@ public interface ServiceItemPlanDao extends PagingAndSortingRepository<ServiceIt
    @Modifying
    @Modifying
    @Query(value ="UPDATE  base_service_item_plan SET status='1' ,complete_time=?3 WHERE status='0' AND plan_id=?1 AND plan_detail_id=?2 ORDER BY plan_time DESC LIMIT 1", nativeQuery = true)
    @Query(value ="UPDATE  base_service_item_plan SET status='1' ,complete_time=?3 WHERE status='0' AND plan_id=?1 AND plan_detail_id=?2 ORDER BY plan_time DESC LIMIT 1", nativeQuery = true)
    void updateState(String planId, String planDetailId, Date date);
    void updateState(String planId, String planDetailId, Date date);
    @Modifying
    @Query(value ="UPDATE  base_service_item_plan SET status='1' ,complete_time=?2 WHERE id=?1 ", nativeQuery = true)
    void updateState(String id, Date date);
}
}

+ 26 - 0
business/base-service/src/main/java/com/yihu/jw/utils/DmDBUtl.java

@ -0,0 +1,26 @@
package com.yihu.jw.utils;
import org.apache.commons.lang3.StringUtils;
/**
 * 达梦数据据看
 * Created by yeshijie on 2024/1/8.
 */
public class DmDBUtl {
    /**
     * 达梦数据库的关键字是双引号(""),而mysql的关键字是反引号(``),所以一些sql的字段加了关键字的,只能做下替换。
     * @param field
     * @param wxId
     * @return
     */
    public static String changeField(String field,String wxId){
        if(StringUtils.isBlank(field)){
            return "";
        }
        if("xm_qsyy_wx".equals(wxId)){
            field = "\""+field.toUpperCase()+"\"";
        }
        return field;
    }
}

+ 35 - 1
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -1831,6 +1831,17 @@ public class ImService {
                }
                }
                outpatientDao.save(wlyyOutpatientDO);
                outpatientDao.save(wlyyOutpatientDO);
                //结束康复执行计划
                ServiceItemPlanDO serviceItemPlanDO = serviceItemPlanDao.findById(wlyyOutpatientDO.getPlanId()).orElse(null);
                if(serviceItemPlanDO!=null){
                    if(!org.springframework.util.StringUtils.isEmpty(serviceItemPlanDO.getRelationCode())){
                        throw new RuntimeException("该计划已发起过咨询,请选择其他计划发起!");
                    }
                    serviceItemPlanDO.setStatus("1");
                    serviceItemPlanDO.setCompleteTime(DateUtil.getStringDate());
                    serviceItemPlanDao.save(serviceItemPlanDO);
                    updPlanStatus(serviceItemPlanDO.getPlanId(),serviceItemPlanDO.getPlanDetailId());
                }
            }
            }
            List<WlyyHospitalWaitingRoomDO> wlyyHospitalWaitingRoomDOS = hospitalWaitingRoomDao.findByOutpatientId(cons.getRelationCode());
            List<WlyyHospitalWaitingRoomDO> wlyyHospitalWaitingRoomDOS = hospitalWaitingRoomDao.findByOutpatientId(cons.getRelationCode());
@ -1870,6 +1881,23 @@ public class ImService {
        return 1;
        return 1;
    }
    }
    //康复计划状态更新
    public void updPlanStatus(String planId, String planDetailId) {
        List<ServiceItemPlanDO> itemPlanDOS = serviceItemPlanDao.findByPlanDetailId(planDetailId, "0");
        if (itemPlanDOS.size() > 0) {
            //服务项计划都完成了
            jdbcTemplate.update("update wlyy_rehabilitation_plan_detail set status=1 where id='" + planDetailId + "'");
            String sql = "SELECT COUNT(*) total,COUNT(if(`status`=1,1,null)) num from wlyy_rehabilitation_plan_detail  " +
                    "WHERE plan_id='" + planId + "'";
            List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
            String total = list.get(0).get("total") + "";
            String num = list.get(0).get("num") + "";
            if (total.equals(num)) {
                jdbcTemplate.update("update wlyy_patient_rehabilitation_plan set status=2 where id='" + planId + "'");
            }
        }
    }
    /**
    /**
     * 居民取消复诊
     * 居民取消复诊
     *
     *
@ -4180,6 +4208,7 @@ public class ImService {
                "op.medical_state as \"medicalState\"  ," +
                "op.medical_state as \"medicalState\"  ," +
                "bop.status as \"payStatus1\" ," +
                "bop.status as \"payStatus1\" ," +
                "op.patient_cancel_value as \"patientCancelValue\" ," +
                "op.patient_cancel_value as \"patientCancelValue\" ," +
                "op.plan_doctor as \"planDoctor\" ," +
                "op.patient_cancel_remark as \"patient_cancel_remark\"  " +
                "op.patient_cancel_remark as \"patient_cancel_remark\"  " +
                "FROM wlyy_outpatient op LEFT JOIN wlyy_consult a  ON a.relation_code = op.id \n" +
                "FROM wlyy_outpatient op LEFT JOIN wlyy_consult a  ON a.relation_code = op.id \n" +
                " LEFT join base_business_order_pay bop on bop.relation_code = op.id" +
                " LEFT join base_business_order_pay bop on bop.relation_code = op.id" +
@ -4197,7 +4226,12 @@ public class ImService {
        }
        }
        if (org.apache.commons.lang.StringUtils.isNotBlank(doctor)) {
        if (org.apache.commons.lang.StringUtils.isNotBlank(doctor)) {
            sql += " AND op.doctor='" + doctor + "' ";
            if("28".equals(type)){
                sql += " AND (op.doctor='" + doctor + "' or op.plan_doctor='"+doctor+"')";
            }else {
                sql += " AND op.doctor='" + doctor + "' ";
            }
        }
        }
        if (org.apache.commons.lang.StringUtils.isNotBlank(patient)) {
        if (org.apache.commons.lang.StringUtils.isNotBlank(patient)) {
            sql += " AND (op.consumer='" + patient + "' or op.patient ='" + patient + "')";
            sql += " AND (op.consumer='" + patient + "' or op.patient ='" + patient + "')";

+ 18 - 0
common/common-entity/src/db/2024.sql

@ -0,0 +1,18 @@
ALTER table wlyy_outpatient add COLUMN `plan_id` varchar(50) DEFAULT NULL COMMENT '康复执行计划关联id';
ALTER table wlyy_outpatient add COLUMN `plan_doctor` varchar(50) DEFAULT NULL COMMENT '康复执行计划负责人id';
--中山医院那套有就不加了 ALTER table base_suggestion add COLUMN `suggest_user_idcard` varchar(50) DEFAULT NULL COMMENT '投诉人身份证';
-- ALTER table base_suggestion add COLUMN `user_idcard_front` varchar(255) DEFAULT NULL COMMENT '投诉人身份证正面url';
-- ALTER table base_suggestion add COLUMN `user_idcard_bak` varchar(255) DEFAULT NULL COMMENT '投诉人身份证反面url';
-- ALTER table base_suggestion add COLUMN `vitist_type` varchar(50) DEFAULT NULL COMMENT '就诊类型 1门诊 2住院';
-- ALTER table base_suggestion add COLUMN `vitist_time` varchar(50) DEFAULT NULL COMMENT '就诊时间';
-- ALTER table base_suggestion add COLUMN `vitist_dept_code` varchar(50) DEFAULT NULL COMMENT '就诊科室编码';
-- ALTER table base_suggestion add COLUMN `vitist_detp_name` varchar(50) DEFAULT NULL COMMENT '就诊科室名称';
-- ALTER table base_suggestion add COLUMN `admission_no` varchar(50) DEFAULT NULL COMMENT '住院号';
ALTER table base_menu_dict add COLUMN `article_type` varchar(2) DEFAULT NULL COMMENT '文章类型 公告、广告、文章、帮助中心 article_menu_type';
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('article_menu_type1', NULL, 'article_menu_type', '1', '公告', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '文章类型 公告、广告、文章、帮助中心');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('article_menu_type2', NULL, 'article_menu_type', '2', '广告', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '文章类型 公告、广告、文章、帮助中心');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('article_menu_type3', NULL, 'article_menu_type', '3', '文章', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '文章类型 公告、广告、文章、帮助中心');
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('article_menu_type4', NULL, 'article_menu_type', '4', '帮助中心', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '文章类型 公告、广告、文章、帮助中心');

+ 36 - 37
common/common-entity/src/main/java/com/yihu/jw/entity/base/complaint/BaseComplaintDO.java

@ -2,7 +2,6 @@ package com.yihu.jw.entity.base.complaint;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Entity;
@ -10,32 +9,36 @@ import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Transient;
import java.util.Date;
import java.util.Date;
/**
 * 投诉反馈,中山和73医院
 */
@Entity
@Entity
@Table(name = "base_complaint")
@Table(name = "base_complaint")
public class BaseComplaintDO  extends UuidIdentityEntity {
public class BaseComplaintDO  extends UuidIdentityEntity {
    private String complaintId;
    private String complaintName;
    private String complaintContent;
    private String visitType;
    private String complaintId;//'投诉类型id'
    private String complaintName;//'投诉类型名称'
    private String complaintContent;//'投诉内容'
    private String visitType;//'就诊类型1门诊2住院'
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date visitTime;
    private String visitDept;
    private String visitDeptName;
    private String admNo;
    private String patient;
    private String patientName;
    private String patientIdcard;
    private String idcardFront;
    private String idcardBack;
    private String imgUrl;
    private String isDel;
    private String status;
    private String mobile;
    private String visitTypeName;
    private Date visitTime;//'就诊时间'
    private String visitDept;//'就诊科室'
    private String visitDeptName;//'就诊科室名称'
    private String admNo;//'住院号'
    private String patient;//'投诉人id'
    private String patientName;//'投诉人姓名'
    private String patientIdcard;//'投诉人身份证号'
    private String idcardFront;//'身份证正面地址'
    private String idcardBack;//'身份证背面地址'
    private String imgUrl;//'投诉图片地址多个逗号隔开'
    private String isDel;//'0删除1正常'
    private String status;//'0已投诉1已接收2已反馈'
    private String mobile;//
    private String visitTypeName;//
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date latestFeedTime;
    private String passto;
    private String defaultdoctor;
    private Date latestFeedTime;//
    private String passto;//
    private String defaultdoctor;//
    @Column(name = "defaultdoctor")
    @Column(name = "defaultdoctor")
    public String getDefaultdoctor() {
    public String getDefaultdoctor() {
        return defaultdoctor;
        return defaultdoctor;
@ -45,9 +48,6 @@ public class BaseComplaintDO  extends UuidIdentityEntity {
        this.defaultdoctor = defaultdoctor;
        this.defaultdoctor = defaultdoctor;
    }
    }
    @Column(name = "passto")
    @Column(name = "passto")
    public String getPassto() {
    public String getPassto() {
        return passto;
        return passto;
@ -80,25 +80,24 @@ public class BaseComplaintDO  extends UuidIdentityEntity {
        return mobile;
        return mobile;
    }
    }
    public void setMobile(String mobile) {
    public void setMobile(String mobile) {
        this.mobile = mobile;
        this.mobile = mobile;
    }
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date createTime;
    private Date createTime;//'创建时间'
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date acceptTime;
    private Date acceptTime;//'接收时间'
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date dealTime;
    private String operator;
    private String operatorName;
    private String operatorDept;
    private String operatorDeptName;
    private String feedBack;
    private String feedImg;
    private String acceptor;
    private String acceptorName;
    private Date dealTime;//'处理时间'
    private String operator;//'操作人'
    private String operatorName;//'操作人姓名'
    private String operatorDept;//'操作人科室'
    private String operatorDeptName;//'操作人科室名称'
    private String feedBack;//'反馈内容'
    private String feedImg;//'反馈图片地址'
    private String acceptor;//'接收人'
    private String acceptorName;//'接收人名称'
    @Column(name = "operator_dept")
    @Column(name = "operator_dept")
    public String getOperatorDept() {
    public String getOperatorDept() {
        return operatorDept;
        return operatorDept;

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/menu/BaseMenuDictDO.java

@ -34,6 +34,7 @@ public class BaseMenuDictDO extends UuidIdentityEntityWithOperator {
    private String menuTitle;//标题
    private String menuTitle;//标题
    private String describtion;//描述
    private String describtion;//描述
    private Integer type;//类型 1 官网菜单 2app文章菜单
    private Integer type;//类型 1 官网菜单 2app文章菜单
    private String articleType;//文章类型 1公告、2广告、3文章、4帮助中心 article_menu_type
    private List<BaseDoctorDO> doctorList;//推荐医生
    private List<BaseDoctorDO> doctorList;//推荐医生
    private Integer collection;//收藏数量
    private Integer collection;//收藏数量
@ -271,4 +272,13 @@ public class BaseMenuDictDO extends UuidIdentityEntityWithOperator {
    public void setIsFabulous(String isFabulous) {
    public void setIsFabulous(String isFabulous) {
        this.isFabulous = isFabulous;
        this.isFabulous = isFabulous;
    }
    }
    @Column(name = "article_type")
    public String getArticleType() {
        return articleType;
    }
    public void setArticleType(String articleType) {
        this.articleType = articleType;
    }
}
}

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

@ -300,6 +300,9 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    private String medicalState;//医保状态(1医保0不用医保)
    private String medicalState;//医保状态(1医保0不用医保)
    private String planId;//康复执行计划关联id
    private String planDoctor;//康复执行计划负责人id
    @Column(name = "medical_state")
    @Column(name = "medical_state")
    public String getMedicalState() {
    public String getMedicalState() {
        return medicalState;
        return medicalState;
@ -826,4 +829,22 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    public void setChannelId(String channelId) {
    public void setChannelId(String channelId) {
        this.channelId = channelId;
        this.channelId = channelId;
    }
    }
    @Column(name = "plan_id")
    public String getPlanId() {
        return planId;
    }
    public void setPlanId(String planId) {
        this.planId = planId;
    }
    @Column(name = "plan_doctor")
    public String getPlanDoctor() {
        return planDoctor;
    }
    public void setPlanDoctor(String planDoctor) {
        this.planDoctor = planDoctor;
    }
}
}

+ 1 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/suggest/BaseSuggestionDO.java

@ -8,6 +8,7 @@ import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Transient;
/**
/**
 * 意见反馈
 * Created by wj on 2020/0811.
 * Created by wj on 2020/0811.
 */
 */
@Entity
@Entity

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

@ -429,7 +429,9 @@ public class BasicZuulFilter extends ZuulFilter {
                    "declare|sitename|net user|xp_cmdshell|or|create|" +
                    "declare|sitename|net user|xp_cmdshell|or|create|" +
                    "table|from|grant|use|group_concat|column_name|" +
                    "table|from|grant|use|group_concat|column_name|" +
                    "information_schema.columns|table_schema|union|where|order|by|like|" ;//过滤掉的sql关键字,可以手动添加
                    "information_schema.columns|table_schema|union|where|order|by|like|" ;//过滤掉的sql关键字,可以手动添加
            return str.matches(badStr);
            boolean flag = str.matches(badStr);
            logger.info("sqlValidate===:"+flag);
            return flag;
        }else {
        }else {
            return true;
            return true;
        }
        }

+ 4 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/menu/BaseMenuNoLoginEndpoint.java

@ -3,7 +3,6 @@ package com.yihu.jw.base.endpoint.menu;
import com.yihu.jw.article.dao.KnowledgeArticleDictDao;
import com.yihu.jw.article.dao.KnowledgeArticleDictDao;
import com.yihu.jw.article.service.BaseMenuManageService;
import com.yihu.jw.article.service.BaseMenuManageService;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDictDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDictDO;
import com.yihu.jw.healthCare.utils.StringUtils;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.base.BaseRequestMapping;
@ -63,17 +62,19 @@ public class BaseMenuNoLoginEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "查询文章")
    @ApiOperation(value = "查询文章")
    public Envelop findArticleByMenuid(
    public Envelop findArticleByMenuid(
            @ApiParam(name = "menuId", value = "menuId", required = false)
            @ApiParam(name = "menuId", value = "menuId", required = false)
            @RequestParam(value = "menuId",required = true) String menuId,
            @RequestParam(value = "menuId",required = false) String menuId,
            @ApiParam(name = "title", value = "menuId", required = false)
            @ApiParam(name = "title", value = "menuId", required = false)
            @RequestParam(value = "title",required = false) String title,
            @RequestParam(value = "title",required = false) String title,
            @ApiParam(name = "isContent", value = "是否返回内容 1是0否", required = false)
            @ApiParam(name = "isContent", value = "是否返回内容 1是0否", required = false)
            @RequestParam(value = "isContent",required = false) String isContent,
            @RequestParam(value = "isContent",required = false) String isContent,
            @ApiParam(name = "articleType", value = "文章类型", required = false)
            @RequestParam(value = "articleType",required = false) String articleType,
            @ApiParam(name = "page", value = "page", required = false)
            @ApiParam(name = "page", value = "page", required = false)
            @RequestParam(value = "page",required = true) Integer page,
            @RequestParam(value = "page",required = true) Integer page,
            @ApiParam(name = "pageSize", value = "pageSize", required = false)
            @ApiParam(name = "pageSize", value = "pageSize", required = false)
            @RequestParam(value = "pageSize",required = true) Integer pageSize) {
            @RequestParam(value = "pageSize",required = true) Integer pageSize) {
        try {
        try {
            return success(menuService.findArticleByMenuId(menuId,title,page,pageSize,isContent));
            return success(menuService.findArticleByMenuId(menuId,title,page,pageSize,isContent,articleType));
        }catch (Exception e){
        }catch (Exception e){
            return failedException(e);
            return failedException(e);
        }
        }

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

@ -2,11 +2,13 @@ package com.yihu.jw.hospital.endpoint.article;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.article.dao.KnowledgeArticleDictDao;
import com.yihu.jw.article.dao.KnowledgeArticleUserDao;
import com.yihu.jw.article.dao.KnowledgeArticleUserDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.patient.BasePatientBusinessDO;
import com.yihu.jw.entity.base.patient.BasePatientBusinessDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDictDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
import com.yihu.jw.entity.hospital.article.KnowledgeCategoryDO;
import com.yihu.jw.entity.hospital.article.KnowledgeCategoryDO;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleDao;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleDao;
@ -55,6 +57,8 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
	private KnowledgeArticleUserDao knowledgeArticleUserDao;
	private KnowledgeArticleUserDao knowledgeArticleUserDao;
	@Autowired
	@Autowired
	private KnowledgeArticleDao knowledgeArticleDao;
	private KnowledgeArticleDao knowledgeArticleDao;
	@Autowired
	private KnowledgeArticleDictDao knowledgeArticleDictDao;
	
	
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchKnowledgePageList)
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchKnowledgePageList)
	@ApiOperation(value = "获取文章列表")
	@ApiOperation(value = "获取文章列表")
@ -111,6 +115,20 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "id", required = true)String id) throws Exception{
			@RequestParam(value = "id", required = true)String id) throws Exception{
			try {
			try {
				KnowledgeArticleDO articleDO = knowledgeArticleDao.findById(id).orElse(null);
				KnowledgeArticleDO articleDO = knowledgeArticleDao.findById(id).orElse(null);
				if(articleDO==null){
					KnowledgeArticleDictDO articleDictDO = knowledgeArticleDictDao.findByIdAndDel(id);
					KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(articleDictDO.getId(),getUID());
					if (knowledgeArticleUserDO!=null){
						articleDictDO.setIsUsed(knowledgeArticleUserDO.getUsed());
						articleDictDO.setKnowledgeArticleUserDO(knowledgeArticleUserDO);
					}
					List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(articleDictDO.getCreateUser());
					if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
						articleDictDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
						articleDictDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
					}
					return success(articleDictDO);
				}
				KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(articleDO.getId(),getUID());
				KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(articleDO.getId(),getUID());
				if (knowledgeArticleUserDO!=null){
				if (knowledgeArticleUserDO!=null){
					articleDO.setIsUsed(knowledgeArticleUserDO.getUsed());
					articleDO.setIsUsed(knowledgeArticleUserDO.getUsed());

+ 4 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/article/BaseMenuNoLoginEndpoint.java

@ -64,7 +64,9 @@ public class BaseMenuNoLoginEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "查询文章")
    @ApiOperation(value = "查询文章")
    public Envelop findArticleByMenuid(
    public Envelop findArticleByMenuid(
            @ApiParam(name = "menuId", value = "menuId", required = false)
            @ApiParam(name = "menuId", value = "menuId", required = false)
            @RequestParam(value = "menuId",required = true) String menuId,
            @RequestParam(value = "menuId",required = false) String menuId,
            @ApiParam(name = "articleType", value = "文章类型", required = false)
            @RequestParam(value = "articleType",required = false) String articleType,
            @ApiParam(name = "title", value = "menuId", required = false)
            @ApiParam(name = "title", value = "menuId", required = false)
            @RequestParam(value = "title",required = false) String title,
            @RequestParam(value = "title",required = false) String title,
            @ApiParam(name = "page", value = "page", required = false)
            @ApiParam(name = "page", value = "page", required = false)
@ -72,7 +74,7 @@ public class BaseMenuNoLoginEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "pageSize", value = "pageSize", required = false)
            @ApiParam(name = "pageSize", value = "pageSize", required = false)
            @RequestParam(value = "pageSize",required = true) Integer pageSize) {
            @RequestParam(value = "pageSize",required = true) Integer pageSize) {
        try {
        try {
            return success(menuService.findArticleByMenuId(menuId,title,page,pageSize,"0"));
            return success(menuService.findArticleByMenuId(menuId,title,page,pageSize,"0",articleType));
        }catch (Exception e){
        }catch (Exception e){
            return failedException(e);
            return failedException(e);
        }
        }

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

@ -590,7 +590,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
   /*     try {*/
   /*     try {*/
            WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisit(outpatientJson, expressageJson, registerJson, chargeType);
            WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisit(outpatientJson, expressageJson, registerJson, chargeType);
            if (wlyyOutpatientDO != null && null == wlyyOutpatientDO.getId() && !wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("3")) {
            if (wlyyOutpatientDO != null && null == wlyyOutpatientDO.getId() && !wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("3")
                    && !wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("4")) {
                ObjEnvelop objEnvelop = new ObjEnvelop();
                ObjEnvelop objEnvelop = new ObjEnvelop();
                String msg = "";
                String msg = "";
                if (1 == wlyyOutpatientDO.getRemindCount()) {
                if (1 == wlyyOutpatientDO.getRemindCount()) {
@ -610,7 +611,6 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                    hospitalSystemMessageService.sendImMessage(systemMessageDO);
                    hospitalSystemMessageService.sendImMessage(systemMessageDO);
                }
                }
                //发送医生抢单消息
                //发送医生抢单消息
                if (StringUtils.isBlank(wlyyOutpatientDO.getDoctor())) {
                if (StringUtils.isBlank(wlyyOutpatientDO.getDoctor())) {
                    hospitalSystemMessageService.sendImPichCheckMessage(wlyyOutpatientDO);
                    hospitalSystemMessageService.sendImPichCheckMessage(wlyyOutpatientDO);

+ 3 - 3
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/statistics/EsStatisticsEndpoint.java

@ -35,10 +35,10 @@ import java.util.Map;
 * Created by wangzhinan on 2019/12/3.
 * Created by wangzhinan on 2019/12/3.
 */
 */
@RestController
@RestController
//@RequestMapping(value = BaseHospitalRequestMapping.Statistics.PREFIX)
@RequestMapping("/open/statistics")
@RequestMapping(value = BaseHospitalRequestMapping.Statistics.PREFIX)
//@RequestMapping("/open/statistics")
@Api(value = "统计分析", description = "统计分析", tags = {"统计分析"})
@Api(value = "统计分析", description = "统计分析", tags = {"统计分析"})
public class EsStatisticsEndpoint extends EnvelopRestEndpoint {
class EsStatisticsEndpoint extends EnvelopRestEndpoint {
    Logger logger = LoggerFactory.getLogger(EsStatisticsEndpoint.class);
    Logger logger = LoggerFactory.getLogger(EsStatisticsEndpoint.class);

+ 5 - 3
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/door/controller/DoorOrderController.java

@ -625,9 +625,10 @@ public class DoorOrderController extends EnvelopRestEndpoint {
    ) {
    ) {
        try {
        try {
            WlyyDoorServiceOrderDO orderDO = doorOrderService.savePatientSignOrCertificate(orderId, finishWay, finishImg, level);
            WlyyDoorServiceOrderDO orderDO = doorOrderService.savePatientSignOrCertificate(orderId, finishWay, finishImg, level);
            return success("获取成功", orderDO);
            return success("保存成功", orderDO);
        } catch (Exception e) {
        } catch (Exception e) {
            return failed(e.getMessage());
            e.printStackTrace();
            return Envelop.getError("保存失败");
        }
        }
    }
    }
@ -643,7 +644,8 @@ public class DoorOrderController extends EnvelopRestEndpoint {
        try {
        try {
            return success("获取成功", doorOrderService.saveExamPaperInfo(orderId, examPaperWay, examPaperTime, examPaperImg, level));
            return success("获取成功", doorOrderService.saveExamPaperInfo(orderId, examPaperWay, examPaperTime, examPaperImg, level));
        } catch (Exception e) {
        } catch (Exception e) {
            return failed(e.getMessage());
            e.printStackTrace();
            return Envelop.getError("保存失败");
        }
        }
    }
    }

+ 2 - 4
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/door/service/DoorOrderService.java

@ -1365,6 +1365,7 @@ public class DoorOrderService {
     * @param level
     * @param level
     * @return
     * @return
     */
     */
    @Transactional
    public WlyyDoorServiceOrderDO savePatientSignOrCertificate(String orderId, Integer finishWay, String finishImg, Integer level) throws Exception {
    public WlyyDoorServiceOrderDO savePatientSignOrCertificate(String orderId, Integer finishWay, String finishImg, Integer level) throws Exception {
        WlyyDoorServiceOrderDO one = doorServiceOrderDao.findById(orderId).orElse(null);
        WlyyDoorServiceOrderDO one = doorServiceOrderDao.findById(orderId).orElse(null);
        one.setPatientConfirmFinishWay(finishWay);
        one.setPatientConfirmFinishWay(finishWay);
@ -1381,12 +1382,9 @@ public class DoorOrderService {
//        one.setTotalFee(cashPrice);
//        one.setTotalFee(cashPrice);
        doorServiceOrderDao.save(one);
        doorServiceOrderDao.save(one);
        //
        String planId = one.getPlanId();//计划id
        String planItemDetailId = one.getPlanItemDetailId();//计划服务项id
        Date date = new Date();
        Date date = new Date();
        //更新计划状态为完成
        //更新计划状态为完成
        serviceItemPlanDao.updateState(planId, planItemDetailId, date);
        serviceItemPlanDao.updateState(one.getRelationCode(), date);
        WlyyDoorServiceOrderDO doorServiceOrderDO = this.getDoorServiceOrderById(orderId, level);
        WlyyDoorServiceOrderDO doorServiceOrderDO = this.getDoorServiceOrderById(orderId, level);

+ 341 - 327
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/service/RehabilitationInfoService.java

@ -284,22 +284,22 @@ public class RehabilitationInfoService {
        if (StringUtils.isNotBlank(idcard)) {
        if (StringUtils.isNotBlank(idcard)) {
            filterSql += " and  b.idcard like '%" + idcard + "%' ";
            filterSql += " and  b.idcard like '%" + idcard + "%' ";
        }
        }
        String sql = "SELECT\n" +
                "	a.idcard,a.id 'patientId',a.`name` 'patientName',a.sex,NULL age,a.address \n" +
                "FROM\n" +
                "	wlyy_rehabilitation_patient_info a\n" +
                "	INNER JOIN base_patient b ON a.patient = b.id \n" +
                "WHERE\n" +
                "	1 = 1 \n" + filterSql +
                "	AND (a.type = 2 OR ISNULL( a.type )) \n" +
                "	AND a.sign_status='0'\n" +
                "	AND a.`status` = '6'\n" +
                "	AND a.patient NOT IN (\n" +
                "	  SELECT i.id \n" +
                "	  FROM wlyy_patient_rehabilitation_plan i INNER JOIN base_patient p ON p.id = i.patient \n" +
                "	  WHERE	1=1 AND	i.create_user = '" + doctorCode + "' AND i.STATUS != 0 \n" +
                "	  GROUP BY	i.patient\n" +
                "	) \n" +
        String sql = "SELECT " +
                "	a.idcard,a.id 'patientId',a.`name` 'patientName',a.sex,NULL age,a.address  " +
                "FROM " +
                "	wlyy_rehabilitation_patient_info a " +
                "	INNER JOIN base_patient b ON a.patient = b.id  " +
                "WHERE " +
                "	1 = 1  " + filterSql +
                "	AND (a.type = 2 OR ISNULL( a.type ))  " +
                "	AND a.sign_status='0' " +
                "	AND a.`status` = '6' " +
                "	AND a.patient NOT IN ( " +
                "	  SELECT i.id  " +
                "	  FROM wlyy_patient_rehabilitation_plan i INNER JOIN base_patient p ON p.id = i.patient  " +
                "	  WHERE	1=1 AND	i.create_user = '" + doctorCode + "' AND i.STATUS != 0  " +
                "	  GROUP BY	i.patient " +
                "	)  " +
                "ORDER BY	a.create_time DESC ";
                "ORDER BY	a.create_time DESC ";
        String pageSql = " LIMIT " + (page - 1) * pagesize + "," + pagesize;
        String pageSql = " LIMIT " + (page - 1) * pagesize + "," + pagesize;
@ -326,34 +326,34 @@ public class RehabilitationInfoService {
     */
     */
    public JSONObject noDownCount(String doctorCode, JSONObject object) {
    public JSONObject noDownCount(String doctorCode, JSONObject object) {
        //未下转所有
        //未下转所有
        String notTurnedDownCountSql = "select count(*) \n" +
                "from wlyy_rehabilitation_patient_info d INNER JOIN base_patient p ON p.id = d.patient \n" +
                "  where d.create_user ='" + doctorCode + "' and ( ISNULL(d.type) or d.type=2)  AND d.patient NOT IN (   \n" +
                "		SELECT i.patient FROM wlyy_patient_rehabilitation_plan i,base_patient p \n" +
        String notTurnedDownCountSql = "select count(*)  " +
                "from wlyy_rehabilitation_patient_info d INNER JOIN base_patient p ON p.id = d.patient  " +
                "  where d.create_user ='" + doctorCode + "' and ( ISNULL(d.type) or d.type=2)  AND d.patient NOT IN (    " +
                "		SELECT i.patient FROM wlyy_patient_rehabilitation_plan i,base_patient p  " +
                "		WHERE i.create_user = '" + doctorCode + "' AND i. STATUS != 0 AND p.id = i.patient ) ";
                "		WHERE i.create_user = '" + doctorCode + "' AND i. STATUS != 0 AND p.id = i.patient ) ";
        //未家签
        //未家签
        String notSignedAtHomeSql = "SELECT count(*) FROM (\n" +
                "select '' id, p.idcard,p.id 'patientId',p.`name` patientName,p.sex,NULL age,p.address  \n" +
                " from wlyy_rehabilitation_patient_info d INNER JOIN base_patient p ON  p.id = d.patient\n" +
                " where d.create_user ='" + doctorCode + "' and ( ISNULL(d.type) or d.type=2) AND d.sign_status='0' \n" +
                " AND d.patient NOT IN ( \n" +
                "	SELECT i.patient FROM wlyy_patient_rehabilitation_plan i INNER JOIN base_patient p  ON p.id = i.patient \n" +
                "	WHERE i.create_user = '" + doctorCode + "' AND i. STATUS != 0 \n" +
                "	GROUP BY i.patient \n" +
                "  )GROUP BY d.patient \n" +
        String notSignedAtHomeSql = "SELECT count(*) FROM ( " +
                "select '' id, p.idcard,p.id 'patientId',p.`name` patientName,p.sex,NULL age,p.address   " +
                " from wlyy_rehabilitation_patient_info d INNER JOIN base_patient p ON  p.id = d.patient " +
                " where d.create_user ='" + doctorCode + "' and ( ISNULL(d.type) or d.type=2) AND d.sign_status='0'  " +
                " AND d.patient NOT IN (  " +
                "	SELECT i.patient FROM wlyy_patient_rehabilitation_plan i INNER JOIN base_patient p  ON p.id = i.patient  " +
                "	WHERE i.create_user = '" + doctorCode + "' AND i. STATUS != 0  " +
                "	GROUP BY i.patient  " +
                "  )GROUP BY d.patient  " +
                ")aa";
                ")aa";
        String notSignedAtHome1Sql = "SELECT count(*) FROM (\n" +
                "	select '' id, p.idcard,p.id 'patientId',p.`name` patientName,p.sex,NULL age,p.address\n" +
                "	from wlyy_rehabilitation_patient_info d \n" +
                "	INNER JOIN base_patient p ON  p.id= d.patient \n" +
                "	where d.create_user = '" + doctorCode + "' and ( ISNULL(d.type) or d.type=2)  AND d.sign_status='1'\n" +
                "	AND d.patient NOT IN (  \n" +
                "  	SELECT DISTINCT i.patient FROM wlyy_patient_rehabilitation_plan i,base_patient p   \n" +
                "	  WHERE i.create_user = '" + doctorCode + "'  AND i. STATUS != 0 AND p.id = i.patient  \n" +
                "	)\n" +
                "	GROUP BY d.patient\n" +
        String notSignedAtHome1Sql = "SELECT count(*) FROM ( " +
                "	select '' id, p.idcard,p.id 'patientId',p.`name` patientName,p.sex,NULL age,p.address " +
                "	from wlyy_rehabilitation_patient_info d  " +
                "	INNER JOIN base_patient p ON  p.id= d.patient  " +
                "	where d.create_user = '" + doctorCode + "' and ( ISNULL(d.type) or d.type=2)  AND d.sign_status='1' " +
                "	AND d.patient NOT IN (   " +
                "  	SELECT DISTINCT i.patient FROM wlyy_patient_rehabilitation_plan i,base_patient p    " +
                "	  WHERE i.create_user = '" + doctorCode + "'  AND i. STATUS != 0 AND p.id = i.patient   " +
                "	) " +
                "	GROUP BY d.patient " +
                ")aa";
                ")aa";
        Integer allCount = jdbcTemplate.queryForObject(notTurnedDownCountSql, Integer.class);
        Integer allCount = jdbcTemplate.queryForObject(notTurnedDownCountSql, Integer.class);
@ -375,21 +375,21 @@ public class RehabilitationInfoService {
        }
        }
//        String sql = "select '' id, p.idcard,p.code patient,p.NAME patientName,p.sex,NULL age,p.address,f.status signStatus," +
//        String sql = "select '' id, p.idcard,p.code patient,p.NAME patientName,p.sex,NULL age,p.address,f.status signStatus," +
//                "f.czrq,f.doctor_name doctorName,f.doctor_health_name doctorHealthName,f.hospital_name hospitalName,f.admin_team_code teamCode " +
//                "f.czrq,f.doctor_name doctorName,f.doctor_health_name doctorHealthName,f.hospital_name hospitalName,f.admin_team_code teamCode " +
//                " from wlyy_patient_discharge d,wlyy_patient p,wlyy_sign_family f\n" +
//                "where 1=1 " + filterSql + " and ( ISNULL(d.type) or d.type=2) AND p. CODE = d.patient AND d.patient=f.patient AND f.`status`=1 AND f.sign_year='" + DateUtil.getSignYear() + "' AND d.patient NOT IN \n" +
//                "(   SELECT i.patient FROM wlyy_patient_rehabilitation_plan i,wlyy_patient p   WHERE i.create_user = '" + doctorCode + "' \n" +
//                " from wlyy_patient_discharge d,wlyy_patient p,wlyy_sign_family f " +
//                "where 1=1 " + filterSql + " and ( ISNULL(d.type) or d.type=2) AND p. CODE = d.patient AND d.patient=f.patient AND f.`status`=1 AND f.sign_year='" + DateUtil.getSignYear() + "' AND d.patient NOT IN  " +
//                "(   SELECT i.patient FROM wlyy_patient_rehabilitation_plan i,wlyy_patient p   WHERE i.create_user = '" + doctorCode + "'  " +
//                "AND i. STATUS != 0 AND p. CODE = i.patient GROUP BY i.patient ORDER BY i.create_time desc)GROUP BY d.patient ORDER BY d.create_time DESC ";
//                "AND i. STATUS != 0 AND p. CODE = i.patient GROUP BY i.patient ORDER BY i.create_time desc)GROUP BY d.patient ORDER BY d.create_time DESC ";
        String sql = "SELECT  \n" +
                " p.idcard,p.id patient,p.`name` 'patientName',p.sex,NULL age,p.address,\n" +
                " d.`dept`,d.`dept_name`\n" +
                " FROM wlyy_rehabilitation_patient_info d INNER JOIN base_patient p ON  p.id = d.patient \n" +
                " WHERE  1=1 \n" + filterSql +
                " AND ( ISNULL(d.type) or d.type=2)  AND d.sign_status='1' \n" +
                " AND d.patient NOT IN (\n" +
                "		SELECT DISTINCT i.patient FROM wlyy_patient_rehabilitation_plan i,base_patient p  \n" +
                "		WHERE i.create_user = '" + doctorCode + "' AND i. STATUS != 0 AND p.id = i.patient\n" +
                ")\n" +
        String sql = "SELECT   " +
                " p.idcard,p.id patient,p.`name` 'patientName',p.sex,NULL age,p.address, " +
                " d.`dept`,d.`dept_name` " +
                " FROM wlyy_rehabilitation_patient_info d INNER JOIN base_patient p ON  p.id = d.patient  " +
                " WHERE  1=1  " + filterSql +
                " AND ( ISNULL(d.type) or d.type=2)  AND d.sign_status='1'  " +
                " AND d.patient NOT IN ( " +
                "		SELECT DISTINCT i.patient FROM wlyy_patient_rehabilitation_plan i,base_patient p   " +
                "		WHERE i.create_user = '" + doctorCode + "' AND i. STATUS != 0 AND p.id = i.patient " +
                ") " +
                "GROUP BY d.patient ORDER BY d.create_time DESC ";
                "GROUP BY d.patient ORDER BY d.create_time DESC ";
        sql += " LIMIT " + (page - 1) * pagesize + "," + pagesize;
        sql += " LIMIT " + (page - 1) * pagesize + "," + pagesize;
@ -421,17 +421,17 @@ public class RehabilitationInfoService {
//                " if(f.id is null,-2,-1) as isTurnDown " +
//                " if(f.id is null,-2,-1) as isTurnDown " +
//                " from wlyy_patient p,wlyy_patient_discharge d " +
//                " from wlyy_patient p,wlyy_patient_discharge d " +
//                " left JOIN wlyy_sign_family f on d.patient=f.patient AND f.`status`=1 AND f.sign_year='" + DateUtil.getSignYear() + "'" +
//                " left JOIN wlyy_sign_family f on d.patient=f.patient AND f.`status`=1 AND f.sign_year='" + DateUtil.getSignYear() + "'" +
//                "where 1=1 " + filterSql + " and ( ISNULL(d.type) or d.type=2) AND p. CODE = d.patient  AND d.patient NOT IN \n" +
//                "(   SELECT DISTINCT i.patient FROM wlyy_patient_rehabilitation_plan i,wlyy_patient p   WHERE i.create_user = '" + doctorCode + "' \n" +
//                "where 1=1 " + filterSql + " and ( ISNULL(d.type) or d.type=2) AND p. CODE = d.patient  AND d.patient NOT IN  " +
//                "(   SELECT DISTINCT i.patient FROM wlyy_patient_rehabilitation_plan i,wlyy_patient p   WHERE i.create_user = '" + doctorCode + "'  " +
//                "AND i. STATUS != 0 AND p. CODE = i.patient )GROUP BY d.patient ORDER BY d.create_time DESC ";
//                "AND i. STATUS != 0 AND p. CODE = i.patient )GROUP BY d.patient ORDER BY d.create_time DESC ";
        String sql = "SELECT '' id, p.idcard,p.id 'patient',p.`name` patientName,p.sex,d.age,p.address,\n" +
                " if(p.sign_status=0,-2,-1) as isTurnDown  \n" +
                " FROM base_patient p \n" +
                " INNER JOIN wlyy_rehabilitation_patient_info d  ON p.id = d.patient  \n" +
        String sql = "SELECT '' id, p.idcard,p.id 'patient',p.`name` patientName,p.sex,d.age,p.address, " +
                " if(p.sign_status=0,-2,-1) as isTurnDown   " +
                " FROM base_patient p  " +
                " INNER JOIN wlyy_rehabilitation_patient_info d  ON p.id = d.patient   " +
                " WHERE 1=1  " + filterSql +
                " WHERE 1=1  " + filterSql +
                "	 AND d.create_user ='" + doctorCode + "'  AND ( ISNULL(d.type) or d.type=2) \n" +
                "    AND d.`status`='0'\n" +
                "	 AND d.create_user ='" + doctorCode + "'  AND ( ISNULL(d.type) or d.type=2)  " +
                "    AND d.`status`='0' " +
                "GROUP BY d.patient ORDER BY d.create_time DESC ";
                "GROUP BY d.patient ORDER BY d.create_time DESC ";
        sql += " LIMIT " + (page - 1) * pagesize + "," + pagesize;
        sql += " LIMIT " + (page - 1) * pagesize + "," + pagesize;
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
@ -449,28 +449,28 @@ public class RehabilitationInfoService {
     */
     */
    public JSONObject downAndNoSign(String idcard, String doctorCode, Integer page, Integer pagesize, JSONObject object) {
    public JSONObject downAndNoSign(String idcard, String doctorCode, Integer page, Integer pagesize, JSONObject object) {
//        String sql2 = "SELECT i.disease_name diseaseName,s.doctor,s.idcard,p.sex, s.patient,CAST(IFNULL(p.birthday,'') AS char ) birthday," +
//        String sql2 = "SELECT i.disease_name diseaseName,s.doctor,s.idcard,p.sex, s.patient,CAST(IFNULL(p.birthday,'') AS char ) birthday," +
//                " i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName, \n" +
//                "IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, \n" +
//                "s.admin_team_code teamCode ,pr.is_manage isManage \n" +
//                "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p ,\n" +
//                "wlyy_specialist_patient_relation pr \n" +
//                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 \n" +
//                " i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName,  " +
//                "IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName,  " +
//                "s.admin_team_code teamCode ,pr.is_manage isManage  " +
//                "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p , " +
//                "wlyy_specialist_patient_relation pr  " +
//                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1  " +
//                "AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 " +
//                "AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 " +
//                " and  (pr.is_manage != 1 OR isnull(pr.is_manage)) ";
//                " and  (pr.is_manage != 1 OR isnull(pr.is_manage)) ";
        String sql2 = "SELECT \n" +
                " i.disease_name diseaseName,i.create_user,p.idcard,p.sex,p.id 'patient',\n" +
                " i.`status`, p.`name` 'patientName', p.address, \n" +
                " CAST(IFNULL(p.birthday,'') AS char ) birthday,\n" +
                " pr.is_manage isManage \n" +
                "FROM wlyy_patient_rehabilitation_plan i \n" +
                "INNER JOIN wlyy_rehabilitation_patient_info q ON q.patient=i.id AND q.sign_status='1' AND i.patient_info_code=q.`code` \n" +
                "INNER JOIN base_patient p ON  p.id = i.patient\n" +
                "INNER JOIN  wlyy_specialist_patient_relation pr ON  pr.patient=p.id\n" +
                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 \n" +
                "	 and pr.`status`>=0 and pr.sign_status=1  \n" +
                "	AND  (pr.is_manage != 1 OR isnull(pr.is_manage))  \n";
        String sql2 = "SELECT  " +
                " i.disease_name diseaseName,i.create_user,p.idcard,p.sex,p.id 'patient', " +
                " i.`status`, p.`name` 'patientName', p.address,  " +
                " CAST(IFNULL(p.birthday,'') AS char ) birthday, " +
                " pr.is_manage isManage  " +
                "FROM wlyy_patient_rehabilitation_plan i  " +
                "INNER JOIN wlyy_rehabilitation_patient_info q ON q.patient=i.id AND q.sign_status='1' AND i.patient_info_code=q.`code`  " +
                "INNER JOIN base_patient p ON  p.id = i.patient " +
                "INNER JOIN  wlyy_specialist_patient_relation pr ON  pr.patient=p.id " +
                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0  " +
                "	 and pr.`status`>=0 and pr.sign_status=1   " +
                "	AND  (pr.is_manage != 1 OR isnull(pr.is_manage))   ";
        if (StringUtils.isNotBlank(idcard)) {
        if (StringUtils.isNotBlank(idcard)) {
@ -504,38 +504,38 @@ public class RehabilitationInfoService {
     * 已经下转统计
     * 已经下转统计
     */
     */
    public JSONObject downCount(String doctorCode, JSONObject object) {
    public JSONObject downCount(String doctorCode, JSONObject object) {
//        String sql1 = "SELECT COUNT(distinct i.patient) \n" +
//                "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p ,\n" +
//                "wlyy_specialist_patient_relation pr \n" +
//                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 \n" +
//        String sql1 = "SELECT COUNT(distinct i.patient)  " +
//                "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p , " +
//                "wlyy_specialist_patient_relation pr  " +
//                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1  " +
//                "AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 ";
//                "AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 ";
        String sql1 = "SELECT \n" +
                " COUNT(distinct i.patient) \n" +
                "FROM wlyy_patient_rehabilitation_plan i \n" +
                "INNER JOIN  base_patient p ON  p.id = i.patient  \n" +
                "INNER JOIN wlyy_rehabilitation_patient_info q ON q.patient=i.id  AND i.patient_info_code=q.`code`  AND q.sign_status='1'\n" +
                "INNER JOIN wlyy_specialist_patient_relation pr ON  pr.patient=p.id\n" +
        String sql1 = "SELECT  " +
                " COUNT(distinct i.patient)  " +
                "FROM wlyy_patient_rehabilitation_plan i  " +
                "INNER JOIN  base_patient p ON  p.id = i.patient   " +
                "INNER JOIN wlyy_rehabilitation_patient_info q ON q.patient=i.id  AND i.patient_info_code=q.`code`  AND q.sign_status='1' " +
                "INNER JOIN wlyy_specialist_patient_relation pr ON  pr.patient=p.id " +
                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0   and pr.`status`>=0 and pr.sign_status=1 ";
                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0   and pr.`status`>=0 and pr.sign_status=1 ";
        Integer list1 = jdbcTemplate.queryForObject(sql1, Integer.class);
        Integer list1 = jdbcTemplate.queryForObject(sql1, Integer.class);
        //康复计划数量
        //康复计划数量
//        String sql2 = "SELECT COUNT(distinct i.id) \n" +
//                "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p\n" +
//                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient \n" +
//        String sql2 = "SELECT COUNT(distinct i.id)  " +
//                "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p " +
//                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient  " +
//                "AND s.status = 1 AND s.expenses_status = 1 ";
//                "AND s.status = 1 AND s.expenses_status = 1 ";
        String sql2 = "SELECT COUNT(distinct i.id) \n" +
        String sql2 = "SELECT COUNT(distinct i.id)  " +
                " FROM wlyy_patient_rehabilitation_plan i " +
                " FROM wlyy_patient_rehabilitation_plan i " +
                " inner join  base_patient p on  p.id = i.patient \n" +
                " inner join  wlyy_rehabilitation_patient_info q on  q.patient = i.patient AND i.patient_info_code=q.`code` AND q.sign_status='1' \n" +
                " WHERE i.create_user = '" + doctorCode + "' AND i.status != 0    \n";
                " inner join  base_patient p on  p.id = i.patient  " +
                " inner join  wlyy_rehabilitation_patient_info q on  q.patient = i.patient AND i.patient_info_code=q.`code` AND q.sign_status='1'  " +
                " WHERE i.create_user = '" + doctorCode + "' AND i.status != 0     ";
        Integer list2 = jdbcTemplate.queryForObject(sql2, Integer.class);
        Integer list2 = jdbcTemplate.queryForObject(sql2, Integer.class);
        //家医接收
        //家医接收
//        String sql3 = "SELECT COUNT(distinct i.patient) " +
//        String sql3 = "SELECT COUNT(distinct i.patient) " +
//                " FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p ,\n" +
//                " wlyy_specialist_patient_relation pr \n" +
//                " WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 \n" +
//                " FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p , " +
//                " wlyy_specialist_patient_relation pr  " +
//                " WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1  " +
//                " AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 and pr.is_manage=1";
//                " AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 and pr.is_manage=1";
//        Integer list3 = jdbcTemplate.queryForObject(sql3, Integer.class);
//        Integer list3 = jdbcTemplate.queryForObject(sql3, Integer.class);
@ -551,22 +551,22 @@ public class RehabilitationInfoService {
     */
     */
    public JSONObject downAndSign(String idcard, String doctorCode, Integer page, Integer pagesize, JSONObject object) {
    public JSONObject downAndSign(String idcard, String doctorCode, Integer page, Integer pagesize, JSONObject object) {
//        String sql2 = "SELECT i.disease_name diseaseName,s.doctor,s.idcard,p.sex, s.patient,CAST(IFNULL(p.birthday,'') AS char ) birthday," +
//        String sql2 = "SELECT i.disease_name diseaseName,s.doctor,s.idcard,p.sex, s.patient,CAST(IFNULL(p.birthday,'') AS char ) birthday," +
//                " i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName, \n" +
//                "IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, \n" +
//                "s.admin_team_code teamCode ,pr.is_manage isManage \n" +
//                "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p ,\n" +
//                "wlyy_specialist_patient_relation pr \n" +
//                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 \n" +
//                " i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName,  " +
//                "IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName,  " +
//                "s.admin_team_code teamCode ,pr.is_manage isManage  " +
//                "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p , " +
//                "wlyy_specialist_patient_relation pr  " +
//                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1  " +
//                "AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 and pr.is_manage=1";
//                "AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 and pr.is_manage=1";
        String sql2 = "SELECT i.disease_name diseaseName,p.idcard,p.sex, p.id 'patient',\n" +
                " CAST(IFNULL(p.birthday,'') AS char ) birthday, \n" +
                " i.`status`, p.`name` patientName, p.address,pr.is_manage isManage \n" +
                "FROM wlyy_patient_rehabilitation_plan i \n" +
                " INNER JOIN wlyy_rehabilitation_patient_info q ON q.patient=i.id AND q.sign_status='1' AND i.patient_info_code=q.`code` \n" +
                " INNER JOIN base_patient p ON p.id = i.patient \n" +
                " INNER JOIN wlyy_specialist_patient_relation pr ON pr.patient=p.id \n" +
                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0  AND pr.`status`>=0 and pr.sign_status=1 and pr.is_manage=1 \n";
        String sql2 = "SELECT i.disease_name diseaseName,p.idcard,p.sex, p.id 'patient', " +
                " CAST(IFNULL(p.birthday,'') AS char ) birthday,  " +
                " i.`status`, p.`name` patientName, p.address,pr.is_manage isManage  " +
                "FROM wlyy_patient_rehabilitation_plan i  " +
                " INNER JOIN wlyy_rehabilitation_patient_info q ON q.patient=i.id AND q.sign_status='1' AND i.patient_info_code=q.`code`  " +
                " INNER JOIN base_patient p ON p.id = i.patient  " +
                " INNER JOIN wlyy_specialist_patient_relation pr ON pr.patient=p.id  " +
                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0  AND pr.`status`>=0 and pr.sign_status=1 and pr.is_manage=1  ";
        if (StringUtils.isNotBlank(idcard)) {
        if (StringUtils.isNotBlank(idcard)) {
            sql2 += " and  p.idcard like '%" + idcard + "%' ";
            sql2 += " and  p.idcard like '%" + idcard + "%' ";
@ -599,22 +599,22 @@ public class RehabilitationInfoService {
     */
     */
    public JSONObject down(String idcard, String doctorCode, Integer page, Integer pagesize, JSONObject object) {
    public JSONObject down(String idcard, String doctorCode, Integer page, Integer pagesize, JSONObject object) {
//        String sql2 = "SELECT i.disease_name diseaseName,s.doctor,s.idcard,p.sex, s.patient,CAST(IFNULL(p.birthday,'') AS char ) birthday," +
//        String sql2 = "SELECT i.disease_name diseaseName,s.doctor,s.idcard,p.sex, s.patient,CAST(IFNULL(p.birthday,'') AS char ) birthday," +
//                " i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName, \n" +
//                "IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, \n" +
//                "s.admin_team_code teamCode ,pr.is_manage isManage \n" +
//                "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p ,\n" +
//                "wlyy_specialist_patient_relation pr \n" +
//                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 \n" +
//                " i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName,  " +
//                "IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName,  " +
//                "s.admin_team_code teamCode ,pr.is_manage isManage  " +
//                "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p , " +
//                "wlyy_specialist_patient_relation pr  " +
//                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1  " +
//                "AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 ";
//                "AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 ";
        String sql2 = "SELECT i.disease_name diseaseName,p.idcard,p.sex, p.id 'patient',\n" +
                " CAST(IFNULL(p.birthday,'') AS char ) birthday, i.`status`, p.`name` patientName, p.address, \n" +
                " pr.is_manage isManage \n" +
                "FROM wlyy_patient_rehabilitation_plan i \n" +
                " INNER JOIN base_patient p ON p.id = i.patient\n" +
                " INNER JOIN wlyy_rehabilitation_patient_info q ON q.patient=i.id AND q.sign_status='1' AND i.patient_info_code=q.`code`\n" +
                " INNER JOIN wlyy_specialist_patient_relation pr ON pr.patient=p.id\n" +
                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 \n" +
        String sql2 = "SELECT i.disease_name diseaseName,p.idcard,p.sex, p.id 'patient', " +
                " CAST(IFNULL(p.birthday,'') AS char ) birthday, i.`status`, p.`name` patientName, p.address,  " +
                " pr.is_manage isManage  " +
                "FROM wlyy_patient_rehabilitation_plan i  " +
                " INNER JOIN base_patient p ON p.id = i.patient " +
                " INNER JOIN wlyy_rehabilitation_patient_info q ON q.patient=i.id AND q.sign_status='1' AND i.patient_info_code=q.`code` " +
                " INNER JOIN wlyy_specialist_patient_relation pr ON pr.patient=p.id " +
                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0  " +
                " and pr.`status`>=0 and pr.sign_status=1  ";
                " and pr.`status`>=0 and pr.sign_status=1  ";
        if (StringUtils.isNotBlank(idcard)) {
        if (StringUtils.isNotBlank(idcard)) {
@ -735,32 +735,32 @@ public class RehabilitationInfoService {
    public JSONObject getDeorsumvergenceCount(String doctorCode) {
    public JSONObject getDeorsumvergenceCount(String doctorCode) {
        JSONObject object = new JSONObject();
        JSONObject object = new JSONObject();
        //已下转
        //已下转
        String sql1 = "SELECT s.idcard, s.patient, i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName, \n" +
                "IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, \n" +
                "s.admin_team_code teamCode ,pr.is_manage isManage \n" +
                "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p ,\n" +
                "wlyy_specialist_patient_relation pr \n" +
                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 \n" +
        String sql1 = "SELECT s.idcard, s.patient, i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName,  " +
                "IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName,  " +
                "s.admin_team_code teamCode ,pr.is_manage isManage  " +
                "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p , " +
                "wlyy_specialist_patient_relation pr  " +
                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1  " +
                "AND s.expenses_status = 1 AND pr.patient=p.code  GROUP BY i.patient ORDER BY i.create_time DESC ";
                "AND s.expenses_status = 1 AND pr.patient=p.code  GROUP BY i.patient ORDER BY i.create_time DESC ";
        List<Map<String, Object>> list1 = jdbcTemplate.queryForList(sql1);
        List<Map<String, Object>> list1 = jdbcTemplate.queryForList(sql1);
        //康复计划数量
        //康复计划数量
        String sql2 = "SELECT s.idcard, s.patient, i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName, \n" +
                "IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, s.admin_team_code teamCode \n" +
                "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p\n" +
                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient \n" +
        String sql2 = "SELECT s.idcard, s.patient, i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName,  " +
                "IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, s.admin_team_code teamCode  " +
                "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p " +
                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient  " +
                "AND s.status = 1 AND s.expenses_status = 1 GROUP BY i.id";
                "AND s.status = 1 AND s.expenses_status = 1 GROUP BY i.id";
        List<Map<String, Object>> list2 = jdbcTemplate.queryForList(sql2);
        List<Map<String, Object>> list2 = jdbcTemplate.queryForList(sql2);
        //家医接收
        //家医接收
        String sql3 = "SELECT * \n" +
                "FROM (\n" +
                "SELECT s.idcard, s.patient, i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName, \n" +
                "IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, \n" +
                "s.admin_team_code teamCode ,pr.is_manage isManage \n" +
                "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p ,\n" +
                "wlyy_specialist_patient_relation pr \n" +
                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 \n" +
                "AND s.expenses_status = 1 AND pr.patient=p.code  GROUP BY i.patient ORDER BY i.create_time DESC\n" +
                ") aa\n" +
        String sql3 = "SELECT *  " +
                "FROM ( " +
                "SELECT s.idcard, s.patient, i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName,  " +
                "IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName,  " +
                "s.admin_team_code teamCode ,pr.is_manage isManage  " +
                "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p , " +
                "wlyy_specialist_patient_relation pr  " +
                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1  " +
                "AND s.expenses_status = 1 AND pr.patient=p.code  GROUP BY i.patient ORDER BY i.create_time DESC " +
                ") aa " +
                "WHERE aa.isManage = 1 ";
                "WHERE aa.isManage = 1 ";
        List<Map<String, Object>> list3 = jdbcTemplate.queryForList(sql3);
        List<Map<String, Object>> list3 = jdbcTemplate.queryForList(sql3);
        object.put("deorsumvergenceCount", list1.size());//下转人数
        object.put("deorsumvergenceCount", list1.size());//下转人数
@ -856,23 +856,23 @@ public class RehabilitationInfoService {
    }
    }
    public JSONObject getUnm(String doctor, String patient) {
    public JSONObject getUnm(String doctor, String patient) {
        String sqlMe = "select d.id,d.plan_id as planId,i.code,i.name,p.patient,d.frequency_code from wlyy_rehabilitation_plan_detail d \n" +
                "LEFT JOIN wlyy_patient_rehabilitation_plan p ON p.id=d.plan_id\n" +
                "LEFT JOIN wlyy_rehabilitation_service_item i on i.code = d.hospital_service_item_id  \n" +
                "where d.plan_id IN (SELECT id FROM wlyy_patient_rehabilitation_plan WHERE patient ='" + patient + "') \n" +
        String sqlMe = "select d.id,d.plan_id as planId,i.code,i.name,p.patient,d.frequency_code from wlyy_rehabilitation_plan_detail d  " +
                "LEFT JOIN wlyy_patient_rehabilitation_plan p ON p.id=d.plan_id " +
                "LEFT JOIN wlyy_rehabilitation_service_item i on i.code = d.hospital_service_item_id   " +
                "where d.plan_id IN (SELECT id FROM wlyy_patient_rehabilitation_plan WHERE patient ='" + patient + "')  " +
                "AND d.doctor = '" + doctor + "'  ";//我的任务
                "AND d.doctor = '" + doctor + "'  ";//我的任务
        List<Map<String, Object>> listMe = jdbcTemplate.queryForList(sqlMe);
        List<Map<String, Object>> listMe = jdbcTemplate.queryForList(sqlMe);
        String sqlAll = "select d.id,d.plan_id as planId,i.code,i.name,p.patient,d.frequency_code from wlyy_rehabilitation_plan_detail d \n" +
                "LEFT JOIN wlyy_patient_rehabilitation_plan p ON p.id=d.plan_id\n" +
                "LEFT JOIN wlyy_rehabilitation_service_item i on i.code = d.hospital_service_item_id  \n" +
        String sqlAll = "select d.id,d.plan_id as planId,i.code,i.name,p.patient,d.frequency_code from wlyy_rehabilitation_plan_detail d  " +
                "LEFT JOIN wlyy_patient_rehabilitation_plan p ON p.id=d.plan_id " +
                "LEFT JOIN wlyy_rehabilitation_service_item i on i.code = d.hospital_service_item_id   " +
                "where d.plan_id IN (SELECT id FROM wlyy_patient_rehabilitation_plan WHERE patient ='" + patient + "') ";//全部任务
                "where d.plan_id IN (SELECT id FROM wlyy_patient_rehabilitation_plan WHERE patient ='" + patient + "') ";//全部任务
        List<Map<String, Object>> listAll = jdbcTemplate.queryForList(sqlAll);
        List<Map<String, Object>> listAll = jdbcTemplate.queryForList(sqlAll);
        String newDetailSql = "select d.id,d.plan_id as planId,i.code,i.name,p.patient,d.frequency_code,r.complete_time createTime, r.doctor_name doctorName \n" +
                "from wlyy_rehabilitation_plan_detail d \n" +
                "INNER JOIN wlyy_rehabilitation_operate_records r ON d.id = r.rehabilitation_detail_id\n" +
                "LEFT JOIN wlyy_patient_rehabilitation_plan p ON p.id=d.plan_id\n" +
                "LEFT JOIN wlyy_rehabilitation_service_item i on i.code = d.hospital_service_item_id  \n" +
                "where d.plan_id IN (SELECT id FROM wlyy_patient_rehabilitation_plan WHERE patient ='" + patient + "')\n" +
        String newDetailSql = "select d.id,d.plan_id as planId,i.code,i.name,p.patient,d.frequency_code,r.complete_time createTime, r.doctor_name doctorName  " +
                "from wlyy_rehabilitation_plan_detail d  " +
                "INNER JOIN wlyy_rehabilitation_operate_records r ON d.id = r.rehabilitation_detail_id " +
                "LEFT JOIN wlyy_patient_rehabilitation_plan p ON p.id=d.plan_id " +
                "LEFT JOIN wlyy_rehabilitation_service_item i on i.code = d.hospital_service_item_id   " +
                "where d.plan_id IN (SELECT id FROM wlyy_patient_rehabilitation_plan WHERE patient ='" + patient + "') " +
                " and r.`status`=1 GROUP BY r.complete_time DESC LIMIT 0,1 ";
                " and r.`status`=1 GROUP BY r.complete_time DESC LIMIT 0,1 ";
        newDetailSql = TransforSqlUtl.wlyy_rehabilitation_operate_recordsDoctorName(newDetailSql);
        newDetailSql = TransforSqlUtl.wlyy_rehabilitation_operate_recordsDoctorName(newDetailSql);
        List<Map<String, Object>> newDetail = jdbcTemplate.queryForList(newDetailSql);
        List<Map<String, Object>> newDetail = jdbcTemplate.queryForList(newDetailSql);
@ -933,30 +933,30 @@ public class RehabilitationInfoService {
    public JSONObject getRehabilitationPatientListNew(String downPatientId, String idcard, String doctorId, String status, Integer page, Integer pagesize) {
    public JSONObject getRehabilitationPatientListNew(String downPatientId, String idcard, String doctorId, String status, Integer page, Integer pagesize) {
        JSONObject object = new JSONObject();
        JSONObject object = new JSONObject();
        List<Map<String, Object>> list = null;
        List<Map<String, Object>> list = null;
        String detailSql = "SELECT \n" +
                " 	p.idcard, q.id 'planId',	p.id 'patientId', p.phone,	p.`name` 'patientName',	p.sex,	p.address, \n" +
                "   d.code 'patientInfoCode',	d.ssc , d.mobile, d.age,	d.diagnosis_name 'diagnosisName',	d.sign_status,	d.dept 'deptCode', \n" +
                " 	d.dept_name 'deptName',	d.create_user 'createUserId', \n" +
                " 	d.create_user_name 'createUserName',DATE_FORMAT(d.create_time, '%Y-%m-%d %H:%i:%s') 'createTime',\n" +
                "	q.`status` 'planStaus',q.plan_doctor 'planDoctor', q.plan_doctor_name 'planDoctorName' , q.advice_content 'adviceContent', \n" +
        String detailSql = "SELECT  " +
                " 	p.idcard, q.id 'planId',	p.id 'patientId', p.phone,	p.`name` 'patientName',	p.sex,	p.address,  " +
                "   d.code 'patientInfoCode',	d.ssc , d.mobile, d.age,	d.diagnosis_name 'diagnosisName',	d.sign_status,	d.dept 'deptCode',  " +
                " 	d.dept_name 'deptName',	d.create_user 'createUserId',  " +
                " 	d.create_user_name 'createUserName',DATE_FORMAT(d.create_time, '%Y-%m-%d %H:%i:%s') 'createTime', " +
                "	q.`status` 'planStaus',q.plan_doctor 'planDoctor', q.plan_doctor_name 'planDoctorName' , q.advice_content 'adviceContent',  " +
                "	DATE_FORMAT(q.create_time, '%Y-%m-%d %H:%i:%s') 'planCreateTime'," +
                "	DATE_FORMAT(q.create_time, '%Y-%m-%d %H:%i:%s') 'planCreateTime'," +
                "   d.from_source," +
                "   d.from_source," +
                "       CASE  \n" +
                "        WHEN d.from_source='1' THEN '手动添加'\n" +
                "        WHEN d.from_source='2' THEN '自动下转'\n" +
                "        WHEN d.from_source='3' THEN '扫码添加'\n" +
                "      END 'fromSourceName',\n" +
                "   d.ijk_id, d.status 'patientStatus', \n" +
                "       CASE   " +
                "        WHEN d.from_source='1' THEN '手动添加' " +
                "        WHEN d.from_source='2' THEN '自动下转' " +
                "        WHEN d.from_source='3' THEN '扫码添加' " +
                "      END 'fromSourceName', " +
                "   d.ijk_id, d.status 'patientStatus',  " +
                "   d.problem_code," +
                "   d.problem_code," +
                "   q.disease 'diseaseId',q.disease_name 'diseaseName' \n" +
                " FROM base_patient p \n" +
                " INNER JOIN wlyy_rehabilitation_patient_info d ON p.id = d.patient \n" +
                "   q.disease 'diseaseId',q.disease_name 'diseaseName'  " +
                " FROM base_patient p  " +
                " INNER JOIN wlyy_rehabilitation_patient_info d ON p.id = d.patient  " +
                " LEFT JOIN wlyy_patient_rehabilitation_plan q ON d.`code`=q.patient_info_code  " +
                " LEFT JOIN wlyy_patient_rehabilitation_plan q ON d.`code`=q.patient_info_code  " +
                " WHERE  1 = 1 ";
                " WHERE  1 = 1 ";
        String countSql = " select count(1) from base_patient p " +
        String countSql = " select count(1) from base_patient p " +
                " INNER JOIN wlyy_rehabilitation_patient_info d ON p.id = d.patient " +
                " INNER JOIN wlyy_rehabilitation_patient_info d ON p.id = d.patient " +
                " LEFT JOIN wlyy_patient_rehabilitation_plan q ON d.`code`=q.patient_info_code" +
                " LEFT JOIN wlyy_patient_rehabilitation_plan q ON d.`code`=q.patient_info_code" +
                " WHERE  1 = 1   \n";
                " WHERE  1 = 1    ";
        String limitSql = " LIMIT " + (page - 1) * pagesize + "," + pagesize;
        String limitSql = " LIMIT " + (page - 1) * pagesize + "," + pagesize;
        String filterSql = "";
        String filterSql = "";
        if (StringUtils.isNotBlank(idcard)) {
        if (StringUtils.isNotBlank(idcard)) {
@ -968,7 +968,7 @@ public class RehabilitationInfoService {
        }
        }
        if (StringUtils.isBlank(status)) {
        if (StringUtils.isBlank(status)) {
            //看全部数据
            //看全部数据
            filterSql += "	AND (d.create_user = '" + doctorId + "'  OR ISNULL(  d.create_user  ) )\n" +
            filterSql += "	AND (d.create_user = '" + doctorId + "'  OR ISNULL(  d.create_user  ) ) " +
                    "	    AND ( ISNULL( d.type ) OR d.type = 2 ) ORDER BY d.create_time DESC ";
                    "	    AND ( ISNULL( d.type ) OR d.type = 2 ) ORDER BY d.create_time DESC ";
            detailSql += filterSql + limitSql;
            detailSql += filterSql + limitSql;
            countSql += filterSql;
            countSql += filterSql;
@ -1002,7 +1002,7 @@ public class RehabilitationInfoService {
            if ("7".equals(status)) {
            if ("7".equals(status)) {
                //已经分配医生
                //已经分配医生
                filterSql += "	AND ( d.create_user = '" + doctorId + "'  OR ISNULL(  d.create_user  ) )  \n" +
                filterSql += "	AND ( d.create_user = '" + doctorId + "'  OR ISNULL(  d.create_user  ) )   " +
                        "	AND ( ISNULL( d.type ) OR d.type = 2 ) and d.status='7' ";
                        "	AND ( ISNULL( d.type ) OR d.type = 2 ) and d.status='7' ";
                filterSql += " ORDER BY d.create_time DESC ";
                filterSql += " ORDER BY d.create_time DESC ";
                detailSql += filterSql + limitSql;
                detailSql += filterSql + limitSql;
@ -1023,11 +1023,11 @@ public class RehabilitationInfoService {
    public List<Map<String, Object>> getDetpAndDoctor(String doctorName, String deptCode, String deptName, String type, String disease) {
    public List<Map<String, Object>> getDetpAndDoctor(String doctorName, String deptCode, String deptName, String type, String disease) {
        List<Map<String, Object>> list = null;
        List<Map<String, Object>> list = null;
        if ("1".equals(type)) {
        if ("1".equals(type)) {
            String sql = "SELECT  DISTINCT b.id 'diseaseId' ,b.`name` 'diseaseName',a.* \n" +
                    "FROM\n" +
                    "	dict_hospital_dept a \n" +
                    "	INNER JOIN base_disease_hospital b ON FIND_IN_SET(a.`code`, b.dept) > 0 \n" +
                    "WHERE 1 =1\n";
            String sql = "SELECT  DISTINCT b.id 'diseaseId' ,b.`name` 'diseaseName',a.*  " +
                    "FROM " +
                    "	dict_hospital_dept a  " +
                    "	INNER JOIN base_disease_hospital b ON FIND_IN_SET(a.`code`, b.dept) > 0  " +
                    "WHERE 1 =1 ";
            if (StringUtils.isNotBlank(deptName)) {
            if (StringUtils.isNotBlank(deptName)) {
                sql += " and `name` LIKE '%" + deptName + "%'";
                sql += " and `name` LIKE '%" + deptName + "%'";
            }
            }
@ -1037,8 +1037,8 @@ public class RehabilitationInfoService {
            list = jdbcTemplate.queryForList(sql);
            list = jdbcTemplate.queryForList(sql);
        }
        }
        if ("2".equals(type)) {
        if ("2".equals(type)) {
            String sql = "SELECT b.id 'doctorId',b.`name` 'doctorName' FROM base_doctor_hospital a \n" +
                    "INNER JOIN base_doctor  b ON a.doctor_code=b.id \n" +
            String sql = "SELECT b.id 'doctorId',b.`name` 'doctorName' FROM base_doctor_hospital a  " +
                    "INNER JOIN base_doctor  b ON a.doctor_code=b.id  " +
                    "WHERE  1=1 ";
                    "WHERE  1=1 ";
            if (StringUtils.isNotBlank(deptCode)) {
            if (StringUtils.isNotBlank(deptCode)) {
                sql += " and a.dept_code = '" + deptCode + "' ";
                sql += " and a.dept_code = '" + deptCode + "' ";
@ -1052,24 +1052,24 @@ public class RehabilitationInfoService {
    }
    }
    public List<Map<String, Object>> getPatientInfo(String patientId, String idcard) {
    public List<Map<String, Object>> getPatientInfo(String patientId, String idcard) {
        String sql = "SELECT\n" +
                "	b.sign_status 'signStatus',\n" +
                "	CASE \n" +
                "	 WHEN b.sign_status='1' THEN '已家签'\n" +
                "	 WHEN b.sign_status='0' THEN '未家签'\n" +
                "	END 'signStatusName',\n" +
                "	a.* \n" +
                "FROM\n" +
                "	base_patient a\n" +
                "	LEFT JOIN wlyy_rehabilitation_patient_info b ON a.id = b.patient \n" +
                "WHERE\n" +
                "	1 = 1 \n" +
                "	AND a.del = 1\n";
        String sql = "SELECT " +
                "	b.sign_status 'signStatus', " +
                "	CASE  " +
                "	 WHEN b.sign_status='1' THEN '已家签' " +
                "	 WHEN b.sign_status='0' THEN '未家签' " +
                "	END 'signStatusName', " +
                "	a.*  " +
                "FROM " +
                "	base_patient a " +
                "	LEFT JOIN wlyy_rehabilitation_patient_info b ON a.id = b.patient  " +
                "WHERE " +
                "	1 = 1  " +
                "	AND a.del = 1 ";
        if (StringUtils.isNotBlank(patientId)) {
        if (StringUtils.isNotBlank(patientId)) {
            sql += "	AND a.id='" + patientId + "'\n";
            sql += "	AND a.id='" + patientId + "' ";
        }
        }
        if (StringUtils.isNotBlank(idcard)) {
        if (StringUtils.isNotBlank(idcard)) {
            sql += "	AND a.idcard='" + idcard + "'\n";
            sql += "	AND a.idcard='" + idcard + "' ";
        }
        }
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;
        return list;
@ -1087,48 +1087,60 @@ public class RehabilitationInfoService {
        String limitSql = " LIMIT " + (page - 1) * pagesize + "," + pagesize;
        String limitSql = " LIMIT " + (page - 1) * pagesize + "," + pagesize;
        String sql = "SELECT * FROM ( " +
        String sql = "SELECT * FROM ( " +
                "SELECT DISTINCT \n" +
                "	 a.idcard,a.id,a.`name`,a.birthday,a.phone,a.sex,a.mobile,TIMESTAMPDIFF(YEAR,a.birthday,NOW()) 'age',\n" +
                "	   (\n" +
                "		SELECT GROUP_CONCAT(q.`name`) FROM base_disease_hospital q \n" +
                "        INNER JOIN wlyy_patient_rehabilitation_plan w ON q.id = w.disease \n" +
                "		 WHERE 1 = 1 AND w.patient=a.id "+sqlTem+" GROUP BY w.patient\n" +
                "	   ) 'diseaseListName',\n" +
                "      (\n" +
                "        SELECT GROUP_CONCAT(DISTINCT w.plan_doctor_name) FROM wlyy_patient_rehabilitation_plan w WHERE a.id = w.patient \n" +sqlTem+
                "      ) 'planDoctorListName',\n" +
                "	   (\n" +
                "			SELECT count(1) FROM wlyy_patient_rehabilitation_plan w \n" +
                "			INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id \n" +
                "           INNER JOIN base_service_item_plan e ON e.plan_detail_id = q.id \n" +
                "			WHERE 1 = 1 AND w.patient = a.id \n" +sqlTem+
                "		)'itemAllCount',\n" +
                "		(\n" +
                "			SELECT count(1) FROM wlyy_patient_rehabilitation_plan w \n" +
                "			INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id \n" +
                "           INNER JOIN base_service_item_plan e ON e.plan_detail_id = q.id \n" +
                "			WHERE	1 = 1 	AND e.`status`='0'	AND w.patient = a.id \n" +sqlTem+
                "		)'unFinishCount',\n" +
                "		(\n" +
                "			SELECT count(1) 	FROM wlyy_patient_rehabilitation_plan w \n" +
                "			INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id \n" +
                "           INNER JOIN base_service_item_plan e ON e.plan_detail_id = q.id \n" +
                "			WHERE	1 = 1 	AND e.`status`='1'	AND w.patient = a.id \n" +sqlTem+
                "		)'finishCount',\n" +
                "		(\n" +
                "			SELECT count(1) FROM wlyy_patient_rehabilitation_plan w \n" +
                "			INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id \n" +
                "           INNER JOIN base_service_item_plan e ON e.plan_detail_id = q.id \n" +
                "			WHERE	1 = 1 	AND e.plan_time=DATE_FORMAT(NOW(),'%Y-%m-%d') AND e.`status`='0'	AND w.patient = a.id \n" +sqlTem+
                "		)'totayTask'\n" +
                "FROM\n" +
                "	base_patient a\n" +
                "	left JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.patient\n" +
                "SELECT DISTINCT  " +
                "	 a.idcard,a.id,a.`name`,a.birthday,a.phone,a.sex,a.mobile,TIMESTAMPDIFF(YEAR,a.birthday,NOW()) 'age', " +
                "	   ( " +
                "		SELECT GROUP_CONCAT(q.`name`) FROM base_disease_hospital q  " +
                "        INNER JOIN wlyy_patient_rehabilitation_plan w ON q.id = w.disease  " +
                "		 WHERE 1 = 1 AND w.patient=a.id "+sqlTem+" GROUP BY w.patient " +
                "	   ) 'diseaseListName', " +
                "      ( " +
                "        SELECT GROUP_CONCAT(DISTINCT w.plan_doctor_name) FROM wlyy_patient_rehabilitation_plan w WHERE a.id = w.patient  " +sqlTem+
                "      ) 'planDoctorListName', " +
                "	         if(ti.num is null,0,ti.num) 'itemAllCount',  " +
                "      if(tu.num1 is null,0,tu.num1) 'unFinishCount',  " +
                "      if(tu.num2 is null,0,tu.num2) 'finishCount',  " +
                "      if(tt.num is null,0,tt.num) 'totayTask' " +
                "FROM " +
                "	base_patient a " +
                "	left JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.patient " +
                "   LEFT JOIN wlyy_rehabilitation_plan_detail d on b.id = d.plan_id "+
                "   LEFT JOIN wlyy_rehabilitation_plan_detail d on b.id = d.plan_id "+
                "	INNER JOIN wlyy_rehabilitation_patient_info c ON c.patient = a.id \n" +
                "WHERE\n" +
                "	1 = 1 \n" +
                "	AND a.del = '1'\n";
                "	INNER JOIN wlyy_rehabilitation_patient_info c ON c.patient = a.id  " +
                " LEFT JOIN (  " +
                "        SELECT  " +
                "          w.patient,count(if(e.`status` = '0',1,null)) num1,count(if(e.`status` = '1',1,null)) num2  " +
                "        FROM  " +
                "          wlyy_patient_rehabilitation_plan w  " +
                "        INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id  " +
                "        INNER JOIN base_service_item_plan e ON e.plan_detail_id = q.id  " +
                "        WHERE  1 = 1  " + sqlTem+
                "        GROUP BY w.patient  " +
                ") tu on tu.patient=a.id  " +
                "LEFT JOIN (  " +
                "        SELECT  " +
                "          w.patient,count(1) num  " +
                "        FROM  " +
                "          wlyy_patient_rehabilitation_plan w  " +
                "        INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id  " +
                "        INNER JOIN base_service_item_plan e ON e.plan_detail_id = q.id  " +
                "        WHERE  1 = 1  " + sqlTem+
                "        AND e.plan_time = DATE_FORMAT(NOW(), '%Y-%m-%d')  " +
                "        AND e.`status` = '0'  " +
                "        GROUP BY w.patient  " +
                ") tt on tt.patient=a.id  " +
                "LEFT JOIN (  " +
                "        SELECT  " +
                "          w.patient,count(1) num  " +
                "        FROM  " +
                "          wlyy_patient_rehabilitation_plan w  " +
                "        INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id  " +
                "        INNER JOIN base_service_item_plan e ON e.plan_detail_id = q.id  " +
                "        WHERE  1 = 1  " + sqlTem+
                "        GROUP BY w.patient  " +
                ") ti on ti.patient=a.id "+
                "WHERE " +
                "	1 = 1  " +
                "	AND a.del = '1' ";
        if (StringUtils.isNotBlank(doctorId) && StringUtils.isBlank(patientId)) {
        if (StringUtils.isNotBlank(doctorId) && StringUtils.isBlank(patientId)) {
            //计划负责人或者任务执行人-执行人不为空
            //计划负责人或者任务执行人-执行人不为空
@ -1171,26 +1183,28 @@ public class RehabilitationInfoService {
     */
     */
    public HashMap<String, Object> getRehabilitationPatientPlanCount(String doctorId) {
    public HashMap<String, Object> getRehabilitationPatientPlanCount(String doctorId) {
        String sql =
        String sql =
                "SELECT DISTINCT \n" +
                        "	 a.id,a.`name`,a.birthday,a.phone,a.sex,a.mobile,TIMESTAMPDIFF(YEAR,a.birthday,NOW()) 'age',\n" +
                        "	  (\n" +
                        "		SELECT GROUP_CONCAT(q.`name`) FROM base_disease_hospital q  INNER JOIN wlyy_patient_rehabilitation_plan w ON q.id = w.disease \n" +
                        "		 WHERE 1 = 1 AND w.patient=a.id  GROUP BY w.patient\n" +
                        "	  ) 'diseaseListName',\n" +
                        "	  (\n" +
                        "	  	SELECT count(1)  FROM wlyy_patient_rehabilitation_plan w \n" +
                        "	  	INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id \n" +
                        "       INNER JOIN base_service_item_plan e ON e.plan_detail_id = q.id \n" +
                        "	  	WHERE 1 = 1  AND e.`status`='0'	 AND w.patient = a.id \n" +
                        "	  )'unFinishCount'\n" +
                        "FROM\n" +
                        "	base_patient a\n" +
                        "	INNER JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.patient\n" +
                "SELECT DISTINCT  " +
                        "	 a.id,a.`name`,a.birthday,a.phone,a.sex,a.mobile,TIMESTAMPDIFF(YEAR,a.birthday,NOW()) 'age', " +
                        "	  ( " +
                        "		SELECT GROUP_CONCAT(q.`name`) FROM base_disease_hospital q  INNER JOIN wlyy_patient_rehabilitation_plan w ON q.id = w.disease  " +
                        "		 WHERE 1 = 1 AND w.patient=a.id  GROUP BY w.patient " +
                        "	  ) 'diseaseListName', " +
                        "	  if(t1.num is null,0,t1.num) 'unFinishCount' " +
                        "FROM " +
                        "	base_patient a " +
                        "	INNER JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.patient " +
                        "   LEFT JOIN wlyy_rehabilitation_plan_detail d on b.id = d.plan_id "+
                        "   LEFT JOIN wlyy_rehabilitation_plan_detail d on b.id = d.plan_id "+
                        "	INNER JOIN wlyy_rehabilitation_patient_info c ON c.patient = b.patient \n" +
                        "WHERE\n" +
                        "	1 = 1 \n" +
                        "	AND a.del = '1'\n";
                        "	INNER JOIN wlyy_rehabilitation_patient_info c ON c.patient = b.patient  " +
                        " LEFT JOIN ( " +
                        "    SELECT w.patient,count(DISTINCT e.id) num  FROM wlyy_patient_rehabilitation_plan w  " +
                        "    INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id  " +
                        "       INNER JOIN base_service_item_plan e ON e.plan_detail_id = q.id  " +
                        "    WHERE 1 = 1  AND e.`status`='0'   " +
                        "   GROUP BY w.patient " +
                        "   ) t1 on t1.patient=a.id "+
                        "WHERE " +
                        "	1 = 1  " +
                        "	AND a.del = '1' ";
        if (StringUtils.isNotBlank(doctorId)) {
        if (StringUtils.isNotBlank(doctorId)) {
            //计划负责人或者任务执行人-执行人不为空
            //计划负责人或者任务执行人-执行人不为空
@ -1221,30 +1235,30 @@ public class RehabilitationInfoService {
     * todo 还需要代办项目还需要重新join一张新表 todayTaskCount 今日任务项,等后面在整
     * todo 还需要代办项目还需要重新join一张新表 todayTaskCount 今日任务项,等后面在整
     */
     */
    public List<Map<String, Object>> getPatientRehabilitationByPatientId(String patientId, String planId,String diseaseId) {
    public List<Map<String, Object>> getPatientRehabilitationByPatientId(String patientId, String planId,String diseaseId) {
        String sql = "SELECT DISTINCT \n" +
                "	 a.id,a.`name`,a.birthday,a.phone,a.sex,a.mobile,TIMESTAMPDIFF(YEAR,a.birthday,NOW()) 'age',a.idcard,\n" +
        String sql = "SELECT DISTINCT  " +
                "	 a.id,a.`name`,a.birthday,a.phone,a.sex,a.mobile,TIMESTAMPDIFF(YEAR,a.birthday,NOW()) 'age',a.idcard, " +
                "	 b.id 'planId',b.title 'planTitle',b.plan_doctor 'planDoctor',b.plan_doctor_name 'planDoctorName'" +
                "	 b.id 'planId',b.title 'planTitle',b.plan_doctor 'planDoctor',b.plan_doctor_name 'planDoctorName'" +
                ",d. `name` 'diseaseName',c.dept_name 'deptName',\n" +
                ",d. `name` 'diseaseName',c.dept_name 'deptName', " +
                "	 b.`status` 'planStatus', c.hospital_name 'hospitalName',b.medical_records_code medicalRecordsCode," +
                "	 b.`status` 'planStatus', c.hospital_name 'hospitalName',b.medical_records_code medicalRecordsCode," +
                "    c.from_source, " +
                "    c.from_source, " +
                "       CASE  \n" +
                "        WHEN c.from_source='1' THEN '手动添加'\n" +
                "        WHEN c.from_source='2' THEN '自动下转'\n" +
                "        WHEN c.from_source='3' THEN '扫码添加'\n" +
                "      END 'fromSourceName',\n" +
                "       CASE   " +
                "        WHEN c.from_source='1' THEN '手动添加' " +
                "        WHEN c.from_source='2' THEN '自动下转' " +
                "        WHEN c.from_source='3' THEN '扫码添加' " +
                "      END 'fromSourceName', " +
                "     c.ijk_id, c.status,'patientStatus'," +
                "     c.ijk_id, c.status,'patientStatus'," +
                "     b.advice_content 'adviceContent',\n" +
                "	 (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q INNER JOIN base_service_item_plan w ON w.plan_detail_id = q.id WHERE 1 = 1 AND q.plan_id = b.id )'itemAllCount',\n" +
                "	 (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q INNER JOIN base_service_item_plan w ON w.plan_detail_id = q.id WHERE 1 = 1 AND w.`status`='1' AND q.plan_id = b.id )'finishCount',\n" +
                "	 (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q INNER JOIN base_service_item_plan w ON w.plan_detail_id = q.id WHERE 1 = 1 AND w.`status`='0' AND q.plan_id = b.id )'unFinishCount',\n" +
                "	 (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q INNER JOIN base_service_item_plan w ON w.plan_detail_id = q.id WHERE 1 = 1 AND w.`status`='0' AND w.plan_time=DATE_FORMAT(NOW(),'%Y-%m-%d') AND q.plan_id = b.id )'todayTaskCount' \n" +
                "FROM\n" +
                "	base_patient a\n" +
                "	LEFT JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.patient\n" +
                "	INNER JOIN wlyy_rehabilitation_patient_info c ON c.code = b.patient_info_code \n" +
                "	LEFT JOIN base_disease_hospital d ON  d.id=b.disease\n" +
                "WHERE\n" +
                "	1 = 1 \n" +
                "     b.advice_content 'adviceContent', " +
                "	 (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q INNER JOIN base_service_item_plan w ON w.plan_detail_id = q.id WHERE 1 = 1 AND q.plan_id = b.id )'itemAllCount', " +
                "	 (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q INNER JOIN base_service_item_plan w ON w.plan_detail_id = q.id WHERE 1 = 1 AND w.`status`='1' AND q.plan_id = b.id )'finishCount', " +
                "	 (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q INNER JOIN base_service_item_plan w ON w.plan_detail_id = q.id WHERE 1 = 1 AND w.`status`='0' AND q.plan_id = b.id )'unFinishCount', " +
                "	 (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q INNER JOIN base_service_item_plan w ON w.plan_detail_id = q.id WHERE 1 = 1 AND w.`status`='0' AND w.plan_time=DATE_FORMAT(NOW(),'%Y-%m-%d') AND q.plan_id = b.id )'todayTaskCount'  " +
                "FROM " +
                "	base_patient a " +
                "	LEFT JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.patient " +
                "	INNER JOIN wlyy_rehabilitation_patient_info c ON c.code = b.patient_info_code  " +
                "	LEFT JOIN base_disease_hospital d ON  d.id=b.disease " +
                "WHERE " +
                "	1 = 1  " +
                "	AND a.del = '1' ";
                "	AND a.del = '1' ";
        if (StringUtils.isNotBlank(patientId)) {
        if (StringUtils.isNotBlank(patientId)) {
            sql += "	AND a.id='" + patientId + "' ";
            sql += "	AND a.id='" + patientId + "' ";
@ -1260,25 +1274,25 @@ public class RehabilitationInfoService {
    }
    }
    public List<Map<String, Object>> getRehabilitationPatientCountNew(String doctorId) {
    public List<Map<String, Object>> getRehabilitationPatientCountNew(String doctorId) {
        String sql = "SELECT\n" +
                "	CASE \n" +
                "		WHEN d.`status`='0' THEN '未下转'\n" +
                "		WHEN d.`status`='1' THEN '待分配'\n" +
//                "		WHEN d.`status`='2' THEN '创建计划过程失败'\n" +
//                "		WHEN d.`status`='3' THEN '患者无住院病历信息'\n" +
//                "		WHEN d.`status`='5' THEN '同步居民失败'\n" +
                "		WHEN d.`status`='7' THEN '已管理'\n" +
                "  END 'statusName',\n" +
                "  d.`status`,count(DISTINCT p.id) 'count' \n" +
                "FROM\n" +
                "	base_patient p\n" +
                "	INNER JOIN wlyy_rehabilitation_patient_info d ON p.id = d.patient\n" +
                "	LEFT JOIN wlyy_patient_rehabilitation_plan q ON d.`code` = q.patient_info_code \n" +
        String sql = "SELECT " +
                "	CASE  " +
                "		WHEN d.`status`='0' THEN '未下转' " +
                "		WHEN d.`status`='1' THEN '待分配' " +
//                "		WHEN d.`status`='2' THEN '创建计划过程失败' " +
//                "		WHEN d.`status`='3' THEN '患者无住院病历信息' " +
//                "		WHEN d.`status`='5' THEN '同步居民失败' " +
                "		WHEN d.`status`='7' THEN '已管理' " +
                "  END 'statusName', " +
                "  d.`status`,count(DISTINCT p.id) 'count'  " +
                "FROM " +
                "	base_patient p " +
                "	INNER JOIN wlyy_rehabilitation_patient_info d ON p.id = d.patient " +
                "	LEFT JOIN wlyy_patient_rehabilitation_plan q ON d.`code` = q.patient_info_code  " +
                "	LEFT JOIN wlyy_rehabilitation_plan_detail pd ON pd.plan_id = q.id " +
                "	LEFT JOIN wlyy_rehabilitation_plan_detail pd ON pd.plan_id = q.id " +
                "WHERE\n" +
                "	1 = 1 \n" +
                " 	AND ( d.create_user = '" + doctorId + "'  OR q.plan_doctor='" + doctorId + "' OR ISNULL( d.create_user ) or pd.doctor='"+doctorId+"' ) \n" +
                "	AND ( ISNULL( d.type ) OR d.type = 2 )\n" +
                "WHERE " +
                "	1 = 1  " +
                " 	AND ( d.create_user = '" + doctorId + "'  OR q.plan_doctor='" + doctorId + "' OR ISNULL( d.create_user ) or pd.doctor='"+doctorId+"' )  " +
                "	AND ( ISNULL( d.type ) OR d.type = 2 ) " +
                "	GROUP BY d.`status`";
                "	GROUP BY d.`status`";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;
        return list;
@ -1289,14 +1303,14 @@ public class RehabilitationInfoService {
     * 查询病例信息
     * 查询病例信息
     */
     */
    public List<PatientMedicalRecordsDO> getPatientMedicalRecordsByPlanId(String planId) {
    public List<PatientMedicalRecordsDO> getPatientMedicalRecordsByPlanId(String planId) {
        String sql = "SELECT\n" +
                " a.* \n" +
                "FROM\n" +
                "	wlyy_patient_medical_records_rehabilitation a\n" +
                "	INNER JOIN wlyy_patient_rehabilitation_plan b ON a.`CODE` = b.medical_records_code \n" +
                "WHERE\n" +
                "	b.id = '" + planId + "' \n" +
                "ORDER BY\n" +
        String sql = "SELECT " +
                " a.*  " +
                "FROM " +
                "	wlyy_patient_medical_records_rehabilitation a " +
                "	INNER JOIN wlyy_patient_rehabilitation_plan b ON a.`CODE` = b.medical_records_code  " +
                "WHERE " +
                "	b.id = '" + planId + "'  " +
                "ORDER BY " +
                "	create_time DESC ";
                "	create_time DESC ";
        List<PatientMedicalRecordsDO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(PatientMedicalRecordsDO.class));
        List<PatientMedicalRecordsDO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(PatientMedicalRecordsDO.class));
        return list;
        return list;
@ -1307,15 +1321,15 @@ public class RehabilitationInfoService {
     * 查询康复计划服务项
     * 查询康复计划服务项
     */
     */
    public List<Map<String, Object>> getPatientPlanItemList(String patientId, String planId, String itemId, String status) {
    public List<Map<String, Object>> getPatientPlanItemList(String patientId, String planId, String itemId, String status) {
        String sql = "SELECT\n" +
                "	b.`name`,\n" +
        String sql = "SELECT " +
                "	b.`name`, " +
                "	a.plan_id," +
                "	a.plan_id," +
                "   a.id, a.doctor,a.doctor_name,a.dept,a.dept_name \n" +
                "FROM\n" +
                "	wlyy_rehabilitation_plan_detail a\n" +
                "	INNER JOIN wlyy_rehabilitation_service_item b ON a.hospital_service_item_id = b.id \n" +
                "WHERE\n" +
                "	1 = 1 \n" +
                "   a.id, a.doctor,a.doctor_name,a.dept,a.dept_name  " +
                "FROM " +
                "	wlyy_rehabilitation_plan_detail a " +
                "	INNER JOIN wlyy_rehabilitation_service_item b ON a.hospital_service_item_id = b.id  " +
                "WHERE " +
                "	1 = 1  " +
                "	AND a.plan_id = '" + planId + "'";
                "	AND a.plan_id = '" + planId + "'";
        if (StringUtils.isNotBlank(itemId)) {
        if (StringUtils.isNotBlank(itemId)) {
            sql += " and b.id= '" + itemId + "'";
            sql += " and b.id= '" + itemId + "'";
@ -1337,20 +1351,20 @@ public class RehabilitationInfoService {
    public List<Map<String, Object>> getPlanDoctorList(String planId) {
    public List<Map<String, Object>> getPlanDoctorList(String planId) {
        String sql = "SELECT DISTINCT q.* FROM (\n" +
                "	SELECT \n" +
                "		a.id,a.`name`,a.mobile,a.photo,a.sex\n" +
                "	FROM\n" +
                "		base_doctor a\n" +
                "		INNER JOIN wlyy_rehabilitation_plan_detail b ON a.id = b.doctor\n" +
                "		WHERE 1=1 AND b.plan_id='" + planId + "'\n" +
                "	UNION ALL\n" +
                "	SELECT \n" +
                "		a.id,a.`name`,a.mobile,a.photo,a.sex\n" +
                "	FROM\n" +
                "		base_doctor a\n" +
                "		INNER JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.plan_doctor\n" +
                "		WHERE 1=1 AND b.id='" + planId + "'\n" +
        String sql = "SELECT DISTINCT q.* FROM ( " +
                "	SELECT  " +
                "		a.id,a.`name`,a.mobile,a.photo,a.sex " +
                "	FROM " +
                "		base_doctor a " +
                "		INNER JOIN wlyy_rehabilitation_plan_detail b ON a.id = b.doctor " +
                "		WHERE 1=1 AND b.plan_id='" + planId + "' " +
                "	UNION ALL " +
                "	SELECT  " +
                "		a.id,a.`name`,a.mobile,a.photo,a.sex " +
                "	FROM " +
                "		base_doctor a " +
                "		INNER JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.plan_doctor " +
                "		WHERE 1=1 AND b.id='" + planId + "' " +
                ")q";
                ")q";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;
        return list;