Browse Source

erp历史订单明细列表和导入

wangxy 2 weeks ago
parent
commit
064a4ec784

+ 127 - 0
fs-company/src/main/java/com/fs/company/controller/store/OrderDetailSummaryController.java

@@ -0,0 +1,127 @@
+package com.fs.company.controller.store;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.his.domain.OrderDetailSummary;
+import com.fs.his.service.IOrderDetailSummaryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+@RestController
+@RequestMapping("/store/orderDetailSummary")
+public class OrderDetailSummaryController extends BaseController {
+
+    @Autowired
+    private IOrderDetailSummaryService orderDetailSummaryService;
+
+    @GetMapping("/list")
+    @PreAuthorize("@ss.hasPermi('his:orderDetailSummary:list')")
+    public TableDataInfo list(OrderDetailSummary orderDetailSummary) {
+        startPage();
+        List<OrderDetailSummary> list = orderDetailSummaryService.selectOrderDetailSummaryList(orderDetailSummary);
+        return getDataTable(list);
+    }
+
+    @GetMapping(value = "/{externalOrderNo}")
+    @PreAuthorize("@ss.hasPermi('his:orderDetailSummary:query')")
+    public AjaxResult getInfo(@PathVariable("externalOrderNo") String externalOrderNo) {
+        return AjaxResult.success(orderDetailSummaryService.selectOrderDetailSummaryByExternalOrderNo(externalOrderNo));
+    }
+
+    @Log(title = "订单明细汇总", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    @PreAuthorize("@ss.hasPermi('his:orderDetailSummary:export')")
+    public AjaxResult export(OrderDetailSummary orderDetailSummary) {
+        List<OrderDetailSummary> list = orderDetailSummaryService.selectOrderDetailSummaryList(orderDetailSummary);
+        ExcelUtil<OrderDetailSummary> util = new ExcelUtil<>(OrderDetailSummary.class);
+        return util.exportExcel(list, "订单明细汇总");
+    }
+
+    @Log(title = "订单明细汇总导入", businessType = BusinessType.IMPORT)
+    @PostMapping("/importData")
+    @PreAuthorize("@ss.hasPermi('his:orderDetailSummary:import')")
+    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
+        ExcelUtil<OrderDetailSummary> util = new ExcelUtil<>(OrderDetailSummary.class);
+        List<OrderDetailSummary> list = util.importExcel(file.getInputStream());
+        String message = orderDetailSummaryService.importOrderDetailSummary(list, updateSupport);
+        return AjaxResult.success(message);
+    }
+
+    @GetMapping("/importTemplate")
+    public AjaxResult importTemplate() {
+        ExcelUtil<OrderDetailSummary> util = new ExcelUtil<>(OrderDetailSummary.class);
+        List<OrderDetailSummary> dataList = new ArrayList<>();
+        OrderDetailSummary example1 = new OrderDetailSummary();
+        example1.setExternalOrderNo("EX20240101001");
+        example1.setOrderNo("DD20240101001");
+        example1.setCustomerNo("KH001");
+        example1.setAgentNo("A001");
+        example1.setAgentName("张三");
+        example1.setAgentGroup("销售一组");
+        example1.setDeptInfo("销售部");
+        example1.setServicePerson("李四");
+        example1.setOrderDate(new Date());
+        example1.setCustomerName("王五");
+        example1.setCustomerMobile("13800138001");
+        example1.setCustomerPhone1("010-12345678");
+        example1.setOrderStatus("已完成");
+        example1.setSignStatus("已签收");
+        example1.setAddress("北京市朝阳区xxx路xxx号");
+        example1.setProductOrdered("产品A x2");
+        example1.setDeposit(new BigDecimal("100.00"));
+        example1.setAmount(new BigDecimal("999.00"));
+        example1.setCollectionAmount(new BigDecimal("899.00"));
+        example1.setRemark("客户备注信息");
+        example1.setTrackingNo("SF1234567890");
+        example1.setShipDate(new Date());
+        example1.setCourierCompany("顺丰快递");
+        example1.setRefundAmount(new BigDecimal("0.00"));
+        example1.setOrderType("普通订单");
+        example1.setAuditor("管理员");
+        example1.setAuditTime(new Date());
+        example1.setMemberLevel("金牌会员");
+        example1.setMemberAge(35);
+        example1.setGender("男");
+        example1.setDiseaseName("高血压");
+        example1.setProvince("北京市");
+        example1.setCity("北京市");
+        example1.setDistrict("朝阳区");
+        example1.setTown("xxx街道");
+        example1.setCustomerPhone2("010-87654321");
+        dataList.add(example1);
+
+        return util.exportExcel(dataList,"订单明细汇总");
+    }
+
+    @Log(title = "新增订单明细汇总", businessType = BusinessType.INSERT)
+    @PostMapping
+    @PreAuthorize("@ss.hasPermi('his:orderDetailSummary:add')")
+    public AjaxResult add(@RequestBody OrderDetailSummary orderDetailSummary) {
+        return toAjax(orderDetailSummaryService.insertOrderDetailSummary(orderDetailSummary));
+    }
+
+    @Log(title = "修改订单明细汇总", businessType = BusinessType.UPDATE)
+    @PutMapping
+    @PreAuthorize("@ss.hasPermi('his:orderDetailSummary:edit')")
+    public AjaxResult edit(@RequestBody OrderDetailSummary orderDetailSummary) {
+        return toAjax(orderDetailSummaryService.updateOrderDetailSummary(orderDetailSummary));
+    }
+
+    @Log(title = "删除订单明细汇总", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{externalOrderNos}")
+    @PreAuthorize("@ss.hasPermi('his:orderDetailSummary:remove')")
+    public AjaxResult remove(@PathVariable String[] externalOrderNos) {
+        return toAjax(orderDetailSummaryService.deleteOrderDetailSummaryBatch(externalOrderNos));
+    }
+}

+ 136 - 0
fs-service/src/main/java/com/fs/his/domain/OrderDetailSummary.java

@@ -0,0 +1,136 @@
+package com.fs.his.domain;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.annotation.Excel;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.Data;
+
+@Data
+public class OrderDetailSummary extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    @Excel(name = "外网订单号")
+    private String externalOrderNo;
+
+    @Excel(name = "订单编号")
+    private String orderNo;
+
+    @Excel(name = "客户编号")
+    private String customerNo;
+
+    @Excel(name = "坐席工号")
+    private String agentNo;
+
+    @Excel(name = "坐席姓名")
+    private String agentName;
+
+    @Excel(name = "坐席组")
+    private String agentGroup;
+
+    @Excel(name = "部门信息")
+    private String deptInfo;
+
+    @Excel(name = "服务人")
+    private String servicePerson;
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "成单日期", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date orderDate;
+
+    @Excel(name = "客户名称")
+    private String customerName;
+
+    @Excel(name = "客户手机")
+    private String customerMobile;
+
+    @Excel(name = "客户电话1")
+    private String customerPhone1;
+
+    @Excel(name = "当前状态")
+    private String orderStatus;
+
+    @Excel(name = "签收状态")
+    private String signStatus;
+
+    @Excel(name = "地址")
+    private String address;
+
+    @Excel(name = "订购产品")
+    private String productOrdered;
+
+    @Excel(name = "定金")
+    private BigDecimal deposit;
+
+    @Excel(name = "金额")
+    private BigDecimal amount;
+
+    @Excel(name = "代收金额")
+    private BigDecimal collectionAmount;
+
+    @Excel(name = "说明")
+    private String remark;
+
+    @Excel(name = "快递单号")
+    private String trackingNo;
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "发货日期", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date shipDate;
+
+    @Excel(name = "快递公司")
+    private String courierCompany;
+
+    @Excel(name = "退款金额")
+    private BigDecimal refundAmount;
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "退款日期", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date refundDate;
+
+    @Excel(name = "订单类型")
+    private String orderType;
+
+    @Excel(name = "审核人")
+    private String auditor;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date auditTime;
+
+    @Excel(name = "会员等级")
+    private String memberLevel;
+
+    @Excel(name = "会员年龄")
+    private Integer memberAge;
+
+    @Excel(name = "性别")
+    private String gender;
+
+    @Excel(name = "病名")
+    private String diseaseName;
+
+    @Excel(name = "省市")
+    private String province;
+
+    @Excel(name = "二级市")
+    private String city;
+
+    @Excel(name = "区县")
+    private String district;
+
+    @Excel(name = "乡镇")
+    private String town;
+
+    @Excel(name = "客户电话2")
+    private String customerPhone2;
+
+    @TableField(exist = false)
+    private String orderDateStart;
+
+    @TableField(exist = false)
+    private String orderDateEnd;
+}

+ 23 - 0
fs-service/src/main/java/com/fs/his/mapper/OrderDetailSummaryMapper.java

@@ -0,0 +1,23 @@
+package com.fs.his.mapper;
+
+import java.util.List;
+
+import com.fs.his.domain.OrderDetailSummary;
+import org.apache.ibatis.annotations.Param;
+
+public interface OrderDetailSummaryMapper {
+
+    List<OrderDetailSummary> selectOrderDetailSummaryList(OrderDetailSummary orderDetailSummary);
+
+    OrderDetailSummary selectOrderDetailSummaryByExternalOrderNo(@Param("externalOrderNo") String externalOrderNo);
+
+    int insertOrderDetailSummary(OrderDetailSummary orderDetailSummary);
+
+    int insertOrderDetailSummaryBatch(@Param("list") List<OrderDetailSummary> list);
+
+    int updateOrderDetailSummary(OrderDetailSummary orderDetailSummary);
+
+    int deleteOrderDetailSummaryByExternalOrderNo(@Param("externalOrderNo") String externalOrderNo);
+
+    int deleteOrderDetailSummaryBatch(@Param("externalOrderNos") String[] externalOrderNos);
+}

+ 24 - 0
fs-service/src/main/java/com/fs/his/service/IOrderDetailSummaryService.java

@@ -0,0 +1,24 @@
+package com.fs.his.service;
+
+import java.util.List;
+
+import com.fs.his.domain.OrderDetailSummary;
+
+public interface IOrderDetailSummaryService {
+
+    List<OrderDetailSummary> selectOrderDetailSummaryList(OrderDetailSummary orderDetailSummary);
+
+    OrderDetailSummary selectOrderDetailSummaryByExternalOrderNo(String externalOrderNo);
+
+    int insertOrderDetailSummary(OrderDetailSummary orderDetailSummary);
+
+    int insertOrderDetailSummaryBatch(List<OrderDetailSummary> list);
+
+    int updateOrderDetailSummary(OrderDetailSummary orderDetailSummary);
+
+    int deleteOrderDetailSummaryByExternalOrderNo(String externalOrderNo);
+
+    int deleteOrderDetailSummaryBatch(String[] externalOrderNos);
+
+    String importOrderDetailSummary(List<OrderDetailSummary> list, boolean updateSupport);
+}

+ 104 - 0
fs-service/src/main/java/com/fs/his/service/impl/OrderDetailSummaryServiceImpl.java

@@ -0,0 +1,104 @@
+package com.fs.his.service.impl;
+
+import java.util.List;
+
+import com.fs.common.exception.ServiceException;
+import com.fs.common.utils.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.fs.his.domain.OrderDetailSummary;
+import com.fs.his.mapper.OrderDetailSummaryMapper;
+import com.fs.his.service.IOrderDetailSummaryService;
+
+@Service
+public class OrderDetailSummaryServiceImpl implements IOrderDetailSummaryService {
+
+    @Autowired
+    private OrderDetailSummaryMapper orderDetailSummaryMapper;
+
+    @Override
+    public List<OrderDetailSummary> selectOrderDetailSummaryList(OrderDetailSummary orderDetailSummary) {
+        return orderDetailSummaryMapper.selectOrderDetailSummaryList(orderDetailSummary);
+    }
+
+    @Override
+    public OrderDetailSummary selectOrderDetailSummaryByExternalOrderNo(String externalOrderNo) {
+        return orderDetailSummaryMapper.selectOrderDetailSummaryByExternalOrderNo(externalOrderNo);
+    }
+
+    @Override
+    public int insertOrderDetailSummary(OrderDetailSummary orderDetailSummary) {
+        return orderDetailSummaryMapper.insertOrderDetailSummary(orderDetailSummary);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public int insertOrderDetailSummaryBatch(List<OrderDetailSummary> list) {
+        if (list == null || list.isEmpty()) {
+            return 0;
+        }
+        return orderDetailSummaryMapper.insertOrderDetailSummaryBatch(list);
+    }
+
+    @Override
+    public int updateOrderDetailSummary(OrderDetailSummary orderDetailSummary) {
+        return orderDetailSummaryMapper.updateOrderDetailSummary(orderDetailSummary);
+    }
+
+    @Override
+    public int deleteOrderDetailSummaryByExternalOrderNo(String externalOrderNo) {
+        return orderDetailSummaryMapper.deleteOrderDetailSummaryByExternalOrderNo(externalOrderNo);
+    }
+
+    @Override
+    public int deleteOrderDetailSummaryBatch(String[] externalOrderNos) {
+        return orderDetailSummaryMapper.deleteOrderDetailSummaryBatch(externalOrderNos);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String importOrderDetailSummary(List<OrderDetailSummary> list, boolean updateSupport) {
+        if (list == null || list.isEmpty()) {
+            throw new ServiceException("导入数据不能为空!");
+        }
+        int successNum = 0;
+        int failureNum = 0;
+        StringBuilder successMsg = new StringBuilder();
+        StringBuilder failureMsg = new StringBuilder();
+        for (OrderDetailSummary item : list) {
+            try {
+                if (StringUtils.isEmpty(item.getExternalOrderNo())) {
+                    failureNum++;
+                    failureMsg.append("<br/>").append(failureNum).append("、外网订单号为空,跳过");
+                    continue;
+                }
+                OrderDetailSummary exist = orderDetailSummaryMapper.selectOrderDetailSummaryByExternalOrderNo(item.getExternalOrderNo());
+                if (exist == null) {
+                    orderDetailSummaryMapper.insertOrderDetailSummary(item);
+                    successNum++;
+                    successMsg.append("<br/>").append(successNum).append("、外网订单号 ").append(item.getExternalOrderNo()).append(" 导入成功");
+                } else if (updateSupport) {
+                    orderDetailSummaryMapper.updateOrderDetailSummary(item);
+                    successNum++;
+                    successMsg.append("<br/>").append(successNum).append("、外网订单号 ").append(item.getExternalOrderNo()).append(" 更新成功");
+                } else {
+                    failureNum++;
+                    failureMsg.append("<br/>").append(failureNum).append("、外网订单号 ").append(item.getExternalOrderNo()).append(" 已存在");
+                }
+            } catch (Exception e) {
+                failureNum++;
+                String msg = "<br/>" + failureNum + "、外网订单号 " + item.getExternalOrderNo() + " 导入失败:" + e.getMessage();
+                failureMsg.append(msg);
+            }
+        }
+        if (failureNum > 0) {
+            failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
+            throw new ServiceException(failureMsg.toString());
+        } else {
+            successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
+        }
+        return successMsg.toString();
+    }
+}

+ 226 - 0
fs-service/src/main/resources/mapper/his/OrderDetailSummaryMapper.xml

@@ -0,0 +1,226 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fs.his.mapper.OrderDetailSummaryMapper">
+
+    <resultMap type="com.fs.his.domain.OrderDetailSummary" id="OrderDetailSummaryResult">
+        <result property="externalOrderNo" column="external_order_no"/>
+        <result property="orderNo" column="order_no"/>
+        <result property="customerNo" column="customer_no"/>
+        <result property="agentNo" column="agent_no"/>
+        <result property="agentName" column="agent_name"/>
+        <result property="agentGroup" column="agent_group"/>
+        <result property="deptInfo" column="dept_info"/>
+        <result property="servicePerson" column="service_person"/>
+        <result property="orderDate" column="order_date"/>
+        <result property="customerName" column="customer_name"/>
+        <result property="customerMobile" column="customer_mobile"/>
+        <result property="customerPhone1" column="customer_phone1"/>
+        <result property="orderStatus" column="order_status"/>
+        <result property="signStatus" column="sign_status"/>
+        <result property="address" column="address"/>
+        <result property="productOrdered" column="product_ordered"/>
+        <result property="deposit" column="deposit"/>
+        <result property="amount" column="amount"/>
+        <result property="collectionAmount" column="collection_amount"/>
+        <result property="remark" column="remark"/>
+        <result property="trackingNo" column="tracking_no"/>
+        <result property="shipDate" column="ship_date"/>
+        <result property="courierCompany" column="courier_company"/>
+        <result property="refundAmount" column="refund_amount"/>
+        <result property="refundDate" column="refund_date"/>
+        <result property="orderType" column="order_type"/>
+        <result property="auditor" column="auditor"/>
+        <result property="auditTime" column="audit_time"/>
+        <result property="memberLevel" column="member_level"/>
+        <result property="memberAge" column="member_age"/>
+        <result property="gender" column="gender"/>
+        <result property="diseaseName" column="disease_name"/>
+        <result property="province" column="province"/>
+        <result property="city" column="city"/>
+        <result property="district" column="district"/>
+        <result property="town" column="town"/>
+        <result property="customerPhone2" column="customer_phone2"/>
+    </resultMap>
+
+    <sql id="selectOrderDetailSummaryVo">
+        select external_order_no, order_no, customer_no, agent_no, agent_name, agent_group, dept_info, service_person, order_date, customer_name, customer_mobile, customer_phone1, order_status, sign_status, address, product_ordered, deposit, amount, collection_amount, remark, tracking_no, ship_date, courier_company, refund_amount, refund_date, order_type, auditor, audit_time, member_level, member_age, gender, disease_name, province, city, district, town, customer_phone2 from order_detail_summary
+    </sql>
+
+    <select id="selectOrderDetailSummaryList" parameterType="com.fs.his.domain.OrderDetailSummary" resultMap="OrderDetailSummaryResult">
+        <include refid="selectOrderDetailSummaryVo"/>
+        <where>
+            <if test="externalOrderNo != null and externalOrderNo != ''">and external_order_no = #{externalOrderNo}</if>
+            <if test="orderNo != null and orderNo != ''">and order_no = #{orderNo}</if>
+            <if test="customerNo != null and customerNo != ''">and customer_no = #{customerNo}</if>
+            <if test="agentNo != null and agentNo != ''">and agent_no = #{agentNo}</if>
+            <if test="agentName != null and agentName != ''">and agent_name like concat('%', #{agentName}, '%')</if>
+            <if test="agentGroup != null and agentGroup != ''">and agent_group = #{agentGroup}</if>
+            <if test="deptInfo != null and deptInfo != ''">and dept_info like concat('%', #{deptInfo}, '%')</if>
+            <if test="servicePerson != null and servicePerson != ''">and service_person like concat('%', #{servicePerson}, '%')</if>
+            <if test="orderDateStart != null and orderDateStart != '' and orderDateEnd != null and orderDateEnd != ''">
+                and order_date between #{orderDateStart} and #{orderDateEnd}
+            </if>
+            <if test="customerName != null and customerName != ''">and customer_name like concat('%', #{customerName}, '%')</if>
+            <if test="customerMobile != null and customerMobile != ''">and customer_mobile = #{customerMobile}</if>
+            <if test="orderStatus != null and orderStatus != ''">and order_status = #{orderStatus}</if>
+            <if test="signStatus != null and signStatus != ''">and sign_status = #{signStatus}</if>
+            <if test="orderType != null and orderType != ''">and order_type = #{orderType}</if>
+            <if test="province != null and province != ''">and province = #{province}</if>
+            <if test="city != null and city != ''">and city = #{city}</if>
+            <if test="district != null and district != ''">and district = #{district}</if>
+        </where>
+        order by order_date desc
+    </select>
+
+    <select id="selectOrderDetailSummaryByExternalOrderNo" parameterType="String" resultMap="OrderDetailSummaryResult">
+        <include refid="selectOrderDetailSummaryVo"/>
+        where external_order_no = #{externalOrderNo}
+    </select>
+
+    <insert id="insertOrderDetailSummary" parameterType="com.fs.his.domain.OrderDetailSummary">
+        insert into order_detail_summary
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="externalOrderNo != null and externalOrderNo != ''">external_order_no,</if>
+            <if test="orderNo != null and orderNo != ''">order_no,</if>
+            <if test="customerNo != null and customerNo != ''">customer_no,</if>
+            <if test="agentNo != null and agentNo != ''">agent_no,</if>
+            <if test="agentName != null and agentName != ''">agent_name,</if>
+            <if test="agentGroup != null and agentGroup != ''">agent_group,</if>
+            <if test="deptInfo != null and deptInfo != ''">dept_info,</if>
+            <if test="servicePerson != null and servicePerson != ''">service_person,</if>
+            <if test="orderDate != null">order_date,</if>
+            <if test="customerName != null and customerName != ''">customer_name,</if>
+            <if test="customerMobile != null and customerMobile != ''">customer_mobile,</if>
+            <if test="customerPhone1 != null and customerPhone1 != ''">customer_phone1,</if>
+            <if test="orderStatus != null and orderStatus != ''">order_status,</if>
+            <if test="signStatus != null and signStatus != ''">sign_status,</if>
+            <if test="address != null and address != ''">address,</if>
+            <if test="productOrdered != null and productOrdered != ''">product_ordered,</if>
+            <if test="deposit != null">deposit,</if>
+            <if test="amount != null">amount,</if>
+            <if test="collectionAmount != null">collection_amount,</if>
+            <if test="remark != null">remark,</if>
+            <if test="trackingNo != null and trackingNo != ''">tracking_no,</if>
+            <if test="shipDate != null">ship_date,</if>
+            <if test="courierCompany != null and courierCompany != ''">courier_company,</if>
+            <if test="refundAmount != null">refund_amount,</if>
+            <if test="refundDate != null">refund_date,</if>
+            <if test="orderType != null and orderType != ''">order_type,</if>
+            <if test="auditor != null and auditor != ''">auditor,</if>
+            <if test="auditTime != null">audit_time,</if>
+            <if test="memberLevel != null and memberLevel != ''">member_level,</if>
+            <if test="memberAge != null">member_age,</if>
+            <if test="gender != null and gender != ''">gender,</if>
+            <if test="diseaseName != null and diseaseName != ''">disease_name,</if>
+            <if test="province != null and province != ''">province,</if>
+            <if test="city != null and city != ''">city,</if>
+            <if test="district != null and district != ''">district,</if>
+            <if test="town != null and town != ''">town,</if>
+            <if test="customerPhone2 != null and customerPhone2 != ''">customer_phone2,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="externalOrderNo != null and externalOrderNo != ''">#{externalOrderNo},</if>
+            <if test="orderNo != null and orderNo != ''">#{orderNo},</if>
+            <if test="customerNo != null and customerNo != ''">#{customerNo},</if>
+            <if test="agentNo != null and agentNo != ''">#{agentNo},</if>
+            <if test="agentName != null and agentName != ''">#{agentName},</if>
+            <if test="agentGroup != null and agentGroup != ''">#{agentGroup},</if>
+            <if test="deptInfo != null and deptInfo != ''">#{deptInfo},</if>
+            <if test="servicePerson != null and servicePerson != ''">#{servicePerson},</if>
+            <if test="orderDate != null">#{orderDate},</if>
+            <if test="customerName != null and customerName != ''">#{customerName},</if>
+            <if test="customerMobile != null and customerMobile != ''">#{customerMobile},</if>
+            <if test="customerPhone1 != null and customerPhone1 != ''">#{customerPhone1},</if>
+            <if test="orderStatus != null and orderStatus != ''">#{orderStatus},</if>
+            <if test="signStatus != null and signStatus != ''">#{signStatus},</if>
+            <if test="address != null and address != ''">#{address},</if>
+            <if test="productOrdered != null and productOrdered != ''">#{productOrdered},</if>
+            <if test="deposit != null">#{deposit},</if>
+            <if test="amount != null">#{amount},</if>
+            <if test="collectionAmount != null">#{collectionAmount},</if>
+            <if test="remark != null">#{remark},</if>
+            <if test="trackingNo != null and trackingNo != ''">#{trackingNo},</if>
+            <if test="shipDate != null">#{shipDate},</if>
+            <if test="courierCompany != null and courierCompany != ''">#{courierCompany},</if>
+            <if test="refundAmount != null">#{refundAmount},</if>
+            <if test="refundDate != null">#{refundDate},</if>
+            <if test="orderType != null and orderType != ''">#{orderType},</if>
+            <if test="auditor != null and auditor != ''">#{auditor},</if>
+            <if test="auditTime != null">#{auditTime},</if>
+            <if test="memberLevel != null and memberLevel != ''">#{memberLevel},</if>
+            <if test="memberAge != null">#{memberAge},</if>
+            <if test="gender != null and gender != ''">#{gender},</if>
+            <if test="diseaseName != null and diseaseName != ''">#{diseaseName},</if>
+            <if test="province != null and province != ''">#{province},</if>
+            <if test="city != null and city != ''">#{city},</if>
+            <if test="district != null and district != ''">#{district},</if>
+            <if test="town != null and town != ''">#{town},</if>
+            <if test="customerPhone2 != null and customerPhone2 != ''">#{customerPhone2},</if>
+        </trim>
+    </insert>
+
+    <insert id="insertOrderDetailSummaryBatch" parameterType="java.util.List">
+        insert into order_detail_summary(external_order_no, order_no, customer_no, agent_no, agent_name, agent_group, dept_info, service_person, order_date, customer_name, customer_mobile, customer_phone1, order_status, sign_status, address, product_ordered, deposit, amount, collection_amount, remark, tracking_no, ship_date, courier_company, refund_amount, refund_date, order_type, auditor, audit_time, member_level, member_age, gender, disease_name, province, city, district, town, customer_phone2)
+        values
+        <foreach collection="list" item="item" separator=",">
+            (#{item.externalOrderNo}, #{item.orderNo}, #{item.customerNo}, #{item.agentNo}, #{item.agentName}, #{item.agentGroup}, #{item.deptInfo}, #{item.servicePerson}, #{item.orderDate}, #{item.customerName}, #{item.customerMobile}, #{item.customerPhone1}, #{item.orderStatus}, #{item.signStatus}, #{item.address}, #{item.productOrdered}, #{item.deposit}, #{item.amount}, #{item.collectionAmount}, #{item.remark}, #{item.trackingNo}, #{item.shipDate}, #{item.courierCompany}, #{item.refundAmount}, #{item.refundDate}, #{item.orderType}, #{item.auditor}, #{item.auditTime}, #{item.memberLevel}, #{item.memberAge}, #{item.gender}, #{item.diseaseName}, #{item.province}, #{item.city}, #{item.district}, #{item.town}, #{item.customerPhone2})
+        </foreach>
+    </insert>
+
+    <update id="updateOrderDetailSummary" parameterType="com.fs.his.domain.OrderDetailSummary">
+        update order_detail_summary
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="orderNo != null and orderNo != ''">order_no = #{orderNo},</if>
+            <if test="customerNo != null and customerNo != ''">customer_no = #{customerNo},</if>
+            <if test="agentNo != null and agentNo != ''">agent_no = #{agentNo},</if>
+            <if test="agentName != null and agentName != ''">agent_name = #{agentName},</if>
+            <if test="agentGroup != null and agentGroup != ''">agent_group = #{agentGroup},</if>
+            <if test="deptInfo != null and deptInfo != ''">dept_info = #{deptInfo},</if>
+            <if test="servicePerson != null and servicePerson != ''">service_person = #{servicePerson},</if>
+            <if test="orderDate != null">order_date = #{orderDate},</if>
+            <if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
+            <if test="customerMobile != null and customerMobile != ''">customer_mobile = #{customerMobile},</if>
+            <if test="customerPhone1 != null and customerPhone1 != ''">customer_phone1 = #{customerPhone1},</if>
+            <if test="orderStatus != null and orderStatus != ''">order_status = #{orderStatus},</if>
+            <if test="signStatus != null and signStatus != ''">sign_status = #{signStatus},</if>
+            <if test="address != null and address != ''">address = #{address},</if>
+            <if test="productOrdered != null and productOrdered != ''">product_ordered = #{productOrdered},</if>
+            <if test="deposit != null">deposit = #{deposit},</if>
+            <if test="amount != null">amount = #{amount},</if>
+            <if test="collectionAmount != null">collection_amount = #{collectionAmount},</if>
+            <if test="remark != null">remark = #{remark},</if>
+            <if test="trackingNo != null and trackingNo != ''">tracking_no = #{trackingNo},</if>
+            <if test="shipDate != null">ship_date = #{shipDate},</if>
+            <if test="courierCompany != null and courierCompany != ''">courier_company = #{courierCompany},</if>
+            <if test="refundAmount != null">refund_amount = #{refundAmount},</if>
+            <if test="refundDate != null">refund_date = #{refundDate},</if>
+            <if test="orderType != null and orderType != ''">order_type = #{orderType},</if>
+            <if test="auditor != null and auditor != ''">auditor = #{auditor},</if>
+            <if test="auditTime != null">audit_time = #{auditTime},</if>
+            <if test="memberLevel != null and memberLevel != ''">member_level = #{memberLevel},</if>
+            <if test="memberAge != null">member_age = #{memberAge},</if>
+            <if test="gender != null and gender != ''">gender = #{gender},</if>
+            <if test="diseaseName != null and diseaseName != ''">disease_name = #{diseaseName},</if>
+            <if test="province != null and province != ''">province = #{province},</if>
+            <if test="city != null and city != ''">city = #{city},</if>
+            <if test="district != null and district != ''">district = #{district},</if>
+            <if test="town != null and town != ''">town = #{town},</if>
+            <if test="customerPhone2 != null and customerPhone2 != ''">customer_phone2 = #{customerPhone2},</if>
+        </trim>
+        where external_order_no = #{externalOrderNo}
+    </update>
+
+    <delete id="deleteOrderDetailSummaryByExternalOrderNo" parameterType="String">
+        delete from order_detail_summary where external_order_no = #{externalOrderNo}
+    </delete>
+
+    <delete id="deleteOrderDetailSummaryBatch" parameterType="String">
+        delete from order_detail_summary where external_order_no in
+        <foreach item="externalOrderNo" collection="externalOrderNos" open="(" separator="," close=")">
+            #{externalOrderNo}
+        </foreach>
+    </delete>
+
+</mapper>