|
@ -0,0 +1,107 @@
|
|
|
package com.yihu.wlyy.web.doctor.template;
|
|
|
|
|
|
import com.yihu.wlyy.aop.ObserverRequired;
|
|
|
import com.yihu.wlyy.entity.template.DoctorGuidanceTempLabel;
|
|
|
import com.yihu.wlyy.service.template.DoctorGuidanceTempLableService;
|
|
|
import com.yihu.wlyy.web.BaseController;
|
|
|
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.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* Created by 刘文彬 on 2018/5/18.
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping(value = "/doctor/guidance_temp/lable")
|
|
|
@Api(description = "医生健康指导模板标签")
|
|
|
public class DoctorGuidanceTempLabelController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private DoctorGuidanceTempLableService doctorGuidanceTempLableService;
|
|
|
|
|
|
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
|
|
@ApiOperation(value = "添加指导模板标签")
|
|
|
@ObserverRequired
|
|
|
public String save(@ApiParam(name = "name", value = "标签名称", required = true)
|
|
|
@RequestParam(value = "name", required = true) String name,
|
|
|
@ApiParam(name = "teamId", value = "医生团队id", required = true)
|
|
|
@RequestParam(value = "teamId", required = true) Integer teamId){
|
|
|
try{
|
|
|
DoctorGuidanceTempLabel doctorGuidanceTempLable = doctorGuidanceTempLableService.save(getUID(),name,teamId);
|
|
|
if(doctorGuidanceTempLable!=null){
|
|
|
return write(200,"保存标签成功!","data",doctorGuidanceTempLable);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return error(-1,"保存标签失败!");
|
|
|
}
|
|
|
return error(-1,"保存标签失败!");
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/findAllList", method = RequestMethod.GET)
|
|
|
@ApiOperation(value = "根据团队id获取标签")
|
|
|
@ObserverRequired
|
|
|
public String findAllList(@ApiParam(name = "pageSize", value = "每页总数", required = true)
|
|
|
@RequestParam(value = "pageSize", required = true,defaultValue = "10") int pageSize,
|
|
|
@ApiParam(name = "pageNo", value = "当前页", required = true)
|
|
|
@RequestParam(value = "pageNo", required = true,defaultValue = "1") int pageNo,
|
|
|
@ApiParam(name = "teamId", value = "医生团队id", required = true)
|
|
|
@RequestParam(value = "teamId", required = true) Integer teamId){
|
|
|
try{
|
|
|
List<DoctorGuidanceTempLabel> list = doctorGuidanceTempLableService.findByDoctorCode(teamId, pageSize, pageNo);
|
|
|
if (list == null || list.size() < 1) {
|
|
|
return write(200, "查询成功!");
|
|
|
} else {
|
|
|
return write(200, "查询成功!", "data", list);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return error(-1,"查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/deleteLabel", method = RequestMethod.POST)
|
|
|
@ApiOperation(value = "删除健康指导模板标签")
|
|
|
@ObserverRequired
|
|
|
public String deleteLabel(@ApiParam(name = "code", value = "标签code", required = true)
|
|
|
@RequestParam(value = "code", required = true) String code){
|
|
|
|
|
|
try {
|
|
|
boolean b = doctorGuidanceTempLableService.delete(code);
|
|
|
if(b){
|
|
|
return success("删除成功!");
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return error(-1,"删除成功!");
|
|
|
}
|
|
|
return error(-1,"删除成功!");
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/updateLabel", method = RequestMethod.POST)
|
|
|
@ApiOperation(value = "修改健康指导模板标签")
|
|
|
@ObserverRequired
|
|
|
public String updateLabel(@ApiParam(name = "code", value = "标签code", required = true)
|
|
|
@RequestParam(value = "code", required = true) String code,
|
|
|
@ApiParam(name = "name", value = "标签名称", required = true)
|
|
|
@RequestParam(value = "name", required = true) String name){
|
|
|
|
|
|
try {
|
|
|
boolean b = doctorGuidanceTempLableService.updateName(code,name);
|
|
|
if(b){
|
|
|
return success("修改成功!");
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return error(-1,"修改失败!");
|
|
|
}
|
|
|
return error(-1,"修改失败!");
|
|
|
}
|
|
|
}
|