Merge branch 'master' of https://codeup.aliyun.com/61c0318acd8b75daa5a125f7/medical/openhis
This commit is contained in:
		| @@ -1,13 +1,45 @@ | |||||||
| package com.openhis.web.basedatamanage.appservice; | package com.openhis.web.basedatamanage.appservice; | ||||||
|  |  | ||||||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||||
|  | import com.core.common.core.domain.R; | ||||||
| import com.openhis.web.basedatamanage.dto.LocationQueryDto; | import com.openhis.web.basedatamanage.dto.LocationQueryDto; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Location 应该服务类 |  * Location 应该服务类 | ||||||
|  */ |  */ | ||||||
| public interface ILocationAppService { | public interface ILocationAppService { | ||||||
|     // 查询位置树 |     /** | ||||||
|     Page<LocationQueryDto> getLocationTree(Integer formKey, Integer pageNo, Integer pageSize); |      * 位置信息 | ||||||
|  |      * | ||||||
|  |      * @param formKey 查询条件 | ||||||
|  |      * @param pageNo 当前页码 | ||||||
|  |      * @param pageSize 查询条数 | ||||||
|  |      * @return 位置信息分页列表 | ||||||
|  |      */ | ||||||
|  |     R<?> getLocationTree(Integer formKey, Integer pageNo, Integer pageSize); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 位置信息详情 | ||||||
|  |      * | ||||||
|  |      * @param locationId 位置信息id | ||||||
|  |      * @return 位置信息详情 | ||||||
|  |      */ | ||||||
|  |     R<?> getLocationById(Long locationId); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 添加/编辑位置信息 | ||||||
|  |      * | ||||||
|  |      * @param locationQueryDto 位置信息 | ||||||
|  |      * @return 操作结果 | ||||||
|  |      */ | ||||||
|  |     R<?> addOrEditInventoryReceipt(LocationQueryDto locationQueryDto); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 删除位置信息 | ||||||
|  |      * | ||||||
|  |      * @param locationId 位置信息id | ||||||
|  |      * @return 操作结果 | ||||||
|  |      */ | ||||||
|  |     R<?> deleteLocation(Long locationId); | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -5,17 +5,20 @@ import java.util.stream.Collectors; | |||||||
|  |  | ||||||
| import javax.annotation.Resource; | import javax.annotation.Resource; | ||||||
|  |  | ||||||
| import com.openhis.common.enums.LocationBedStatus; |  | ||||||
| import com.openhis.common.enums.LocationMode; |  | ||||||
| import com.openhis.common.enums.LocationStatus; |  | ||||||
| import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||||
|  |  | ||||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 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.Location; | ||||||
| import com.openhis.administration.service.ILocationService; | import com.openhis.administration.service.ILocationService; | ||||||
|  | import com.openhis.common.constant.PromptMsgConstant; | ||||||
|  | import com.openhis.common.enums.LocationBedStatus; | ||||||
| import com.openhis.common.enums.LocationForm; | import com.openhis.common.enums.LocationForm; | ||||||
|  | import com.openhis.common.enums.LocationMode; | ||||||
|  | import com.openhis.common.enums.LocationStatus; | ||||||
| import com.openhis.common.utils.EnumUtils; | import com.openhis.common.utils.EnumUtils; | ||||||
| import com.openhis.web.basedatamanage.appservice.ILocationAppService; | import com.openhis.web.basedatamanage.appservice.ILocationAppService; | ||||||
| import com.openhis.web.basedatamanage.dto.LocationQueryDto; | import com.openhis.web.basedatamanage.dto.LocationQueryDto; | ||||||
| @@ -27,7 +30,7 @@ public class LocationAppServiceImpl implements ILocationAppService { | |||||||
|     ILocationService locationService; |     ILocationService locationService; | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public Page<LocationQueryDto> getLocationTree(Integer formKey, Integer pageNo, Integer pageSize) { |     public R<?> getLocationTree(Integer formKey, Integer pageNo, Integer pageSize) { | ||||||
|  |  | ||||||
|         QueryWrapper<Location> queryWrapper = new QueryWrapper<>(); |         QueryWrapper<Location> queryWrapper = new QueryWrapper<>(); | ||||||
|         if (formKey != null) { |         if (formKey != null) { | ||||||
| @@ -53,7 +56,8 @@ public class LocationAppServiceImpl implements ILocationAppService { | |||||||
|             e.setModeEnum_enumText(EnumUtils.getInfoByValue(LocationMode.class, e.getModeEnum())); |             e.setModeEnum_enumText(EnumUtils.getInfoByValue(LocationMode.class, e.getModeEnum())); | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|         return locationQueryDtoPage; |         return R.ok(locationQueryDtoPage, | ||||||
|  |             MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"位置信息查询"})); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -98,4 +102,64 @@ public class LocationAppServiceImpl implements ILocationAppService { | |||||||
|         return tree; |         return tree; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 位置信息详情 | ||||||
|  |      * | ||||||
|  |      * @param locationId 位置信息id | ||||||
|  |      * @return 位置信息详情 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public R<?> getLocationById(Long locationId) { | ||||||
|  |         Location location = locationService.getById(locationId); | ||||||
|  |         return R.ok(location, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"位置信息查询"})); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 添加/编辑位置信息 | ||||||
|  |      * | ||||||
|  |      * @param locationQueryDto 位置信息 | ||||||
|  |      * @return 操作结果 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public R<?> addOrEditInventoryReceipt(LocationQueryDto locationQueryDto) { | ||||||
|  |  | ||||||
|  |         // 初始化位置信息 | ||||||
|  |         Location location = new Location(); | ||||||
|  |         BeanUtils.copyProperties(locationQueryDto, location); | ||||||
|  |  | ||||||
|  |         if (locationQueryDto.getId() != null) { | ||||||
|  |             // 更新位置信息 | ||||||
|  |             locationService.updateById(location); | ||||||
|  |         } else { | ||||||
|  |             // 插入位置信息 | ||||||
|  |             location | ||||||
|  |                 // 状态编码:有效 | ||||||
|  |                 .setStatusEnum(LocationStatus.ACTIVE.getValue()) | ||||||
|  |                 // 操作状态:空闲 | ||||||
|  |                 .setOperationalEnum(LocationBedStatus.U.getValue()) | ||||||
|  |                 // 模式编码:具体 | ||||||
|  |                 .setModeEnum(LocationMode.INSTANCE.getValue()) | ||||||
|  |                 // 模式编码:库房 | ||||||
|  |                 .setFormEnum(LocationForm.CABINET.getValue()); | ||||||
|  |             locationService.save(location); | ||||||
|  |         } | ||||||
|  |         // 返回位置信息id | ||||||
|  |         return R.ok(location.getId(), | ||||||
|  |             MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"位置信息添加编辑"})); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 删除位置信息 | ||||||
|  |      * | ||||||
|  |      * @param locationId 位置信息id | ||||||
|  |      * @return 操作结果 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public R<?> deleteLocation(Long locationId) { | ||||||
|  |         // 删除位置信息 | ||||||
|  |         boolean result = locationService.removeById(locationId); | ||||||
|  |         return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"位置信息删除"})) | ||||||
|  |             : R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00006, new Object[] {"位置信息删除"})); | ||||||
|  |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ import java.util.stream.Collectors; | |||||||
| import javax.annotation.Resource; | import javax.annotation.Resource; | ||||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||||
|  |  | ||||||
|  | import com.openhis.common.enums.AccountStatus; | ||||||
| import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||||
|  |  | ||||||
| @@ -107,6 +108,8 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService { | |||||||
|             // 更新机构信息 |             // 更新机构信息 | ||||||
|             organizationService.updateById(organization); |             organizationService.updateById(organization); | ||||||
|         } else { |         } else { | ||||||
|  |             // 活动标识:有效 | ||||||
|  |             organization.setActiveFlag(AccountStatus.ACTIVE.getValue()); | ||||||
|             // 生成待发送的机构信息 |             // 生成待发送的机构信息 | ||||||
|             organizationService.save(organization); |             organizationService.save(organization); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -3,21 +3,10 @@ | |||||||
|  */ |  */ | ||||||
| package com.openhis.web.basedatamanage.controller; | package com.openhis.web.basedatamanage.controller; | ||||||
|  |  | ||||||
| import org.springframework.beans.factory.annotation.Autowired; |  | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
|  |  | ||||||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |  | ||||||
| import com.core.common.core.domain.R; | import com.core.common.core.domain.R; | ||||||
| import com.core.common.utils.MessageUtils; |  | ||||||
| import com.openhis.administration.domain.Location; |  | ||||||
| import com.openhis.administration.mapper.LocationMapper; |  | ||||||
| import com.openhis.administration.service.ILocationService; |  | ||||||
| import com.openhis.common.constant.PromptMsgConstant; |  | ||||||
| import com.openhis.common.enums.LocationBedStatus; |  | ||||||
| import com.openhis.common.enums.LocationForm; |  | ||||||
| import com.openhis.common.enums.LocationMode; |  | ||||||
| import com.openhis.common.enums.LocationStatus; |  | ||||||
| import com.openhis.web.basedatamanage.appservice.ILocationAppService; | import com.openhis.web.basedatamanage.appservice.ILocationAppService; | ||||||
| import com.openhis.web.basedatamanage.dto.LocationQueryDto; | import com.openhis.web.basedatamanage.dto.LocationQueryDto; | ||||||
|  |  | ||||||
| @@ -36,12 +25,8 @@ import lombok.extern.slf4j.Slf4j; | |||||||
| @AllArgsConstructor | @AllArgsConstructor | ||||||
| public class CabinetLocationController { | public class CabinetLocationController { | ||||||
|  |  | ||||||
|     private final ILocationService locationService; |  | ||||||
|     private final ILocationAppService iLocationAppService; |     private final ILocationAppService iLocationAppService; | ||||||
|  |  | ||||||
|     @Autowired |  | ||||||
|     private LocationMapper locationMapper; |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 位置分页列表 |      * 位置分页列表 | ||||||
|      * |      * | ||||||
| @@ -53,34 +38,7 @@ public class CabinetLocationController { | |||||||
|     public R<?> getLocationPage(@RequestParam(required = false, value = "formKey", defaultValue = "") Integer formKey, |     public R<?> getLocationPage(@RequestParam(required = false, value = "formKey", defaultValue = "") Integer formKey, | ||||||
|         @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, |         @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, | ||||||
|         @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { |         @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { | ||||||
|  |         return iLocationAppService.getLocationTree(formKey, pageNo, pageSize); | ||||||
|         Page<LocationQueryDto> locationTree = iLocationAppService.getLocationTree(formKey, pageNo, pageSize); |  | ||||||
|         return R.ok(locationTree, MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"机构信息"})); |  | ||||||
|  |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 添加库房位置信息 |  | ||||||
|      * |  | ||||||
|      * @param locationQueryDto 库房位置信息 |  | ||||||
|      */ |  | ||||||
|     @PostMapping("/cabinet-location") |  | ||||||
|     public R<?> addLocation(@Validated @RequestBody LocationQueryDto locationQueryDto) { |  | ||||||
|  |  | ||||||
|         // 设置为库房 |  | ||||||
|         // LocationQueryDto locationQuery = new LocationQueryDto(LocationForm.CABINET); |  | ||||||
|         // locationQueryDto.setFormEnum(LocationForm.CABINET); |  | ||||||
|         // BeanUtils.copyProperties(locationQueryDto, location); |  | ||||||
|         Location location = new Location(locationQueryDto.getId(), locationQueryDto.getBusNo(), |  | ||||||
|             locationQueryDto.getName(), LocationStatus.ACTIVE.getValue(), LocationBedStatus.U.getValue(), |  | ||||||
|             LocationMode.INSTANCE.getValue(), locationQueryDto.getTypeCode(), locationQueryDto.getTypeJson(), |  | ||||||
|             locationQueryDto.getPyStr(), locationQueryDto.getWbStr(), LocationForm.CABINET.getValue(), |  | ||||||
|             locationQueryDto.getOrganizationId(), locationQueryDto.getDisplayOrder()); |  | ||||||
|  |  | ||||||
|         boolean saveLocationSuccess = locationService.save(location); |  | ||||||
|         return saveLocationSuccess |  | ||||||
|             ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"位置信息"})) |  | ||||||
|             : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00003, new Object[] {"位置信息"})); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -90,9 +48,7 @@ public class CabinetLocationController { | |||||||
|      */ |      */ | ||||||
|     @GetMapping("/cabinet-location-getById") |     @GetMapping("/cabinet-location-getById") | ||||||
|     public R<?> getLocationById(@Validated @RequestParam Long locationId) { |     public R<?> getLocationById(@Validated @RequestParam Long locationId) { | ||||||
|  |         return iLocationAppService.getLocationById(locationId); | ||||||
|         Location location = locationService.getById(locationId); |  | ||||||
|         return R.ok(location, MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"位置信息"})); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -101,18 +57,8 @@ public class CabinetLocationController { | |||||||
|      * @param locationQueryDto 库房位置信息 |      * @param locationQueryDto 库房位置信息 | ||||||
|      */ |      */ | ||||||
|     @PutMapping("/cabinet-location") |     @PutMapping("/cabinet-location") | ||||||
|     public R<?> editLocation(@Validated @RequestBody LocationQueryDto locationQueryDto) { |     public R<?> addOrEditLocation(@Validated @RequestBody LocationQueryDto locationQueryDto) { | ||||||
|  |         return iLocationAppService.addOrEditInventoryReceipt(locationQueryDto); | ||||||
|         Location location = new Location(locationQueryDto.getId(), locationQueryDto.getBusNo(), |  | ||||||
|             locationQueryDto.getName(), LocationStatus.ACTIVE.getValue(), LocationBedStatus.U.getValue(), |  | ||||||
|             LocationMode.INSTANCE.getValue(), locationQueryDto.getTypeCode(), locationQueryDto.getTypeJson(), |  | ||||||
|             locationQueryDto.getPyStr(), locationQueryDto.getWbStr(), LocationForm.CABINET.getValue(), |  | ||||||
|             locationQueryDto.getOrganizationId(), locationQueryDto.getDisplayOrder()); |  | ||||||
|  |  | ||||||
|         boolean updateLocationSuccess = locationService.updateById(location); |  | ||||||
|         return updateLocationSuccess |  | ||||||
|             ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"位置信息"})) |  | ||||||
|             : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"位置信息"})); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -122,12 +68,7 @@ public class CabinetLocationController { | |||||||
|      */ |      */ | ||||||
|     @DeleteMapping("/cabinet-location") |     @DeleteMapping("/cabinet-location") | ||||||
|     public R<?> deleteLocation(@RequestParam Long locationId) { |     public R<?> deleteLocation(@RequestParam Long locationId) { | ||||||
|  |         return iLocationAppService.deleteLocation(locationId); | ||||||
|         boolean deleteLocationSuccess = locationService.removeById(locationId); |  | ||||||
|  |  | ||||||
|         return deleteLocationSuccess |  | ||||||
|             ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"位置信息"})) |  | ||||||
|             : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00006, new Object[] {"位置信息"})); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -4,9 +4,6 @@ import com.baomidou.mybatisplus.annotation.IdType; | |||||||
| import com.baomidou.mybatisplus.annotation.TableId; | import com.baomidou.mybatisplus.annotation.TableId; | ||||||
| import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||||
| import com.core.common.core.domain.HisBaseEntity; | import com.core.common.core.domain.HisBaseEntity; | ||||||
| import com.openhis.common.enums.LocationBedStatus; |  | ||||||
| import com.openhis.common.enums.LocationMode; |  | ||||||
| import com.openhis.common.enums.LocationStatus; |  | ||||||
|  |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||||
| @@ -68,22 +65,22 @@ public class Location extends HisBaseEntity { | |||||||
|     /** 显示顺序 */ |     /** 显示顺序 */ | ||||||
|     private Integer displayOrder; |     private Integer displayOrder; | ||||||
|  |  | ||||||
|     public Location(Long id, String busNo, String name, Integer statusEnum, Integer operationalEnum, |     // public Location(Long id, String busNo, String name, Integer statusEnum, Integer operationalEnum, | ||||||
|         Integer modeEnum, String typeCode, String typeJson, String pyStr, String wbStr, Integer formEnum, |     // Integer modeEnum, String typeCode, String typeJson, String pyStr, String wbStr, Integer formEnum, | ||||||
|         Long organizationId, Integer displayOrder) { |     // Long organizationId, Integer displayOrder) { | ||||||
|         this.id = id; |     // this.id = id; | ||||||
|         this.busNo = busNo; |     // this.busNo = busNo; | ||||||
|         this.name = name; |     // this.name = name; | ||||||
|         this.statusEnum = statusEnum; |     // this.statusEnum = statusEnum; | ||||||
|         this.operationalEnum = operationalEnum; |     // this.operationalEnum = operationalEnum; | ||||||
|         this.modeEnum = modeEnum; |     // this.modeEnum = modeEnum; | ||||||
|         this.typeCode = typeCode; |     // this.typeCode = typeCode; | ||||||
|         this.typeJson = typeJson; |     // this.typeJson = typeJson; | ||||||
|         this.pyStr = pyStr; |     // this.pyStr = pyStr; | ||||||
|         this.wbStr = wbStr; |     // this.wbStr = wbStr; | ||||||
|         this.formEnum = formEnum; |     // this.formEnum = formEnum; | ||||||
|         this.organizationId = organizationId; |     // this.organizationId = organizationId; | ||||||
|         this.displayOrder = displayOrder; |     // this.displayOrder = displayOrder; | ||||||
|     } |     // } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 liuhongrui
					liuhongrui