Selaa lähdekoodia

诊后服务初始化

LAPTOP-KB9HII50\70708 2 vuotta sitten
vanhempi
commit
af29638e9a
17 muutettua tiedostoa jossa 660 lisäystä ja 76 poistoa
  1. 45 0
      starter/minio-starter/pom.xml
  2. 3 0
      starter/minio-starter/readme.MD
  3. 35 0
      starter/minio-starter/src/main/java/com/yihu/jw/minio/MinioConfiguration.java
  4. 76 0
      starter/minio-starter/src/main/java/com/yihu/jw/minio/MinioProperties.java
  5. 428 0
      starter/minio-starter/src/main/java/com/yihu/jw/minio/MinioUtil.java
  6. 4 4
      svr/svr-after-diagnosis/src/mian/java/com/yihu/jw/afterDiagnosis/service/device/DeviceDetailService.java
  7. 0 1
      svr/svr-after-diagnosis/src/mian/java/com/yihu/jw/afterDiagnosis/service/device/DeviceWxMessageService.java
  8. 4 4
      svr/svr-after-diagnosis/src/mian/java/com/yihu/jw/afterDiagnosis/service/device/PatientDeviceLogService.java
  9. 2 18
      svr/svr-after-diagnosis/src/mian/java/com/yihu/jw/afterDiagnosis/service/device/PatientDeviceService.java
  10. 9 9
      svr/svr-after-diagnosis/src/mian/java/com/yihu/jw/afterDiagnosis/service/device/PatientHealthIndexService.java
  11. 4 5
      svr/svr-after-diagnosis/src/mian/java/com/yihu/jw/afterDiagnosis/service/prescription/PrescriptionAdressService.java
  12. 0 15
      svr/svr-after-diagnosis/src/mian/java/com/yihu/jw/afterDiagnosis/service/rehabilitation/DiagnosisInformationService.java
  13. 0 2
      svr/svr-after-diagnosis/src/mian/java/com/yihu/jw/afterDiagnosis/service/rehabilitation/RehabilitationGuidanceService.java
  14. 2 1
      svr/svr-after-diagnosis/src/mian/java/com/yihu/jw/afterDiagnosis/service/rehabilitation/RehabilitationInfoService.java
  15. 32 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/MinioController.java
  16. 15 16
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/UnSettledHISPrescriptionService.java
  17. 1 1
      wlyy-parent-pom/pom.xml

+ 45 - 0
starter/minio-starter/pom.xml

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>wlyy-starter</artifactId>
        <groupId>com.yihu.jw</groupId>
        <version>2.4.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>minio-starter</artifactId>
    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot</artifactId>
        </dependency>
        <dependency>
            <groupId>io.minio</groupId>
            <artifactId>minio</artifactId>
            <version>8.4.4</version>
            <exclusions>
                <exclusion>
                    <groupId>com.squareup.okhttp3</groupId>
                    <artifactId>okhttp</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
            <version>4.10.0</version>
        </dependency>
    </dependencies>
</project>

+ 3 - 0
starter/minio-starter/readme.MD

@ -0,0 +1,3 @@
MinIO 分布式对象存储系统
https://zhuanlan.zhihu.com/p/540847036?utm_id=0

+ 35 - 0
starter/minio-starter/src/main/java/com/yihu/jw/minio/MinioConfiguration.java

@ -0,0 +1,35 @@
package com.yihu.jw.minio;
import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
 * MinIO配置类
 * Created by yeshijie on 2023/3/30.
 */
@Configuration
public class MinioConfiguration {
    @Autowired
    private MinioProperties minioProperties;
    @Autowired
    public void setMinioProperties(MinioProperties minioProperties) {
        this.minioProperties = minioProperties;
    }
    /**
     * 初始化客户端
     *
     * @return 客户端
     */
    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(minioProperties.getEndpoint())
                .credentials(minioProperties.getAccessKey(), minioProperties.getSecretKey())
                .build();
    }
}

+ 76 - 0
starter/minio-starter/src/main/java/com/yihu/jw/minio/MinioProperties.java

@ -0,0 +1,76 @@
package com.yihu.jw.minio;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
 * Created by yeshijie on 2023/3/30.
 */
@Configuration
@ConfigurationProperties(prefix = "minio")
public class MinioProperties {
    /**
     * 服务地址
     */
    private String endpoint;
    /**
     * 文件预览地址
     */
    private String preview;
    /**
     * 存储桶名称
     */
    private String bucket;
    /**
     * 用户名
     */
    private String accessKey;
    /**
     * 密码
     */
    private String secretKey;
    public String getEndpoint() {
        return endpoint;
    }
    public void setEndpoint(String endpoint) {
        this.endpoint = endpoint;
    }
    public String getPreview() {
        return preview;
    }
    public void setPreview(String preview) {
        this.preview = preview;
    }
    public String getBucket() {
        return bucket;
    }
    public void setBucket(String bucket) {
        this.bucket = bucket;
    }
    public String getAccessKey() {
        return accessKey;
    }
    public void setAccessKey(String accessKey) {
        this.accessKey = accessKey;
    }
    public String getSecretKey() {
        return secretKey;
    }
    public void setSecretKey(String secretKey) {
        this.secretKey = secretKey;
    }
}

+ 428 - 0
starter/minio-starter/src/main/java/com/yihu/jw/minio/MinioUtil.java

@ -0,0 +1,428 @@
package com.yihu.jw.minio;
import io.minio.*;
import io.minio.http.Method;
import io.minio.messages.Bucket;
import io.minio.messages.Item;
import org.springframework.http.MediaType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaTypeFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
/**
 * Created by yeshijie on 2023/3/30.
 */
@Component
public class MinioUtil {
    private static MinioClient minioClient;
    /**
     * setter注入
     *
     * @param minioClient 客户端
     */
    @Autowired
    public void setMinioClient(MinioClient minioClient) {
        MinioUtil.minioClient = minioClient;
    }
    /**
     * 启动SpringBoot容器的时候初始化Bucket,如果没有Bucket则创建
     */
    public static void createBucket(String bucketName) throws Exception {
        if (!bucketExists(bucketName)) {
            minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());
        }
    }
    /**
     * 判断Bucket是否存在
     *
     * @return true:存在,false:不存在
     */
    public static boolean bucketExists(String bucketName) throws Exception {
        return minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build());
    }
    /**
     * 获得Bucket策略
     *
     * @param bucketName 存储桶名称
     * @return Bucket策略
     */
    public static String getBucketPolicy(String bucketName) throws Exception {
        return minioClient.getBucketPolicy(GetBucketPolicyArgs.builder().bucket(bucketName).build());
    }
    /**
     * 获得所有Bucket列表
     *
     * @return Bucket列表
     */
    public static List<Bucket> getAllBuckets(MinioClient minioClient) throws Exception {
        return minioClient.listBuckets();
    }
    /**
     * 根据存储桶名称获取其相关信息
     *
     * @param bucketName 存储桶名称
     * @return 相关信息
     */
    public static Optional<Bucket> getBucket(String bucketName) throws Exception {
        return getAllBuckets(minioClient)
                .stream()
                .filter(b -> b.name().equals(bucketName))
                .findFirst();
    }
    /**
     * 根据存储桶名称删除Bucket,true:删除成功;false:删除失败,文件或已不存在
     *
     * @param bucketName 存储桶名称
     */
    public static void removeBucket(String bucketName) throws Exception {
        minioClient.removeBucket(RemoveBucketArgs.builder().bucket(bucketName).build());
    }
    /**
     * 判断文件是否存在
     *
     * @param bucketName 存储桶名称
     * @param objectName 文件名
     * @return true:存在;false:不存在
     */
    public static boolean isObjectExist(String bucketName, String objectName) {
        boolean exist = true;
        try {
            minioClient.statObject(StatObjectArgs.builder().bucket(bucketName).object(objectName).build());
        } catch (Exception e) {
            exist = false;
        }
        return exist;
    }
    /**
     * 判断文件夹是否存在
     *
     * @param bucketName 存储桶名称
     * @param objectName 文件夹名称
     * @return true:存在;false:不存在
     */
    public static boolean isFolderExist(String bucketName, String objectName) {
        boolean exist = false;
        try {
            ListObjectsArgs listObjectsArgs = ListObjectsArgs.builder()
                    .bucket(bucketName)
                    .prefix(objectName)
                    .recursive(false)
                    .build();
            Iterable<Result<Item>> results = minioClient.listObjects(listObjectsArgs);
            for (Result<Item> result : results) {
                Item item = result.get();
                if (item.isDir() && objectName.equals(item.objectName())) {
                    exist = true;
                }
            }
        } catch (Exception e) {
            exist = false;
        }
        return exist;
    }
    /**
     * 根据文件前缀查询文件
     *
     * @param bucketName 存储桶名称
     * @param prefix     前缀
     * @param recursive  是否使用递归查询
     * @return MinioItem列表
     */
    public static List<Item> getAllObjectsByPrefix(String bucketName, String prefix, boolean recursive) throws Exception {
        List<Item> list = new ArrayList<>();
        ListObjectsArgs listObjectsArgs = ListObjectsArgs.builder()
                .bucket(bucketName)
                .prefix(prefix)
                .recursive(recursive)
                .build();
        Iterable<Result<Item>> objectsIterator = minioClient.listObjects(listObjectsArgs);
        if (objectsIterator != null) {
            for (Result<Item> o : objectsIterator) {
                Item item = o.get();
                list.add(item);
            }
        }
        return list;
    }
    /**
     * 获取文件流
     *
     * @param bucketName 存储桶名称
     * @param objectName 文件名
     * @return 二进制流
     */
    public static InputStream getObject(String bucketName, String objectName) throws Exception {
        GetObjectArgs getObjectArgs = GetObjectArgs.builder()
                .bucket(bucketName)
                .object(objectName)
                .build();
        return minioClient.getObject(getObjectArgs);
    }
    /**
     * 断点下载
     *
     * @param bucketName 存储桶名称
     * @param objectName 文件名称
     * @param offset     起始字节的位置
     * @param length     要读取的长度
     * @return 二进制流
     */
    public InputStream getObject(String bucketName, String objectName, long offset, long length) throws Exception {
        GetObjectArgs getObjectArgs = GetObjectArgs.builder()
                .bucket(bucketName)
                .object(objectName)
                .offset(offset)
                .length(length)
                .build();
        return minioClient.getObject(getObjectArgs);
    }
    /**
     * 获取路径下文件列表
     *
     * @param bucketName 存储桶名称
     * @param prefix     文件名称
     * @param recursive  是否递归查找,false:模拟文件夹结构查找
     * @return 二进制流
     */
    public static Iterable<Result<Item>> listObjects(String bucketName, String prefix, boolean recursive) {
        ListObjectsArgs listObjectsArgs = ListObjectsArgs.builder()
                .bucket(bucketName)
                .prefix(prefix)
                .recursive(recursive)
                .build();
        return minioClient.listObjects(listObjectsArgs);
    }
    /**
     * 使用MultipartFile进行文件上传
     *
     * @param bucketName  存储桶名称
     * @param file        文件名
     * @param objectName  对象名
     * @return ObjectWriteResponse对象
     */
    public static ObjectWriteResponse uploadFile(String bucketName, MultipartFile file, String objectName) throws Exception {
        InputStream inputStream = file.getInputStream();
        Optional<MediaType> optional = MediaTypeFactory.getMediaType(objectName);
        String mediaType = optional.orElseThrow(() -> new RuntimeException("文件类型暂不支持")).toString();
        PutObjectArgs putObjectArgs = PutObjectArgs.builder()
                .bucket(bucketName)
                .object(objectName)
                .contentType(mediaType)
                .stream(inputStream, inputStream.available(), -1)
                .build();
        return minioClient.putObject(putObjectArgs);
    }
    /**
     * 上传本地文件
     *
     * @param bucketName 存储桶名称
     * @param objectName 对象名称
     * @param fileName   本地文件路径
     */
    public static ObjectWriteResponse uploadFile(String bucketName, String objectName, String fileName) throws Exception {
        UploadObjectArgs uploadObjectArgs = UploadObjectArgs.builder()
                .bucket(bucketName)
                .object(objectName)
                .filename(fileName)
                .build();
        return minioClient.uploadObject(uploadObjectArgs);
    }
    /**
     * 通过流上传文件
     *
     * @param bucketName  存储桶名称
     * @param objectName  文件对象
     * @param inputStream 文件流
     */
    public static ObjectWriteResponse uploadFile(String bucketName, String objectName, InputStream inputStream) throws Exception {
        PutObjectArgs putObjectArgs = PutObjectArgs.builder()
                .bucket(bucketName)
                .object(objectName)
                .stream(inputStream, inputStream.available(), -1)
                .build();
        return minioClient.putObject(putObjectArgs);
    }
    /**
     * 创建文件夹或目录
     *
     * @param bucketName 存储桶名称
     * @param objectName 目录路径
     */
    public static ObjectWriteResponse createDir(String bucketName, String objectName) throws Exception {
        PutObjectArgs putObjectArgs = PutObjectArgs.builder()
                .bucket(bucketName)
                .object(objectName)
                .stream(new ByteArrayInputStream(new byte[]{}), 0, -1)
                .build();
        return minioClient.putObject(putObjectArgs);
    }
    /**
     * 获取文件信息, 如果抛出异常则说明文件不存在
     *
     * @param bucketName 存储桶名称
     * @param objectName 文件名称
     */
    public static String getFileStatusInfo(String bucketName, String objectName) throws Exception {
        StatObjectArgs statObjectArgs = StatObjectArgs.builder()
                .bucket(bucketName)
                .object(objectName)
                .build();
        return minioClient.statObject(statObjectArgs).toString();
    }
    /**
     * 拷贝文件
     *
     * @param bucketName    存储桶名称
     * @param objectName    文件名
     * @param srcBucketName 目标存储桶
     * @param srcObjectName 目标文件名
     */
    public static ObjectWriteResponse copyFile(String bucketName, String objectName, String srcBucketName, String srcObjectName) throws Exception {
        return minioClient.copyObject(CopyObjectArgs.builder()
                .source(CopySource.builder()
                        .bucket(bucketName)
                        .object(objectName).build())
                .bucket(srcBucketName)
                .object(srcObjectName).build());
    }
    /**
     * 删除文件
     *
     * @param bucketName 存储桶名称
     * @param objectName 文件名称
     */
    public static void removeFile(String bucketName, String objectName) throws Exception {
        RemoveObjectArgs removeObjectArgs = RemoveObjectArgs.builder()
                .bucket(bucketName)
                .object(objectName)
                .build();
        minioClient.removeObject(removeObjectArgs);
    }
    /**
     * 批量删除文件
     *
     * @param bucketName 存储桶名称
     * @param keys       需要删除的文件列表
     */
    public static void removeFiles(String bucketName, List<String> keys) {
        keys.forEach(key -> {
            try {
                removeFile(bucketName, key);
            } catch (Exception e) {
                e.printStackTrace();
                System.out.println("批量删除失败!");
            }
        });
    }
    /**
     * 获取文件外链
     *
     * @param bucketName 存储桶名称
     * @param objectName 文件名
     * @param expires    过期时间 <=7 秒 (外链有效时间(单位:秒))
     * @return 文件外链
     */
    public static String getPreSignedObjectUrl(String bucketName, String objectName, Integer expires) throws Exception {
        GetPresignedObjectUrlArgs args = GetPresignedObjectUrlArgs.builder()
                .expiry(expires)
                .bucket(bucketName)
                .object(objectName)
                .build();
        return minioClient.getPresignedObjectUrl(args);
    }
    /**
     * 获得文件外链
     *
     * @param bucketName 存储桶名称
     * @param objectName 文件名
     * @return 文件外链
     */
    public static String getPreSignedObjectUrl(String bucketName, String objectName) throws Exception {
        GetPresignedObjectUrlArgs args = GetPresignedObjectUrlArgs.builder()
                .bucket(bucketName)
                .object(objectName)
                .method(Method.GET)
                .build();
        return minioClient.getPresignedObjectUrl(args);
    }
    /**
     * 将URLDecoder编码转成UTF8
     *
     * @param str 字符串
     * @return 编码
     */
    public static String getUtf8ByDecoder(String str) throws UnsupportedEncodingException {
        String url = str.replaceAll("%(?![0-9a-fA-F]{2})", "%");
        return URLDecoder.decode(url, "UTF-8");
    }
    public static void main(String[] args) {
        try {
            //http://172.26.0.152:9001/browser
            MinioClient minioClient = MinioClient.builder().endpoint("http:172.26.0.152:9000")
                    .credentials("minio@admin", "minio@admin")
                    .build();
            //创建bucket
            String bucketName = "image";
            boolean isExist = minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build());
            if(!isExist){
                minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());
            }
            minioClient.uploadObject(UploadObjectArgs.builder()
                    .bucket(bucketName)
                    .object("test/77.jpg")
                    .filename("C:\\Users\\70708\\Desktop\\微信图片_20211208171916.jpg")//本地磁盘路径
                    .build());
            GetPresignedObjectUrlArgs urlArgs = GetPresignedObjectUrlArgs.builder()
                    .bucket(bucketName)
                    .object("test/77.jpg")
                    .method(Method.GET)
                    .build();
            System.out.println(minioClient.getPresignedObjectUrl(urlArgs));
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}

+ 4 - 4
svr/svr-after-diagnosis/src/mian/java/com/yihu/jw/afterDiagnosis/service/device/DeviceDetailService.java

@ -88,17 +88,17 @@ public class DeviceDetailService {
		}
		if (isFirst){
			String updateFirstSql ="update device.wlyy_devices dd set dd.is_grant=1,dd.grant_admin_team=?,dd.grant_org_code=?,dd.binding_count=?,dd.grant_time = ?,dd.org_name=?,dd.grant_doctor=?,dd.grant_doctor_name=?,dd.is_binding=1 where dd.device_code=?";
			String updateFirstSql ="update wlyy_devices dd set dd.is_grant=1,dd.grant_admin_team=?,dd.grant_org_code=?,dd.binding_count=?,dd.grant_time = ?,dd.org_name=?,dd.grant_doctor=?,dd.grant_doctor_name=?,dd.is_binding=1 where dd.device_code=?";
			jdbcTemplate.update(updateFirstSql,new Object[]{String.valueOf(adminTeam),hospital,isFirstBind,grantTime,hospitalName,doctorCode, "",patientDevice.getDeviceSn()});
		}else {
			List<PatientDevice> patientDeviceList = patientDeviceDao.findByDeviceSn(patientDevice.getDeviceSn());
			int patientDeviceSize = patientDeviceList.size();
			String updateSql = "";
			if (bind == 0){
				updateSql ="update device.wlyy_devices dd set dd.is_grant=1,dd.grant_admin_team=?,dd.grant_org_code=?,dd.binding_count=?,dd.is_binding=?,dd.org_name=?,dd.grant_doctor=?,dd.grant_doctor_name=?  where dd.device_code=?";
				updateSql ="update wlyy_devices dd set dd.is_grant=1,dd.grant_admin_team=?,dd.grant_org_code=?,dd.binding_count=?,dd.is_binding=?,dd.org_name=?,dd.grant_doctor=?,dd.grant_doctor_name=?  where dd.device_code=?";
				jdbcTemplate.update(updateSql,new Object[]{String.valueOf(adminTeam),hospital,isFirstBind,patientDeviceSize,hospitalName,doctorCode,"",patientDevice.getDeviceSn()});
			}else if (bind>0){
				updateSql ="update device.wlyy_devices dd set dd.is_grant=1,dd.binding_count=?,dd.is_binding=? where dd.device_code=?";
				updateSql ="update wlyy_devices dd set dd.is_grant=1,dd.binding_count=?,dd.is_binding=? where dd.device_code=?";
				jdbcTemplate.update(updateSql,new Object[]{isFirstBind,patientDeviceSize,patientDevice.getDeviceSn()});
			}
		}
@ -171,7 +171,7 @@ public class DeviceDetailService {
	 */
	public void unBindUpdateIsBinding(String deviceSn)throws Exception{
		List<PatientDevice> patientDeviceList = patientDeviceDao.findByDeviceSn(deviceSn);
		String sql = "update device.wlyy_devices dd set dd.is_binding=? where dd.device_code=?";
		String sql = "update wlyy_devices dd set dd.is_binding=? where dd.device_code=?";
		if (patientDeviceList.size()==0){
			jdbcTemplate.update(sql,new Object[]{0,deviceSn});
		}

+ 0 - 1
svr/svr-after-diagnosis/src/mian/java/com/yihu/jw/afterDiagnosis/service/device/DeviceWxMessageService.java

@ -38,7 +38,6 @@ public class DeviceWxMessageService{
        List<DeviceWxMessage> messageList = new ArrayList<>();
        for (int i=0;i<jsonArray.length();i++){
            JSONObject jsonObject = jsonArray.getJSONObject(i);
            //DeviceWxMessage deviceWxMessage = (DeviceWxMessage) jsonArray.get(i);
            DeviceWxMessage deviceWxMessage = new DeviceWxMessage();
            deviceWxMessage.setPatient(jsonObject.getString("patient"));
            deviceWxMessage.setCategoryCode(jsonObject.getString("categoryCode"));

+ 4 - 4
svr/svr-after-diagnosis/src/mian/java/com/yihu/jw/afterDiagnosis/service/device/PatientDeviceLogService.java

@ -102,19 +102,19 @@ public class PatientDeviceLogService {
        }
        //筛选条件--今日未测量
        if (!StringUtils.isEmpty(noGaugeDay) && StringUtils.equals("1",noGaugeDay)){
            sql += " and b.patient NOT IN (SELECT user FROM device.wlyy_patient_health_index WHERE TO_DAYS(record_date)=TO_DAYS(NOW()))";
            sql += " and b.patient NOT IN (SELECT user FROM wlyy_patient_health_index WHERE TO_DAYS(record_date)=TO_DAYS(NOW()))";
        }
        //筛选条件--七天内未测量
        if (!StringUtils.isEmpty(noGaugeDay) && StringUtils.equals("2",noGaugeDay)){
            sql += " and b.patient NOT IN (SELECT user FROM device.wlyy_patient_health_index WHERE DATE_SUB(CURDATE(),INTERVAL 7 DAY) <= DATE(record_date))";
            sql += " and b.patient NOT IN (SELECT user FROM wlyy_patient_health_index WHERE DATE_SUB(CURDATE(),INTERVAL 7 DAY) <= DATE(record_date))";
        }
        //筛选条件--一个月内未测量
        if (!StringUtils.isEmpty(noGaugeDay) && StringUtils.equals("3",noGaugeDay)){
            sql += " and b.patient NOT IN (SELECT user FROM device.wlyy_patient_health_index WHERE DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= DATE(record_date))";
            sql += " and b.patient NOT IN (SELECT user FROM wlyy_patient_health_index WHERE DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= DATE(record_date))";
        }
        //筛选条件--超过一个月未测量
        if (!StringUtils.isEmpty(noGaugeDay) && StringUtils.equals("4",noGaugeDay)){
            sql += " and b.patient NOT IN (SELECT user FROM device.wlyy_patient_health_index WHERE  DATE_SUB(DATE_SUB(CURDATE(), INTERVAL 1 MONTH),INTERVAL 1 DAY) <= DATE(record_date))";
            sql += " and b.patient NOT IN (SELECT user FROM wlyy_patient_health_index WHERE  DATE_SUB(DATE_SUB(CURDATE(), INTERVAL 1 MONTH),INTERVAL 1 DAY) <= DATE(record_date))";
        }
        //发送消息要筛选未发送消息的设备
        if (StringUtils.isNotEmpty(isSend)){

+ 2 - 18
svr/svr-after-diagnosis/src/mian/java/com/yihu/jw/afterDiagnosis/service/device/PatientDeviceService.java

@ -419,21 +419,6 @@ public class PatientDeviceService  {
    /**
     * 用户自定义血糖仪各个时间段
     *
     * @param fastingStart
     * @param fastingEnd
     * @param afterBreakfastStart
     * @param afterBreakfastEnd
     * @param beforeLunchStart
     * @param beforeLunchEnd
     * @param afterLunchStart
     * @param afterLunchEnd
     * @param beforeDinnerStart
     * @param beforeDinnerEnd
     * @param afterDinnerStart
     * @param afterDinnerEnd
     * @param beforeSleepStart
     * @param beforeSleepEnd
     */
    public void setBloodTime(String user, String deviceSN, String fastingStart, String fastingEnd, String afterBreakfastStart, String afterBreakfastEnd, String beforeLunchStart, String beforeLunchEnd,
                             String afterLunchStart, String afterLunchEnd, String beforeDinnerStart, String beforeDinnerEnd, String afterDinnerStart, String afterDinnerEnd,
@ -502,7 +487,7 @@ public class PatientDeviceService  {
    public Map<String,Object> getDeviceByDeviceSn(String deviceSn)throws Exception {
        Map<String,Object> map  = new HashedMap();
        String sql = "SELECT d.id,d.device_name deviceName,d.device_model deviceMode,d.sim,CAST(e.is_multi_user AS UNSIGNED INTEGER) isMultiUser,e.category_code as deviceType,e.multi_user multiUser,e.id as device_id FROM device.wlyy_devices d LEFT JOIN dm_device e ON d.device_model = e.model WHERE d.device_code='"+deviceSn+"'";
        String sql = "SELECT d.id,d.device_name deviceName,d.device_model deviceMode,d.sim,CAST(e.is_multi_user AS UNSIGNED INTEGER) isMultiUser,e.category_code as deviceType,e.multi_user multiUser,e.id as device_id FROM wlyy_devices d LEFT JOIN dm_device e ON d.device_model = e.model WHERE d.device_code='"+deviceSn+"'";
        List<Map<String,Object>> mapSqlList = jdbcTemplate.queryForList(sql);
        if (mapSqlList!=null && mapSqlList.size()>0){
            map = mapSqlList.get(0);
@ -605,9 +590,8 @@ public class PatientDeviceService  {
        int healthBp = 0;
        int healthBs = 0;
        int resultHealty= 0;
        boolean hasUploadHealth = false;
        String today = DateUtil.dateToStr(DateUtil.getDateShort(new Date()),"yyyy-MM-dd");
        String healthSql ="SELECT type as healtyType,device_sn deviceSn FROM device.wlyy_patient_health_index where record_date >'"+today+" 00:00:00' and record_date <='"+today+" 23:59:59' and  status = 0 and  del = 1 and user = '"+patientCode+"'";
        String healthSql ="SELECT type as healtyType,device_sn deviceSn FROM wlyy_patient_health_index where record_date >'"+today+" 00:00:00' and record_date <='"+today+" 23:59:59' and  status = 0 and  del = 1 and user = '"+patientCode+"'";
        List<Map<String,Object>>  maps =jdbcTemplate.queryForList(healthSql);
        for (Map<String,Object> map : maps){
            if (map.get("type")!=null && String.valueOf(map.get("Type")).equals("1")){

+ 9 - 9
svr/svr-after-diagnosis/src/mian/java/com/yihu/jw/afterDiagnosis/service/device/PatientHealthIndexService.java

@ -200,7 +200,7 @@ public class PatientHealthIndexService {
        String sql = "SELECT " +
                " * " +
                " FROM " +
                "  device.wlyy_patient_health_index a " +
                "  wlyy_patient_health_index a " +
                " WHERE " +
                " a. USER = ? " +
                " AND a.type = ? " +
@ -392,7 +392,7 @@ public class PatientHealthIndexService {
                ",sort_date" +
                ",czrq as createDate" +
                ",min(czrq) czrq " +
                " from device.wlyy_patient_health_index " +
                " from wlyy_patient_health_index " +
                " WHERE `user` = '" + patient + "' " +
                " and type = 1" +
                " and DATE_FORMAT(record_date,'%Y-%m-%d') = '" + dateString + "'" +
@ -519,7 +519,7 @@ public class PatientHealthIndexService {
                ",DATE_FORMAT(record_date,'%Y-%m-%d') as record_date " +
                ",sort_date" +
                ",min(czrq) czrq " +
                " from device.wlyy_patient_health_index " +
                " from wlyy_patient_health_index " +
                " WHERE `user` = '" + patient + "' " +
                " and type = 1" +
                " and del = '1' " +
@ -1092,7 +1092,7 @@ public class PatientHealthIndexService {
                ",record_date" +
                ",sort_date" +
                ",min(czrq) czrq " +
                " from device.wlyy_patient_health_index " +
                " from wlyy_patient_health_index " +
                " WHERE `user` = '" + patient + "' " +
                " and type =" + type +
                " and record_date >= '" + begin + "'" +
@ -1167,7 +1167,7 @@ public class PatientHealthIndexService {
                ",record_date" +
                ",sort_date" +
                ",min(czrq) czrq " +
                " from device.wlyy_patient_health_index " +
                " from wlyy_patient_health_index " +
                " WHERE `user` = '" + patient + "' " +
                " and type =" + type +
                " and record_date >= '" + begin + "'" +
@ -1381,7 +1381,7 @@ public class PatientHealthIndexService {
                    ",sort_date" +
                    ",czrq as createDate" +
                    ",min(czrq) czrq " +
                    " from device.wlyy_patient_health_index " +
                    " from wlyy_patient_health_index " +
                    " WHERE `user` = '" + patient + "' " +
                    " and type =" + type +
                    " and record_date >= '" + start + "'" +
@ -1463,7 +1463,7 @@ public class PatientHealthIndexService {
                    ",record_date" +
                    ",sort_date" +
                    ",min(czrq) czrq " +
                    " from device.wlyy_patient_health_index " +
                    " from wlyy_patient_health_index " +
                    " WHERE `user` = '" + patient + "' " +
                    " and type =" + type +
                    " and del = '1' " +
@ -1484,7 +1484,7 @@ public class PatientHealthIndexService {
                    ",record_date" +
                    ",sort_date" +
                    ",min(czrq) czrq " +
                    " from device.wlyy_patient_health_index " +
                    " from wlyy_patient_health_index " +
                    " WHERE `user` = '" + patient + "' " +
                    " and type =" + type +
                    " and del = '1' " +
@ -1604,7 +1604,7 @@ public class PatientHealthIndexService {
                    ",record_date" +
                    ",sort_date" +
                    ",min(czrq) czrq " +
                    " from device.wlyy_patient_health_index " +
                    " from wlyy_patient_health_index " +
                    " WHERE `user` = '" + patient + "' " +
                    " and type = 1" +
                    " and del = '1' " +

+ 4 - 5
svr/svr-after-diagnosis/src/mian/java/com/yihu/jw/afterDiagnosis/service/prescription/PrescriptionAdressService.java

@ -39,8 +39,8 @@ public class PrescriptionAdressService {
        }else{
            return null;
        }
    }
    //保存
    public String saveAdress(String adressJosn){
        JSONObject jsonObject = JSONObject.fromObject(adressJosn);
@ -80,7 +80,7 @@ public class PrescriptionAdressService {
                " p.`code`, " +
                " p.`name` " +
                " FROM " +
                " dm_province p";
                " base_province p";
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
        return rs;
    }
@ -90,7 +90,7 @@ public class PrescriptionAdressService {
                " p.`code`, " +
                " p.`name` " +
                " FROM " +
                " dm_city p " +
                " base_city p " +
                " WHERE p.province = '"+province+"'";
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
        return rs;
@ -101,11 +101,10 @@ public class PrescriptionAdressService {
                " p.`code`, " +
                " p.`name` " +
                " FROM " +
                " dm_town p " +
                " base_town p " +
                " WHERE p.city = '"+city+"'";
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
        return rs;
    }
}

+ 0 - 15
svr/svr-after-diagnosis/src/mian/java/com/yihu/jw/afterDiagnosis/service/rehabilitation/DiagnosisInformationService.java

@ -32,26 +32,11 @@ public class DiagnosisInformationService extends BaseJpaService<PatientDiagnosis
    @Autowired
    private BaseDoctorDao doctorDao;
    ObjectMapper objectMapper = new ObjectMapper();
    /**
     * 创建诊疗信息
     * @param patient
     * @param patientName
     * @param planId
     * @param hospital
     * @param hospitalName
     * @param department
     * @param attendingDoctorName
     * @param admittingDiagnosis
     * @param dischargeDiagnosis
     * @param advice
     * @param dischargeTime
     * @param doctor
     * @return
     */
    public String createDiagnosisInformation(String patient, String patientName, String planId, String hospital, String hospitalName,
                                             String department, String attendingDoctorName, String admittingDiagnosis, String dischargeDiagnosis, String advice, String dischargeTime, BaseDoctorDO doctor) {
        JSONObject json = new JSONObject();
        String attendingDoctorCode = "";
        List<BaseDoctorDO> d = doctorDao.findDoctorByName(attendingDoctorName);
        if(d != null && d.size() == 1){

+ 0 - 2
svr/svr-after-diagnosis/src/mian/java/com/yihu/jw/afterDiagnosis/service/rehabilitation/RehabilitationGuidanceService.java

@ -128,9 +128,7 @@ public class RehabilitationGuidanceService {
        Long totalCount = jdbcTemplate.queryForObject(sqlCounts.toString(),Long.class);
        for (RehabilitationguidanceDO temp:list){
            String contents = temp.getContent();
//            System.out.println(contents);
            temp.setContent(StringEscapeUtils.unescapeJava(contents));
//            System.out.println(StringEscapeUtils.unescapeJava(contents));
        }
        PageRequest pageRequest = PageRequest.of(page, pagesize);
        if (list.size() <= 0) {

+ 2 - 1
svr/svr-after-diagnosis/src/mian/java/com/yihu/jw/afterDiagnosis/service/rehabilitation/RehabilitationInfoService.java

@ -133,6 +133,8 @@ public class RehabilitationInfoService {
        return res;
    }
    /**
     * 获取厦心出院就诊记录信息
     * @param patientCode
@ -276,7 +278,6 @@ public class RehabilitationInfoService {
        List<PatientDischargeDO> patientDischargeDOS = patientDischargeDao.findAllByCreateUser(doctorCode);
        for(PatientDischargeDO patientDischargeDO : patientDischargeDOS){
            Map jsonObject = JSONObject.parseObject(JSONObject.toJSONString(patientDischargeDO), Map.class);
//            JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(patientDischargeDO));
            jsonObject.put("patientName",patientDischargeDO.getName());
            jsonObject.put("patient", patientDischargeDO.getPatient());
            String idcard = patientDischargeDO.getIdcard();

+ 32 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/MinioController.java

@ -0,0 +1,32 @@
//package com.yihu.jw.base.endpoint.common;
//
//import com.yihu.jw.minio.MinioProperties;
//import com.yihu.jw.minio.MinioUtil;
//import io.swagger.annotations.Api;
//import lombok.SneakyThrows;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//import org.springframework.web.multipart.MultipartFile;
//
///**
// * Created by yeshijie on 2023/3/30.
// */
//@RestController
//@RequestMapping("open/minio")
//@Api(tags = "文件上传相关操作", description = "文件上传相关操作")
//public class MinioController {
//    @Autowired
//    private MinioProperties minioProperties;
//
//    @SneakyThrows
//    @PostMapping(value = "/upload")
//    public String upload(@RequestParam(name = "file") MultipartFile multipartFile) {
//        String fileName = multipartFile.getOriginalFilename();
//        MinioUtil.createBucket(minioProperties.getBucket());
//        MinioUtil.uploadFile(minioProperties.getBucket(), multipartFile, fileName);
//        return MinioUtil.getPreSignedObjectUrl(minioProperties.getBucket(), fileName);
//    }
//}

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

@ -7,7 +7,6 @@ import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import com.yihu.jw.entity.base.wx.*;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
@ -138,7 +137,7 @@ public class UnSettledHISPrescriptionService {
     * @param session_id 会话ID
     */
    public String sendWeTempMesMiniProgram(String sender_id, String sender_name, String reciver_id, String reciver_name,String session_id)throws Exception {
        BasePatientDO basePatientDO = basePatientDao.findById(reciver_id);
        BasePatientDO basePatientDO = basePatientDao.findById(reciver_id).orElse(null);
        if(basePatientDO!=null){
            List<BasePatientWechatDo> ps = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,reciver_id);
            if(ps.isEmpty()){
@ -207,14 +206,14 @@ public class UnSettledHISPrescriptionService {
                        msgObj.put("outpatientid",outpatientId);
                        msgObj.put("prescriptionId",prescriptionId);
                        msgObj.put("reason","处方驳回");
                        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
                        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId).orElse(null);
                        System.out.println("发送诊断消息开始+"+wlyyOutpatientDO.getId());
                        String immsg = imService.pushPrescriptionBackMsg(msgObj,doctor,doctorName,outpatientId,wlyyOutpatientDO.getPatient(),wlyyOutpatientDO.getOutpatientType(),wlyyOutpatientDO.getType());
                        System.out.println("发送诊断消息成功:"+immsg);
                        //发送短信提醒
                        String content = "";
                        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findByRealOrder(cfsb);
                        BaseDoctorDO baseDoctorDO = doctorDao.findById(doctor);
                        BaseDoctorDO baseDoctorDO = doctorDao.findById(doctor).orElse(null);
                        ykyySMSService.sendSmsByTempcode("check_failed",wlyyOutpatientDO,prescriptionDO,baseDoctorDO.getMobile());
                        logger.info("极光推送处方驳回消息");
                       prescriptionService.wxTempalteJPush("prescription_refuse",wlyyOutpatientDO,null,"","","",prescriptionDO.getId());
@ -239,7 +238,7 @@ public class UnSettledHISPrescriptionService {
                        List<Map<String, Object>> pre = hibenateUtils.createSQLQuery(sql);
                        if(pre!=null && pre.size()>0){
                            String outpatientId = pre.get(0).get("OUTPATIENT_ID").toString();
                            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
                            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId).orElse(null);
                            String prescriptionId = pre.get(0).get("ID").toString();
                            String doctorName = pre.get(0).get("DOCTOR_NAME").toString();
                            //判断是否发送过
@ -281,7 +280,7 @@ public class UnSettledHISPrescriptionService {
                                wxPushLogDO.setReceiverName(patientDO.getName());
                                wxPushLogDO.setScene("djsxxtz");
                                wxPushLogDao.save(wxPushLogDO);
                                WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
                                WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findById(prescriptionId).orElse(null);
                                wlyyPrescriptionDO.setPrescribeTime(new Date());
                                wlyyPrescriptionDO.setCheckStatus(2);
                                wlyyPrescriptionDO.setCheckReason("审核通过");
@ -330,7 +329,7 @@ public class UnSettledHISPrescriptionService {
                    List<Map<String, Object>> pre = hibenateUtils.createSQLQuery(sql);
                    if(pre!=null && pre.size()>0){
                        String prescriptionId = pre.get(0).get("ID").toString();
                        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
                        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findById(prescriptionId).orElse(null);
                        logger.info(sprq+yfrq);
                        if (StringUtils.isNoneBlank(sprq)){
                            logger.info("111111111111");
@ -374,14 +373,14 @@ public class UnSettledHISPrescriptionService {
                        msgObj.put("outpatientid",outpatientId);
                        msgObj.put("prescriptionId",prescriptionId);
                        msgObj.put("reason","处方驳回");
                        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
                        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId).orElse(null);
                        System.out.println("发送诊断消息开始+"+wlyyOutpatientDO.getId());
                        String immsg = imService.pushPrescriptionBackMsg(msgObj,doctor,doctorName,outpatientId,wlyyOutpatientDO.getPatient(),wlyyOutpatientDO.getOutpatientType(),wlyyOutpatientDO.getType());
                        System.out.println("发送诊断消息成功:"+immsg);
                        //发送短信提醒
                        String content = "";
                        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findByRealOrder(cfsb);
                        BaseDoctorDO baseDoctorDO = doctorDao.findById(doctor);
                        BaseDoctorDO baseDoctorDO = doctorDao.findById(doctor).orElse(null);
                        ykyySMSService.sendSmsByTempcode("check_failed",wlyyOutpatientDO,prescriptionDO,baseDoctorDO.getMobile());
                        logger.info("极光推送处方驳回消息");
                        prescriptionService.wxTempalteJPush("prescription_refuse",wlyyOutpatientDO,null,"","","",prescriptionDO.getId());
@ -406,7 +405,7 @@ public class UnSettledHISPrescriptionService {
                        List<Map<String, Object>> pre = hibenateUtils.createSQLQuery(sql);
                        if(pre!=null && pre.size()>0){
                            String outpatientId = pre.get(0).get("OUTPATIENT_ID").toString();
                            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
                            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId).orElse(null);
                            String prescriptionId = pre.get(0).get("ID").toString();
                            String doctorName = pre.get(0).get("DOCTOR_NAME").toString();
                            //判断是否发送过
@ -448,7 +447,7 @@ public class UnSettledHISPrescriptionService {
                                wxPushLogDO.setReceiverName(patientDO.getName());
                                wxPushLogDO.setScene("djsxxtz");
                                wxPushLogDao.save(wxPushLogDO);
                                WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
                                WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findById(prescriptionId).orElse(null);
                                wlyyPrescriptionDO.setPrescribeTime(new Date());
                                wlyyPrescriptionDO.setCheckStatus(0);
                                wlyyPrescriptionDO.setCheckReason("审核通过");
@ -487,7 +486,7 @@ public class UnSettledHISPrescriptionService {
    public void updateStatusByPayTime() throws Exception{
        if("xm_ykyy_wx".equals(wechatId)){
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("PAY_TIME");
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("PAY_TIME").orElse(null);
            if (wlyyHospitalSysDictDO!=null){
                String remind = wlyyHospitalSysDictDO.getDictValue();
                String close = wlyyHospitalSysDictDO.getDictCode();
@ -508,7 +507,7 @@ public class UnSettledHISPrescriptionService {
                            consultTeamDo.setStatus(-1);
                            consultTeamOrderDao.save(consultTeamDo);
                        }else if (orderCategory.equalsIgnoreCase("2")){
                            WlyyOutpatientDO outpatientDO = outpatientDao.findById(relationCode);
                            WlyyOutpatientDO outpatientDO = outpatientDao.findById(relationCode).orElse(null);
                            outpatientDO.setStatus("-1");
                            outpatientDao.save(outpatientDO);
                        }
@ -535,8 +534,8 @@ public class UnSettledHISPrescriptionService {
                                +"' and w.OPENID = '"+relationCode+"' and w.scene = 'zxzfts' and w.WECHAT_ID='"+wechatId+"'";
                        List<Map<String, Object>> count = hibenateUtils.createSQLQuery(countSql);
                        if(count==null || count.size() == 0){
                            BasePatientDO patientDO = basePatientDao.findById(patient);
                            BaseDoctorDO doctorDO = doctorDao.findById(doctor);
                            BasePatientDO patientDO = basePatientDao.findById(patient).orElse(null);
                            BaseDoctorDO doctorDO = doctorDao.findById(doctor).orElse(null);
                            List<BasePatientWechatDo> ps = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,patient);
                            if(ps.isEmpty()){
                                logger.info("该用户"+patientDO.getName()+"没有openid,无法推送模版消息,用户ID:"+patientDO.getId()+"wechatId:"+wechatId);
@ -630,7 +629,7 @@ public class UnSettledHISPrescriptionService {
                }
            }
            wxTemplateDao.save(savelist);
            wxTemplateDao.saveAll(savelist);
        }
        return Envelop.getSuccess(BaseRequestMapping.WeChat.api_success);

+ 1 - 1
wlyy-parent-pom/pom.xml

@ -102,7 +102,7 @@
        <version.fastdfs>1.27</version.fastdfs>
        <version.poi>3.17</version.poi>
        <version.jxl>2.6.10</version.jxl>
        <version.okhttp>3.4.1</version.okhttp>
        <version.okhttp>4.10.0</version.okhttp>
        <version.jackson-dataformat-xml>2.6.6</version.jackson-dataformat-xml>
        <version.mysql>8.0.23</version.mysql>
        <version.commons-dbcp2>2.1.1</version.commons-dbcp2>