Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

wangjun 4 years ago
parent
commit
269d548ce5

+ 63 - 0
business/base-service/src/main/java/com/yihu/jw/file_upload/FileUploadService.java

@ -1,5 +1,8 @@
package com.yihu.jw.file_upload;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.fastdfs.FastDFSUtil;
import com.yihu.jw.exception.business.file_upload.*;
@ -45,6 +48,8 @@ public class FileUploadService {
    @Value("${wlyy.url}")
    private String wlyyUrl;
    @Autowired
    private ObjectMapper objectMapper;
    /**
     * 文件流上传图片
@ -266,6 +271,64 @@ public class FileUploadService {
        }
        return url;
    }
    /**
     * 调用健康上传语音文件.
     * @param voices_Path
     * @return
     * @throws Exception
     */
    public String uploadWxVoiceToEntrance(String remoteUrl,String voices_Path) throws Exception {
        String url = "";
        // 文件保存的临时路径
        FastDFSUtil fastDFSUtil = new FastDFSUtil();
        String fileUrls = "";
        File f = new File(voices_Path);
        logger.info("语音文件转换file");
        if (f.exists()) {
            logger.info("语音文件转换file-start");
            FileInputStream input = new FileInputStream(f);
            String fileContenType = "text/plain";
            try {
                logger.info("获取文件类型--开始");
                fileContenType = new MimetypesFileTypeMap().getContentType(f);
                logger.info("获取文件类型--成功--fileContenType:"+fileContenType);
            } catch (Exception e) {
                logger.info("获取文件类型--失败:"+e.getMessage());
            }
            MultipartFile multipartFile = new MockMultipartFile("file", f.getName(), fileContenType, IOUtils.toByteArray(input));
            logger.info("语音文件转换file-转换-multipartFile");
            long size = multipartFile.getSize();
            if(size<=0){
//                map.put("uploadStatus",1);//size小于0
//                map.put("accessoryUrl",null);//
                return url;
            }
            String fileName = multipartFile.getOriginalFilename();
            String[] fs = fileName.split("\\.");
            String type = fs[1];
            logger.info("uploadImg type:"+type);
            //图片常见格式:bmp,jpg,png,tif,gif,pcx,tga,exif,fpx,svg,psd,cdr,pcd,dxf,ufo,eps,ai,raw,WMF,webp
//        List img = new ArrayList(Arrays.asList("bmp", "jpg", "png", "tif", "gif", "pcx", "tga", "exif", "fpx", "svg", "psd", "cdr", "pcd", "dxf", "ufo", "eps", "ai", "raw", "WMF", "webp"));
//        if (!img.contains(type)) {
//            map.put("uploadStatus",2);//文件类型不对
//            map.put("accessoryUrl",null);//
//            return map;
//        }
            logger.info("语音文件转换file-转换-multipartFile-成功,开始调用i健康接口上传文件");
            String response = request( remoteUrl, multipartFile, null);
            JSONObject json = JSON.parseObject(response);
            Integer status = json.getInteger("status");
            if (status == 200) {
                UploadVO uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
                return uploadVO.getFullUri();
            }
            throw new Exception();
        }
        return url;
    }
    
    /**
     * 调用健康上传图片.

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

@ -3281,7 +3281,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return rs;
    }
    public BaseDoctorDO updateDoctorInfo(String id, String img,String background,String expertise,String visitHospital,String visitHospitalName,String visitDept,String visitDeptName,String backgroundId,String name,Integer sex,String learning,String introduce){
    public BaseDoctorDO updateDoctorInfo(String id, String img,String background,String expertise,String visitHospital,String visitHospitalName,String visitDept,String visitDeptName,String backgroundId,String name,Integer sex,String learning,String introduce,String photo){
        if (StringUtils.isNoneBlank(id)){
            BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(id);
            if (StringUtils.isNoneBlank(img)){
@ -3327,6 +3327,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            if (StringUtils.isNoneBlank(introduce)){
                baseDoctorDO.setIntroduce(introduce);
            }
            if(StringUtils.isNoneBlank(photo)){
                baseDoctorDO.setPhoto(photo);
            }
            return baseDoctorDao.save(baseDoctorDO);
        }else {
            return null;

+ 1 - 11
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java

@ -9,14 +9,11 @@ import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.entity.hospital.doctor.BaseDoctorZsInfoDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionEmrDO;
import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
@ -37,8 +34,6 @@ import com.yihu.jw.util.idcard.IdCardUtil;
import net.sf.json.JSON;
import net.sf.json.JSONArray;
import net.sf.json.xml.XMLSerializer;
import org.apache.axis.client.Call;
import org.apache.axis.encoding.XMLType;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
@ -51,12 +46,7 @@ import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.ServiceException;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
@ -1409,7 +1399,7 @@ public class EntranceService {
            if (StringUtils.isNotBlank(now)) {
                sbs.append("<query compy=\"&lt;\" item=\"ADM_DAT\" splice=\"and\" value=\"'" + now + "'\"/>");
            }
            sbs.append("<order item=\"ADM_DAT\" sort=\"desc\"/>");
            sbs.append("<order item=\"CON_DATE\" sort=\"desc\"/>");
            //查询信息结束
            sbs.append("</MsgInfo></ESBEntry>");
            resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java

@ -25,7 +25,7 @@ public abstract class IntegerIdentityEntity implements Serializable {
//==========mysql 环境 id策略 end======================================================
//==========Oracle 环境id策略 =========================================================
/*    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")*/
 /*   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")*/
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
        return id;

+ 3 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeArticleDO.java

@ -3,6 +3,7 @@ package com.yihu.jw.entity.hospital.article;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
@ -40,6 +41,7 @@ public class KnowledgeArticleDO extends UuidIdentityEntity {
	private Integer readCount;//已读数
	private Integer collection;//收藏数量
	private Integer fabulous;//点赞数量
	@Column(name = "is_share")
	private Integer share;//分享 数量
	private String intro;//简介
@ -233,6 +235,7 @@ public class KnowledgeArticleDO extends UuidIdentityEntity {
		this.fabulous = fabulous;
	}
	@Column(name = "is_share")
	public Integer getShare() {
		return share;
	}

+ 6 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/BaseBannerDO.java

@ -1,13 +1,10 @@
package com.yihu.jw.entity.hospital.message;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * @author zmk
@ -21,29 +18,35 @@ public class BaseBannerDO extends UuidIdentityEntityWithOperator {
    /**
     *锦旗名称
     */
    @Column(name = "name")
    private String name;
    /*
      *医生id
     */
    @Column(name = "saas_id")
    private String saasId;
    /**
     *锦旗描述
     */
    @Column(name = "description")
    private String description;
    /**
     *锦旗图标
     */
    @Column(name = "img")
    private String img;
    /**
     * 排序
     */
    @Column(name = "sort")
    private Integer sort;
    /*
    *状态
     */
    @Column(name = "status")
    private Integer status;
    @Column(name = "saas_id")

+ 9 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java

@ -119,6 +119,11 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	@Value("${pay.flag}")
	private boolean payFlag;
	@Value("${testPattern.sign}")
	private String isClose;
	@Value("${testPattern.remote_inner_url}")
	private String remote_inner_url;
	
	@Autowired
	private FileUtil fileUtil;
@ -282,7 +287,10 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
						logger.info("voice_wx_type:"+wechat_appid);
						voiceurl = fileUploadService.uploadWxVoice(voicepath);
//					uploadVO.setFullUri(map.get("accessory").toString());
					}else{
					}else if ("xm_xzzx_wx".equalsIgnoreCase(wechat_appid)){
						voiceurl = fileUploadService.uploadWxVoiceToEntrance(remote_inner_url,voicepath);
						logger.info(voiceurl);
					}else {
						voiceurl = fileUtil.copyTempVoice(voicepath,fastdfs_file_url);
					}
					obj.put("path", voiceurl);

+ 32 - 10
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/file_upload/FileUploadEndpoint.java

@ -3,13 +3,11 @@ package com.yihu.jw.hospital.endpoint.file_upload;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.wlyy.service.WlyyBusinessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -18,7 +16,10 @@ 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.web.bind.annotation.*;
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;
import java.io.InputStream;
@ -50,10 +51,20 @@ public class FileUploadEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "文件流上传图片", notes = "文件流上传图片")
    public ObjEnvelop<UploadVO> uploadImg(@ApiParam(value = "文件", required = true)
                                       @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
        // 得到文件的完整名称  xxx.txt
        String originalFilename = file.getOriginalFilename();
        InputStream inputStream = file.getInputStream();
        UploadVO uploadVO = fileUploadService.uploadImg(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
        UploadVO uploadVO = new UploadVO();
        if (isClose.equalsIgnoreCase("1")){
            // 得到文件的完整名称  xxx.txt
            String originalFilename = file.getOriginalFilename();
            InputStream inputStream = file.getInputStream();
            uploadVO = fileUploadService.uploadImg(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
        }else if(isClose.equals("2")){
            //内网上传
            String rs = fileUploadService.request(remote_inner_url,file,null);
            logger.info(rs);
            JSONObject json = JSON.parseObject(rs);
            uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
        }
        return success("上传成功", uploadVO);
    }
@ -62,9 +73,19 @@ public class FileUploadEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "文件流上传附件", notes = "文件流上传附件")
    public ObjEnvelop<UploadVO> uploadAttachment(@ApiParam(value = "文件", required = true)
                                       @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
        String originalFilename = file.getOriginalFilename();
        InputStream inputStream = file.getInputStream();
        UploadVO uploadVO = fileUploadService.uploadAttachment(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
        UploadVO uploadVO = new UploadVO();
        if (isClose.equalsIgnoreCase("1")){
            String originalFilename = file.getOriginalFilename();
            InputStream inputStream = file.getInputStream();
            uploadVO = fileUploadService.uploadAttachment(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
        }else if(isClose.equals("2")){
            //内网上传
            String rs = fileUploadService.request(remote_inner_url,file,null);
            logger.info(rs);
            JSONObject json = JSON.parseObject(rs);
            uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
        }
        return success("上传成功", uploadVO);
    }
@ -104,6 +125,7 @@ public class FileUploadEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "base64上传图片",notes = "base64上传图片")
    public ObjEnvelop<UploadVO> uploadImages(@ApiParam(name = "jsonData", value = "头像转化后的输入流")
                                             @RequestParam(value = "jsonData", required = true) String jsonData) throws Exception {
        UploadVO uploadVO = fileUploadService.uploadImages(jsonData,fastdfs_file_url);
        return success("上传成功", uploadVO);
    }

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

@ -573,6 +573,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                     @RequestParam(value = "id", required = true)String id,
                                       @ApiParam(name = "img", value = "风采图")
                                       @RequestParam(value = "img", required = false)String img,
                                       @ApiParam(name = "photo", value = "头像")
                                           @RequestParam(value = "photo", required = false)String photo,
                                       @ApiParam(name = "background", value = "医生id")
                                           @RequestParam(value = "background", required = false)String background,
                                       @ApiParam(name = "expertise", value = "医生特长")
@ -596,7 +598,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                       @ApiParam(name = "introduce", value = "简介")
                                           @RequestParam(value = "introduce", required = false)String introduce){
        try {
            return success(prescriptionService.updateDoctorInfo(id, img,background,expertise, visitHospital, visitHospitalName, visitDept, visitDeptName, backgroundId,name,sex,learning,introduce));
            return success(prescriptionService.updateDoctorInfo(id, img,background,expertise, visitHospital, visitHospitalName, visitDept, visitDeptName, backgroundId,name,sex,learning,introduce,photo));
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError(e.getMessage());