hz-zhhq-app-service/greenH5modul/.svn/pristine/4d/4d1e6cee70156d2e4201bc9efe8...

93 lines
3.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.nationalelectric.greenH5;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import com.sgcc.uap.persistence.IHibernateDao;
import org.springframework.web.bind.annotation.RequestMapping;
import com.nationalelectric.greenH5.DTO.GreenMealTicketApplyDTO;
import com.nationalelectric.greenH5.bizc.IGreenOperateLogBizc;
import com.nationalelectric.greenH5.po.GreenPhysicalBase;
import com.nationalelectric.greenH5.po.GreenUserInfo;
import com.nationalelectric.greenH5.po.GreenVisitorInfo;
import com.nationalelectric.greenH5.po.UserVo;
import java.util.*;
import javax.annotation.Resource;
import com.nationalelectirc.Constant.Constant;
import com.nationalelectirc.utils.RestResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
/**
* <b>概述</b><br>
* TODO
* <p>
* <b>功能</b><br>
* TODO
*
* @author Administrator
*/
@Controller
@RequestMapping("/greenPhysicalBase")
public class GreenPhysicalBaseController {
/**
* HibernateDao逻辑构件
*/
@Autowired
IHibernateDao hibernateDao;
@Resource
private IGreenOperateLogBizc greenOperateLogBizc;
/**
* 根据用户id获取体检基础详情(第一张图)(参数用户id)
*/
@RequestMapping(value = "/physicalBaseinfo", method = RequestMethod.POST)
public @ResponseBody RestResult greenPhysicalBase(@RequestBody Object requestBody) {
GreenPhysicalBase greenPhysicalBase = new ObjectMapper().convertValue(requestBody, new TypeReference<GreenPhysicalBase>() {});
try {
if(greenPhysicalBase.getIdentifyId()!=null)
{ //获取关联的用户体检的 基础详情
String physicalBaseInfoSql="SELECT b.sex AS sex, b.hospital_name AS hosName,i.real_name as realName,b.physical_date AS physicalDate,b.physical_card AS hosCard,b.tj_id as tjId FROM GREEN_PHYSICAL_BASE b LEFT JOIN GREEN_USER_INFO i ON b.user_id = i.id WHERE identify_id = ? order by b.physical_date desc";
List<GreenVisitorInfo> visitorInfolist = hibernateDao.queryForListWithSql(physicalBaseInfoSql,new Object[] {greenPhysicalBase.getIdentifyId()});
// greenOperateLogBizc.addLog(Constant.PHYSICAL, Constant.QUERY, Constant.OPERATE_SUCCESS, "查询体检列表", Constant.LOG_OPERATE, greenPhysicalBase.getUserId());
return new RestResult(Constant.SUCCESS, "请求成功!",visitorInfolist);
}
return new RestResult(Constant.FAILED, "用户id为空");
} catch (Exception e) {
//greenOperateLogBizc.addLog(Constant.PHYSICAL, Constant.QUERY, Constant.OPERATE_FAIL, "查询体检列表", Constant.LOG_ERROR, greenPhysicalBase.getUserId());
return new RestResult(Constant.FAILED,"返回异常");
}
}
/**
* 根据用户id获取身份证号
*/
@RequestMapping(value = "/userInforIdCard", method = RequestMethod.POST)
public @ResponseBody RestResult getUserInforIdCard(@RequestBody Object requestBody) {
UserVo userVo = new ObjectMapper().convertValue(requestBody, new TypeReference<UserVo>() {});
if(userVo.getUserId()!=null)
{ String id=userVo.getUserId();
String userInfoSql="SELECT * FROM GREEN_USER_INFO WHERE id=?";
List<GreenUserInfo> userInfolist = hibernateDao.queryForListWithSql(userInfoSql,new Object[] {id},new BeanPropertyRowMapper(GreenUserInfo.class));//根据用户id获取用户餐卡号
return new RestResult(Constant.SUCCESS, "请求成功!",userInfolist);
}
return new RestResult(Constant.FAILED, "用户id为空");
}
}