Commit 6d7df8b6c2f17c9ae7ec2f034f864693310c7ac1

Authored by fangcheng
1 parent 78a08a79d5
Exists in master

医院组包含医院selector选择

Showing 7 changed files with 70 additions and 233 deletions

parent/base.common/src/main/java/com/lyms/base/common/dao/organ/OrganGroupMapsMapper.java View file @ 6d7df8b
... ... @@ -7,8 +7,8 @@
7 7  
8 8 import com.baomidou.mybatisplus.mapper.BaseMapper;
9 9 import com.baomidou.mybatisplus.plugins.Page;
10   -import com.lyms.base.common.entity.organ.OrganGroup;
11 10 import com.lyms.base.common.entity.organ.OrganGroupMaps;
  11 +import com.lyms.base.common.entity.organ.Organizations;
12 12  
13 13 /**
14 14 * <p>
... ... @@ -23,7 +23,9 @@
23 23  
24 24 public Integer deleteLogicById(Serializable id);
25 25  
26   - public List<OrganGroup> getOrgList(Page<OrganGroup> page,Serializable groupId);
  26 + public List<Organizations> getOrgList(Serializable groupId);
  27 +
  28 + public List<Organizations> getPageOrgList(Page<Organizations> page,Serializable groupId);
27 29  
28 30 }
parent/base.common/src/main/java/com/lyms/base/common/dao/organ/OrganGroupMapsMapper.xml View file @ 6d7df8b
... ... @@ -13,9 +13,16 @@
13 13 <sql id="Base_Column_List">
14 14 ID AS id, GROUP_ID AS group_id, ORGAN_ID AS organ_id
15 15 </sql>
  16 + <sql id="getOrgList_SQL">
  17 + select o.* from SYS_ORGANIZATIONS o left join SYS_ORGAN_GROUP_MAPS g on o.ID = g.ORGAN_ID where g.GROUP_ID = #{groupId}
  18 + </sql>
16 19  
17 20 <select id="getOrgList" resultType="Organizations">
18   - select o.* from SYS_ORGANIZATIONS o left join SYS_ORGAN_GROUP_MAPS g on o.ID = g.ORGAN_ID where g.GROUP_ID = #{groupId}
  21 + <include refid="getOrgList_SQL" />
  22 + </select>
  23 +
  24 + <select id="getPageOrgList" resultType="Organizations">
  25 + <include refid="getOrgList_SQL" />
19 26 </select>
20 27 </mapper>
parent/base.common/src/main/java/com/lyms/base/common/service/organ/OrganGroupMapsService.java View file @ 6d7df8b
1 1 package com.lyms.base.common.service.organ;
2 2  
3 3 import java.io.Serializable;
  4 +import java.util.List;
4 5  
5 6 import com.baomidou.mybatisplus.plugins.Page;
6 7 import com.lyms.base.common.entity.organ.OrganGroup;
7 8 import com.lyms.base.common.entity.organ.OrganGroupMaps;
  9 +import com.lyms.base.common.entity.organ.Organizations;
8 10 import com.lyms.web.service.BaseService;
9 11  
10 12 /**
... ... @@ -33,7 +35,18 @@
33 35 * <li>修改人:
34 36 * <li>修改时间:
35 37 */
36   - public Page<OrganGroup> getOrgList(Page<OrganGroup> page,Serializable groupId);
  38 + public Page<Organizations> getOrgList(Page<Organizations> page,Serializable groupId);
  39 +
  40 + /**
  41 + * <li>@Description:根据组id获取所有机构
  42 + * <li>@param groupId
  43 + * <li>@return
  44 + * <li>创建人:方承
  45 + * <li>创建时间:2017年5月26日
  46 + * <li>修改人:
  47 + * <li>修改时间:
  48 + */
  49 + public List<Organizations> getOrgListByGroupId(Serializable groupId);
37 50  
38 51  
39 52 }
parent/base.common/src/main/java/com/lyms/base/common/service/organ/impl/OrganGroupMapsServiceImpl.java View file @ 6d7df8b
1 1 package com.lyms.base.common.service.organ.impl;
2 2  
3 3 import java.io.Serializable;
  4 +import java.util.List;
4 5  
5 6 import org.springframework.stereotype.Service;
6 7  
... ... @@ -9,6 +10,7 @@
9 10 import com.lyms.base.common.dao.organ.OrganGroupMapsMapper;
10 11 import com.lyms.base.common.entity.organ.OrganGroup;
11 12 import com.lyms.base.common.entity.organ.OrganGroupMaps;
  13 +import com.lyms.base.common.entity.organ.Organizations;
12 14 import com.lyms.base.common.service.organ.OrganGroupMapsService;
13 15  
14 16 /**
15 17  
... ... @@ -27,9 +29,14 @@
27 29 }
28 30  
29 31 @Override
30   - public Page<OrganGroup> getOrgList(Page<OrganGroup> page,Serializable groupId) {
31   - page.setRecords(baseMapper.getOrgList(page,groupId));
  32 + public Page<Organizations> getOrgList(Page<Organizations> page,Serializable groupId) {
  33 + page.setRecords(baseMapper.getPageOrgList(page,groupId));
32 34 return page;
  35 + }
  36 +
  37 + @Override
  38 + public List<Organizations> getOrgListByGroupId(Serializable groupId) {
  39 + return baseMapper.getOrgList(groupId);
33 40 }
34 41  
35 42  
parent/center.manager/src/main/java/com/lyms/cm/controller/sys/SysOrganGroupController.java View file @ 6d7df8b
1 1 package com.lyms.cm.controller.sys;
2 2  
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import org.apache.commons.lang3.StringUtils;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.stereotype.Controller;
  9 +import org.springframework.ui.Model;
  10 +import org.springframework.web.bind.annotation.PathVariable;
  11 +import org.springframework.web.bind.annotation.RequestMapping;
  12 +import org.springframework.web.bind.annotation.RequestMethod;
  13 +import org.springframework.web.bind.annotation.ResponseBody;
  14 +
3 15 import com.baomidou.mybatisplus.mapper.EntityWrapper;
4 16 import com.baomidou.mybatisplus.plugins.Page;
5 17 import com.lyms.base.common.entity.organ.OrganGroup;
  18 +import com.lyms.base.common.entity.organ.Organizations;
  19 +import com.lyms.base.common.entity.role.UserRoleMaps;
6 20 import com.lyms.base.common.enums.ValidityEnum;
7 21 import com.lyms.base.common.service.organ.OrganGroupMapsService;
8 22 import com.lyms.base.common.service.organ.OrganGroupService;
  23 +import com.lyms.base.common.service.organ.OrganizationsService;
9 24 import com.lyms.constants.OperationName;
10 25 import com.lyms.util.StrUtils;
11 26 import com.lyms.web.bean.AjaxResult;
12 27 import com.lyms.web.controller.BaseController;
13   -import org.apache.commons.lang3.StringUtils;
14   -import org.springframework.beans.factory.annotation.Autowired;
15   -import org.springframework.stereotype.Controller;
16   -import org.springframework.ui.Model;
17   -import org.springframework.web.bind.annotation.PathVariable;
18   -import org.springframework.web.bind.annotation.RequestMapping;
19   -import org.springframework.web.bind.annotation.RequestMethod;
20   -import org.springframework.web.bind.annotation.ResponseBody;
21 28  
22   -import java.util.Map;
23   -
24 29 /**
25 30 * <p>
26 31 * 机构组信息
... ... @@ -37,6 +42,9 @@
37 42  
38 43 @Autowired
39 44 private OrganGroupMapsService organGroupMapsService;
  45 +
  46 + @Autowired
  47 + private OrganizationsService sysOrganizationsService;
40 48  
41 49 /**
42 50 * <li>@Description:跳转到租列表
... ... @@ -47,7 +55,9 @@
47 55 * <li>修改时间:
48 56 */
49 57 @RequestMapping(value = "/toList", method = RequestMethod.GET)
50   - public String toList() {
  58 + public String toList(Model model) {
  59 + List<Organizations> orgs = sysOrganizationsService.getAllEnableOrg();
  60 + model.addAttribute("orgs", orgs);
51 61 return "/group/group_list";
52 62 }
53 63  
54 64  
55 65  
... ... @@ -78,10 +88,18 @@
78 88 */
79 89 @RequestMapping(value = { "/{id}/toEdit" }, method = RequestMethod.GET)
80 90 public String toEdit(@PathVariable String id, Model model) {
81   - if (!StringUtils.isBlank(id)) {
  91 + if (!StringUtils.isBlank(id) && ! "0".equals(id)) {
82 92 OrganGroup group = groupService.selectById(id);
83 93 model.addAttribute("group", group);
  94 + List<Organizations> includeOrgs = organGroupMapsService.getOrgListByGroupId(group.getId());
  95 + StringBuilder orgSB = new StringBuilder();
  96 + for (Organizations orgEntity : includeOrgs) {
  97 + orgSB.append("," + orgEntity.getId());
  98 + }
  99 + model.addAttribute("includeOrgs", orgSB.toString().replaceFirst(",", ""));
84 100 }
  101 + List<Organizations> orgs = sysOrganizationsService.getAllEnableOrg();
  102 + model.addAttribute("orgs", orgs);
85 103 return "/group/group_edit";
86 104 }
87 105 @ResponseBody
... ... @@ -109,7 +127,7 @@
109 127 @ResponseBody
110 128 @RequestMapping(value = "/listGroupOrg/{groupId}", method = { RequestMethod.GET, RequestMethod.POST })
111 129 public Map<String, Object> listGroupOrg(@PathVariable String groupId) {
112   - Page<OrganGroup> page = getPage();
  130 + Page<Organizations> page = getPage();
113 131 if(StrUtils.isNotEmpty(groupId)){
114 132 page = organGroupMapsService.getOrgList(page,groupId);
115 133 }
parent/center.manager/src/main/webapp/WEB-INF/views/group/group_edit.html View file @ 6d7df8b
... ... @@ -36,12 +36,8 @@
36 36 </div>
37 37 <div class="form-group">
38 38 <label class="col-sm-3 control-label">医院列表:</label>
39   - <button class="btn btn-info " type="button" onclick="del();"><i class="fa fa-trash"></i> 移除</button>
  39 + #selector("orgIds" "orgIds" $orgs $!includeOrgs true)
40 40 </div>
41   - <div class="form-group">
42   - <input type="hidden" id="orgIds" name="orgIds"/>
43   - <table id="orgList"></table>
44   - </div>
45 41 <div class="hr-line-dashed"></div>
46 42 <div class="form-group">
47 43 <div class="col-sm-4 col-sm-offset-3 pull-right">
48 44  
... ... @@ -51,62 +47,9 @@
51 47 </div>
52 48 </form>
53 49 </div>
54   - <!-- 所有医院 -->
55   - <div class="col-sm-8">
56   - <div style="padding-top:30px;">
57   - <form class="form-inline">
58   - <div class="form-group">
59   - <input type="text" placeholder="请输入医院名过滤" id="groupName" name="groupName" class="form-control">
60   - </div>
61   - <div class="form-group" onclick="search();">
62   - <a class="btn btn-primary"><i class="fa fa-search"></i> 查询</a>
63   - </div>
64   - <div class="form-group" onclick="add();">
65   - <a class="btn btn-primary"><i class="fa fa-plus"></i> 添加</a>
66   - </div>
67   - </form>
68   - </div>
69   - <table id="dataTable"></table>
70 50 </div>
71 51 </div>
72 52 <script type="text/javascript">
73   -function search(){
74   - var queryParams = {
75   - query:{
76   - name: $("#groupName").val()
77   - }
78   - }
79   - $('#dataTable').bootstrapTable('refresh', queryParams );
80   -}
81   -function add(){
82   - var list = $('#dataTable').bootstrapTable('getSelections');
83   - for(var i = 0 ; i< list.length ; i++){
84   - if(! $('#orgList').bootstrapTable('getRowByUniqueId', list[i]['id'])){
85   - var row = [];
86   - row.push({
87   - id: list[i]['id'],
88   - name: list[i]['name']
89   - });
90   - $('#orgList').bootstrapTable('append', row);
91   - }
92   - }
93   - $('#orgIds').val(getOrgIds());
94   -}
95   -function del(){
96   - var list = $('#orgList').bootstrapTable('getSelections');
97   - for(var i = 0 ; i< list.length ; i++){
98   - $('#orgList').bootstrapTable('remove', {field: 'id', values: list[i]['id']});
99   - }
100   - $('#orgIds').val(getOrgIds());
101   -}
102   -function getOrgIds(){
103   - var list = $('#orgList').bootstrapTable('getData');
104   - var ids = [];
105   - for(var i = 0 ;i < list.length ;i++){
106   - ids.push(list[i]['id']);
107   - }
108   - return ids.join(',');
109   -}
110 53 function save(){
111 54 if($('#validForm').valid()){
112 55 var data = $('#validForm').serialize();
113 56  
... ... @@ -119,160 +62,7 @@
119 62 parent.reloadGrid('dataTable');
120 63 }
121 64 }
122   -
123   -var controllerRequestMappint = "/sysOrganizations/";
124   -
125   -## 参考 base_table_init.js 或者根据empty_bootstrap_table_init.js 来自己创建特殊的table
126   -## 注意:自己创建的特殊的table不能extends base_list.html
127   -var default_dataUrl = APP.PATH + controllerRequestMappint + "list";
128   -var default_dataColumns = [{
129   - field: 'check_state',
130   - title: '',
131   - checkbox: true
132   - },{
133   - field: 'id',
134   - title: '编号'
135   - },{
136   - field: 'name',
137   - title: '名称'
138   - },{
139   - field: 'type',
140   - title: '类型',
141   - formatter:function(value,row,index){
142   - //1:卫生与计划生育委员会,2:妇幼保健院/站,3:妇产(科)医院,4:综合医院,5:计生站,6:卫生院,7:卫生所,8:其他
143   - switch(value){
144   - case 1:return "卫生与计划生育委员会";
145   - case 2:return "妇幼保健院/站";
146   - case 3:return "妇产(科)医院";
147   - case 4:return "综合医院";
148   - case 5:return "计生站";
149   - case 6:return "卫生院";
150   - case 7:return "卫生所";
151   - case 8:return "其他";
152   - }
153   - }
154   - },{
155   - field: 'shortCode',
156   - title: '简码'
157   - },{
158   - field: 'level',
159   - title: '等级',
160   - formatter:function(value,row,index){
161   - switch (value) {
162   - case 1:return "省";
163   - case 2:return "市";
164   - case 3:return "区县";
165   - case 4:return "乡镇";
166   - case 5:return "村";
167   - case 6:return "其他";
168   -
169   - default:
170   - return "";
171   - }
172   - }
173   - },{
174   - field: 'gradeLevel',
175   - title: '医院等级'
176   - },{
177   - field: 'mobile',
178   - title: '服务热线'
179   - },{
180   - field: 'starLevel',
181   - title: '星级'
182   - },{
183   - field: 'status',
184   - title: '状态',
185   - formatter:function(value,row,index){
186   - switch (value) {
187   - case 0: return "正式运行";
188   - case 1: return "试运行";
189   - case 2: return "停止运行";
190   - default:
191   - break;
192   - }
193   - }
194   - },{
195   - field: 'address',
196   - title: '地址'
197   - }];
198   -
199 65 </script>
200 66 #end
201 67 #extends("/common/base_list.html")
202   -
203   -<script type="text/javascript">
204   -//拥有医院列表
205   -$(function () {
206   - var orgListTable = new orgLostTableInit();
207   - orgListTable.Init();
208   -})
209   -
210   -
211   -
212   -var orgLostTableInit = function () {
213   - var orgListTableInit = new Object();
214   - //初始化Table
215   - orgListTableInit.Init = function () {
216   - $('#orgList').bootstrapTable({
217   - url: '${ctx}/sysOrganGroup/listGroupOrg/$!group.id', //请求后台的URL(*)
218   - method: 'get', //请求方式(*)
219   - striped: true, //是否显示行间隔色
220   - cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
221   - sortable: false, //是否启用排序
222   - queryParams: orgListTableInit.queryParams,//传递参数(*)
223   - sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
224   - pageNumber:1, //初始化加载第一页,默认第一页
225   - pageSize: 999, //每页的记录行数(*)
226   - pageList: [999], //可供选择的每页的行数(*)
227   - strictSearch: true,
228   - clickToSelect: true, //是否启用点击选中行
229   - //height: 600, //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度
230   - uniqueId: "id", //每一行的唯一标识,一般为主键列
231   - cardView: false, //是否显示详细视图
232   - detailView: false, //是否显示父子表
233   - columns: [{
234   - field: 'check_state',
235   - title: '',
236   - checkbox: true
237   - },{
238   - field: 'id',
239   - title: '序号',
240   - visible: false
241   - }, {
242   - field: 'name',
243   - title: '医院名称'
244   - }],
245   - onLoadSuccess: function(){ //加载成功时执行
246   - var list = $('#orgList').bootstrapTable('getData');
247   - var ids = [];
248   - for(var i = 0 ;i< list.length ; i++ ){
249   - ids.push(list[i]['id']);
250   - }
251   - $('#orgIds').val(ids.join(','));
252   - }
253   - });
254   - };
255   -
256   - //得到查询的参数
257   - orgListTableInit.queryParams = function (params) {
258   - var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
259   - _size: 999, //每页记录数
260   - _offset: 1 , //偏移量
261   - /*sdate: $("#stratTime").val(),
262   - edate: $("#endTime").val(),
263   - sellerid: $("#sellerid").val(),
264   - orderid: $("#orderid").val(),
265   - CardNumber: $("#CardNumber").val(),
266   - maxrows: params.limit,
267   - pageindex: params.pageNumber,
268   - portid: $("#portid").val(),
269   - CardNumber: $("#CardNumber").val(),
270   - tradetype: $('input:radio[name="tradetype"]:checked').val(),
271   - success: $('input:radio[name="success"]:checked').val(),*/
272   - };
273   - return temp;
274   - };
275   - return orgListTableInit;
276   -};
277   -</script>
parent/center.manager/src/main/webapp/WEB-INF/views/group/group_list.html View file @ 6d7df8b
1 1 #override("body")
2 2  
3   -<div class="ibox float-e-margins"><div class="row wrapper border-bottom white-bg page-heading">
  3 +<!-- <div class="ibox float-e-margins"><div class="row wrapper border-bottom white-bg page-heading">
4 4 <div class="col-sm-10">
5 5 <div style="padding-top:30px;">
6 6 <form role="form" class="form-inline">
... ... @@ -25,7 +25,7 @@
25 25 <a class="btn btn-primary"><i class="fa fa-search"></i> 查询</a>
26 26 </div>
27 27 </div>
28   -</div>
  28 +</div> -->
29 29 <div class="wrapper wrapper-content">
30 30 <div class="row">
31 31 <div class="col-sm-12">