diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/OrganizationGroupsController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/OrganizationGroupsController.java new file mode 100644 index 0000000..1c118d8 --- /dev/null +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/OrganizationGroupsController.java @@ -0,0 +1,66 @@ +package com.lyms.platform.operate.web.controller; + +import com.lyms.platform.common.annotation.TokenRequired; +import com.lyms.platform.common.base.BaseController; +import com.lyms.platform.common.base.LoginContext; +import com.lyms.platform.common.result.BaseResponse; +import com.lyms.platform.operate.web.facade.OrganizationGroupsFacade; +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.RequestParam; + +import javax.servlet.http.HttpServletRequest; + +/** + * 机构组接口 + *
+ * Created by Administrator on 2016/12/22 0022. + */ +@Controller +public class OrganizationGroupsController extends BaseController { + + @Autowired + private OrganizationGroupsFacade organizationGroupsFacade; + + /** + * 查询当前帐号所有的机构组 + * + * @param request + * @return + */ + public BaseResponse queryByOwner(HttpServletRequest request) { + + return null; + } + + /** + * 增加机构组 + * + * @param request + * @return + */ + @TokenRequired + @RequestMapping(value = "/group",method = RequestMethod.POST) + public BaseResponse addOneEntity(HttpServletRequest request, + @RequestParam("groupName") String groupName, + @RequestParam("bType") Integer bType) { + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); + return organizationGroupsFacade.addOneEntity(groupName,bType,loginState.getId()); + } + + /** + * 增加机构组 + * + * @param request + * @return + */ + @TokenRequired + @RequestMapping(value = "/groupitem",method = RequestMethod.POST) + public BaseResponse addOneItemEntity(HttpServletRequest request, + @RequestParam("groupName") String groupName, + @RequestParam("bType") Integer bType) { + return organizationGroupsFacade.addOneGroupItem(); + } +} \ No newline at end of file diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/OrganizationGroupsFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/OrganizationGroupsFacade.java new file mode 100644 index 0000000..affe705 --- /dev/null +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/OrganizationGroupsFacade.java @@ -0,0 +1,208 @@ +package com.lyms.platform.operate.web.facade; + +import com.lyms.platform.biz.service.OrganizationGroupsItemService; +import com.lyms.platform.biz.service.OrganizationGroupsService; +import com.lyms.platform.common.constants.ErrorCodeConstants; +import com.lyms.platform.common.enums.YnEnums; +import com.lyms.platform.common.result.BaseListResponse; +import com.lyms.platform.common.result.BaseResponse; +import com.lyms.platform.operate.web.result.OrganizationGroupsResult; +import com.lyms.platform.permission.model.Organization; +import com.lyms.platform.permission.model.OrganizationQuery; +import com.lyms.platform.permission.service.OrganizationService; +import com.lyms.platform.pojo.OrganizationGroups; +import com.lyms.platform.pojo.OrganizationGroupsItems; +import com.lyms.platform.query.OrganizationGroupsItemQuery; +import com.lyms.platform.query.OrganizationGroupsQuery; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * 机构组 + * + * Created by Administrator on 2016/12/22 0022. + */ +@Component +public class OrganizationGroupsFacade { + @Autowired + private OrganizationGroupsItemService groupsItemService; + @Autowired + private OrganizationGroupsService groupsService; + @Autowired + private AutoMatchFacade autoMatchFacade; + @Autowired + private OrganizationService organizationService; + + + /** + * 增加一个分组 + * + * @param group + * @param bType + * @param userId + * @return + */ + public BaseResponse addOneEntity(String group,Integer bType,Integer userId){ + OrganizationGroups organizationGroups=new OrganizationGroups(); + organizationGroups.setCreated(new Date()); + organizationGroups.setGroupName(group); + organizationGroups.setbType(bType); + String hospital=autoMatchFacade.getHospitalId(userId); + organizationGroups.setOwner(Integer.valueOf(hospital)); + groupsService.addOneEntity(organizationGroups); + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); + } + + + public BaseResponse addOneGroupItem(){ + OrganizationGroupsItems organizationGroupsItems=new OrganizationGroupsItems(); + organizationGroupsItems.setCreated(new Date()); + organizationGroupsItems.setModified(new Date()); + organizationGroupsItems.setType(1); + List