pc端订单信息修改

This commit is contained in:
zhangheng 2023-10-27 10:29:39 +08:00
parent a08846f797
commit 9ba5b7f7ca
5 changed files with 532 additions and 3 deletions

View File

@ -0,0 +1,138 @@
package com.xinelu.manage.controller.appointmentorderdetails;
import com.xinelu.common.annotation.Log;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.enums.BusinessType;
import com.xinelu.common.utils.poi.ExcelUtil;
import com.xinelu.manage.domain.appointmentorderdetails.AppointmentOrderDetails;
import com.xinelu.manage.dto.appointmentorderdetails.AppointmentOrderDetailsDTO;
import com.xinelu.manage.service.appointmentorderdetails.IAppointmentOrderDetailsService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Objects;
/**
* 预约订单明细Controller
*
* @author 纪寒
* @date 2022-09-05
*/
@RestController
@RequestMapping("/system/appointmentOrderDetails")
public class AppointmentOrderDetailsController extends BaseController {
@Resource
private IAppointmentOrderDetailsService appointmentOrderDetailsService;
/**
* 查询预约订单明细列表
*/
@PreAuthorize("@ss.hasPermi('system:appointmentOrderDetails:list')")
@GetMapping("/list")
public TableDataInfo list(AppointmentOrderDetails appointmentOrderDetails) {
startPage();
List<AppointmentOrderDetails> list = appointmentOrderDetailsService.selectAppointmentOrderDetailsList(appointmentOrderDetails);
return getDataTable(list);
}
/**
* 导出预约订单明细列表
*/
@PreAuthorize("@ss.hasPermi('system:appointmentOrderDetails:export')")
@Log(title = "预约订单明细", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, AppointmentOrderDetails appointmentOrderDetails) {
List<AppointmentOrderDetails> list = appointmentOrderDetailsService.selectAppointmentOrderDetailsList(appointmentOrderDetails);
ExcelUtil<AppointmentOrderDetails> util = new ExcelUtil<>(AppointmentOrderDetails.class);
util.exportExcel(response, list, "预约订单明细数据");
}
/**
* 获取预约订单明细详细信息
*/
@PreAuthorize("@ss.hasPermi('system:appointmentOrderDetails:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(appointmentOrderDetailsService.selectAppointmentOrderDetailsById(id));
}
/**
* 新增预约订单明细
*/
@PreAuthorize("@ss.hasPermi('system:appointmentOrderDetails:add')")
@Log(title = "预约订单明细", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult add(@RequestBody AppointmentOrderDetails appointmentOrderDetails) {
return toAjax(appointmentOrderDetailsService.insertAppointmentOrderDetails(appointmentOrderDetails));
}
/**
* 修改预约订单明细
*/
@PreAuthorize("@ss.hasPermi('system:appointmentOrderDetails:edit')")
@Log(title = "预约订单明细", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
public AjaxResult edit(@RequestBody AppointmentOrderDetails appointmentOrderDetails) {
return toAjax(appointmentOrderDetailsService.updateAppointmentOrderDetails(appointmentOrderDetails));
}
/**
* 逻辑删除预约订单明细
*/
@PreAuthorize("@ss.hasPermi('system:appointmentOrderDetails:remove')")
@Log(title = "预约订单明细", businessType = BusinessType.DELETE)
@PostMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return appointmentOrderDetailsService.updateAppointmentOrderDetailsByIds(ids);
}
/**
* 获取预约订单明细详细信息
*/
@GetMapping(value = "/detailed")
public AjaxResult getAppointmentOrderDetailsByDetailed(String orderNo) {
if (StringUtils.isEmpty(orderNo)) {
return AjaxResult.error("订单编号不能为空");
}
return AjaxResult.success(appointmentOrderDetailsService.getAppointmentOrderDetailsByDetailed(orderNo));
}
/**
* 根据订单编号查询预约订单信息
*
* @param orderNo 订单编号
* @return 信息
*/
@GetMapping("/getCancelOrderInfo")
public AjaxResult getCancelAppointmentOrderInfo(String orderNo) {
if (StringUtils.isBlank(orderNo)) {
return AjaxResult.error("请选择预约订单信息!");
}
return appointmentOrderDetailsService.getCancelAppointmentOrderInfo(orderNo);
}
/**
* 修改陪诊陪护预约订单信息
*
* @param appointmentOrderDetailsDTO 订单信息
* @return com.xinyilu.common.core.domain.AjaxResult
*/
@PostMapping("/updateAppointmentOrderInfo")
public AjaxResult updateAppointmentOrderInfo(@RequestBody AppointmentOrderDetailsDTO appointmentOrderDetailsDTO) {
if (Objects.isNull(appointmentOrderDetailsDTO)) {
return AjaxResult.error("保存预约订单信息不能为空!");
}
if (Objects.isNull(appointmentOrderDetailsDTO.getAppointOrderId()) || Objects.isNull(appointmentOrderDetailsDTO.getAppointOrderDetailsId())) {
return AjaxResult.error("保存预约订单信息id不能为空");
}
return appointmentOrderDetailsService.updateAppointmentOrderInfo(appointmentOrderDetailsDTO);
}
}

View File

@ -0,0 +1,83 @@
package com.xinelu.manage.dto.appointmentorderdetails;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
/**
* @author ljh
* @date 2023/5/19 17:38
*/
@Data
public class AppointmentOrderDetailsDTO implements Serializable {
private static final long serialVersionUID = 6239480658926598422L;
/**
* 预约订单主表id
*/
private Long appointOrderId;
/**
* 预约订单明细表id
*/
private Long appointOrderDetailsId;
/**
* 护理人姓名院内陪护订单使用
*/
private String caregiverName;
/**
* 护理人电话院内陪护订单使用
*/
private String caregiverPhone;
/**
* 医院名称院内陪护订单使用
*/
private String hospitalName;
/**
* 科室名称院内陪护订单使用
*/
private String departmentName;
/**
* 病床号院内陪护订单使用
*/
private String hospitalBedNumber;
/**
* 陪护开始时间院内陪护订单使用格式yyyy-MM-dd
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate companionStartDate;
/**
* 陪护结束时间院内陪护订单使用格式yyyy-MM-dd
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate companionEndDate;
/**
* 陪护天数院内陪护订单使用
*/
private Integer companionDays;
/**
* 订单填写人姓名院内陪护订单使用
*/
private String orderWriteName;
/**
* 总价
*/
private BigDecimal totalPrice;
/**
* 护理项目价格
*/
private BigDecimal nurseItemPrice;
}

View File

@ -0,0 +1,90 @@
package com.xinelu.manage.service.appointmentorderdetails;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.manage.domain.appointmentorderdetails.AppointmentOrderDetails;
import com.xinelu.manage.dto.appointmentorderdetails.AppointmentOrderDetailsDTO;
import com.xinelu.manage.vo.appointmentorderdetails.AppointmentOrderDetailsVO;
import java.util.List;
/**
* 预约订单明细Service接口
*
* @author 纪寒
* @date 2022-09-05
*/
public interface IAppointmentOrderDetailsService {
/**
* 查询预约订单明细
*
* @param id 预约订单明细主键
* @return 预约订单明细
*/
AppointmentOrderDetails selectAppointmentOrderDetailsById(Long id);
/**
* 查询预约订单明细列表
*
* @param appointmentOrderDetails 预约订单明细
* @return 预约订单明细集合
*/
List<AppointmentOrderDetails> selectAppointmentOrderDetailsList(AppointmentOrderDetails appointmentOrderDetails);
/**
* 新增预约订单明细
*
* @param appointmentOrderDetails 预约订单明细
* @return 结果
*/
int insertAppointmentOrderDetails(AppointmentOrderDetails appointmentOrderDetails);
/**
* 修改预约订单明细
*
* @param appointmentOrderDetails 预约订单明细
* @return 结果
*/
int updateAppointmentOrderDetails(AppointmentOrderDetails appointmentOrderDetails);
/**
* 逻辑批量删除预约订单明细
*
* @param ids 需要删除的预约订单明细主键集合
* @return 结果
*/
AjaxResult updateAppointmentOrderDetailsByIds(Long[] ids);
/**
* 删除预约订单明细信息
*
* @param id 预约订单明细主键
* @return 结果
*/
int deleteAppointmentOrderDetailsById(Long id);
/**
* 预约订单管理列表页面查看明细
*
* @param orderNo 订单编号
* @return com.xinyilu.base.vo.appointmentorderdetails.AppointmentOrderDetailsVO
**/
AppointmentOrderDetailsVO getAppointmentOrderDetailsByDetailed(String orderNo);
/**
* 根据订单编号查询预约订单信息
*
* @param orderNo 订单编号
* @return 信息
*/
AjaxResult getCancelAppointmentOrderInfo(String orderNo);
/**
* 修改陪诊陪护预约订单信息
*
* @param appointmentOrderDetailsDTO 预约订单信息
* @return 结果
*/
AjaxResult updateAppointmentOrderInfo(AppointmentOrderDetailsDTO appointmentOrderDetailsDTO);
}

View File

@ -0,0 +1,219 @@
package com.xinelu.manage.service.appointmentorderdetails.impl;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.bean.BeanUtils;
import com.xinelu.common.utils.regex.RegexUtil;
import com.xinelu.manage.domain.appointmentorder.AppointmentOrder;
import com.xinelu.manage.domain.appointmentorderconsumable.AppointmentOrderConsumable;
import com.xinelu.manage.domain.appointmentorderdetails.AppointmentOrderDetails;
import com.xinelu.manage.domain.patientdiseaseinfo.PatientDiseaseInfo;
import com.xinelu.manage.dto.appointmentorderdetails.AppointmentOrderDetailsDTO;
import com.xinelu.manage.mapper.appointmentorder.AppointmentOrderMapper;
import com.xinelu.manage.mapper.appointmentorderconsumable.AppointmentOrderConsumableMapper;
import com.xinelu.manage.mapper.appointmentorderdetails.AppointmentOrderDetailsMapper;
import com.xinelu.manage.mapper.patientdiseaseinfo.PatientDiseaseInfoMapper;
import com.xinelu.manage.service.appointmentorderdetails.IAppointmentOrderDetailsService;
import com.xinelu.manage.vo.appointmentorderdetails.AppointmentOrderDetailsVO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 预约订单明细Service业务层处理
*
* @author 纪寒
* @date 2022-09-05
*/
@Service
public class AppointmentOrderDetailsServiceImpl implements IAppointmentOrderDetailsService {
@Resource
private AppointmentOrderDetailsMapper appointmentOrderDetailsMapper;
@Resource
private AppointmentOrderConsumableMapper appointmentOrderConsumableMapper;
@Resource
private PatientDiseaseInfoMapper patientDiseaseInfoMapper;
@Resource
private AppointmentOrderMapper appointmentOrderMapper;
@Resource
private RegexUtil regexUtil;
/**
* 查询预约订单明细
*
* @param id 预约订单明细主键
* @return 预约订单明细
*/
@Override
public AppointmentOrderDetails selectAppointmentOrderDetailsById(Long id) {
return appointmentOrderDetailsMapper.selectAppointmentOrderDetailsById(id);
}
/**
* 查询预约订单明细列表
*
* @param appointmentOrderDetails 预约订单明细
* @return 预约订单明细
*/
@Override
public List<AppointmentOrderDetails> selectAppointmentOrderDetailsList(AppointmentOrderDetails appointmentOrderDetails) {
return appointmentOrderDetailsMapper.selectAppointmentOrderDetailsList(appointmentOrderDetails);
}
/**
* 新增预约订单明细
*
* @param appointmentOrderDetails 预约订单明细
* @return 结果
*/
@Override
public int insertAppointmentOrderDetails(AppointmentOrderDetails appointmentOrderDetails) {
appointmentOrderDetails.setCreateTime(LocalDateTime.now());
return appointmentOrderDetailsMapper.insertAppointmentOrderDetails(appointmentOrderDetails);
}
/**
* 修改预约订单明细
*
* @param appointmentOrderDetails 预约订单明细
* @return 结果
*/
@Override
public int updateAppointmentOrderDetails(AppointmentOrderDetails appointmentOrderDetails) {
appointmentOrderDetails.setUpdateTime(LocalDateTime.now());
return appointmentOrderDetailsMapper.updateAppointmentOrderDetails(appointmentOrderDetails);
}
/**
* 逻辑批量删除预约订单明细
*
* @param ids 需要删除的预约订单明细主键
* @return 结果
*/
@Override
public AjaxResult updateAppointmentOrderDetailsByIds(Long[] ids) {
int appointmentOrderDetailsByIds = appointmentOrderDetailsMapper.updateAppointmentOrderDetailsByIds(ids);
if (appointmentOrderDetailsByIds <= 0) {
throw new ServiceException("删测试项目信息失败");
}
return AjaxResult.success();
}
/**
* 删除预约订单明细信息
*
* @param id 预约订单明细主键
* @return 结果
*/
@Override
public int deleteAppointmentOrderDetailsById(Long id) {
return appointmentOrderDetailsMapper.deleteAppointmentOrderDetailsById(id);
}
/**
* 预约订单管理列表页面查看明细
*
* @param orderNo 订单编号
* @return com.xinyilu.base.vo.appointmentorderdetails.AppointmentOrderDetailsVO
**/
@Override
public AppointmentOrderDetailsVO getAppointmentOrderDetailsByDetailed(String orderNo) {
//根据订单编号查询预约订单管理列表页面查看明细
AppointmentOrderDetailsVO appointmentOrderDetails = appointmentOrderDetailsMapper.getAppointmentOrderDetailsByDetailed(orderNo);
if (Objects.isNull(appointmentOrderDetails)) {
return null;
}
//健康状况
List<PatientDiseaseInfo> patientDiseaseInfo = patientDiseaseInfoMapper.selectPatientDiseaseInfoByOrderNo(orderNo);
if (CollectionUtils.isNotEmpty(patientDiseaseInfo)) {
List<String> diseaseNameList = patientDiseaseInfo.stream().filter(Objects::nonNull).map(PatientDiseaseInfo::getDiseaseName).filter(StringUtils::isNotBlank).collect(Collectors.toList());
String diseaseName = String.join(",", diseaseNameList);
appointmentOrderDetails.setDiseaseName(diseaseName);
}
//获取订单明细表id查询耗材包详情信息集合
if (Objects.isNull(appointmentOrderDetails.getAppointOrderDetailsId())) {
return appointmentOrderDetails;
}
List<AppointmentOrderConsumable> appointmentOrderConsumableList = appointmentOrderConsumableMapper.getByAppointOrderDetailsId(appointmentOrderDetails.getAppointOrderDetailsId());
if (CollectionUtils.isEmpty(appointmentOrderConsumableList)) {
return appointmentOrderDetails;
}
appointmentOrderDetails.setAppointmentOrderConsumableList(appointmentOrderConsumableList);
return appointmentOrderDetails;
}
/**
* 根据订单编号查询预约订单信息
*
* @param orderNo 订单编号
* @return 信息
*/
@Override
public AjaxResult getCancelAppointmentOrderInfo(String orderNo) {
return AjaxResult.success(appointmentOrderDetailsMapper.getCancelAppointmentOrderInfo(orderNo));
}
/**
* 修改陪诊陪护预约订单信息
*
* @param appointmentOrderDetailsDTO 预约订单信息
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public AjaxResult updateAppointmentOrderInfo(AppointmentOrderDetailsDTO appointmentOrderDetailsDTO) {
//判断时间数量是否符合
if (Objects.nonNull(appointmentOrderDetailsDTO.getCompanionStartDate()) && Objects.nonNull(appointmentOrderDetailsDTO.getCompanionEndDate())) {
if (appointmentOrderDetailsDTO.getCompanionStartDate().isBefore(LocalDate.now())) {
return AjaxResult.error("时间错误,时间只能选择今天以及以后的时间!");
}
long companionDays = ChronoUnit.DAYS.between(appointmentOrderDetailsDTO.getCompanionStartDate(), appointmentOrderDetailsDTO.getCompanionEndDate()) + 1;
if (Objects.nonNull(appointmentOrderDetailsDTO.getCompanionDays()) && appointmentOrderDetailsDTO.getCompanionDays() != companionDays) {
return AjaxResult.error("数量与时间不符合,请重新调整时间!");
}
}
//预约天数
int companionDays = Objects.isNull(appointmentOrderDetailsDTO.getCompanionDays()) ? 0 : appointmentOrderDetailsDTO.getCompanionDays();
//护理项目价格
BigDecimal nurseItemPrice = Objects.isNull(appointmentOrderDetailsDTO.getNurseItemPrice()) ? BigDecimal.ZERO : appointmentOrderDetailsDTO.getNurseItemPrice();
if (Objects.nonNull(appointmentOrderDetailsDTO.getTotalPrice()) && appointmentOrderDetailsDTO.getTotalPrice().compareTo(BigDecimal.valueOf(companionDays).multiply(nurseItemPrice)) != 0) {
return AjaxResult.error("总价格与实际应付价格不符!");
}
//判断手机号
if (StringUtils.isNotBlank(appointmentOrderDetailsDTO.getCaregiverPhone())) {
boolean regexPhone = regexUtil.regexPhone(appointmentOrderDetailsDTO.getCaregiverPhone());
if (BooleanUtils.isFalse(regexPhone)) {
return AjaxResult.error("您输入的联系电话" + appointmentOrderDetailsDTO.getCaregiverPhone() + "不正确,请重新输入!");
}
}
AppointmentOrder appointmentOrder = new AppointmentOrder();
BeanUtils.copyProperties(appointmentOrderDetailsDTO, appointmentOrder);
appointmentOrder.setId(appointmentOrderDetailsDTO.getAppointOrderId());
appointmentOrder.setUpdateTime(LocalDateTime.now());
int updateAppointmentOrder = appointmentOrderMapper.updateAppointmentOrder(appointmentOrder);
if (updateAppointmentOrder <= 0) {
throw new ServiceException("修改订单主表信息失败,请联系管理员!");
}
AppointmentOrderDetails appointmentOrderDetails = new AppointmentOrderDetails();
BeanUtils.copyProperties(appointmentOrderDetailsDTO, appointmentOrderDetails);
appointmentOrderDetails.setId(appointmentOrderDetailsDTO.getAppointOrderDetailsId());
appointmentOrderDetails.setUpdateTime(LocalDateTime.now());
int updateAppointmentOrderDetails = appointmentOrderDetailsMapper.updateAppointmentOrderDetails(appointmentOrderDetails);
if (updateAppointmentOrderDetails <= 0) {
throw new ServiceException("修改订单明细表信息失败,请联系管理员!");
}
return AjaxResult.success();
}
}

View File

@ -166,9 +166,8 @@
LEFT JOIN patient_info pi ON pi.id = ao.patient_id
LEFT JOIN nurse_station_person nsp ON nsp.id = ao.nurse_station_person_id
<where>
pi.del_flag = 0
and ao.del_flag = 0
and aod.del_flag = 0
ao.del_flag = 0
and aod.del_flag = 0
<if test="orderNo != null and orderNo != ''">
and ao.order_no = #{orderNo}
</if>