|
@ -0,0 +1,64 @@
|
|
|
package com.yihu.jw.care.endpoint.video;
|
|
|
|
|
|
import com.yihu.jw.care.dao.video.BaseVideoDao;
|
|
|
import com.yihu.jw.restmodel.web.ListEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.ObjEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* Created by yeshijie on 2022/3/21.
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping(value = "pateintVideo")
|
|
|
@Api(value = "居民视频", description = "居民视频", tags = {"居民视频"})
|
|
|
public class PatientVideoEndpoint extends EnvelopRestEndpoint {
|
|
|
|
|
|
@Autowired
|
|
|
private BaseVideoDao baseVideoDao;
|
|
|
@Autowired
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
@RequestMapping(value = "findVideoNum", method = RequestMethod.GET)
|
|
|
@ApiOperation(value = "按类型获取视频列表")
|
|
|
public ObjEnvelop findVideoNum() {
|
|
|
try {
|
|
|
String sql = "SELECT type,COUNT(*) num from base_video GROUP BY type";
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
Map<String, Integer> map = new HashMap<>();
|
|
|
//类型 1疾病防治 2健康生活 3慢病防治
|
|
|
map.put("1",0);
|
|
|
map.put("2",0);
|
|
|
map.put("3",0);
|
|
|
for (Map<String, Object> one:list){
|
|
|
map.put(String.valueOf(one.get("type")), Integer.valueOf(String.valueOf(one.get("num"))));
|
|
|
}
|
|
|
|
|
|
return ObjEnvelop.getSuccess("获取成功",map);
|
|
|
} catch (Exception e) {
|
|
|
return failedObjEnvelopException2(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "findVideo", method = RequestMethod.GET)
|
|
|
@ApiOperation(value = "按类型获取视频列表")
|
|
|
public ListEnvelop findVideo(@ApiParam(name = "type", value = "类型 1疾病防治 2健康生活 3慢病防治")
|
|
|
@RequestParam(value = "type", required = true) String type) {
|
|
|
try {
|
|
|
return ListEnvelop.getSuccess("获取成功",baseVideoDao.findByType(type));
|
|
|
} catch (Exception e) {
|
|
|
return failedListEnvelopException2(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|