|
@ -0,0 +1,134 @@
|
|
|
package com.yihu.wlyy.web.third.specialist;
|
|
|
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
import com.yihu.wlyy.service.app.family.FamilyService;
|
|
|
import com.yihu.wlyy.service.app.team.AdminTeamService;
|
|
|
import com.yihu.wlyy.service.common.account.DoctorService;
|
|
|
import com.yihu.wlyy.service.specialist.RehabilitationPlanService;
|
|
|
import com.yihu.wlyy.web.BaseController;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.MediaType;
|
|
|
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;
|
|
|
|
|
|
/**
|
|
|
* Created by humingfen on 2018/8/22.
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping(value = "/third/rehabilitaionPlan",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
@Api(description = "康复服务套餐管理")
|
|
|
public class ThirdRehabilitationPlanController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private RehabilitationPlanService rehabilitationPlanService;
|
|
|
@Autowired
|
|
|
private AdminTeamService teamService;
|
|
|
@Autowired
|
|
|
private DoctorService doctorService;
|
|
|
@Autowired
|
|
|
private FamilyService familyService;
|
|
|
|
|
|
@RequestMapping(value = "/findTemplateList", method = RequestMethod.GET)
|
|
|
@ApiOperation(value = "获取康复服务套餐模板列表")
|
|
|
public String templateList(@ApiParam(name = "patient", value = "居民标识")
|
|
|
@RequestParam(required = false)String patient){
|
|
|
try {
|
|
|
Long adminTeamId = null;
|
|
|
if(StringUtils.isNotBlank(patient)) {
|
|
|
SignFamily signFamily = familyService.findByPatientAndDoctor(patient, getUID());
|
|
|
adminTeamId = signFamily.getAdminTeamId();
|
|
|
}else {
|
|
|
AdminTeam team = teamService.findByLeaderCode(getUID());
|
|
|
adminTeamId = team.getId();
|
|
|
}
|
|
|
return write(200, "获取成功", "data", rehabilitationPlanService.findTemplateInfo(adminTeamId));
|
|
|
// return write(200, "获取成功", "data", rehabilitationPlanService.findTemplateInfo((long) 646));
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "请求失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/findTemplateDetail", method = RequestMethod.GET)
|
|
|
@ApiOperation(value = "获取康复服务套餐模板明细")
|
|
|
public String findTemplateDetail(@ApiParam(name = "templateId", value = "模板id")
|
|
|
@RequestParam(required = true)String templateId){
|
|
|
try {
|
|
|
return write(200, "获取成功", "data", rehabilitationPlanService.findTemplateDetailInfo(templateId));
|
|
|
// return write(200, "获取成功", "data", rehabilitationPlanService.findTemplateInfo((long) 646));
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "请求失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/createTemplate", method = RequestMethod.POST)
|
|
|
@ApiOperation(value = "创建康复服务套餐模板")
|
|
|
public String createTemplate(@ApiParam(name = "title", value = "康复服务模板名称")
|
|
|
@RequestParam(required = true) String title){
|
|
|
try {
|
|
|
AdminTeam team = teamService.findByLeaderCode(getUID());
|
|
|
Doctor doctor = doctorService.findDoctorByCode(getUID());
|
|
|
return write(200, "获取成功", "data", rehabilitationPlanService.createTemplate(title,doctor,team.getId()));
|
|
|
// Doctor doctor = doctorService.findDoctorByCode("0272469a6dcf11e69f7c005056850d66");
|
|
|
// return write(200, "获取成功", "data", rehabilitationPlanService.createTemplate(title,doctor,(long) 646));
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "请求失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/createTemplateDetail", method = RequestMethod.POST)
|
|
|
@ApiOperation(value = "创建康复服务套餐模板明细")
|
|
|
public String createTemplateDetail(@ApiParam(name = "json", value = "康复服务模板明细")
|
|
|
@RequestParam(required = true) String json,
|
|
|
@ApiParam(name = "type", value = "create或者edit")
|
|
|
@RequestParam(required = true) String type){
|
|
|
try {
|
|
|
// Doctor doctor = doctorService.findDoctorByCode(getUID());
|
|
|
// return write(200, "获取成功", "data", rehabilitationPlanService.createTemplate(title,doctor,team.getId()));
|
|
|
Doctor doctor = doctorService.findDoctorByCode("0272469a6dcf11e69f7c005056850d66");
|
|
|
return write(200, "获取成功", "data", rehabilitationPlanService.createTemplateDetail(json,type,doctor));
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "请求失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/findServiceItemsByHospital", method = RequestMethod.GET)
|
|
|
@ApiOperation(value = "根据机构查找服务项目列表")
|
|
|
public String findServiceItemsByHospital(@ApiParam(name = "patient", value = "居民标识")
|
|
|
@RequestParam(required = true)String patient){
|
|
|
try {
|
|
|
// Doctor doctor = doctorService.findDoctorByCode(getUID());
|
|
|
SignFamily signFamily = familyService.findByPatientAndDoctor(patient, getUID());
|
|
|
Doctor doctor = doctorService.findDoctorByCode("0272469a6dcf11e69f7c005056850d66");
|
|
|
return write(200, "获取成功", "data", rehabilitationPlanService.findServiceItemsByHospital(signFamily,doctor));
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "请求失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/createRehabilitationPlan", method = RequestMethod.POST)
|
|
|
@ApiOperation(value = "创建居民康复计划")
|
|
|
public String createRehabilitationPlan(@ApiParam(name = "json", value = "康复计划json")
|
|
|
@RequestParam(required = true) String json){
|
|
|
try {
|
|
|
// Doctor doctor = doctorService.findDoctorByCode(getUID());
|
|
|
Doctor doctor = doctorService.findDoctorByCode("0272469a6dcf11e69f7c005056850d66");
|
|
|
return write(200, "获取成功", "data", rehabilitationPlanService.createRehabilitationPlan(json,doctor));
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "请求失败");
|
|
|
}
|
|
|
}
|
|
|
}
|