LiTaohong 7 vuotta sitten
vanhempi
commit
d2e3ea6c31
16 muutettua tiedostoa jossa 189 lisäystä ja 78 poistoa
  1. 45 32
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/DeviceHealthIndexService.java
  2. 8 8
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/util/SystemConf.java
  3. 2 1
      patient-co/patient-co-figure-label/src/main/java/com/yihu/wlyy/figure/label/convert/ConvertHelper.java
  4. 1 1
      patient-co/patient-co-figure-label/src/main/java/com/yihu/wlyy/figure/label/job/Mysql2ESJob.java
  5. 13 7
      patient-co/patient-co-wlyy/pom.xml
  6. 3 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/Application.java
  7. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java
  8. 6 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  9. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java
  10. 13 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/iot/IotDeviceService.java
  11. 21 7
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/Base64Utils.java
  12. 40 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandingService.java
  13. 12 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandlingController.java
  14. 16 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java
  15. 2 1
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml
  16. 4 4
      patient-co/patient-co-wlyy/src/main/resources/logback.xml

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

@ -191,32 +191,31 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
        User loginUser = (User) request.getSession().getAttribute("userInfo");
        StringBuilder filter = new StringBuilder();
        String sql = "SELECT a.patient  FROM wlyy.wlyy_sign_family a, wlyy.wlyy_patient b WHERE a.status > 0 AND a.patient = b.code  ";
        String sql =" SELECT i.* ,s.name userName FROM device.wlyy_patient_health_index i , wlyy.wlyy_sign_family s WHERE s. STATUS > 0  and i.user=s.patient ";
        //1、管理员  2、医生 0、其他
        if(loginUser.getType()==2){
            Doctor doctor = doctorDao.findByCode(loginUser.getCode());
            if(doctor!=null &&StringUtils.isNotEmpty(doctor.getHospital())){
                sql += " AND a.hospital = '"+doctor.getHospital()+"' ";
                filter.append(" AND s.hospital = '"+doctor.getHospital()+"' ");
            }
        }
        //根据患者名称过滤
        if(!StringUtils.isEmpty(userName)){
            sql +=" AND b.NAME LIKE '%"+userName+"%'";
            filter.append(" AND s.NAME LIKE '%"+userName+"%' ");
        }
        //根据健管师或医生名称过滤
        if(!StringUtils.isEmpty(doctorName)){
            sql += " and (a.doctor_name like '%"+doctorName+"%' or a.doctor_health_name like '%"+doctorName+"%') ";
            filter.append(" and (s.doctor_name like '%"+doctorName+"%' or s.doctor_health_name like '%"+doctorName+"%') ");
        }
        List<String> patientList = jdbcTemplate.queryForList(sql,String.class);
        if(!StringUtils.isEmpty(deviceSn)){
            filter.append("deviceSn="+deviceSn+";");
            filter.append(" and i.deviceSn="+deviceSn);
        }
        if(!StringUtils.isEmpty(idcard)){
            filter.append("idcard="+idcard+";");
            filter.append(" and i.idcard="+idcard);
        }
        //体征数据创建时间
        if(!StringUtils.isEmpty(date)){
            Date startTimeTemp  =  DateTimeUtil.simpleDateParse(date);
            Calendar calendar = new GregorianCalendar();
@ -226,58 +225,72 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
            calendar.set(Calendar.SECOND,59);
            calendar.set(Calendar.MILLISECOND,999);
            Date endTimeTemp = calendar.getTime();
            filter.append("czrq>=" + DateTimeUtil.utcDateTimeFormat(startTimeTemp)+ ";");
            filter.append("czrq<=" + DateTimeUtil.utcDateTimeFormat(endTimeTemp)+ ";");
        }
        if(patientList != null && patientList.size() >0){
            String temp = StringUtils.join(patientList, ",");
            filter.append("user="+temp+";");
            filter.append(" and i.czrq>=" + DateTimeUtil.utcDateTimeFormat(startTimeTemp));
            filter.append(" and i.czrq<=" + DateTimeUtil.utcDateTimeFormat(endTimeTemp));
        }
        //指标类型
        if(!StringUtils.isEmpty(indexType)){
            filter.append("type="+indexType+";");
            filter.append(" and i.type="+indexType);
        }
        //体征数据
        if("1".equals(indexType)||"2".equals(indexType)||"4".equals(indexType)){
            if(indexTypeMin1!=null){
                filter.append("value1>="+indexTypeMin1+";");
                filter.append(" and value1>="+indexTypeMin1);
            }
            if(indexTypeMax1!=null){
                filter.append("value1<="+indexTypeMax1+";");
                filter.append(" and value1<="+indexTypeMax1);
            }
            if(indexTypeMin2!=null){
                filter.append("value2>="+indexTypeMin2+";");
                filter.append(" and value2>="+indexTypeMin2);
            }
            if(indexTypeMax2!=null){
                filter.append("value2<="+indexTypeMax2+";");
                filter.append(" and value2<="+indexTypeMax2);
            }
        }else{
            if(indexTypeMin1!=null){
                filter.append("value3>="+indexTypeMin1+";");
                filter.append(" and value3>="+indexTypeMin1);
            }
            if(indexTypeMax1!=null){
                filter.append("value3<="+indexTypeMax1+";");
                filter.append(" and value3<="+indexTypeMax1);
            }
            if(indexTypeMin2!=null){
                filter.append("value4>="+indexTypeMin2+";");
                filter.append(" and value4>="+indexTypeMin2);
            }
            if(indexTypeMax2!=null){
                filter.append("value4<="+indexTypeMax2+";");
                filter.append(" and value4<="+indexTypeMax2);
            }
        }
        List<DeviceHealthIndex> list = (List<DeviceHealthIndex>)search(filter.toString());
        String f = filter.toString();
        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql+f+" order by i.czrq desc ");
        String regex = "(\\w{3})(\\w+)(\\w{3})";
        List<DeviceHealthIndexVO> listTemp = new ArrayList<>();
        if(list !=null && list.size()>0){
            for (DeviceHealthIndex info : list){
        if(resultList !=null && resultList.size()>0){
            for (Map<String, Object> info : resultList){
                DeviceHealthIndexVO bean = new DeviceHealthIndexVO();
                BeanUtils.copyProperties(info, bean);
//                BeanUtils.copyProperties(bean, info);
                Patient patient = findPatient(bean.getUser());
                bean.setUserName(patient== null?"":patient.getName());
                bean.setId(Long.getLong(info.get("id")+""));
                bean.setCzrq(info.get("czrq")!=null?(Date)info.get("czrq"):null);
                bean.setDel(info.get("del")!=null?info.get("del")+"":null);
                bean.setDeviceSn(info.get("device_sn")!=null?info.get("device_sn")+"":null);
                bean.setIdcard(info.get("idcard")!=null?info.get("idcard")+"":null);
                bean.setIntervene(info.get("intervene")!=null?info.get("intervene")+"":null);
                bean.setRecordDate(info.get("record_date")!=null?(Date)info.get("record_date"):null);
                bean.setSortDate(info.get("sort_date")!=null?(Date)info.get("sort_date"):null);
                bean.setStatus(info.get("status")!=null?(Integer)info.get("status"):null);
                bean.setType(info.get("type")!=null?(Integer)info.get("type"):0);
                bean.setUser(info.get("user")!=null?info.get("user")+"":null);
                bean.setUserName(info.get("userName")!=null?info.get("userName")+"":null);
                bean.setValue1(info.get("value1")!=null?info.get("value1")+"":null);
                bean.setValue2(info.get("value2")!=null?info.get("value2")+"":null);
                bean.setValue3(info.get("value3")!=null?info.get("value3")+"":null);
                bean.setValue4(info.get("value4")!=null?info.get("value4")+"":null);
                bean.setValue5(info.get("value5")!=null?info.get("value5")+"":null);
                bean.setValue6(info.get("value6")!=null?info.get("value6")+"":null);
                bean.setValue7(info.get("value7")!=null?info.get("value7")+"":null);
                if(StringUtils.isNotBlank(bean.getIdcard())){
                    bean.setIdcard(bean.getIdcard().replaceAll(regex, "$1****$3"));
                }
                bean.setHealthStandard(gethealthStandard(info.getType(),info.getUser()).toString());
                bean.setHealthStandard(gethealthStandard(bean.getType(),bean.getUser()).toString());
                listTemp.add(bean);
            }
        }

+ 8 - 8
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/util/SystemConf.java

@ -42,22 +42,22 @@ public class SystemConf {
	private static final String appSecret = "appSecret";
	// 血糖餐前最小值
	public static final double HEALTH_STANDARD_ST_MIN_BEFORE = 3.9;
	public static final double HEALTH_STANDARD_ST_MIN_BEFORE = 4;//3.9
	// 血糖餐前最大值
	public static final double HEALTH_STANDARD_ST_MAX_BEFORE = 6.1;
	public static final double HEALTH_STANDARD_ST_MAX_BEFORE = 7;//6.1
	// 血糖餐后最小值
	public static final double HEALTH_STANDARD_ST_MIN_AFTER = 4.4;
	public static final double HEALTH_STANDARD_ST_MIN_AFTER = 4;//4.4
	// 血糖餐后最大值
	public static final double HEALTH_STANDARD_ST_MAX_AFTER = 7.8;
	public static final double HEALTH_STANDARD_ST_MAX_AFTER = 11.1;//7.8
	// 舒张压最小值
	public static final double HEALTH_STANDARD_SZY_MIN = 60;
	public static final double HEALTH_STANDARD_SZY_MIN = 60;//60
	// 舒张压最大值
	public static final double HEALTH_STANDARD_SZY_MAX = 89;
	public static final double HEALTH_STANDARD_SZY_MAX = 90;//89
	// 收缩压最小值
	public static final double HEALTH_STANDARD_SSY_MIN = 90;
	public static final double HEALTH_STANDARD_SSY_MIN = 90;//90
	// 收缩压最大值
	public static final double HEALTH_STANDARD_SSY_MAX = 139;
	public static final double HEALTH_STANDARD_SSY_MAX = 140;//139
	// 短信接口地址
	public static final String SMS_URL = "https://smsapi.ums86.com:9600/sms/Api/Send.do";

+ 2 - 1
patient-co/patient-co-figure-label/src/main/java/com/yihu/wlyy/figure/label/convert/ConvertHelper.java

@ -43,7 +43,7 @@ public class ConvertHelper {
    public List<SaveModel> convert(List<DataModel> dataModels, FLlabelDictJob fLlabelDictJob) throws Exception {
        List<SaveModel> saveModels = new ArrayList<>();
            //不需要转换
            if(StringUtils.isEmpty(fLlabelDictJob.getConvertClazz()) || StringUtils.isEmpty(fLlabelDictJob.getSql())){
            if(fLlabelDictJob==null || StringUtils.isEmpty(fLlabelDictJob.getConvertClazz()) || StringUtils.isEmpty(fLlabelDictJob.getSql())){
                return generateSaveModleWithOutConvert(dataModels);
            }
            List<FLlabelDict> flLabelDictList = jdbcTemplate.query(fLlabelDictJob.getSql(),new BeanPropertyRowMapper(FLlabelDict.class));
@ -64,6 +64,7 @@ public class ConvertHelper {
                dataModel -> {
                    SaveModel saveModel = new SaveModel();
                    saveModel.setIdcard(dataModel.getIdcard());
                    saveModel.setModelId(MakeModelIDUtil.makeModelID(dataModel,""));
                    saveModel.setLabelType(dataModel.getParentCode());
                    saveModel.setLabelCode(dataModel.getLabelCode());
                    saveModel.setLabeName(dataModel.getLabelName());

+ 1 - 1
patient-co/patient-co-figure-label/src/main/java/com/yihu/wlyy/figure/label/job/Mysql2ESJob.java

@ -79,7 +79,7 @@ public class Mysql2ESJob implements Job {
        //增量存储成功后,修改增量的czrq时间为当前时间
        if (bool) {
            this.flJobConfigDao.updateSqlFildeValue(this.flJobConfigId, DateFormatUtils.format(new Date(), ConstantUtil.date_format));
                this.flJobConfigDao.updateSqlFildeValue(this.flJobConfigId, DateFormatUtils.format(new Date(), ConstantUtil.date_format));
        }
    }

+ 13 - 7
patient-co/patient-co-wlyy/pom.xml

@ -28,11 +28,6 @@
    <dependencies>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>common-logback-starter</artifactId>
            <version>1.0.1</version>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>common-entity</artifactId>
@ -431,7 +426,7 @@
            <version>2.4.1.0</version>
        </dependency>
        <!--elasticsearch start-->
        <dependency>
  <!--      <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>2.4.4</version>
@ -440,7 +435,7 @@
            <groupId>io.searchbox</groupId>
            <artifactId>jest</artifactId>
            <version>2.4.0</version>
        </dependency>
        </dependency>-->
        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
@ -482,6 +477,17 @@
            <version>4.3.10.RELEASE</version>
        </dependency>
        <!--拼音https://mvnrepository.com/artifact/org.clojars.cbilson/pinyin4j end-->
        <dependency>
            <groupId>com.googlecode.log4jdbc</groupId>
            <artifactId>log4jdbc</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
    </dependencies>
    <build>
        <finalName>wlyy</finalName>

+ 3 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/Application.java

@ -7,6 +7,7 @@ import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAu
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.elasticsearch.jest.JestAutoConfiguration;
import org.springframework.context.ApplicationContext;
/**
@ -17,7 +18,8 @@ import org.springframework.context.ApplicationContext;
        ElasticsearchAutoConfiguration.class,
        ElasticsearchRepositoriesAutoConfiguration.class,
        ElasticsearchDataAutoConfiguration.class,
        RedisRepositoriesAutoConfiguration.class
        RedisRepositoriesAutoConfiguration.class,
        JestAutoConfiguration.class
})
public class Application {
    public static ApplicationContext ctx = null;

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -1470,6 +1470,7 @@ public class DoctorInfoService extends BaseService {
                String data = responseObject.getString("data");
                if("0".equals(data)){
                    Doctor doctor = findDoctorByCode(doctorCode);
                    strNewCalledPasswd = Base64Utils.encryptBASE64(strNewCalledPasswd);
                    doctor.setCheckPassword(strNewCalledPasswd);//保存密码,以便忘记密码时候使用
                    doctor.setIscertified(1);//说明已经(线上认证,已修改密码)
                    doctorDao.save(doctor);
@ -1583,7 +1584,7 @@ public class DoctorInfoService extends BaseService {
        Doctor doctor = doctorDao.findByCode(doctorCode);
        boolean b = updateAuthenticationPassword(doctor.getIdcard(),doctor.getCheckPassword(),"11111111",doctorCode);
        boolean b = updateAuthenticationPassword(doctor.getIdcard(),Base64Utils.decryptBASE64(doctor.getCheckPassword()),"11111111",doctorCode);
        if(b){
            doctor.setCheckPassword("");
            doctor.setIscertified(0);

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

@ -1333,7 +1333,11 @@ public class StatisticsESService {
        if (resultList != null) {
            String signTaskNum = "";
            if ("3".equals(lowCode)) {
                signTaskNum = systemDictService.getDictValueNoRedis("SIGN_TASKNUM_17_65", year);//2017年65岁以上的目标量
                if ("2017".equals(year)){
                    signTaskNum = systemDictService.getDictValueNoRedis("SIGN_TASKNUM_17_65", year);//2017年65岁以上的目标量
                }else if ("2016".equals(year)){
                    signTaskNum = systemDictService.getDictValueNoRedis("SIGN_TASKNUM_16_65", year);
                }
            } else {
                signTaskNum = systemDictService.getDictValueNoRedis("SIGN_TASKNUM_17", year);//目标量
            }
@ -2258,7 +2262,7 @@ public class StatisticsESService {
            }
            resultMaps.add(rs);
        }
        if ((level == 3 && "5".equals(low_level)) || (level == 4) || (level == 3 && "5".equals(low_level))) {
        if (level == 4 ||"5".equals(low_level)) {
            Map<Integer, Map<String, Object>> leaders = getAllTeamLeaders();
            if (resultMaps != null && resultMaps.size() > 0) {
                for (Map<String, Object> r : resultMaps) {

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

@ -1327,7 +1327,7 @@ public class JMJkEduArticleService extends BaseService {
            heapm.setLeaveWords(one.getLeaveWords());//医生留言
            doctor = doctorDao.findByCode(one.getDoctorCode());
            heapm.setPhoto(doctor.getPhoto());
//            heapm.setTotalData(total);
            heapm.setTotalData(total);
            result.add(heapm);
            // heapm.setTime();//时间  xx小时前  2017-10-11
        }

+ 13 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/iot/IotDeviceService.java

@ -23,6 +23,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.stereotype.Service;
@ -201,7 +202,8 @@ public class IotDeviceService {
    public String upload(JSONObject json){
        json.put("access_token",accessToken);
        json.put("data_source",dataSource);
        String url = baseUrl+"/dataInput/input";
//        String url = baseUrl+"/dataInput/input";
        String url = baseUrl+"input";
        String response = httpClientUtil.iotPostBody(url, json.toString());
        return response;
    }
@ -544,13 +546,18 @@ public class IotDeviceService {
     * @return
     */
    public String initData(){
        Integer page = 1;
        Integer page = 2;
        Integer size = 1000;
        Integer start = (page-1)*size;
//        String sql = "SELECT i.id,i.user,i.value1,i.value2,i.value3,i.value4,i.type,i.record_date,i.device_sn,i.status,i.del,d.device_name,d.user_type,p.name,p.idcard " +
//                "from device.wlyy_patient_health_index i " +
//                "LEFT JOIN wlyy_patient_device d on i.`user` = d.`user` and i.device_sn = d.device_sn " +
//                "LEFT JOIN wlyy_patient p on i.`user` = p.code order by i.id limit ?,1000";
        String sql = "SELECT i.id,i.user,i.value1,i.value2,i.value3,i.value4,i.type,i.record_date,i.device_sn,i.status,i.del,d.device_name,d.user_type,p.name,p.idcard " +
                "from device.wlyy_patient_health_index i " +
                "LEFT JOIN wlyy_patient_device d on i.`user` = d.`user` and i.device_sn = d.device_sn " +
                "LEFT JOIN wlyy_patient p on i.`user` = p.code order by i.id limit ?,1000";
                "LEFT JOIN wlyy_patient_device_copy d on i.`user` = d.`user` and i.device_sn = d.device_sn " +
                "LEFT JOIN wlyy_patient_copy p on i.`user` = p.code order by i.id limit ?,1000";
        List<JSONObject> list = jdbcTemplate.query(sql,new Object[]{start}, new ResultSetExtractor<List<JSONObject>>() {
            @Override
            public List<JSONObject> extractData(ResultSet resultSet) throws SQLException, DataAccessException {
@ -586,7 +593,7 @@ public class IotDeviceService {
                    DeviceHealthyInfoMapping info = new DeviceHealthyInfoMapping();
                    info.setCreateTime(new Date());
                    info.setIndexId(one.getLong("id"));
                    info.setRid(one.getJSONObject("obj").getJSONArray("rid").getString(0));
                    info.setRid(re.getJSONObject("obj").getJSONArray("rid").getString(0));
                    infos.add(info);
                }
            });
@ -595,7 +602,7 @@ public class IotDeviceService {
            //下一次
            page++;
            start = (page-1)*size;
            list = jdbcTemplate.queryForList(sql,new Object[]{start},JSONObject.class);
            list = jdbcTemplate.query(sql,new Object[]{start},new BeanPropertyRowMapper(JSONObject.class));
        }
        return null;

+ 21 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/Base64Utils.java

@ -1,14 +1,10 @@
package com.yihu.wlyy.util;
import org.apache.axis.encoding.Base64;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.*;
/**
@ -141,4 +137,22 @@ public class Base64Utils {
		in.close();
	}
	//加密
	public static String encryptBASE64(String key) {
		byte[] bt = key.getBytes();
		return (new BASE64Encoder()).encodeBuffer(bt);
	}
	//解密
	public static String decryptBASE64(String key) {
		byte[] bt;
		try {
			bt = (new BASE64Decoder()).decodeBuffer(key);
			return new String(bt, "utf-8");//如果出现乱码可以改成: String(bt, "utf-8")或 gbk
		} catch (IOException e) {
			e.printStackTrace();
			return "";
		}
	}
}

+ 40 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandingService.java

@ -11,6 +11,7 @@ import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.manage.UserDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientDeviceDao;
import com.yihu.wlyy.util.Base64Utils;
import com.yihu.wlyy.util.ElasticsearchUtil;
import com.yihu.wlyy.util.LatitudeUtils;
import com.yihu.wlyy.util.MD5;
@ -20,10 +21,14 @@ 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.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
/**
@ -43,6 +48,8 @@ public class DataHandingService {
    private ElastricSearchSave elastricSearchSave;
    @Autowired
    private PatientDeviceDao patientDeviceDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Transactional
    public String producePatientAndDoctorPassword() {
@ -190,4 +197,37 @@ public class DataHandingService {
        });
        return ja;
    }
    //原有CA的密码没有加密,清洗成加密密码
    public boolean updateCAPassword(){
        boolean flag = true;
        try {
            String sql = " select * from wlyy_doctor where check_password is not null and check_password <> ''";
//            List<Doctor> list =  jdbcTemplate.query(sql, new RowMapper<Doctor>() {
//                @Override
//                public Doctor mapRow(ResultSet resultSet, int i) throws SQLException {
//                    Doctor doctor = new Doctor();
//                    doctor.setId(resultSet.getLong("id"));
//                    doctor.setCode(resultSet.getString("code"));
//                    doctor.setCheckPassword(resultSet.getString("check_password"));
//                    return doctor;
//                }
//            });
            List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
            List<Doctor> result = new ArrayList<>();
            list.stream().forEach(one->{
                Doctor d = doctorDao.findByCode(one.get("code")!=null?one.get("code").toString():"");
                if(d!=null){
                    d.setCheckPassword(Base64Utils.encryptBASE64(d.getCheckPassword()));
                    result.add(d);
                }
            });
            doctorDao.save(result);
        }catch (Exception e){
            e.printStackTrace();
            flag = false;
        }
        return  flag;
    }
}

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

@ -264,4 +264,16 @@ public class DataHandlingController extends BaseController {
        return write(200, jsonObject.toString());
    }
    @RequestMapping(value = "/updateCAPassword", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("CA密码加密")
    public String updateCAPassword() {
        boolean flag = dataHandingService.updateCAPassword();
        if (flag) {
            return write(200, "清洗数据成功!");
        } else {
            return write(0, "清洗数据失败!");
        }
    }
}

+ 16 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -24,10 +24,7 @@ import com.yihu.wlyy.service.app.sign.FamilyContractService;
import com.yihu.wlyy.service.app.team.DrHealthTeamService;
import com.yihu.wlyy.service.common.account.RoleService;
import com.yihu.wlyy.service.common.account.TokenService;
import com.yihu.wlyy.util.CommonUtil;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.IdcardValidator;
import com.yihu.wlyy.util.RSAUtils;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -1987,7 +1984,8 @@ public class DoctorController extends BaseController {
    public String installAuthenticationPassword(@RequestParam(value = "strNewCalledPasswd",required = true) String strNewCalledPasswd){
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
            String strOldCalledPasswd = StringUtils.isNotEmpty(doctor.getCheckPassword())?doctor.getCheckPassword():"11111111";
            String strOldCalledPasswd = StringUtils.isNotEmpty(doctor.getCheckPassword())?doctor.getCheckPassword():Base64Utils.encryptBASE64("11111111");
            strOldCalledPasswd = Base64Utils.decryptBASE64(strOldCalledPasswd);
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),strOldCalledPasswd,strNewCalledPasswd,getUID());
            if(b){
                return write(200, "设置密码成功!", "data", b);
@ -2010,7 +2008,7 @@ public class DoctorController extends BaseController {
    public String resetAuthenticationPassword(@RequestParam(value = "strNewCalledPasswd",required = true) String strNewCalledPasswd){
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),doctor.getCheckPassword(),strNewCalledPasswd,getUID());
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),Base64Utils.decryptBASE64(doctor.getCheckPassword()),strNewCalledPasswd,getUID());
            if(b){
                return write(200, "重置密码成功!", "data", b);
            }
@ -2138,5 +2136,17 @@ public class DoctorController extends BaseController {
            return error(-1, "获取失败!");
        }
    }
    public static void main(String[] args) {
        String aa = "111111";
//        String bb= MD5.GetMD5Code(aa);
//        System.out.printf(bb);
//        String cc= MD5.GetMD5Code(bb);
//        System.out.printf(cc);
        String bb = Base64Utils.encryptBASE64(aa);
        System.out.println(bb);
        String cc = Base64Utils.decryptBASE64(bb);
        System.out.println(cc);
    }
}

+ 2 - 1
patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml

@ -35,7 +35,8 @@ im:
#物联网配置
iot:
  url: http://192.168.131.24:8088/svr-iot/
#  url: http://192.168.131.24:8088/svr-iot/
  url: http://localhost:10050/svr-iot/
wechat:
  appId: wx1f129f7b51701428

+ 4 - 4
patient-co/patient-co-wlyy/src/main/resources/logback.xml

@ -23,7 +23,7 @@
        </encoder>
    </appender>
    <appender name="business_m" class="com.yihu.base.es.ElasticsearchAppender">
  <!--  <appender name="business_m" class="com.yihu.base.es.ElasticsearchAppender">
        <hosts>http://172.19.103.68:9200</hosts>
        <index>business</index>
        <type>business</type>
@ -36,7 +36,7 @@
        <type>interface</type>
        <clusterName>jkzl</clusterName>
        <rolling>year</rolling>
    </appender>
    </appender>-->
    <!-- project default level -->
    <logger name="com.yihu.wlyy" level="INFO"/>
@ -44,12 +44,12 @@
    <logger name="jdbc.sqltiming" level="INFO"/>
    <logger name="com.yihu.wlyy.logs.BusinessLogs" level="INFO" additivity="false">
   <!-- <logger name="com.yihu.wlyy.logs.BusinessLogs" level="INFO" additivity="false">
        <appender-ref ref="business_m"/>
    </logger>
    <logger name="com.yihu.wlyy.logs.InterfaceCallLogs" level="INFO" additivity="false">
        <appender-ref ref="interface_call_m"/>
    </logger>
    </logger>-->
    <!--处方支付日志 start-->