ソースを参照

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

yeshijie 7 年 前
コミット
d563c02838
17 ファイル変更218 行追加78 行削除
  1. 10 10
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/vo/PatientArchivesDto.java
  2. 4 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/DeviceHealthIndexService.java
  3. 4 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyPatientDeviceService.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. 1 14
      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. 8 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java
  10. 31 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java
  11. 21 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java
  12. 38 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/DateUtil.java
  13. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandlingController.java
  14. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/archives/DoctorArchivesController.java
  15. 7 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEdu/DoctorJMJkEduArticleController.java
  16. 52 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/jimeiJkEdu/PatientJMJkEduArticleController.java
  17. 0 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/service/EduArticleService.java

+ 10 - 10
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/vo/PatientArchivesDto.java

@ -18,8 +18,8 @@ public class PatientArchivesDto {
    private String blood; // 血型
    private String marry; //结婚
    private String adress;  //地址
    private String orgGo;//户口所在地code
    private String orgGoStr;//户口所在地
    private String origo;//户口所在地code
    private String origoStr;//户口所在地
    private String education; //教育水平
    private String occupation; //职业
@ -108,12 +108,12 @@ public class PatientArchivesDto {
        this.adress = adress;
    }
    public String getOrgGo() {
        return orgGo;
    public String getOrigo() {
        return origo;
    }
    public void setOrgGo(String orgGo) {
        this.orgGo = orgGo;
    public void setOrigo(String origo) {
        this.origo = origo;
    }
    public String getEducation() {
@ -284,11 +284,11 @@ public class PatientArchivesDto {
        this.sex = sex;
    }
    public String getOrgGoStr() {
        return orgGoStr;
    public String getOrigoStr() {
        return origoStr;
    }
    public void setOrgGoStr(String orgGoStr) {
        this.orgGoStr = orgGoStr;
    public void setOrigoStr(String origoStr) {
        this.origoStr = origoStr;
    }
}

+ 4 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/DeviceHealthIndexService.java

@ -72,11 +72,15 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
        }
        List<DeviceHealthIndex> list = (List<DeviceHealthIndex>)search("", filter.toString(), "-czrq", page, pageSize);
        long count = 0;
        String regex = "(\\w{3})(\\w+)(\\w{3})";
        if(list !=null && list.size()>0){
            count = getCount(filter.toString());
            for (DeviceHealthIndex info : list){
                Patient patient = findPatient(info.getUser());
                info.setUserName(patient== null?"":patient.getName());
                if(StringUtils.isNotBlank(info.getIdcard())){
                    info.setIdcard(info.getIdcard().replaceAll(regex, "$1****$3"));
                }
            }
        }
        return new PageImpl<DeviceHealthIndex>(list,pageRequest,count);

+ 4 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyPatientDeviceService.java

@ -61,10 +61,14 @@ public class WlyyPatientDeviceService extends BaseJpaService<WlyyPatientDevice,W
        }
        List<WlyyPatientDevice> list = (List<WlyyPatientDevice>)search("", filters.toString(), "-czrq", page, pageSize);
        long count = 0;
        String regex = "(\\w{3})(\\w+)(\\w{3})";
        if(list !=null && list.size()>0){
            count = getCount(filters.toString());
            for (WlyyPatientDevice info : list){
                Patient patient = findPatient(info.getUser());
                if(StringUtils.isNotBlank(info.getUserIdcard())){
                    info.setUserIdcard(info.getUserIdcard().replaceAll(regex, "$1****$3"));
                }
                info.setUserName(patient== null?"":patient.getName());
            }
        }

+ 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;
	}
}

+ 1 - 14
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;
    }
    
    /**
     * 智业公钥
@ -173,7 +160,7 @@ public class ZysoftApi extends AbstractApiExecuter {
    {
        if(apiCryptoParameter == null)
        {
            apiCryptoParameter =  buildApiCryptoParameter(getPublicKey(), "<root><org code=\"jkzl\" /><visitor type=\"0\" code=\"jkzl\" key=\"jkzl\" /></root>");
            apiCryptoParameter =  buildApiCryptoParameter(getPublicKey(), "<root><org code=\"jtqy\" /><visitor type=\"0\" code=\"jtqy\" key=\"jtqy\" /></root>");
        }
        return  apiCryptoParameter;

+ 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/

+ 8 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java

@ -489,10 +489,10 @@ public class PatientInfoService extends BaseService {
        json.put("RESIDENCE","1");//户籍【1.户籍 2.非户籍】
        json.put("NATIONAL",archive.getNation());//民族【NATION_DICT】
        //json.put("ORIGO","350200");//户口所在地【ZONE_DICT】
        if (StringUtils.isEmpty(archive.getOrgGo())){
        if (StringUtils.isEmpty(archive.getOrigo())){
            json.put("ORIGO","350200");//户口所在地【ZONE_DICT】
        }else{
            json.put("ORIGO",archive.getOrgGo());//户口所在地【ZONE_DICT】
            json.put("ORIGO",archive.getOrigo());//户口所在地【ZONE_DICT】
        }
        json.put("BLOOD",archive.getBlood());//血型【1.A型 2.3.O型4.AB型 5.不详】
        json.put("BLOOD_RH","1");//RH阴性【1.否 2.是 3.不详】
@ -517,10 +517,10 @@ public class PatientInfoService extends BaseService {
        archiveDateBase.setOrgId("0");
        archiveDateBase.setResidence(1);
        archiveDateBase.setNational(archive.getNation());
        if (StringUtils.isEmpty(archive.getOrgGoStr())){
        if (StringUtils.isEmpty(archive.getOrigoStr())){
            archiveDateBase.setOrigo("福建省厦门市");
        }else{
            archiveDateBase.setOrigo(archive.getOrgGoStr());
            archiveDateBase.setOrigo(archive.getOrigoStr());
        }
        archiveDateBase.setBlood(Integer.valueOf(archive.getBlood()));
        archiveDateBase.setBloodRh(1);
@ -982,10 +982,10 @@ public class PatientInfoService extends BaseService {
        json.put("ORG_ID","0");//新增默认传0
        json.put("RESIDENCE","1");//户籍【1.户籍 2.非户籍】
        json.put("NATIONAL",archive.getNation());//民族【NATION_DICT】
        if (StringUtils.isEmpty(archive.getOrgGo())){
        if (StringUtils.isEmpty(archive.getOrigo())){
            json.put("ORIGO","350200");//户口所在地【ZONE_DICT】
        }else{
            json.put("ORIGO",archive.getOrgGo());//户口所在地【ZONE_DICT】
            json.put("ORIGO",archive.getOrigo());//户口所在地【ZONE_DICT】
        }
        json.put("BLOOD",archive.getBlood());//血型【1.A型 2.3.O型4.AB型 5.不详】
        json.put("BLOOD_RH","1");//RH阴性【1.否 2.是 3.不详】
@ -1010,10 +1010,10 @@ public class PatientInfoService extends BaseService {
        archiveDataBase.setOrgId("0");
        archiveDataBase.setResidence(1);
        archiveDataBase.setNational(archive.getNation());
        if (StringUtils.isEmpty(archive.getOrgGoStr())){
        if (StringUtils.isEmpty(archive.getOrigoStr())){
            archiveDataBase.setOrigo("福建省厦门市");
        }else {
            archiveDataBase.setOrigo(archive.getOrgGoStr());
            archiveDataBase.setOrigo(archive.getOrigoStr());
        }
        archiveDataBase.setBlood(Integer.valueOf(archive.getBlood()));
        archiveDataBase.setBloodRh(1);

+ 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<>();

+ 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;
//    }
}

+ 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());
	 }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandlingController.java

@ -190,7 +190,7 @@ public class DataHandlingController extends BaseController {
    public String deleteEsOldArticlePatient() {
        Map<String, Object> flag = null;
        try {
            flag = eduArticleService.deleteEsOldArticlePatient();
            //flag = eduArticleService.deleteEsOldArticlePatient();
        } catch (Exception e) {
            e.printStackTrace();
        }

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/archives/DoctorArchivesController.java

@ -248,7 +248,7 @@ public class DoctorArchivesController extends BaseController {
    }
    /**
     * 建档记录详情
     * 建档记录详情.
     * @param code
     * @return
     */

+ 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, "查询失败!");
//        }
//    }
}

+ 0 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/service/EduArticleService.java

@ -982,10 +982,6 @@ public class EduArticleService {
        }
        final String firstId = firstIdStr;
        //查询所有患者list
        String patientSql = "SELECT code,name FROM wlyy_patient WHERE status=1";
        List<Map<String,Object>> patientList = jdbcTemplate.queryForList(patientSql);
        //4.获取医生的推送记录
        //String sql = "select * from wlyy_health_edu_article_patient_copy where admin_team_code IS NOT NULL AND batch_no IS NOT NULL AND doctor='" + doctorCode + "'";
        String sql = "select ap.*,p.name AS patientName from wlyy_health_edu_article_patient_copy ap LEFT JOIN wlyy_patient p ON ap.patient = p.code where ap.admin_team_code IS NOT NULL AND ap.batch_no IS NOT NULL AND ap.doctor='"+doctorCode+"'";