瀏覽代碼

Merge branch 'dev' of liuwenbin/patient-co-management into dev

liuwenbin 6 年之前
父節點
當前提交
f37bb37c67

+ 34 - 8
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerSynergyManageController.java

@ -14,6 +14,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
@ -308,13 +309,13 @@ public class CustomerSynergyManageController extends BaseController {
    @ApiOperation(value = "协同任务提交")
    public String taskSubmit(@ApiParam(name="workorderCode",value="协同服务工单code",required = true)
                             @RequestParam(required = true)String workorderCode,
                             @ApiParam(name="dealResultRemark",value="说明",required = true)
                             @RequestParam(required = true)String dealResultRemark,
                             @ApiParam(name="dealResultAccessory",value="附件路径(多个用逗号隔开)",required = true)
                             @RequestParam(required = true)String dealResultAccessory){
                             @ApiParam(name="dealResultRemark",value="说明",required = false)
                             @RequestParam(required = false)String dealResultRemark,
                             @ApiParam(name="accessoryJson",value="附件的json",required = true)
                             @RequestParam(required = true)String accessoryJson){
        try{
            synergyManageService.taskSubmit(workorderCode,dealResultRemark,dealResultAccessory);
            synergyManageService.taskSubmit(workorderCode,dealResultRemark,accessoryJson);
            return write(200,"提交成功");
        }catch (Exception e){
            error(e);
@ -586,10 +587,9 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "uploadAccessory",method = RequestMethod.POST)
    @ApiOperation(value = "上传附件")
    public String uploadAccessory(@ApiParam(name="workorderCode",value="协同服务工单code",required = true)
                                  @RequestParam(required = true)String workorderCode,HttpServletRequest request){
    public String uploadAccessory(HttpServletRequest request){
        try{
            Map<String,Object> map = synergyManageService.uploadAccessory(workorderCode,request);
            Map<String,Object> map = synergyManageService.uploadAccessory(request);
            return write(200,"获取成功!","data",map);
        }catch (Exception e){
            e.printStackTrace();
@ -609,5 +609,31 @@ public class CustomerSynergyManageController extends BaseController {
            return write(-1,"获取失败!");
        }
    }
    @RequestMapping(value = "deleteFile",method = RequestMethod.POST)
    @ApiOperation(value = "删除附件")
    public String deleteFile(@ApiParam(name="storagePath",value="文件的全部路径 如:group1/M00/00/00/wKgRsVjtwpSAXGwkAAAweEAzRjw471.jpg",required = true)
                             @RequestParam(required = true)String storagePath){
        try{
            synergyManageService.deleteFile(storagePath);
            return write(200,"删除成功!");
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"删除失败!");
        }
    }
    @RequestMapping(value = "getArticalById",method = RequestMethod.GET)
    @ApiOperation(value = "获取健康文章详情")
    public String getArticalById(@ApiParam(name="articalId",value="文章id",required = true)
                             @RequestParam(required = true)String articalId){
        try{
            JSONObject jsonObject = synergyManageService.getArticalById(articalId);
            return write(200,"获取成功!","data",jsonObject);
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"获取失败!");
        }
    }
}

+ 55 - 16
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java

@ -22,6 +22,7 @@ import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -238,6 +239,10 @@ public class SynergyManageService extends BaseJpaService {
                case 4: workorderTypeName="问卷调查";break;
                case 5: workorderTypeName="疾病筛查";break;
            }
            if(workorderTypeR==0||workorderTypeR==2||workorderTypeR==3){
                List<ManageSynergyWorkorderServicerDO> ls = workorderServicerDao.findByWorkorderCode(workorderCode);
                map.put("patientCode",ls.size()>0?ls.get(0):null);//1对1服务工单,服务对象code
            }
            map.put("typeName",workorderTypeName);//服务类型名称
            map.put("serviceTime", DateUtil.dateToStr((Date)one.get("service_time"),"yyyy-MM-dd HH:mm"));//服务时间
            map.put("priority",one.get("priority"));//工单优先级
@ -1071,11 +1076,25 @@ public class SynergyManageService extends BaseJpaService {
    @Transactional
    public void taskSubmit(String workorderCode,String dealResultRemark,String dealResultAccessory) throws Exception{
    public void taskSubmit(String workorderCode,String dealResultRemark,String accessoryJson) throws Exception{
        JSONArray jsonArray = new JSONArray(accessoryJson);
        String fileName;
        String url;
        List<ManageSynergyAccessoryDO> accessoryList = new ArrayList<>();
        for(int i=0;i<jsonArray.length();i++){
            fileName = jsonArray.getJSONObject(i).get("name")+"";
            url = jsonArray.getJSONObject(i).get("url")+"";
            ManageSynergyAccessoryDO manageSynergyAccessoryDO = new ManageSynergyAccessoryDO();
            manageSynergyAccessoryDO.setCode(getCode());
            manageSynergyAccessoryDO.setDel(0);
            manageSynergyAccessoryDO.setName(fileName);
            manageSynergyAccessoryDO.setUrl(url);
            manageSynergyAccessoryDO.setWorkorderCode(workorderCode);
            accessoryList.add(manageSynergyAccessoryDO);
        }
        manageSynergyAccessoryDao.save(accessoryList);
        ManageSynergyWorkorderDO manageSynergyWorkorderDO = workOrderDao.findByCode(workorderCode);
        manageSynergyWorkorderDO.setDealResultRemark(dealResultRemark);
        manageSynergyWorkorderDO.setDealResultAccessory(dealResultAccessory);
        manageSynergyWorkorderDO.setStatus(3);
        workOrderDao.save(manageSynergyWorkorderDO);
    }
@ -1579,21 +1598,24 @@ public class SynergyManageService extends BaseJpaService {
//    }
    @Transactional
    public Map<String,Object> uploadAccessory(String workorderCode, HttpServletRequest request) throws Exception{
    public Map<String,Object> uploadAccessory(HttpServletRequest request) throws Exception{
        Map<String,Object> map = new HashMap<>();
        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
        MultipartFile multipartFile = multipartRequest.getFile("file");
        long size = multipartFile.getSize();
        if(size<=0){
            map.put("uploadStatus",1);//size小于0
            map.put("accessory",null);//
            map.put("accessoryUrl",null);//
            return map;
        }
        String fileName = multipartFile.getOriginalFilename();
        String type = fileName.split(".")[1];
        if(!("doc".equals(type)||"docx".equals(type)||"xls".equals(type)||"xlsx".equals(type))){
        String[] fs = fileName.split("\\.");
        String type = fs[1];
        //图片常见格式: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(!("doc".equals(type)||"docx".equals(type)||"xls".equals(type)||"xlsx".equals(type)||img.contains(type))){
            map.put("uploadStatus",2);//文件类型不对
            map.put("accessory",null);//
            map.put("accessoryUrl",null);//
            return map;
        }
        String response = request(wlyyUrl + "/upload/chat", multipartFile, null);
@ -1601,15 +1623,8 @@ public class SynergyManageService extends BaseJpaService {
        Integer status =(Integer)rs.get("status");
        if(status==200){
            String url = rs.get("urls")+"";
            ManageSynergyAccessoryDO manageSynergyAccessoryDO = new ManageSynergyAccessoryDO();
            manageSynergyAccessoryDO.setCode(getCode());
            manageSynergyAccessoryDO.setDel(0);
            manageSynergyAccessoryDO.setName(fileName);
            manageSynergyAccessoryDO.setUrl(url);
            manageSynergyAccessoryDO.setWorkorderCode(workorderCode);
            ManageSynergyAccessoryDO accessoryDO = manageSynergyAccessoryDao.save(manageSynergyAccessoryDO);
            map.put("uploadStatus",0);//文件类型正确
            map.put("accessory",accessoryDO);//
            map.put("accessory",url);//
            return map;
        }
        throw new Exception();
@ -1889,4 +1904,28 @@ public class SynergyManageService extends BaseJpaService {
    public List<User> getCustomers() {
        return userDao.findAllCustomer();
    }
    public void deleteFile(String storagePath) throws Exception{
        Map<String,Object> params = new HashMap<>();
        params.put("storagePath",storagePath);
        String response = httpClientUtil.post(wlyyUrl + "/upload/deleteFile", params);
        JSONObject jsonObject = new JSONObject(response);
        Integer status = (Integer) jsonObject.get("status");
        if(status!=200){
            throw new Exception();
        }
    }
    public JSONObject getArticalById(String articalId) throws Exception{
        Map<String,Object> params = new HashMap<>();
        params.put("articalId",articalId);
        String response = httpClientUtil.post(wlyyUrl + "/third/synergy/getArticalById", params);
        JSONObject jsonObject = new JSONObject(response);
        Integer status = (Integer) jsonObject.get("status");
        if(status==200){
            return jsonObject.getJSONObject("data");
        }
        throw new Exception();
    }
}

+ 6 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jkEduArticle/ThirdJkEduArticleService.java

@ -414,8 +414,12 @@ public class ThirdJkEduArticleService extends BaseService {
        try {
            JSONObject param = new JSONObject();
            param.put("articleId", articleId);
            param.put("userId", userId);
            param.put("userType", userType);
            if(!StringUtils.isEmpty(userId)){
                param.put("userId", userId);
            }
            if(!StringUtils.isEmpty(userType)){
                param.put("userType", userType);
            }
            String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getArticalById, param.toString(), "1"));
            json = JSON.parseObject(response);
            if("1".equals(userType)&&!org.apache.commons.lang.StringUtils.isEmpty(messageCode)){

+ 14 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/CommonUtil.java

@ -16,6 +16,8 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -639,4 +641,16 @@ public class CommonUtil {
        
        return fileUrls.substring(0,fileUrls.length()-1);
    }
    public void deleteFile(String storagePath,HttpServletRequest request, HttpServletResponse response) throws Exception{
        String url = neiwangWlyy + request.getRequestURI();//uri请求路径 http://172.19.103.88/wlyy/upload/deleteFile
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("storagePath", storagePath));
        String result = httpClientUtil.post(url, params, "UTF-8");
        JSONObject jsonObject = new JSONObject(result);
        Integer status = (Integer)jsonObject.get("status");
        if(status!=200){
            throw new Exception();
        }
    }
}

+ 18 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/fastdfs/FastDFSUtil.java

@ -272,8 +272,8 @@ public class FastDFSUtil {
    /**
     * 删除文件。
     *
     * @param groupName
     * @param remoteFileName
     * @param groupName 组名 如:group1
     * @param remoteFileName 不带组名的路径名称 如:M00/00/00/wKgRsVjtwpSAXGwkAAAweEAzRjw471.jpg
     */
    public static void delete(String groupName, String remoteFileName) throws IOException, MyException {
@ -284,4 +284,20 @@ public class FastDFSUtil {
            FastDFSClientPool.getInstance().releaseStorageClient(client);
        }
    }
    /**
     *
     * @param storagePath 文件的全部路径 如:group1/M00/00/00/wKgRsVjtwpSAXGwkAAAweEAzRjw471.jpg
     * @throws IOException
     * @throws MyException
     */
    public static void delete(String storagePath) throws Exception {
        if(!storagePath.startsWith("group")){
            throw new Exception();
        }
        String[] temp = storagePath.split("/");
        String groupName = temp[0];
        String remoteFileName = storagePath.substring(storagePath.indexOf("/")+1);
        delete(groupName, remoteFileName);
    }
}

+ 21 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/FileUploadController.java

@ -641,4 +641,25 @@ public class FileUploadController extends BaseController {
//
//
//    }
    @RequestMapping(value = "deleteFile", method = RequestMethod.POST  /*,headers = "Accept=image/png"*/ )
    @ResponseBody
    public String deleteFile(@ApiParam(name="storagePath",value="文件的全部路径 如:group1/M00/00/00/wKgRsVjtwpSAXGwkAAAweEAzRjw471.jpg",required = true)
                             @RequestParam(required = true)String storagePath,HttpServletRequest request, HttpServletResponse response){
        try {
            if (isneiwang) {
                fastDFSUtil.delete(storagePath);
            }else{
                CommonUtil.deleteFile(storagePath,request,response);
            }
            JSONObject json = new JSONObject();
            json.put("status", 200);
            json.put("msg", "删除成功");
            return json.toString();
        }catch (Exception e){
            error(e);
            return error(-1, "删除失败");
        }
    }
}

+ 16 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/synergy/SynergyManagerController.java

@ -12,6 +12,7 @@ import com.yihu.wlyy.service.app.followup.FollowupDrugsService;
import com.yihu.wlyy.service.app.survey.SurveyScreenResultService;
import com.yihu.wlyy.service.specialist.SpecialistEvaluateSevice;
import com.yihu.wlyy.service.survey.ManagerQuestionnaireService;
import com.yihu.wlyy.service.third.jkEduArticle.ThirdJkEduArticleService;
import com.yihu.wlyy.service.third.jw.ZyDictService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
@ -47,6 +48,8 @@ public class SynergyManagerController extends BaseController{
    private FollowupDrugsService followupDrugsService;
    @Autowired
    private SpecialistEvaluateSevice specialistEvaluateSevice;
    @Autowired
    private ThirdJkEduArticleService thirdJkEduArticleService;
    @ApiOperation("新增临时随访记录(返回ID)")
    @RequestMapping(value = "/addFollowup", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
@ -322,4 +325,17 @@ public class SynergyManagerController extends BaseController{
            return error(-1, "获取消息失败!");
        }
    }
    @RequestMapping(value = "getArticalById",method = RequestMethod.GET)
    @ApiOperation("获取文章详情")
    public String getArticalById(@ApiParam(name = "articleId", value = "文章id")
                                 @RequestParam(value = "articleId", required = true) String articleId){
        try {
            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticalById(articleId,null,null);
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败!");
        }
    }
}

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

@ -52,7 +52,7 @@ rehabilitation:
  url: http://localhost:10055/svr-wlyy-rehabilitation/
#集美客服配置
customerService:
  url: http://localhost:8180/
  url: http://localhost:8082/
#小程序
applets:

+ 3 - 1
patient-co/patient-co-wlyy/src/main/resources/application-prod.yml

@ -48,8 +48,10 @@ healthBank:
rehabilitation:
  url: http://localhost:10055/svr-rehabilitation/
#集美客服配置
#customerService:
#  url: http://172.19.103.72:8080/customer-service/
customerService:
  url: http://172.19.103.72:8080/customer-service/
  url: http://www.xmtyw.cn/wlyy/
#小程序
applets:
  appId: wx0e663ce069b5170c

+ 2 - 0
patient-co/patient-co-wlyy/src/main/resources/application-test.yml

@ -43,6 +43,8 @@ healthBank:
#康复计划配置
rehabilitation:
  url: http://localhost:10055/svr-rehabilitation/
customerService:
  url: http://172.19.103.88:9092/wlyy/
#小程序
applets:
  appId: wx0e663ce069b5170c