Browse Source

新增随访接口

hzp 8 years ago
parent
commit
dc1a1daedb

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorPatientDao.java

@ -30,7 +30,7 @@ public interface DoctorPatientDao extends PagingAndSortingRepository<DoctorPatie
	List<Doctor> findDoctors(String patient, int teamType);
	//查询团队下所有的医生信息
	@Query("select a from Doctor a, DoctorTeamMember b where b.team = ?1 and a.code = b.memberCode and b.type <> 5")
	@Query("select a from Doctor a, DoctorTeamMember b where b.team = ?1 and a.code = b.memberCode and b.type <> 5 and b.del='1'")
	List<Doctor> findTeamDoctors(String team);
	// 更新家庭医生与患者关系为无效

+ 3 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/followup/FollowUpDao.java

@ -23,4 +23,7 @@ public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>,
    @Query("select a from Followup a where a.creater = ?1 and a.followupDate between ?2 and ?3 and a.status <> '0'")
    List<Followup> findByCreater(String creater, Date begin, Date end, Pageable pageRequest) throws Exception;
    @Query(value = "select a.* from wlyy_followup a where a.doctor_code = ?1 and a.patient_code = ?2 and a.status ='1' order by a.followup_date DESC limit 1",nativeQuery = true)
    Followup findLastFollowup(String doctorCode,String patientCode) throws Exception;
}

+ 21 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java

@ -399,6 +399,27 @@ public class FollowUpService extends BaseService {
		return re;
	}
	/**
	 * 获取上次随访项目数据
	 */
	public Map<String,String> getLastFollowupProjectData(String doctor,String patient,String followupProject) throws Exception
	{
		Map<String,String> re = new HashMap<>();
		Followup lastFollowup = followupDao.findLastFollowup(doctor,patient);
		if(lastFollowup!=null)
		{
			List<FollowupContent> dataList =  followupContentDao.findByFollowupIdAndFollowupProject(lastFollowup.getId(),followupProject);
			for(FollowupContent item:dataList)
			{
				re.put(item.getFollowupKey(),item.getFollowupValue());
			}
		}
		return re;
	}
	/**
	 *保存面访项目数据
	 */

+ 31 - 15
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/followup/DoctorFollowUpController.java

@ -187,7 +187,7 @@ public class DoctorFollowUpController extends BaseController {
		}
	}
	/*********************************** 随访详情 *******************************************************************/
	@ApiOperation("获取面访信息")
	@ApiOperation("获取随访信息")
	@RequestMapping(value = "/getFollowup", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
	@ResponseBody
	public String getFollowup(@ApiParam(name="id",value="随访记录ID",defaultValue = "4")
@ -196,13 +196,13 @@ public class DoctorFollowUpController extends BaseController {
		try {
			Map<String,String> response = followUpService.getFollowup(id);
			return write(200, "获取面访信息成功!","data",response);
			return write(200, "获取随访信息成功!","data",response);
		} catch (Exception e) {
			return invalidUserException(e, -1, "获取面访信息失败!"+e.getMessage());
			return invalidUserException(e, -1, "获取随访信息失败!"+e.getMessage());
		}
	}
	@ApiOperation("获取面访项目列表")
	@ApiOperation("获取随访项目列表")
	@RequestMapping(value = "/getFollowupProject", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
	@ResponseBody
	public String getFollowupProject(@ApiParam(name="id",value="随访记录ID",defaultValue = "4")
@ -211,46 +211,62 @@ public class DoctorFollowUpController extends BaseController {
		try {
			List<Map<String,String>> list = followUpService.getFollowupProject(id);
			return write(200, "获取面访项目列表成功!","data",list);
			return write(200, "获取随访项目列表成功!","data",list);
		} catch (Exception e) {
			return invalidUserException(e, -1, "获取面访项目列表失败!"+e.getMessage());
			return invalidUserException(e, -1, "获取随访项目列表失败!"+e.getMessage());
		}
	}
	@ApiOperation("获取面访项目数据")
	@ApiOperation("获取随访项目数据")
	@RequestMapping(value = "/getFollowupProjectData", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
	@ResponseBody
	public String getFollowupProjectData(@ApiParam(name="id",value="随访记录ID",defaultValue = "4")
									 @RequestParam(value="id",required = true) String id,
									 @ApiParam(name="followupProject",value="面访项目",defaultValue = "2")
									 @ApiParam(name="followupProject",value="随访项目",defaultValue = "2")
									 @RequestParam(value="followupProject",required = true) String followupProject)
	{
		try {
			Map<String,String> response = followUpService.getFollowupProjectData(id,followupProject);
			return write(200, "获取面访项目数据成功!","data",response);
			return write(200, "获取随访项目数据成功!","data",response);
		} catch (Exception e) {
			return invalidUserException(e, -1, "获取面访项目数据失败!"+e.getMessage());
			return invalidUserException(e, -1, "获取随访项目数据失败!"+e.getMessage());
		}
	}
	@ApiOperation("获取上次随访项目数据")
	@RequestMapping(value = "/getLastFollowupProjectData", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
	@ResponseBody
	public String getLastFollowupProjectData(@ApiParam(name="patient",value="患者代码",defaultValue = "P20161008001")
										 @RequestParam(value="patient",required = true) String patient,
										 @ApiParam(name="followupProject",value="随访项目",defaultValue = "2")
										 @RequestParam(value="followupProject",required = true) String followupProject)
	{
		try {
			Map<String,String> response = followUpService.getLastFollowupProjectData("D20161008003",patient,followupProject);
			return write(200, "获取上次随访项目数据成功!","data",response);
		} catch (Exception e) {
			return invalidUserException(e, -1, "获取上次随访项目数据失败!"+e.getMessage());
		}
	}
	@ApiOperation("保存面访项目数据")
	@ApiOperation("保存随访项目数据")
	@RequestMapping(value = "/saveFollowupProjectData", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
	@ResponseBody
	public String saveFollowupProjectData(@ApiParam(name="id",value="随访记录ID",defaultValue = "4")
								   @RequestParam(value="id",required = true) String id,
								   @ApiParam(name="followupProject",value="面访项目",defaultValue = "2")
								   @ApiParam(name="followupProject",value="随访项目",defaultValue = "2")
								   @RequestParam(value="followupProject",required = true) String followupProject,
								   @ApiParam(name="followupProjectData",value="面访项目数据",defaultValue = "{\"WEIGHT\":\"76\",\"WEIGHT_EXP\":\"60\",\"BMI\":\"11\"}")
								   @ApiParam(name="followupProjectData",value="随访项目数据",defaultValue = "{\"WEIGHT\":\"76\",\"WEIGHT_EXP\":\"60\",\"BMI\":\"11\"}")
								   @RequestParam(value="followupProjectData",required = true) String followupProjectData)
	{
		try {
			followUpService.saveFollowupProjectData(id,followupProject,followupProjectData);
			return write(200, "保存面访项目数据成功!");
			return write(200, "保存随访项目数据成功!");
		} catch (Exception e) {
			return invalidUserException(e, -1, "保存面访项目数据失败!"+e.getMessage());
			return invalidUserException(e, -1, "保存随访项目数据失败!"+e.getMessage());
		}
	}