CommonApiController.java 4.98 KB
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
package com.lyms.hospital.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lyms.base.common.entity.region.Regions;
import com.lyms.base.common.service.region.RegionsService;
import com.lyms.hospital.entity.history.HistorySource;
import com.lyms.hospital.enums.ServiceStatusEnums;
import com.lyms.hospital.service.history.HistorySourceService;
import com.lyms.hospital.util.trans.OldDictionary;
import com.lyms.hospital.util.trans.XjhMapUtil;
import com.lyms.web.bean.AjaxResult;
import com.lyms.web.controller.BaseController;

/**
* <p>
* 公用接口-前端控制器
* </p>
*
* []查询病史配置<br>
* 查询省市区数据<br>
* 查询字典数据<br>
*
* @author xujiahong
* @since 2017-04-21
*/
@Controller
@RequestMapping("/commonApi")
public class CommonApiController extends BaseController {

@Autowired
private RegionsService regionService;
@Autowired
private HistorySourceService historySourceService;

/**
* <li>@Description:查询病史配置
* <li>@return
* <li>创建人:xujiahong
* <li>创建时间:2017年4月28日
* <li>修改人:
* <li>修改时间:
*/
@RequestMapping(value = "/queryHistorySource", method = RequestMethod.GET)
@ResponseBody
public AjaxResult queryHistorySource() {
List<HistorySource> list = historySourceService.selectStructureByType();
return AjaxResult.returnSuccess(list);
}

/**
* <li>@Description:查询省市区数据
* <li>@param parentId
* <li>@return
* <li>创建人:xujiahong
* <li>创建时间:2017年4月24日
* <li>修改人:
* <li>修改时间:
*/
@RequestMapping(value = "/queryRegions", method = RequestMethod.GET)
@ResponseBody
public AjaxResult queryRegions(String parentId) {
List<Regions> list = regionService.selectRegions(parentId);
return AjaxResult.returnSuccess(list);
}

/**
* <li>@Description:查询字典数据
* <li>@return
* <li>创建人:xujiahong
* <li>创建时间:2017年4月24日
* <li>修改人:
* <li>修改时间:
*/
@RequestMapping(value = "/queryDictionary", method = RequestMethod.GET)
@ResponseBody
public AjaxResult queryDictionary() {
// TODO 模拟查询数据字典的数据
Map<String, Object> dictionary = new HashMap<>();
/* 户口类型 */
List<Map<String, Object>> censusType = new ArrayList<>();
censusType.add(XjhMapUtil.transBean2Map(new OldDictionary("001", "非农业户口")));
censusType.add(XjhMapUtil.transBean2Map(new OldDictionary("002", "农业户口")));
/* 证件类型 */
List<Map<String, Object>> certeType = new ArrayList<>();
certeType.add(XjhMapUtil.transBean2Map(new OldDictionary("003", "身份证")));
certeType.add(XjhMapUtil.transBean2Map(new OldDictionary("004", "手机号")));
/* 国家 */
List<Map<String, Object>> country = new ArrayList<>();
country.add(XjhMapUtil.transBean2Map(new OldDictionary("005", "中国")));
country.add(XjhMapUtil.transBean2Map(new OldDictionary("006", "美国")));
/* vip体验类型 */
List<Map<String, Object>> expYunEnums = new ArrayList<>();
expYunEnums.add(XjhMapUtil.transBean2Map(new OldDictionary("007", "vip体验类型1")));
expYunEnums.add(XjhMapUtil.transBean2Map(new OldDictionary("008", "vip体验类型2")));
/* 居住类型 */
List<Map<String, Object>> liveType = new ArrayList<>();
liveType.add(XjhMapUtil.transBean2Map(new OldDictionary("009", "本地")));
liveType.add(XjhMapUtil.transBean2Map(new OldDictionary("010", "非本地")));
/* 民族 */
List<Map<String, Object>> nation = new ArrayList<>();
nation.add(XjhMapUtil.transBean2Map(new OldDictionary("011", "汉族")));
nation.add(XjhMapUtil.transBean2Map(new OldDictionary("012", "白族")));
/* 职业类型 */
List<Map<String, Object>> professionType = new ArrayList<>();
professionType.add(XjhMapUtil.transBean2Map(new OldDictionary("013", "医生")));
professionType.add(XjhMapUtil.transBean2Map(new OldDictionary("014", "教师")));
/* 服务状态 */
List<Map<String, String>> serviceStatus = ServiceStatusEnums.getServiceStatusList();
/* 服务类型 */
List<Map<String, String>> serviceType = ServiceStatusEnums.getServiceTypeList();

dictionary.put("censusType", censusType);
dictionary.put("certeType", certeType);
dictionary.put("country", country);
dictionary.put("expYunEnums", expYunEnums);
dictionary.put("liveType", liveType);
dictionary.put("nation", nation);
dictionary.put("professionType", professionType);
dictionary.put("serviceStatus", serviceStatus);
dictionary.put("serviceType", serviceType);
return AjaxResult.returnSuccess(dictionary);
}
}