diff --git a/pom.xml b/pom.xml index b49f0bd5d..c96194afb 100644 --- a/pom.xml +++ b/pom.xml @@ -198,6 +198,12 @@ <artifactId>aliyun-sdk-oss</artifactId> <version>${aliyun-oss.version}</version> </dependency> + <!-- 阿里云视频点播 --> + <dependency> + <groupId>com.aliyun</groupId> + <artifactId>vod20170321</artifactId> + <version>2.0.0</version> + </dependency> </dependencies> <modules> diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java index a4660d826..a85fc2e2d 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java @@ -15,12 +15,14 @@ import com.stdiet.custom.domain.SysCustomerPhysicalSigns; import com.stdiet.custom.service.ISysCustomerHealthyService; import com.stdiet.custom.service.ISysCustomerPhysicalSignsService; import com.stdiet.custom.service.ISysCustomerService; +import com.stdiet.custom.service.ISysPhysicalSignsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.List; +import java.util.regex.Pattern; /** * 客户体征信息Controller @@ -40,6 +42,9 @@ public class SysCustomerController extends BaseController { @Autowired private ISysCustomerHealthyService sysCustomerHealthyService; + @Autowired + private ISysPhysicalSignsService sysPhysicalSignsService; + /** * 查询客户信息列表 */ @@ -56,6 +61,20 @@ public class SysCustomerController extends BaseController { sysCustomer.setChannels(remark.split("\\|")); } } + + //体征查询 + if(StringUtils.isNotEmpty(sysCustomer.getPhysicalSignsId())){ + //判断是否数字ID + Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$"); + if(pattern.matcher(sysCustomer.getPhysicalSignsId()).matches()){ + List<Long> signIdList = new ArrayList<>(); + signIdList.add(Long.parseLong(sysCustomer.getPhysicalSignsId())); + sysCustomer.setSignIdList(signIdList); + }else { + sysCustomer.setSignIdList(sysPhysicalSignsService.getSignIdByName(sysCustomer.getPhysicalSignsId())); + } + } + list = sysCustomerService.selectSysCustomerList(sysCustomer); if (list != null && list.size() > 0) { for (SysCustomer sysCus : list) { diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java index abcee28f7..6c7df9d0f 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java @@ -1,11 +1,15 @@ package com.stdiet.web.controller.custom; +import com.aliyun.vod20170321.models.GetPlayInfoResponseBody; +import com.aliyun.vod20170321.models.GetVideoInfoResponseBody; +import com.aliyun.vod20170321.models.GetVideoListResponseBody; import com.itextpdf.io.util.DateTimeUtil; import com.stdiet.common.core.controller.BaseController; import com.stdiet.common.core.domain.AjaxResult; import com.stdiet.common.core.page.TableDataInfo; import com.stdiet.common.enums.BusinessType; import com.stdiet.common.exception.file.FileNameLengthLimitExceededException; +import com.stdiet.common.utils.AliyunVideoUtils; import com.stdiet.common.utils.DateUtils; import com.stdiet.common.utils.StringUtils; import com.stdiet.common.utils.file.FileUploadUtils; @@ -15,6 +19,7 @@ import com.stdiet.common.utils.sign.AesUtils; import com.stdiet.custom.domain.*; import com.stdiet.custom.dto.response.CustomerCaseResponse; import com.stdiet.custom.dto.response.MessageNoticeResponse; +import com.stdiet.custom.dto.response.NutritionalVideoResponse; import com.stdiet.custom.page.WxLogInfo; import com.stdiet.custom.service.*; import org.aspectj.weaver.loadtime.Aj; @@ -353,4 +358,62 @@ public class WechatAppletController extends BaseController { sysMessageNotice.setId(id); return toAjax(sysMessageNoticeService.updateSysMessageNotice(sysMessageNotice)); } + + /** + * 更新用户通知消息已读状态 + */ + @GetMapping(value = "/getVideoList") + public AjaxResult getVideoList(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) { + AjaxResult result = AjaxResult.success(); + int total = 0; + List<NutritionalVideoResponse> nutritionalVideoList = new ArrayList<>(); + try{ + GetVideoListResponseBody videoListResponseBody = AliyunVideoUtils.getVideoListByPage(null, "Normal", pageNum, pageSize); + if(videoListResponseBody != null){ + total = videoListResponseBody.total; + for (GetVideoListResponseBody.GetVideoListResponseBodyVideoListVideo video : videoListResponseBody.videoList.video) { + NutritionalVideoResponse nutritionalVideoResponse = new NutritionalVideoResponse(); + nutritionalVideoResponse.setCoverURL(video.getCoverURL()); + nutritionalVideoResponse.setTitle(video.getTitle()); + nutritionalVideoResponse.setVideoId(video.getVideoId()); + nutritionalVideoResponse.setDescription(video.getDescription()); + nutritionalVideoResponse.setTags(video.getTags()); + nutritionalVideoList.add(nutritionalVideoResponse); + } + } + }catch (Exception e){ + e.printStackTrace(); + } + result.put("total", total); + result.put("nutritionalVideoList", nutritionalVideoList); + return result; + } + + + /** + * 根据视频id获取播放链接 + */ + @GetMapping(value = "/getVideoDetailById") + public AjaxResult getVideoDetailById(@RequestParam(value = "videoId") String videoId) { + AjaxResult result = AjaxResult.success(); + NutritionalVideoResponse nutritionalVideoResponse = new NutritionalVideoResponse(); + try{ + GetPlayInfoResponseBody playInfoResponseBody = AliyunVideoUtils.getVideoVisitDetail(videoId); + GetVideoInfoResponseBody videoInfoResponseBody = AliyunVideoUtils.getVideoById(videoId); + List<GetPlayInfoResponseBody.GetPlayInfoResponseBodyPlayInfoListPlayInfo> playList = playInfoResponseBody.playInfoList.playInfo; + if(playList != null && playList.size() > 0){ + nutritionalVideoResponse.setPlayUrl(playList.get(0).getPlayURL()); + } + if(videoInfoResponseBody != null){ + nutritionalVideoResponse.setDescription(videoInfoResponseBody.video.description); + nutritionalVideoResponse.setTags(videoInfoResponseBody.video.tags); + nutritionalVideoResponse.setTitle(videoInfoResponseBody.video.title); + nutritionalVideoResponse.setCreateTime(videoInfoResponseBody.video.creationTime); + } + }catch (Exception e){ + e.printStackTrace(); + } + result.put("videoDetail", nutritionalVideoResponse); + return result; + } } diff --git a/stdiet-common/src/main/java/com/stdiet/common/utils/AliyunVideoUtils.java b/stdiet-common/src/main/java/com/stdiet/common/utils/AliyunVideoUtils.java new file mode 100644 index 000000000..0133e9c05 --- /dev/null +++ b/stdiet-common/src/main/java/com/stdiet/common/utils/AliyunVideoUtils.java @@ -0,0 +1,101 @@ +package com.stdiet.common.utils; + +import com.aliyun.vod20170321.models.*; +import com.aliyun.teaopenapi.models.*; +import com.stdiet.common.config.AliyunOSSConfig; + +public class AliyunVideoUtils { + + public static com.aliyun.vod20170321.Client videoClient = null; + + public static final String default_definition = "FD,LD,SD,HD"; + + public static final String default_stream_type = "video"; + + public static final String default_output_type = "oss"; + + public static final String default_formats = "mp4"; + + /** + * 初始化视频点播Client + * @return + * @throws Exception + */ + public static com.aliyun.vod20170321.Client createClient() throws Exception { + if(videoClient == null){ + synchronized (com.aliyun.vod20170321.Client.class){ + if(videoClient == null){ + Config config = new Config() + // 您的AccessKey ID + .setAccessKeyId(AliyunOSSConfig.AccessKeyID) + // 您的AccessKey Secret + .setAccessKeySecret(AliyunOSSConfig.AccessKeySecret); + // 访问的域名 + config.endpoint = "vod.cn-shenzhen.aliyuncs.com"; + videoClient = new com.aliyun.vod20170321.Client(config); + } + } + } + return videoClient; + } + + /** + * 分页获取视频列表 + * @param pageNo 页码 + * @param pageSize 每页数量 + * @return + * @throws Exception + */ + public static GetVideoListResponseBody getVideoListByPage(Long cateId, String status, Integer pageNo, Integer pageSize) throws Exception{ + com.aliyun.vod20170321.Client client = AliyunVideoUtils.createClient(); + GetVideoListRequest getVideoListRequest = new GetVideoListRequest() + .setCateId(cateId == null ? null : cateId) + .setStatus(status == null ? "Normal": status) + .setPageNo(pageNo == null ? 1 : pageNo) + .setPageSize(pageSize == null ? 10 : pageSize); + GetVideoListResponse videoListResponse = client.getVideoList(getVideoListRequest); + if(videoListResponse != null){ + return videoListResponse.getBody(); + } + return null; + } + + /** + * 根据videoID获取视频访问地址信息 + * @param videoId + * @throws Exception + */ + public static GetPlayInfoResponseBody getVideoVisitDetail(String videoId) throws Exception{ + com.aliyun.vod20170321.Client client = AliyunVideoUtils.createClient(); + GetPlayInfoRequest getPlayInfoRequest = new GetPlayInfoRequest() + .setVideoId(videoId) + .setStreamType(default_stream_type) + .setOutputType(default_output_type) + .setFormats(default_formats); + GetPlayInfoResponse getPlayInfoResponse = client.getPlayInfo(getPlayInfoRequest); + if(getPlayInfoResponse != null){ + return getPlayInfoResponse.getBody(); + } + return null; + } + + /** + * 根据videoID获取视频信息 + * @param videoId + * @throws Exception + */ + public static GetVideoInfoResponseBody getVideoById (String videoId) throws Exception{ + com.aliyun.vod20170321.Client client = AliyunVideoUtils.createClient(); + GetVideoInfoRequest getVideoInfoRequest = new GetVideoInfoRequest() + .setVideoId(videoId); + GetVideoInfoResponse response = client.getVideoInfo(getVideoInfoRequest); + if(response != null){ + return response.body; + } + return null; + } + + + + +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomer.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomer.java index a99cd9447..072923305 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomer.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomer.java @@ -2,6 +2,8 @@ package com.stdiet.custom.domain; import java.math.BigDecimal; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.apache.commons.lang3.builder.ToStringBuilder; @@ -102,4 +104,10 @@ public class SysCustomer extends BaseEntity private String[] channels; + //病史体征ID集合,非持久化字段 + private List<Long> signIdList; + + //病史体征ID + private String physicalSignsId; + } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/NutritionalVideoResponse.java b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/NutritionalVideoResponse.java new file mode 100644 index 000000000..d3827493c --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/NutritionalVideoResponse.java @@ -0,0 +1,39 @@ +package com.stdiet.custom.dto.response; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class NutritionalVideoResponse implements Serializable { + + private static final long serialVersionUID = 1L; + + //分类ID + public Long cateId; + + //分类名称 + public String cateName; + + //标题 + public String title; + + //标签 + public String tags; + + //视频ID + public String videoId; + + //封面URL + public String coverURL; + + //视频描述 + public String description; + + //播放链接 + public String playUrl; + + + public String createTime; + +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysPhysicalSignsMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysPhysicalSignsMapper.java index 22cca22d8..cbd9b349b 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysPhysicalSignsMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysPhysicalSignsMapper.java @@ -2,6 +2,7 @@ package com.stdiet.custom.mapper; import java.util.List; import com.stdiet.custom.domain.SysPhysicalSigns; +import org.apache.ibatis.annotations.Param; /** * 体征Mapper接口 @@ -58,4 +59,11 @@ public interface SysPhysicalSignsMapper * @return 结果 */ public int deleteSysPhysicalSignsByIds(Long[] ids); + + /** + * 根据名称查询体征ID集合 + * @param name + * @return + */ + List<Long> getSignIdByName(@Param("name") String name); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysPhysicalSignsService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysPhysicalSignsService.java index 204ba992a..eee6b4ce0 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysPhysicalSignsService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysPhysicalSignsService.java @@ -58,4 +58,11 @@ public interface ISysPhysicalSignsService * @return 结果 */ public int deleteSysPhysicalSignsById(Long id); + + /** + * 根据名称查询体征ID集合 + * @param name + * @return + */ + List<Long> getSignIdByName(String name); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysPhysicalSignsServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysPhysicalSignsServiceImpl.java index 71d5a4182..1aa9f149e 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysPhysicalSignsServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysPhysicalSignsServiceImpl.java @@ -90,4 +90,14 @@ public class SysPhysicalSignsServiceImpl implements ISysPhysicalSignsService { return sysPhysicalSignsMapper.deleteSysPhysicalSignsById(id); } + + /** + * 根据名称查询体征ID集合 + * @param name + * @return + */ + @Override + public List<Long> getSignIdByName(String name){ + return sysPhysicalSignsMapper.getSignIdByName(name); + } } \ No newline at end of file diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml index 086da23a6..0e7b805e0 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml @@ -34,26 +34,41 @@ </sql> <select id="selectSysCustomerList" parameterType="SysCustomer" resultMap="SysCustomerResult"> - <include refid="selectSysCustomerVo"/> - where del_flag = 0 - <if test="name != null and name != ''"> and (name like concat('%', #{name}, '%') or phone like concat('%', #{name}, '%'))</if> - <if test="mainDietitian != null and mainDietitian != ''"> and main_dietitian = #{mainDietitian}</if> - <if test="mainDietitian == 0"> and (isnull(main_dietitian) or main_dietitian=0)</if> - <if test="salesman != null and salesman != ''"> and salesman = #{salesman}</if> - <if test="salesman == 0"> and (isnull(salesman) or salesman=0)</if> - <if test="afterDietitian != null and afterDietitian != ''"> and after_dietitian = #{afterDietitian}</if> - <if test="afterDietitian == 0"> and (isnull(after_dietitian) or after_dietitian=0)</if> - <if test="assistantDietitian != null and assistantDietitian != ''"> and assistant_dietitian = #{assistantDietitian}</if> - <if test="assistantDietitian == 0"> and (isnull(assistant_dietitian) or assistant_dietitian=0)</if> - <if test="fansChannel != null "> and fans_channel = #{fansChannel}</if> - <if test="channelId != null "> and channel_id = #{channelId}</if> + select + sc.id, sc.name, sc.phone, sc.email, sc.fans_time, sc.fans_channel, sc.address, sc.pay_date, sc.start_date, sc.purchase_num, sc.pay_total, sc.main_dietitian, + sc.assistant_dietitian, sc.after_dietitian, sc.salesman, sc.charge_person, sc.follow_status, sc.create_time,sc.channel_id + from sys_customer sc + left join sys_customer_healthy as sch + on sch.customer_id = sc.id and sch.del_flag = 0 + where sc.del_flag = 0 + <if test="name != null and name != ''"> + and (sc.name like concat('%', #{name}, '%') or sc.phone like concat('%', #{name}, '%')) + </if> + <if test="mainDietitian != null and mainDietitian != ''"> and sc.main_dietitian = #{mainDietitian}</if> + <if test="mainDietitian == 0"> and (isnull(sc.main_dietitian) or sc.main_dietitian=0)</if> + <if test="salesman != null and salesman != ''"> and sc.salesman = #{salesman}</if> + <if test="salesman == 0"> and (isnull(sc.salesman) or sc.salesman=0)</if> + <if test="afterDietitian != null and afterDietitian != ''"> and sc.after_dietitian = #{afterDietitian}</if> + <if test="afterDietitian == 0"> and (isnull(sc.after_dietitian) or sc.after_dietitian=0)</if> + <if test="assistantDietitian != null and assistantDietitian != ''"> and sc.assistant_dietitian = #{assistantDietitian}</if> + <if test="assistantDietitian == 0"> and (isnull(sc.assistant_dietitian) or sc.assistant_dietitian=0)</if> + <if test="fansChannel != null "> and sc.fans_channel = #{fansChannel}</if> + <if test="channelId != null "> and sc.channel_id = #{channelId}</if> <if test="channels != null"> - and channel_id in + and sc.channel_id in <foreach collection="channels" item="cn" separator="," open="(" close=")"> #{cn} </foreach> </if> - order by create_time desc + <if test="signIdList != null"> + and ( + sch.other_physical_signs like concat('%', #{name}, '%') + <foreach collection="signIdList " item="signId" index="index" open=" OR (" close=")" separator=" OR "> + FIND_IN_SET(#{signId}, sch.physical_signs_id) + </foreach> + ) + </if> + order by sc.create_time desc </select> <select id="selectSysCustomerById" parameterType="Long" resultMap="SysCustomerResult"> diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysPhysicalSignsMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysPhysicalSignsMapper.xml index 0c6493d6b..081231caa 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysPhysicalSignsMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysPhysicalSignsMapper.xml @@ -66,5 +66,10 @@ </foreach> </delete> + <!-- 根据体征名称查询体征ID --> + <select id="getSignIdByName" parameterType="String" resultType="Long"> + select sps.id from sys_physical_signs sps where sps.name like concat('%', #{name}, '%') + </select> + </mapper> \ No newline at end of file diff --git a/stdiet-ui/src/views/custom/askQuestion/index.vue b/stdiet-ui/src/views/custom/askQuestion/index.vue index 5db66b6ad..f0ee6985c 100644 --- a/stdiet-ui/src/views/custom/askQuestion/index.vue +++ b/stdiet-ui/src/views/custom/askQuestion/index.vue @@ -49,6 +49,7 @@ </el-tag> </template> </el-table-column> + <el-table-column label="创建时间" align="center" prop="createTime" /> <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <template slot-scope="scope"> <el-button diff --git a/stdiet-ui/src/views/custom/customer/index.vue b/stdiet-ui/src/views/custom/customer/index.vue index cd87b904b..d63a018b4 100644 --- a/stdiet-ui/src/views/custom/customer/index.vue +++ b/stdiet-ui/src/views/custom/customer/index.vue @@ -83,6 +83,26 @@ /> </el-select> </el-form-item> + + <el-form-item label="病史体征" prop="physicalSignsId"> + <el-select + v-model="queryParams.physicalSignsId" + filterable + clearable + allow-create + default-first-option + placeholder="请选择病史体征" + > + <el-option + v-for="physicalSign in physicalSignsList" + :key="physicalSign.id" + :label="physicalSign.name" + :value="physicalSign.id" + > + </el-option> + </el-select> + </el-form-item> + <el-form-item> <el-button type="cyan" icon="el-icon-search" @click="handleQuery" >搜索</el-button @@ -434,6 +454,7 @@ import ContractDrawer from "@/components/ContractDrawer"; import HeatStatisticsDrawer from "@/components/HeatStatisticsDrawer"; import RecipesPlanDrawer from "@/components/RecipesPlanDrawer"; import CustomerPunchLogDrawer from "@/components/PunchLog/CustomerPunchLog"; +import { listPhysicalSigns } from "@/api/custom/physicalSigns"; import { mapGetters } from "vuex"; export default { @@ -483,6 +504,7 @@ export default { assistantDietitian: null, afterDietitian: null, salesman: null, + physicalSignsId: null }, // 表单参数 form: {}, @@ -524,6 +546,8 @@ export default { return time.getTime() > Date.now(); }, }, + //病史体征 + physicalSignsList:[] }; }, created() { @@ -545,6 +569,9 @@ export default { } }); this.getList(); + listPhysicalSigns().then(response => { + this.physicalSignsList = response.rows; + }); }, computed: { isPartner() {