Commit ae080416ab1b6acd2f7df7abe3307fd11b23f152

Authored by litao
1 parent 4890eb3422

新增接口

Showing 8 changed files with 104 additions and 12 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/BasicConfigContainer.java View file @ ae08041
  1 +package com.lyms.platform.permission;
  2 +
  3 +import com.lyms.platform.pojo.BasicConfig;
  4 +import org.apache.commons.collections.CollectionUtils;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.context.annotation.Configuration;
  7 +import org.springframework.data.mongodb.core.MongoTemplate;
  8 +import org.springframework.data.mongodb.core.query.Criteria;
  9 +import org.springframework.data.mongodb.core.query.Query;
  10 +
  11 +import java.util.ArrayList;
  12 +import java.util.HashMap;
  13 +import java.util.List;
  14 +import java.util.Map;
  15 +
  16 +/**
  17 + * @Author: litao
  18 + * @Date: 2017/5/15 0015 15:18
  19 + * @Version: V1.0
  20 + */
  21 +@Configuration
  22 +public class BasicConfigContainer {
  23 +
  24 + @Autowired
  25 + private MongoTemplate mongoTemplate;
  26 +
  27 + private static final String DEFAULT_PARENT_KEY = "parentId";
  28 + private static final String ENABLE_KEY = "enable";
  29 +
  30 + public List<Map<String, Object>> getValuesByPid(String value) {
  31 + List<BasicConfig> configs = mongoTemplate.find(Query.query(Criteria.where(DEFAULT_PARENT_KEY).is(value).and(ENABLE_KEY).is(1)), BasicConfig.class);
  32 + if(CollectionUtils.isNotEmpty(configs)) {
  33 + List<Map<String, Object>> restMap = new ArrayList<>();
  34 + for (BasicConfig config : configs) {
  35 + Map<String, Object> temp = new HashMap<>();
  36 + temp.put("id", config.getId());
  37 + temp.put("value", config.getName());
  38 + }
  39 + }
  40 + return null;
  41 + }
  42 +
  43 +}
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java View file @ ae08041
... ... @@ -29,5 +29,9 @@
29 29 Set<Integer> findTypes(Map<String, Object> param);
30 30  
31 31 void update(Map<String, Object> param);
  32 +
  33 + List<Map<String, Object>> findOrgUsers(String hospitalId);
  34 +
  35 + List<Map<String, Object>> findOrgAreas(String hospitalId);
32 36 }
platform-biz-service/src/main/java/com/lyms/platform/permission/service/CouponService.java View file @ ae08041
... ... @@ -26,5 +26,9 @@
26 26 Map<String, Object> getPatientsInfoByCode(String code);
27 27  
28 28 void del(String userId, String hospitalId, String delUserId);
  29 +
  30 + BaseObjectResponse doctors(String hospitalId);
  31 +
  32 + BaseObjectResponse areas(String hospitalId);
29 33 }
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/BabyPatientExtendEarServiceImpl.java View file @ ae08041
... ... @@ -5,6 +5,7 @@
5 5 import com.lyms.platform.common.result.BaseObjectResponse;
6 6 import com.lyms.platform.common.result.RespBuilder;
7 7 import com.lyms.platform.common.utils.EnumUtil;
  8 +import com.lyms.platform.permission.BasicConfigContainer;
8 9 import com.lyms.platform.permission.dao.master.BabyPatientExtendEarMapper;
9 10 import com.lyms.platform.permission.model.BabyPatientExtendEar;
10 11 import com.lyms.platform.permission.model.BabyPatientExtendEarBirth;
... ... @@ -30,6 +31,9 @@
30 31  
31 32 @Autowired
32 33 private BabyPatientExtendEarMapper earMapper;
  34 +
  35 + @Autowired
  36 + private BasicConfigContainer configContainer;
33 37  
34 38 @Override
35 39 public BaseObjectResponse insert(BabyPatientExtendEar ear, BabyPatientExtendEarBirth earBirth,
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/CouponServiceImpl.java View file @ ae08041
... ... @@ -68,6 +68,7 @@
68 68  
69 69 @Autowired
70 70 private OrganizationService organizationService;
  71 +
71 72 /**
72 73 * 生成规则:
73 74 * 孕妇 建档、产检、分娩、出院小结、产后复查
... ... @@ -309,6 +310,16 @@
309 310 param.put("useDate", new Date());
310 311 param.put("userId", delUserId);
311 312 couponMapper.update(param);
  313 + }
  314 +
  315 + @Override
  316 + public BaseObjectResponse doctors(String hospitalId) {
  317 + return RespBuilder.buildSuccess(couponMapper.findOrgUsers(hospitalId));
  318 + }
  319 +
  320 + @Override
  321 + public BaseObjectResponse areas(String hospitalId) {
  322 + return RespBuilder.buildSuccess(couponMapper.findOrgAreas(hospitalId));
312 323 }
313 324  
314 325 /** 1=省 2=市 3=区 4=单医院 */
platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml View file @ ae08041
... ... @@ -59,9 +59,9 @@
59 59 </select>
60 60  
61 61 <select id="findInfo" parameterType="map" resultType="map">
62   - select a.create_date, b.name, b.title, b.show_start, b.show_end, b.unit_type, b.content, a.sequence_id, a.status
63   - from coupon_info a, coupon_template b, coupon_type c
64   - where a.user_id = #{userId} and a.create_hospital_id = #{hospitalId} and a.coupon_template_id = b.id and b.type_id=c.id
  62 + select a.create_date, d.coupon_desc, d.img_base64, b.name, b.title, b.show_start, b.show_end, b.unit_type, b.content, a.sequence_id, a.status
  63 + from coupon_info a, coupon_template b, coupon_type c, hospital_coupon_template_group d
  64 + where a.user_id = #{userId} and a.create_hospital_id = #{hospitalId} and a.coupon_template_id = b.id and b.type_id=c.id and d.hospital_id = #{hospitalId}
65 65 order by c.type, b.coupon_order
66 66 </select>
67 67  
... ... @@ -88,6 +88,18 @@
88 88 select c.type
89 89 from hospital_coupon_template_group a,coupon_template b, coupon_type c
90 90 where a.hospital_id = #{hospitalId} and a.coupon_template_group_id = b.group_id and b.type_id = c.id
  91 + </select>
  92 +
  93 + <select id="findOrgUsers" parameterType="string" resultType="map">
  94 + select name
  95 + from users
  96 + where org_id = #{id} and yn=1 and enable = 1
  97 + </select>
  98 +
  99 + <select id="findOrgAreas" parameterType="string" resultType="map">
  100 + select area_name as name
  101 + from coupon_hospial_area
  102 + where hospital_id = #{id}
91 103 </select>
92 104  
93 105 </mapper>
platform-common/src/main/java/com/lyms/platform/common/utils/BasicConfigUtil.java View file @ ae08041
1   -package com.lyms.platform.common.utils;
2   -
3   -/**
4   - * @Author: litao
5   - * @Date: 2017/5/15 0015 15:18
6   - * @Version: V1.0
7   - */
8   -public class BasicConfigUtil {
9   -}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CouponController.java View file @ ae08041
... ... @@ -84,6 +84,29 @@
84 84 return couponService.use(code, hospitalId, loginState.getId());
85 85 }
86 86  
  87 + /**
  88 + * 获取当前登陆医生所属医院的所有人员
  89 + * @param request
  90 + * @return
  91 + */
  92 + @RequestMapping(method = RequestMethod.GET, value = "/doctors")
  93 + @TokenRequired
  94 + @ResponseBody
  95 + public BaseObjectResponse doctors(HttpServletRequest request) {
  96 + return couponService.doctors(autoMatchFacade.getHospitalId(getUserId(request)));
  97 + }
  98 +
  99 + /**
  100 + * 获取当前登陆医生所属医院的所有配置了的区域
  101 + * @param request
  102 + * @return
  103 + */
  104 + @RequestMapping(method = RequestMethod.GET, value = "/areas")
  105 + @TokenRequired
  106 + @ResponseBody
  107 + public BaseObjectResponse areas(HttpServletRequest request) {
  108 + return couponService.areas(autoMatchFacade.getHospitalId(getUserId(request)));
  109 + }
87 110  
88 111 }