Преглед на файлове

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

zd_123 преди 7 години
родител
ревизия
f81613c0bd
променени са 18 файла, в които са добавени 471 реда и са изтрити 60 реда
  1. 42 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/DoctorDao.java
  2. 3 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/WlyyRoleDao.java
  3. 228 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/user/ManageRangeService.java
  4. 0 2
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/common/SystemConfig.java
  5. 18 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/common/util/SOAPUtil.java
  6. 0 13
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ZysoftApi.java
  7. 6 9
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/guahao/GuahaoService.java
  8. 16 18
      patient-co-service/wlyy_service/src/main/resources/system.properties
  9. 4 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/extract/db/Data2Save.java
  10. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/template/DoctorTeamGuidanceTemplateDao.java
  11. 31 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java
  12. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  13. 21 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java
  14. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorTeamGuidanceService.java
  15. 38 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/DateUtil.java
  16. 7 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEdu/DoctorJMJkEduArticleController.java
  17. 52 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/jimeiJkEdu/PatientJMJkEduArticleController.java
  18. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionInfoController.java

+ 42 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/DoctorDao.java

@ -7,12 +7,14 @@ package com.yihu.wlyy.repository;
import java.util.List;
import com.yihu.wlyy.entity.Doctor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.wlyy.entity.Doctor;
import org.springframework.web.bind.annotation.RequestParam;
public interface DoctorDao extends PagingAndSortingRepository<Doctor, Long>, JpaSpecificationExecutor<Doctor> {
@ -60,4 +62,42 @@ public interface DoctorDao extends PagingAndSortingRepository<Doctor, Long>, Jpa
    // 身份证查询医生信息
    @Query("select p from Doctor p where p.idCard = ?1 and p.status = 1")
    Doctor findByIdCard(String idcard);
    //搜索及列表查询
    @Query("SELECT p  FROM Doctor p, WlyyUserRole r, WlyyRole ro " +
            " WHERE r.user = p.code AND p.hospital = ro.code AND p.status = 1 AND p.name = ?1 AND p.idCard = ?2")
    Page<Doctor> findByFilter(String name, String  idcard, Pageable pageable);
    //搜索及列表查询
    @Query("SELECT p  FROM Doctor p, WlyyUserRole r, WlyyRole ro " +
            " WHERE r.user = p.code AND p.hospital = ro.code AND p.status = 1 AND p.name = ?1 ")
    Page<Doctor> findByName(String name, Pageable pageable);
    //搜索及列表查询
    @Query("SELECT p  FROM Doctor p, WlyyUserRole r, WlyyRole ro " +
            " WHERE r.user = p.code AND p.hospital = ro.code AND p.status = 1 AND p.idCard = ?1 ")
    Page<Doctor> findByIdcard(String  idcard, Pageable pageable);
    //搜索及列表查询
    @Query("SELECT p  FROM Doctor p, WlyyUserRole r, WlyyRole ro " +
            " WHERE r.user = p.code AND p.hospital = ro.code AND p.status = 1 ")
    Page<Doctor> findByFilterAll(Pageable pageable);
    //搜索及列表查询不在wlyy_user_role表的医生
    @Query(value = "SELECT p FROM Doctor p where p.status= 1 AND p.name = ?1 AND p.idCard = ?2 ")
    List<Doctor> findDoctorByFilter(String name, String  idcard);
    //搜索及列表查询不在wlyy_user_role表的医生
    @Query(value = "SELECT p FROM Doctor p where p.status= 1 AND p.name = ?1 ")
    List<Doctor> findDoctorByName(String name);
    //搜索及列表查询不在wlyy_user_role表的医生
    @Query(value = "SELECT p FROM Doctor p where p.status= 1 AND p.idCard = ?1 ")
    List<Doctor> findDoctorByIdcard(String  idcard);
    //搜索及列表查询
    @Query("SELECT p  FROM Doctor p, WlyyUserRole r, WlyyRole ro " +
            " WHERE r.user = p.code AND p.hospital = ro.code AND p.status = 1 AND p.code = ?1 ")
    Doctor findListByCode(String code);
}

+ 3 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/WlyyRoleDao.java

@ -18,4 +18,7 @@ public interface WlyyRoleDao extends JpaRepository<WlyyRole,Integer> {
    @Query(value = "select b.* from  wlyy_role b where b.name = ?1", nativeQuery = true)
    WlyyRole findByName(String name);
    @Query(value = "select b.* from  wlyy_role b where b.code = ?1", nativeQuery = true)
    WlyyRole findByCode(String code);
}

+ 228 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/user/ManageRangeService.java

@ -0,0 +1,228 @@
package com.yihu.wlyy.service.manager.user;
import com.yihu.wlyy.entity.*;
import com.yihu.wlyy.repository.*;
import com.yihu.wlyy.util.Envelop;
import com.yihu.wlyy.util.MD5;
import com.yihu.wlyy.util.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import java.util.*;
/**
 * Created by Reece on 2018/1/16.
 */
@Service
public class ManageRangeService extends BaseJpaService<Doctor, DoctorDao> {
    @Autowired
    private WlyyUserRoleDao userRoleDao;
    @Autowired
    private DoctorDao doctorDao;
    @Autowired
    private WlyyRoleDao roleDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * wlyy_user_role 列表展示及页面搜索医生信息
     *
     * @param name
     * @param idcard
     * @param page
     * @param pageSize
     * @return
     * @throws Exception
     */
    public List<Doctor> searchList(String name, String idcard, Integer page, Integer pageSize) throws Exception {
        if (page == null) {
            page = 1;
        }
        if (page == null) {
            pageSize = 15;
        }
        // 展示状态排序
        Sort sort = new Sort(Sort.Direction.ASC, "id");
        PageRequest pageRequest = new PageRequest(page - 1, pageSize, sort);
        List<Doctor> userList = null;
        /*if (StringUtils.isNotEmpty(name) && StringUtils.isNotEmpty(idcard)) {
            userList = doctorDao.findByFilter(name, idcard, pageRequest);
        } else if (StringUtils.isEmpty(name) && StringUtils.isNotEmpty(idcard)) {
            userList = doctorDao.findByIdcard(idcard, pageRequest);
        } else if (StringUtils.isNotEmpty(name) && StringUtils.isEmpty(idcard)) {
            userList = doctorDao.findByName(name, pageRequest);
        } else {
            userList = doctorDao.findByFilterAll(pageRequest);
        }*/
        String sql = "SELECT p.code,p.name,p.sex,p.idCard,p.mobile,ro.code hospital,ro.name hospitalName " +
                " FROM wlyy_doctor p, wlyy_user_role r, wlyy_role ro  " +
                " WHERE r.user = p.code AND r.role = ro.code AND p.status = 1 ";
        if (StringUtils.isNotEmpty(name) && StringUtils.isNotEmpty(idcard)) {
            sql += " AND p.name = " + name + " AND p.idcard = " + idcard;
        } else if (StringUtils.isEmpty(name) && StringUtils.isNotEmpty(idcard)) {
            sql += " AND p.idcard = " + idcard;;
        } else if (StringUtils.isNotEmpty(name) && StringUtils.isEmpty(idcard)) {
            sql += " AND p.name = " + name;
        }
        sql += " ORDER BY p.id ASC  limit "+ (page-1) +"," +pageSize;
        userList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(Doctor.class));
        return userList;
    }
    /**
     * wlyy_user_role 列表展示及页面搜索医生信息
     *
     * @return
     * @throws Exception
     */
    public List<Doctor> searchList(String name, String idcard) throws Exception {
        List<Doctor> userList = null;
        String sql = "SELECT p.code,p.name,p.sex,p.idcard,p.mobile,ro.code hospital,ro.name hospitalName " +
                " FROM wlyy_doctor p, wlyy_user_role r, wlyy_role ro  " +
                " WHERE r.user = p.code AND r.role = ro.code AND p.status = 1  ";
        if (StringUtils.isNotEmpty(name) && StringUtils.isNotEmpty(idcard)) {
            sql += " AND p.name = " + name + " AND p.idcard = " + idcard;
        } else if (StringUtils.isEmpty(name) && StringUtils.isNotEmpty(idcard)) {
            sql += " AND p.idcard = " + idcard;;
        } else if (StringUtils.isNotEmpty(name) && StringUtils.isEmpty(idcard)) {
            sql += " AND p.name = " + name;
        }
        sql += " ORDER BY p.id ASC  ";
        userList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(Doctor.class));
        return userList;
    }
    /**
     * 查询所有的医院信息
     *
     * @return
     * @throws Exception
     */
    public List<WlyyRole> getHostpitalList() throws Exception {
        // 展示状态排序
        List<WlyyRole> roleList = roleDao.findAll();
        return roleList;
    }
    /**
     * wlyy_user_role 列表展示及页面搜索医生信息
     * @return
     * @throws Exception
     */
    public List<Doctor> getDoctorList(String name, String idcard) throws Exception {
        // 展示状态排序
        List<Doctor> userList = null;
        if (StringUtils.isNotEmpty(name) && StringUtils.isNotEmpty(idcard)) {
            userList = doctorDao.findDoctorByFilter(name, idcard);
        } else if (StringUtils.isEmpty(name) && StringUtils.isNotEmpty(idcard)) {
            userList = doctorDao.findDoctorByIdcard(idcard);
        } else if (StringUtils.isNotEmpty(name) && StringUtils.isEmpty(idcard)) {
            userList = doctorDao.findDoctorByName(name);
        }
        return userList;
    }
    /**
     * 用户删除
     * @param doc
     * @param hospital
     * @return
     * @throws Exception
     */
    public boolean deleteUserRole(String doc,String hospital) throws Exception {
        Boolean flag = false;
        try {
            WlyyUserRole role = userRoleDao.findByUserAndRole(doc,hospital);
            userRoleDao.delete(role);
            flag = true;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return flag;
    }
    //保存先判断wlyy_role是否存在在新增
    public int saveUserRole(String doc, String hospital) throws Exception {
        int flag = 200;
        try {
            Doctor doctor = doctorDao.findByCode(doc);
            if (doctor != null) {
                WlyyUserRole wlyyUserRole = userRoleDao.findByUserAndRole(doc, hospital);
                if (wlyyUserRole == null) {
                    WlyyUserRole userRole = new WlyyUserRole();
                    userRole.setUser(doc);
                    userRole.setRole(hospital);
                    userRole.setCzrq(new Date());
                    userRole.setCzy("1");
                    userRoleDao.save(userRole);
                } else {
                    flag = -1;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            flag = -2;
        }
        return flag;
    }
    /**
     * 列表页查询医生详情
     *
     * @param doc
     * @return
     */
    public List<Doctor> getUser(String doc,String hospital) throws Exception{
        List<Doctor> doctor = null;
        try {
            String sql = "SELECT p.code,p.name,p.sex,p.idcard,p.mobile,ro.code hospital,ro.name hospitalName " +
                    " FROM wlyy_doctor p, wlyy_user_role r, wlyy_role ro  " +
                    " WHERE r.user = p.code AND r.role = ro.code AND p.status = 1  " +
                    " and r.user = "+ doc +" and ro.code = "+ hospital;
            doctor =  jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(Doctor.class));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return doctor;
    }
    /**
     * 编辑医生相关信息
     *
     * @param doc         编辑医生code(批量添加逗号分隔)
     * @param oldHospital 修改前的医生权限code
     * @param hospital    修改后的医生权限code
     * @return
     */
    public void updateUserRole(String doc, String oldHospital, String hospital) throws Exception {
        try {
            WlyyUserRole userRole = userRoleDao.findByUserAndRole(doc,oldHospital);
            userRole.setRole(hospital);
            userRoleDao.save(userRole);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

+ 0 - 2
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/common/SystemConfig.java

@ -70,8 +70,6 @@ public class SystemConfig {
    }
    public String getPublicKey() { return  getSystemProperties().getProperty("gateway_public_key"); }
    
    public String getImmPublicKey() { return  getSystemProperties().getProperty("imm_public_key"); }
    public String getJwHospital()
    {

+ 18 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/common/util/SOAPUtil.java

@ -246,6 +246,24 @@ public class SOAPUtil {
		return new String[] { condition, strCredential, strKey };
	}
	
	/**
	 * 加密计免预约condition
	 * @param condition
	 * @return
	 * @throws UnsupportedEncodingException
	 */
	public static String getImmCondition(String condition) throws UnsupportedEncodingException {
		
		// 对身份证据Compress()压缩
		byte[] pbyteSource = sehrCrypto.sehrCrypto.Compress(condition.getBytes("UTF-16LE"));
		// 采用bKEY对称加密Encrypt()
		byte[] encryptSource = sehrCrypto.sehrCrypto.Encrypt(pbyteSource, bKEY);
		// 再编码EncodeU()
		condition = new String(sehrCrypto.sehrCrypto.EncodeU(encryptSource));
		
		return condition;
	}
}

+ 0 - 13
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ZysoftApi.java

@ -23,19 +23,6 @@ public class ZysoftApi extends AbstractApiExecuter {
    private static byte[]  publicKey;
    private static byte[]  zkzlPublicKey;
    private static byte[]  zkzlPrivateKey;
    private static String  immPublicKey;
    
    /**
     * 获取计免预约加密公钥
     */
    public static String getImmPublicKey() throws Exception {
        if(immPublicKey == null)
        {
            immPublicKey =  ZysoftApi.class.getClassLoader().getResource(SystemConfig.getInstance().getImmPublicKey()).toURI().getPath();
        }
        return immPublicKey;
    }
    
    /**
     * 智业公钥

+ 6 - 9
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/guahao/GuahaoService.java

@ -1304,16 +1304,13 @@ public class GuahaoService {
    public String GetOrgImmuneList()throws Exception  {
        String result = "";
        Map<String,String> params = new HashMap<>();
    
        String condition = "<root><zone>350203</zone><zone>350206</zone><zone>350205</zone><zone>350211</zone><zone>350212</zone><zone>350213</zone></root>";
        ZysoftApi api = ZysoftApi.getSingleton();
        PublicKey publicKey=immPublicKeyget(api.getImmPublicKey());
        byte[] encryptedBytes = this.encrypt(condition.getBytes(),publicKey);
        condition = new String(encryptedBytes,"utf-8");
        System.out.println(condition);
        params.put("Condition", condition);
        String[] values = SOAPUtil.getCredential(condition, true);
//        System.out.println(condition);
        params.put("Condition", values[0]);
        params.put("Credential", values[1]);
        params.put("Key", values[2]);
        return immPostSecond("GetOrgImmuneList","计免预约-获取免疫接种机构列表",params);
    }

+ 16 - 18
patient-co-service/wlyy_service/src/main/resources/system.properties

@ -1,22 +1,20 @@
###基卫测试环境服务
gateway_url = http://117.25.173.18:18280/
gateway_licence = 5YGl5bq45LmL7Lev
gateway_public_key = PublicKeyTest.key
imm_public_key=ImmPublicTest.key
jw_hospital = 350211B1013
jw_licence = 5YGl5bq45LmL7Lev
ca_url = http://117.29.183.114:8081/XMCAService?wsdl
ca_namespace = http://platfomservice.xmca.com/
#gateway_url = http://117.25.173.18:18280/
#gateway_licence = 5YGl5bq45LmL7Lev
#gateway_public_key = PublicKeyTest.key
#jw_hospital = 350211B1013
#jw_licence = 5YGl5bq45LmL7Lev
#ca_url = http://117.29.183.114:8081/XMCAService?wsdl
#ca_namespace = http://platfomservice.xmca.com/
##基卫服务
#guahao_url =  http://10.95.18.10/urp.service/urp.open.service/ReservationPulic.asmx
#guahao_namespace = http://www.zysoft.com.cn/
#gateway_url = http://10.95.21.21:18280/
#gateway_licence = 5YGl5bq45LmL7Lev
#gateway_public_key = PublicGov.key
#imm_public_key=ImmPublic.key
#jw_hospital = 350211B1004
#jw_licence = 5YGl5bq35LmL6LevMzUwMjExQjEwMDQ=
#ca_url = http://10.95.21.21:18280/base/XMCA6_UnifiedCallInterface
#ca_namespace = http://platfomservice.xmca.com/
guahao_url =  http://10.95.18.10/urp.service/urp.open.service/ReservationPulic.asmx
guahao_namespace = http://www.zysoft.com.cn/
gateway_url = http://10.95.21.21:18280/
gateway_licence = 5YGl5bq45LmL7Lev
gateway_public_key = PublicGov.key
jw_hospital = 350211B1004
jw_licence = 5YGl5bq35LmL6LevMzUwMjExQjEwMDQ=
ca_url = http://10.95.21.21:18280/base/XMCA6_UnifiedCallInterface
ca_namespace = http://platfomservice.xmca.com/

+ 4 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/extract/db/Data2Save.java

@ -56,6 +56,9 @@ public class Data2Save {
        //没维度
        for (AdminTeam adminTeam : teams) {
            if(adminTeam.getOrgCode().length() != 10){
                continue;
            }
            SaveModel saveModel = new SaveModel();
            saveModel.setCity("350200");
            saveModel.setCityName("厦门市");
@ -146,6 +149,7 @@ public class Data2Save {
                "  wlyy_admin_team wat " +
                "WHERE " +
                "  h.`code` = wat.org_code " +
                " AND length (h.`code`) = 10 "+
                "AND wat.available = 1";
        List<AdminTeam> adminTeams = jdbcTemplate.query(sql, new BeanPropertyRowMapper(AdminTeam.class));

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/template/DoctorTeamGuidanceTemplateDao.java

@ -68,7 +68,7 @@ public interface DoctorTeamGuidanceTemplateDao extends PagingAndSortingRepositor
    // 根据模板文章标题模糊搜索团队指导模板
    @Query("SELECT b FROM DoctorTeamGuidanceTemplate b ,DoctorTeamGuidanceDetail a WHERE a.code = b.teamTemplateCode  " +
            " AND b.del = 1 AND b.creater = ?1 AND b.title LIKE ?2 ")
    List<DoctorTeamGuidanceTemplate> getListByTile(String doctor, String title, Pageable pageRequest);
            " AND b.del = 1 AND b.teamId = ?1 AND b.title LIKE ?2 ")
    List<DoctorTeamGuidanceTemplate> getListByTile(int teamId, String title, Pageable pageRequest);
}

+ 31 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.service.app.sign;
import com.yihu.es.entity.HealthEduArticleES;
import com.yihu.wlyy.entity.address.Country;
import com.yihu.wlyy.entity.address.Street;
import com.yihu.wlyy.entity.address.Town;
@ -34,6 +35,7 @@ import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.service.third.jw.JwSignService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ElasticsearchUtil;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.apache.commons.lang3.StringUtils;
@ -42,6 +44,7 @@ import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.redis.core.StringRedisTemplate;
@ -49,6 +52,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@ -117,6 +121,12 @@ public class SignWebService extends BaseService {
    private SMSService smsService;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Value("${es.type.HealthEduArticlePatient}")
    private String esType;
    @Value("${es.index.HealthEduArticlePatient}")
    private String esIndex;
    @Autowired
    private ElasticsearchUtil elasticsearchUtil;
    /**
     * 厦门市
     */
@ -1025,11 +1035,13 @@ public class SignWebService extends BaseService {
        return object;
    }
    public JSONObject getSignServiceInfo(String signCode) {
    public JSONObject getSignServiceInfo(String signCode) throws Exception{
        SignFamily signFamily = signFamilyDao.findByCode(signCode);
        if (signFamily == null) {
            return new JSONObject();
        }
        String doctorHealth = signFamily.getDoctorHealth();
        String doctor = signFamily.getDoctor();
        Patient p = patientService.findByCode(signFamily.getPatient());
        String patient = p.getCode();
        //获取咨询
@ -1039,12 +1051,18 @@ public class SignWebService extends BaseService {
        //获取待预约
        String reservation_sql = "select w.code,w.id, w.doctor_name,w.doctor_code,w.doctor_job,w.doctor,w.dname,w.org_code,w.status,w.start_time as czrq,3 as type from wlyy_patient_reservation  w where (w.doctor = ? or w.doctor =?) and w.patient =? and YEAR(w.czrq) = ? ";
        //获取健康教育
        String article_sql = "select w.id,w.article,w2.title,w2.summary,w.czrq,w.doctor,w.doctor_name,w.is_read,4 as type from wlyy_health_edu_article_patient  w,wlyy_health_edu_article w2 where w.article = w2.code and  (w.doctor = ? or w.doctor =?) and w.patient =? and YEAR(w.czrq) = ? ";
//        String article_sql = "select w.id,w.article,w2.title,w2.summary,w.czrq,w.doctor,w.doctor_name,w.is_read,4 as type from wlyy_health_edu_article_patient  w,wlyy_health_edu_article w2 where w.article = w2.code and  (w.doctor = ? or w.doctor =?) and w.patient =? and YEAR(w.czrq) = ? ";
        Date startTime = DateUtil.getBeginDayOfYear();
        Date endTime = DateUtil.getEndDayOfYear();
        String startDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(startTime);
        String endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(endTime);
        String start = elasticsearchUtil.changeTime(startDate);
        String end = elasticsearchUtil.changeTime(endDate);
        String article_sql = "SELECT id,articleId as article,articleTitle as title,createTime as czrq,doctorCode as doctor,doctorName as doctor_name,isRead as is_read,articleContent as content FROM "+esIndex+" where userType='1' and patientCode='"+patient+"' and (doctorCode='"+doctorHealth+"' or doctorCode='"+doctor+"') and createTime>='"+start+"' and createTime<='"+end+"'";
        //获取健康指导
        String guidance_sql = "select w.id,w.doctor,w.content,w.czrq,w.read_status,5 as type  from wlyy_patient_health_guidance  w where (w.doctor = ? or w.doctor =?) and w.patient =? and YEAR(w.czrq) = ? ";
        String doctorHealth = signFamily.getDoctorHealth();
        String doctor = signFamily.getDoctor();
        Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT+08:00"));
        int year = calendar.get(Calendar.YEAR);
        //咨询量
@ -1054,7 +1072,15 @@ public class SignWebService extends BaseService {
        //待预约量
        List<Map<String, Object>> reservationResult = jdbcTemplate.queryForList(reservation_sql, new Object[]{doctorHealth, doctor, patient, year});
        //健康教育量
        List<Map<String, Object>> articleResult = jdbcTemplate.queryForList(article_sql, new Object[]{doctorHealth, doctor, patient, year});
//        List<Map<String, Object>> articleResult = jdbcTemplate.queryForList(article_sql, new Object[]{doctorHealth, doctor, patient, year});
//        List<HealthEduArticleES> esList = elasticsearchUtil.excute(article_sql, HealthEduArticleES.class, esIndex, esType);
        List<Map<String, Object>> articleResult = elasticsearchUtil.excuteDataModel(article_sql);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        for(Map<String, Object> map :articleResult){
            map.put("type","4");
            map.put("czrq",map.get("czrq")!=null?simpleDateFormat.format(new Date(((Long)map.get("czrq")).longValue())):"");
            map.put("summary",map.get("content")!=null?(map.get("content").toString().length()>40?map.get("content").toString().substring(0,40):map.get("content").toString()):"");
        }
        //健康指导量
        List<Map<String, Object>> guidanceResult = jdbcTemplate.queryForList(guidance_sql, new Object[]{doctorHealth, doctor, patient, year});
        List<JSONObject> objects = new ArrayList<>();

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java

@ -4949,7 +4949,7 @@ public class StatisticsESService {
        //83:健康文章,84:健康指导
        List<SaveModel> list_83_84 = elasticsearchUtil.findListDateQuotaLevel0(null, endDate, area, level, "83,84", SaveModel.timeLevel_DDL, lowLevel);
        List<SaveModel> list_83_84 = elasticsearchUtil.findListDateQuotaLevel0( endDate, area, level, "83,84", SaveModel.timeLevel_DDL, lowLevel);
        List<SaveModel> list_read_83_84 = elasticsearchUtil.findListDateQuotaLevel1(endDate,area,level,"83,84", SaveModel.timeLevel_DDL, lowLevel, "1");
//        List<SaveModel> list_84 = elasticsearchUtil.findListDateQuotaLevel0(null, endDate, area, level, "84", SaveModel.timeLevel_ZL, lowLevel);

+ 21 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -11,6 +11,7 @@ import com.yihu.wlyy.entity.doctor.profile.DoctorRole;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.education.HealthEduArticle;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorRoleDao;
import com.yihu.wlyy.repository.patient.PatientDao;
@ -35,6 +36,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.annotation.Transient;
import org.springframework.data.domain.PageRequest;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -85,6 +87,8 @@ public class JMJkEduArticleService extends BaseService {
    private DoctorInfoService doctorInfoService;
    @Autowired
    private DoctorRoleDao doctorRoleDao;
    @Autowired
    DoctorAdminTeamDao teamDao;
    /**
     *
@ -355,6 +359,7 @@ public class JMJkEduArticleService extends BaseService {
            adminTeam = adminTeamService.getTeam(teamId);
        }
        Patient one = null;
        String batchNo = UUID.randomUUID().toString();
        String sendName = "";
@ -406,9 +411,16 @@ public class JMJkEduArticleService extends BaseService {
            healthEduArticleES.setSendSex(doctor.getSex()+"");
            if(adminTeam!=null){
                healthEduArticleES.setAdminTeamCode(adminTeam.getId());
                healthEduArticleES.setAdminTeamName(adminTeam.getName());
                healthEduArticleES.setAdminTeamCode(adminTeam.getId());
            }else{
                List<Object> results = teamDao.findAdminTeamByPatientSignTeam(patient, new PageRequest(0, 1));
                Object[] result = (Object[]) results.get(0);
                healthEduArticleES.setAdminTeamName(result[1].toString());
                healthEduArticleES.setAdminTeamCode(Long.parseLong(result[0].toString()));
            }
            healthEduArticleES.setHospital(doctor.getHospital());
            healthEduArticleES.setHospitalName(doctor.getHospitalName());
            healthEduArticleES.setTown(doctor.getTown());
@ -1143,4 +1155,12 @@ public class JMJkEduArticleService extends BaseService {
        re.addAll(result);
        return re;
    }
//    public List<HealthEduArticleES> findByArticleAndPatient(String articleId,String patient){
//
//        StringBuffer sql = new StringBuffer("select * from   " + esType +
//                " where articleId='"+articleId+"' and userType='1' and patientCode='"+patient+"'" );
//        List<HealthEduArticleES> esList = elasticsearchUtil.excute(sql.toString(),HealthEduArticleES.class, esIndex, esType);
//        return esList;
//    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorTeamGuidanceService.java

@ -277,7 +277,7 @@ public class DoctorTeamGuidanceService extends BaseService {
        if (StringUtils.isEmpty(filter)){
            listGuidances = doctorTeamGuidanceTemplateDao.findGuidanceByTeamId(teamId, request);
        }else {
            listGuidances = doctorTeamGuidanceTemplateDao.getListByTile(doctor,"%"+filter+"%", request);
            listGuidances = doctorTeamGuidanceTemplateDao.getListByTile(teamId,"%"+filter+"%", request);
        }
        for (DoctorTeamGuidanceTemplate guidance : listGuidances) {

+ 38 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/DateUtil.java

@ -1235,4 +1235,42 @@ public class DateUtil {
		return week;
	}
	//获取本年的开始时间
    public static Date getBeginDayOfYear() {
		Calendar cal = Calendar.getInstance();
		cal.set(Calendar.YEAR, getNowYear());
		// cal.set
		cal.set(Calendar.MONTH, Calendar.JANUARY);
		cal.set(Calendar.DATE, 1);
		return getDayStartTime(cal.getTime());
	 }
	//获取本年的结束时间
	public static Date getEndDayOfYear() {
		Calendar cal = Calendar.getInstance();
		cal.set(Calendar.YEAR, getNowYear());
		cal.set(Calendar.MONTH, Calendar.DECEMBER);
		cal.set(Calendar.DATE, 31);
		return getDayEndTime(cal.getTime());
	 }
	//获取某个日期的开始时间
	public static Timestamp getDayStartTime(Date d) {
		Calendar calendar = Calendar.getInstance();
		if(null != d) calendar.setTime(d);
		calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),calendar.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
		calendar.set(Calendar.MILLISECOND, 0);
		return new Timestamp(calendar.getTimeInMillis());
	}
	//获取某个日期的结束时间
     public static Timestamp getDayEndTime(Date d) {
		 Calendar calendar = Calendar.getInstance();
		 if(null != d) calendar.setTime(d);
		 calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),    calendar.get(Calendar.DAY_OF_MONTH), 23, 59, 59);
		 calendar.set(Calendar.MILLISECOND, 999);
		 return new Timestamp(calendar.getTimeInMillis());
	 }
}

+ 7 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEdu/DoctorJMJkEduArticleController.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.web.doctor.jimeiJkEdu;
import com.alibaba.fastjson.JSONObject;
import com.yihu.es.entity.HealthEduArticleES;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
import com.yihu.wlyy.service.jimeiJkEdu.JMJkEduArticleService;
import com.yihu.wlyy.service.third.jkEduArticle.ThirdJkEduArticleService;
import com.yihu.wlyy.util.DateUtil;
@ -16,6 +17,7 @@ import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.MediaType;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
@ -46,6 +48,8 @@ public class DoctorJMJkEduArticleController extends BaseController {
    private String channelName;
    @Value("${jkEdu.web.articleBaseUrl}")
    private String articleBaseUrl;
    @Autowired
    DoctorAdminTeamDao teamDao;
    /**
@ -379,8 +383,10 @@ public class DoctorJMJkEduArticleController extends BaseController {
            Set<String> patientSet = new HashSet<>(); //放入set中可以去重复
            //得到需要发送的患者
            patientSet.add(patientCode);
            List<Object> results = teamDao.findAdminTeamByPatientSignTeam(patientCode, new PageRequest(0, 1));
            Object[] result = (Object[]) results.get(0);
//            jmJkEduArticleService.initPatients(patientSet,labelType,condition,groupType,teamId,getUID());
            List<HealthEduArticleES> healthEduArticleESList = jmJkEduArticleService.savePCPushArticle(patientSet, getUID(), 1,"", 0L, articleId,leaveWords,currentUserRole,currentUserRoleLevel);
            List<HealthEduArticleES> healthEduArticleESList = jmJkEduArticleService.savePCPushArticle(patientSet, getUID(), 1,"", Long.parseLong(result[0].toString()), articleId,leaveWords,currentUserRole,currentUserRoleLevel);
            //推送微信模板消息和发送im消息
            new Thread(() -> {
                //发送任务到redis

+ 52 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/jimeiJkEdu/PatientJMJkEduArticleController.java

@ -2,8 +2,13 @@ package com.yihu.wlyy.web.patient.jimeiJkEdu;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.es.entity.HealthEduArticleES;
import com.yihu.wlyy.entity.education.HealthEduArticle;
import com.yihu.wlyy.entity.education.HealthEduArticleOpHistory;
import com.yihu.wlyy.entity.education.HealthEduArticlePatient;
import com.yihu.wlyy.service.jimeiJkEdu.JMJkEduArticleService;
import com.yihu.wlyy.service.third.jkEduArticle.ThirdJkEduArticleService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -11,12 +16,11 @@ import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
@ -202,4 +206,48 @@ public class PatientJMJkEduArticleController extends BaseController {
            return error(-1,"保存失败!");
        }
    }
//    /**
//     * 旧接口查询文章详情
//     *
//     * @param article 数据文章唯一标示article
//     * @return 列表
//     */
//    @RequestMapping(value = "article")
//    @ResponseBody
//    @ApiOperation("查询文章")
//    public String article(
//            @ApiParam(name = "article", value = "文章ID", required = true) @RequestParam(value = "article", required = true) String article
////            @ApiParam(name = "batchNo", value = "发送所属批次", required = true) @RequestParam(value = "batchNo", required = true) String batchNo
//    ) {
//        try {
//            //获取单条文章记录
//            String patient = getUID();
//            thirdJkEduArticleService.saveBehavior(article,patient,4,null);
//            List<HealthEduArticleES> healthEduArticleES = jmJkEduArticleService.findByArticleAndPatient(article, patient);
//
//            if (healthEduArticleES == null || healthEduArticleES.size() == 0) {
//                return error(-2, "对不起,该消息不是您的消息,您无法查看哦~");
//            }
//            jmJkEduArticleService.readPatientArticle(patient,article);
//            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticalById(article,patient);
//            org.json.JSONObject json = new org.json.JSONObject();
//           // 文章标识
//            json.put("article", response.get("articleId"));
//            // 医生姓名
//            json.put("doctorName", response.get("doctorName"));
//           // 文章标题
//            json.put("title", response.get("articleTitle"));
//           // 文章内容
//            json.put("content", response.get("articleContent"));
//           // 添加日期
//            json.put("czrq", DateUtil.dateToStrLong(new Date()));
////            int readAmount = healthEduArticleOpHistoryService.countReadAmount(healthEduArticlePatient.getArticle());
//            json.put("readAmount", response.get("browseNumber"));
//            return write(200, "查询成功", "data", json);
//        } catch (Exception ex) {
//            error(ex);
//            return invalidUserException(ex, -1, "查询失败!");
//        }
//    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionInfoController.java

@ -79,7 +79,7 @@ public class PatientPrescriptionInfoController extends BaseController {
    @ApiOperation(value = "获取长处方详细信息")
    public String getPrescription(@RequestParam(required = true)@ApiParam(name="code",value="处方CODE")String code){
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.getPrescription(code,getUID()));
            return write(200, "查询成功!", "data", prescriptionInfoService.getPrescription(code,getRepUID()));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");