机构位置格式修改
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
package com.openhis.web.basedatamanage.appservice;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocQueryDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocQueryParam;
|
||||
|
||||
/**
|
||||
* Organization 应该服务类
|
||||
*/
|
||||
public interface IOrganizationLocationAppService {
|
||||
/**
|
||||
* 查询机构位置
|
||||
*
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 机构位置分页列表
|
||||
*/
|
||||
R<?> getOrgLocPage(OrgLocQueryParam orgLocQueryParam, String searchKey, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 机构位置信息详情
|
||||
*
|
||||
* @param orgLocId 机构位置信息id
|
||||
* @return 机构位置信息详情
|
||||
*/
|
||||
R<?> getOrgLocById(Long orgLocId);
|
||||
|
||||
/**
|
||||
* 添加/编辑机构位置信息
|
||||
*
|
||||
* @param orgLocQueryDto 机构位置信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditOrgLoc(OrgLocQueryDto orgLocQueryDto);
|
||||
|
||||
/**
|
||||
* 机构位置信息
|
||||
*
|
||||
* @param orgLocId 机构位置信息id
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> deleteOrgLoc(Long orgLocId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.openhis.web.basedatamanage.appservice.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.openhis.administration.domain.OrganizationLocation;
|
||||
import com.openhis.administration.mapper.OrganizationLocationMapper;
|
||||
import com.openhis.administration.service.IOrganizationLocationService;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.utils.HisPageUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.basedatamanage.appservice.IOrganizationLocationAppService;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocQueryDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocQueryParam;
|
||||
|
||||
@Service
|
||||
public class OrganizationLocationAppServiceImpl implements IOrganizationLocationAppService {
|
||||
|
||||
@Autowired
|
||||
private OrganizationLocationMapper organizationLocationMapper;
|
||||
|
||||
@Autowired
|
||||
private IOrganizationLocationService organizationLocationService;
|
||||
|
||||
@Override
|
||||
public R<?> getOrgLocPage(OrgLocQueryParam orgLocQueryParam, String searchKey, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request) {
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<OrganizationLocation> queryWrapper = HisQueryUtils.buildQueryWrapper(orgLocQueryParam, searchKey,
|
||||
new HashSet<>(Arrays.asList("name", "py_str", "wb_str")), request);
|
||||
|
||||
// 查询机构位置分页列表
|
||||
Page<OrgLocQueryDto> orgLocQueryDtoPage =
|
||||
HisPageUtils.selectPage(organizationLocationMapper, queryWrapper, pageNo, pageSize, OrgLocQueryDto.class);
|
||||
|
||||
return R.ok(orgLocQueryDtoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 机构位置信息详情
|
||||
*
|
||||
* @param orgLocId 机构位置信息id
|
||||
* @return 机构位置信息详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getOrgLocById(Long orgLocId) {
|
||||
OrganizationLocation orgLoc = organizationLocationService.getById(orgLocId);
|
||||
return R.ok(orgLoc, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"机构位置信息查询"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑机构位置信息
|
||||
*
|
||||
* @param orgLocQueryDto 机构位置信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> addOrEditOrgLoc(OrgLocQueryDto orgLocQueryDto) {
|
||||
|
||||
OrganizationLocation orgLoc = new OrganizationLocation();
|
||||
BeanUtils.copyProperties(orgLocQueryDto, orgLoc);
|
||||
|
||||
if (orgLocQueryDto.getId() != null) {
|
||||
// 更新机构位置信息
|
||||
organizationLocationService.updateById(orgLoc);
|
||||
} else {
|
||||
// 新增机构位置信息
|
||||
organizationLocationService.save(orgLoc);
|
||||
}
|
||||
// 返回机构位置id
|
||||
return R.ok(orgLoc.getId(),
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"机构位置信息更新添加"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除机构位置
|
||||
*
|
||||
* @param orgLocId 机构位置信息id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> deleteOrgLoc(Long orgLocId) {
|
||||
// 删除机构位置信息
|
||||
boolean deleteOrgLocSuccess = organizationLocationService.removeById(orgLocId);
|
||||
return deleteOrgLocSuccess
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"机构位置信息"}))
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"机构位置信息"}));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,30 +3,18 @@
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.openhis.administration.domain.Location;
|
||||
import com.openhis.administration.domain.OrganizationLocation;
|
||||
import com.openhis.administration.mapper.OrganizationLocationMapper;
|
||||
import com.openhis.administration.service.ILocationService;
|
||||
import com.openhis.administration.service.IOrganizationLocationService;
|
||||
import com.openhis.administration.service.IOrganizationService;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.utils.HisPageUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.basedatamanage.appservice.IOrganizationLocationAppService;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocInitDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocQueryDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocQueryParam;
|
||||
@@ -46,9 +34,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@AllArgsConstructor
|
||||
public class OrganizationLocationController {
|
||||
|
||||
@Autowired
|
||||
private final IOrganizationLocationService organizationLocationService;
|
||||
|
||||
@Autowired
|
||||
private IOrganizationService organizationService;
|
||||
|
||||
@@ -56,7 +41,7 @@ public class OrganizationLocationController {
|
||||
private ILocationService locationService;
|
||||
|
||||
@Autowired
|
||||
private OrganizationLocationMapper organizationLocationMapper;
|
||||
private IOrganizationLocationAppService iOrganizationLocationAppService;
|
||||
|
||||
/**
|
||||
* 机构位置关系初始化
|
||||
@@ -88,40 +73,8 @@ public class OrganizationLocationController {
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return iOrganizationLocationAppService.getOrgLocPage(orgLocQueryParam, searchKey, pageNo, pageSize, request);
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<OrganizationLocation> queryWrapper = HisQueryUtils.buildQueryWrapper(orgLocQueryParam, searchKey,
|
||||
new HashSet<>(Arrays.asList("name", "py_str", "wb_str")), request);
|
||||
|
||||
// 设置排序
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
|
||||
// 执行分页查询并转换为 orgLocQueryDtoPage
|
||||
Page<OrgLocQueryDto> orgLocQueryDtoPage =
|
||||
HisPageUtils.selectPage(organizationLocationMapper, queryWrapper, pageNo, pageSize, OrgLocQueryDto.class);
|
||||
|
||||
return R.ok(orgLocQueryDtoPage,
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"机构信息"}));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加机构位置关系信息
|
||||
*
|
||||
* @param orgLocQueryDto 机构位置关系信息
|
||||
*/
|
||||
@PostMapping("/org-loc")
|
||||
public R<?> addOrgLoc(@Validated @RequestBody OrgLocQueryDto orgLocQueryDto) {
|
||||
|
||||
// 新增organizationLocation信息
|
||||
OrganizationLocation orgLoc = new OrganizationLocation();
|
||||
BeanUtils.copyProperties(orgLocQueryDto, orgLoc);
|
||||
|
||||
boolean saveOrgLocSuccess = organizationLocationService.save(orgLoc);
|
||||
|
||||
return saveOrgLocSuccess
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"机构位置关系信息"}))
|
||||
: R.fail(PromptMsgConstant.Common.M00007, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,9 +84,7 @@ public class OrganizationLocationController {
|
||||
*/
|
||||
@GetMapping("/org-loc-getById")
|
||||
public R<?> getOrgLocById(@Validated @RequestParam Long orgLocId) {
|
||||
|
||||
OrganizationLocation orgLoc = organizationLocationService.getById(orgLocId);
|
||||
return R.ok(orgLoc, MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"机构位置关系信息"}));
|
||||
return iOrganizationLocationAppService.getOrgLocById(orgLocId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,16 +93,8 @@ public class OrganizationLocationController {
|
||||
* @param orgLocQueryDto 机构位置关系信息
|
||||
*/
|
||||
@PutMapping("/org-loc")
|
||||
public R<?> editOrgLoc(@Validated @RequestBody OrgLocQueryDto orgLocQueryDto) {
|
||||
|
||||
// 编辑organizationLocation信息
|
||||
OrganizationLocation orgLoc = new OrganizationLocation();
|
||||
BeanUtils.copyProperties(orgLocQueryDto, orgLoc);
|
||||
|
||||
boolean editOrgLocSuccess = organizationLocationService.updateById(orgLoc);
|
||||
return editOrgLocSuccess
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"机构位置关系信息"}))
|
||||
: R.fail(PromptMsgConstant.Common.M00007, null);
|
||||
public R<?> addOrEditOrgLoc(@Validated @RequestBody OrgLocQueryDto orgLocQueryDto) {
|
||||
return iOrganizationLocationAppService.addOrEditOrgLoc(orgLocQueryDto);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,12 +104,7 @@ public class OrganizationLocationController {
|
||||
*/
|
||||
@DeleteMapping("/org-loc")
|
||||
public R<?> delOrgLoc(@RequestParam Long orgLocId) {
|
||||
|
||||
boolean delOrgLocSuccess = organizationLocationService.removeById(orgLocId);
|
||||
|
||||
return delOrgLocSuccess
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"机构位置关系信息"}))
|
||||
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00006, new Object[] {"机构位置关系信息"}));
|
||||
return iOrganizationLocationAppService.deleteOrgLoc(orgLocId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,9 +11,6 @@ import javax.validation.constraints.NotNull;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.enums.LocationBedStatus;
|
||||
import com.openhis.common.enums.LocationMode;
|
||||
import com.openhis.common.enums.LocationStatus;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -39,19 +36,19 @@ public class LocationQueryDto {
|
||||
|
||||
/** 状态编码 */
|
||||
@NotNull(message = "状态编码不能为空")
|
||||
// private LocationStatus statusEnum;
|
||||
// private LocationStatus statusEnum;
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/** 操作状态 */
|
||||
@NotNull(message = "操作状态不能为空")
|
||||
// private LocationBedStatus operationalEnum;
|
||||
// private LocationBedStatus operationalEnum;
|
||||
private Integer operationalEnum;
|
||||
private String operationalEnum_enumText;
|
||||
|
||||
/** 模式编码 */
|
||||
@NotNull(message = "模式编码不能为空")
|
||||
// private LocationMode modeEnum;
|
||||
// private LocationMode modeEnum;
|
||||
private Integer modeEnum;
|
||||
private String modeEnum_enumText;
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -20,16 +20,19 @@ import lombok.experimental.Accessors;
|
||||
public class OrgLocQueryDto {
|
||||
|
||||
/** ID */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 机构编码 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long organizationId;
|
||||
|
||||
/** 位置编码 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
|
||||
/** 默认药房 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long defLocationId;
|
||||
|
||||
/** 药品类别 */
|
||||
|
||||
@@ -27,7 +27,6 @@ public class Organization extends HisBaseEntity {
|
||||
|
||||
/** ID */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 编码 */
|
||||
|
||||
Reference in New Issue
Block a user