فهرست منبع

销售端新增客户信息表业务代码

cgp 1 روز پیش
والد
کامیت
442ead6e85

+ 122 - 0
fs-company/src/main/java/com/fs/company/controller/qw/FsCompanyCustomerController.java

@@ -0,0 +1,122 @@
+package com.fs.company.controller.qw;
+
+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.exception.CustomException;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.company.domain.CompanyUser;
+import com.fs.company.mapper.CompanyUserRoleMapper;
+import com.fs.company.service.ICompanyUserService;
+import com.fs.framework.security.LoginUser;
+import com.fs.framework.security.SecurityUtils;
+import com.fs.qw.domain.FsCompanyCustomer;
+import com.fs.qw.service.IFsCompanyCustomerService;
+import com.fs.qw.vo.CompanyUserAndDoctorVO;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.checkerframework.checker.index.qual.SameLen;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 客户基础信息Controller
+ *
+ * @author cgp
+ * @date 2026-04-30
+ */
+@Slf4j
+@RestController
+@RequestMapping("/qw/companyCustomer")
+public class FsCompanyCustomerController extends BaseController {
+
+    @Autowired
+    private IFsCompanyCustomerService fsCompanyCustomerService;
+
+    @Autowired
+    private ICompanyUserService companyUserService;
+
+    @Autowired
+    private CompanyUserRoleMapper roleMapper;
+
+    /**
+     * 查询客户列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(FsCompanyCustomer fsCompanyCustomer) {
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        fsCompanyCustomer.setCompanyUserId(loginUser.getUser().getUserId());
+        //管理员查看所有数据
+        Long isAdmin = roleMapper.companyUserIsAdmin(fsCompanyCustomer.getCompanyUserId());
+        if (isAdmin != null) {
+            fsCompanyCustomer.setCompanyUserId(null);
+        }
+        PageHelper.startPage(fsCompanyCustomer.getPageNum(), fsCompanyCustomer.getPageSize());
+        List<FsCompanyCustomer> list = fsCompanyCustomerService.selectFsCompanyCustomerList(fsCompanyCustomer);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出客户信息
+     */
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, FsCompanyCustomer fsCompanyCustomer) {
+        List<FsCompanyCustomer> list = fsCompanyCustomerService.selectFsCompanyCustomerList(fsCompanyCustomer);
+        ExcelUtil<FsCompanyCustomer> util = new ExcelUtil<>(FsCompanyCustomer.class);
+        try {
+            util.exportExcel(response, list, "客户信息数据");
+        }catch (Exception e){
+            log.error("导出客户信息数据异常",e);
+            throw new CustomException("客户信息数据异常");
+        }
+
+    }
+
+    /**
+     * 获取客户详情
+     */
+    @GetMapping("/{id}")
+    public AjaxResult getInfo(@PathVariable Long id) {
+        return AjaxResult.success(fsCompanyCustomerService.selectFsCompanyCustomerById(id));
+    }
+
+    /**
+     * 新增客户
+     */
+    @PostMapping
+    public AjaxResult add(@RequestBody FsCompanyCustomer fsCompanyCustomer) {
+        return toAjax(fsCompanyCustomerService.insertFsCompanyCustomer(fsCompanyCustomer));
+    }
+
+    /**
+     * 修改客户
+     */
+    @PutMapping
+    public AjaxResult edit(@RequestBody FsCompanyCustomer fsCompanyCustomer) {
+        return toAjax(fsCompanyCustomerService.updateFsCompanyCustomer(fsCompanyCustomer));
+    }
+
+    /**
+     * 删除客户
+     */
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(fsCompanyCustomerService.deleteFsCompanyCustomerByIds(ids));
+    }
+
+    /**
+     * 获取当前登录销售id信息以及绑定的医生信息
+     * */
+    @GetMapping("/getCompanyUserAndDoctor")
+    public AjaxResult getSaleAndDoctor(){
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        Long companyUserId = loginUser.getUser().getUserId();
+        CompanyUserAndDoctorVO companyUserAndDoctorVO = companyUserService.getCompanyUserAndDoctor(companyUserId);
+        return AjaxResult.success(companyUserAndDoctorVO);
+    }
+
+}

+ 4 - 0
fs-service/src/main/java/com/fs/company/service/ICompanyUserService.java

@@ -10,6 +10,7 @@ import com.fs.his.vo.CitysAreaVO;
 import com.fs.his.vo.OptionsVO;
 import com.fs.hisStore.vo.FsStoreProductExportVO;
 import com.fs.qw.dto.UserProjectDTO;
+import com.fs.qw.vo.CompanyUserAndDoctorVO;
 import com.fs.qw.vo.CompanyUserQwVO;
 import com.fs.qw.vo.QwOptionsVO;
 import com.fs.qw.vo.QwUserVO;
@@ -246,4 +247,7 @@ public interface ICompanyUserService {
     R getBindInfo(Long companyUserId);
 
     Boolean bindCompanyUserReplyTxt(String replyText, List<Long> userIds);
+
+    //根据销售id获取销售绑定的医生信息
+    CompanyUserAndDoctorVO getCompanyUserAndDoctor(Long companyUserId);
 }

+ 31 - 2
fs-service/src/main/java/com/fs/company/service/impl/CompanyUserServiceImpl.java

@@ -1,13 +1,11 @@
 package com.fs.company.service.impl;
 
-import cn.hutool.core.collection.ListUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
 import com.fs.common.BeanCopyUtils;
 import com.fs.common.QRutils;
 import com.fs.common.annotation.DataScope;
 import com.fs.common.constant.UserConstants;
-import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.redis.RedisCache;
 import com.fs.common.exception.CustomException;
@@ -27,6 +25,8 @@ import com.fs.company.service.ICompanyUserService;
 import com.fs.company.vo.*;
 import com.fs.course.service.IFsUserCompanyUserQwService;
 import com.fs.course.service.IFsUserCompanyUserService;
+import com.fs.his.domain.FsDoctor;
+import com.fs.his.mapper.FsDoctorMapper;
 import com.fs.his.mapper.FsUserMapper;
 import com.fs.his.service.IFsCityService;
 import com.fs.his.vo.CitysAreaVO;
@@ -40,6 +40,7 @@ import com.fs.qw.domain.QwUser;
 import com.fs.qw.dto.UserProjectDTO;
 import com.fs.qw.mapper.QwUserMapper;
 import com.fs.qw.service.IQwUserService;
+import com.fs.qw.vo.CompanyUserAndDoctorVO;
 import com.fs.qw.vo.CompanyUserQwVO;
 import com.fs.qw.vo.QwOptionsVO;
 import com.fs.qw.vo.QwUserVO;
@@ -47,6 +48,7 @@ import com.fs.system.oss.CloudStorageService;
 import com.fs.system.oss.OSSFactory;
 import com.fs.voice.utils.StringUtil;
 import com.fs.wxUser.domain.CompanyWxUser;
+import lombok.extern.slf4j.Slf4j;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -67,6 +69,7 @@ import java.util.stream.Collectors;
  * @author fs
  * @date 2021-05-25
  */
+@Slf4j
 @Service
 public class CompanyUserServiceImpl implements ICompanyUserService
 {
@@ -115,6 +118,9 @@ public class CompanyUserServiceImpl implements ICompanyUserService
     @Autowired
     private IQwUserService qwUserService;
 
+    @Autowired
+    private FsDoctorMapper doctorMapper;
+
     /**
      * 查询物业公司管理员信息
      *
@@ -1072,4 +1078,27 @@ public class CompanyUserServiceImpl implements ICompanyUserService
         }
         return true;
     }
+
+    @Override
+    public CompanyUserAndDoctorVO getCompanyUserAndDoctor(Long companyUserId) {
+        if (companyUserId==null){
+            throw new ServiceException("销售人员不存在");
+        }
+
+        CompanyUser companyUser = companyUserService.selectCompanyUserById(companyUserId);
+        if (companyUser==null){
+            throw new ServiceException("销售人员不存在");
+        }
+        CompanyUserAndDoctorVO companyUserAndDoctorVO=new CompanyUserAndDoctorVO();
+        companyUserAndDoctorVO.setCompanyUserId(companyUser.getUserId());
+        companyUserAndDoctorVO.setCompanyUserName(companyUser.getUserName());
+        FsDoctor fsDoctor = doctorMapper.selectFsDoctorByDoctorId(companyUser.getDoctorId());
+        if (fsDoctor==null){
+            log.error("销售人员所绑定的医生不存在,销售companyUserId:{}",companyUserId);
+            return companyUserAndDoctorVO;
+        }
+        companyUserAndDoctorVO.setDoctorId(fsDoctor.getDoctorId());
+        companyUserAndDoctorVO.setDoctorName(fsDoctor.getDoctorName());
+        return companyUserAndDoctorVO;
+    }
 }

+ 3 - 0
fs-service/src/main/java/com/fs/his/mapper/FsDoctorMapper.java

@@ -184,6 +184,9 @@ public interface FsDoctorMapper
     //根据入参类型随机返回一个在线药师
     List<FsDoctor> selectRandomOnlineDoctorForPackage();
 
+    //根据ids集合查询
+    List<FsDoctor> selectDoctorByIds(@Param("ids") List<Long> ids);
+
     @Select("select doctor_id from fs_doctor where doctor_type=1 and  `status`=1 and is_audit=1 and is_agreement_prescribe_doctor=1  and sign_url is not null")
     List<Long>  selectFsDoctorDoctorByPackage();
 

+ 5 - 0
fs-service/src/main/java/com/fs/his/mapper/FsPrescribeMapper.java

@@ -339,4 +339,9 @@ public interface FsPrescribeMapper
      * 根据采集信息主键id查询最新审核通过的处方信息
      * */
     FsPrescribe selectNewestAuditedPrescribeByCollectionId(@Param("collectionId") Long collectionId);
+
+    /**
+     * 根据处方id集合批量查询
+     * */
+    List<FsPrescribe> selectFsPrescribeListByPrescribeIds(@Param("prescribeIds") List<Long> prescribeIds);
 }

+ 73 - 2
fs-service/src/main/java/com/fs/hisStore/service/impl/FsUserInformationCollectionServiceImpl.java

@@ -1740,13 +1740,84 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         queryDto.setCompleteStatus(1);//已完善信息标识
         queryDto.setQwTag(1);//个微标识
         PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize());
-        List<FsUserInformationCollectionOverviewVo> resultList=fsUserInformationCollectionMapper.selectUserInformationCollectionOverviewByPage(queryDto);
-        if (CollectionUtils.isEmpty(resultList)){
+        List<FsUserInformationCollectionOverviewVo> resultList = fsUserInformationCollectionMapper.selectUserInformationCollectionOverviewByPage(queryDto);
+        if (CollectionUtils.isEmpty(resultList)) {
             return Collections.emptyList();
         }
+        // 填充药师信息(处方对应药师)
+        fillPharmacistInfo(resultList);
         return resultList;
     }
 
+    /**
+     * 填充结果列表中的药师ID与姓名
+     */
+    private void fillPharmacistInfo(List<FsUserInformationCollectionOverviewVo> resultList) {
+        if (CollectionUtils.isEmpty(resultList)) {
+            return;
+        }
+        // 1. 收集非空的处方ID
+        List<Long> prescribeIds = resultList.stream()
+                .map(FsUserInformationCollectionOverviewVo::getPrescribeId)
+                .filter(Objects::nonNull)
+                .distinct()
+                .collect(Collectors.toList());
+        if (prescribeIds.isEmpty()) {
+            return;
+        }
+
+        // 2. 查询处方表(只需 prescribe_id 和 drug_doctor_id)
+        List<FsPrescribe> prescribeList = fsPrescribeMapper.selectFsPrescribeListByPrescribeIds(prescribeIds);
+        if (CollectionUtils.isEmpty(prescribeList)) {
+            return;
+        }
+
+        // 3. 构建 处方ID -> 药师ID 的映射
+        Map<Long, Long> prescribeToDoctorIdMap = prescribeList.stream()
+                .collect(Collectors.toMap(
+                        FsPrescribe::getPrescribeId,
+                        FsPrescribe::getDrugDoctorId,
+                        (existing, replacement) -> existing
+                ));
+
+        // 4. 收集所有药师ID(去重)
+        List<Long> doctorIds = prescribeList.stream()
+                .map(FsPrescribe::getDrugDoctorId)
+                .filter(Objects::nonNull)
+                .distinct()
+                .collect(Collectors.toList());
+        if (doctorIds.isEmpty()) {
+            return;
+        }
+
+        // 5. 批量查询医生(药师)信息
+        List<FsDoctor> doctorList = doctorMapper.selectDoctorByIds(doctorIds);
+        if (CollectionUtils.isEmpty(doctorList)) {
+            return;
+        }
+        Map<Long, FsDoctor> doctorMap = doctorList.stream()
+                .collect(Collectors.toMap(
+                        FsDoctor::getDoctorId,
+                        Function.identity(),
+                        (existing, replacement) -> existing
+                ));
+
+        // 6. 回填药师ID与姓名
+        resultList.forEach(vo -> {
+            Long prescribeId = vo.getPrescribeId();
+            if (prescribeId != null) {
+                Long doctorId = prescribeToDoctorIdMap.get(prescribeId);
+                if (doctorId != null) {
+                    vo.setPharmacistId(doctorId.toString()); // 字段类型注意转换
+                    FsDoctor doctor = doctorMap.get(doctorId);
+                    if (doctor != null) {
+                        vo.setPharmacistName(doctor.getDoctorName());
+                    }
+                }
+            }
+        });
+    }
+
     @Override
     @Transactional
     public Long bindCollectionPackage(bindCollectionPackageParam param) {

+ 7 - 0
fs-service/src/main/java/com/fs/hisStore/vo/FsUserInformationCollectionOverviewVo.java

@@ -62,6 +62,13 @@ public class FsUserInformationCollectionOverviewVo {
     @Excel(name = "医生姓名")
     private String doctorName;
 
+    /** 药师Id */
+    private String pharmacistId;
+
+    /** 药师姓名 */
+    @Excel(name = "药师姓名")
+    private String pharmacistName;
+
     /** 销售人员姓名 */
     @Excel(name = "销售人员姓名")
     private String companyUserName;

+ 82 - 0
fs-service/src/main/java/com/fs/qw/domain/FsCompanyCustomer.java

@@ -0,0 +1,82 @@
+package com.fs.qw.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.annotation.Excel;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 客户基础信息对象 fs_company_customer
+ *
+ * @author yourname
+ * @date 2026-04-30
+ */
+@Data
+public class FsCompanyCustomer extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /** 客户ID */
+    private Long id;
+
+    /** 客户姓名 */
+    @Excel(name = "客户姓名")
+    private String customerName;
+
+    /** 性别(0女 1男 2未知) */
+    @Excel(name = "性别", readConverterExp = "0=女,1=男,2=未知")
+    private String sex;
+
+    /** 年龄 */
+    @Excel(name = "年龄")
+    private Integer age;
+
+    /** 地址(精确到市) */
+    @Excel(name = "地址")
+    private String address;
+
+    /** 电话 */
+    @Excel(name = "电话")
+    private String phone;
+
+    /** 建档时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "建档时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date filingTime;
+
+    /** 销售id */
+    private Long companyUserId;
+
+    /** 销售姓名 */
+    @Excel(name = "客服姓名")
+    private String companyUserName;
+
+    /** 约诊时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "约诊时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date appointmentTime;
+
+    /** 负责医生id */
+    private Long doctorId;
+
+    /** 负责医生 */
+    @Excel(name = "负责医生")
+    private String doctorName;
+
+    /** 现病史 */
+    @Excel(name = "现病史")
+    private String presentIllness;
+
+    /** 现用药情况 */
+    @Excel(name = "现用药情况")
+    private String currentMedication;
+
+    /** 过敏史 */
+    @Excel(name = "过敏史")
+    private String allergyHistory;
+
+    // 分页相关
+    private Integer pageNum;
+    private Integer pageSize;
+}

+ 42 - 0
fs-service/src/main/java/com/fs/qw/mapper/FsCompanyCustomerMapper.java

@@ -0,0 +1,42 @@
+package com.fs.qw.mapper;
+
+import com.fs.qw.domain.FsCompanyCustomer;
+import java.util.List;
+
+/**
+ * 客户基础信息Mapper接口
+ *
+ * @author yourname
+ * @date 2026-04-30
+ */
+public interface FsCompanyCustomerMapper {
+    /**
+     * 查询客户信息
+     */
+    public FsCompanyCustomer selectFsCompanyCustomerById(Long id);
+
+    /**
+     * 查询客户信息列表
+     */
+    public List<FsCompanyCustomer> selectFsCompanyCustomerList(FsCompanyCustomer fsCompanyCustomer);
+
+    /**
+     * 新增客户信息
+     */
+    public int insertFsCompanyCustomer(FsCompanyCustomer fsCompanyCustomer);
+
+    /**
+     * 修改客户信息
+     */
+    public int updateFsCompanyCustomer(FsCompanyCustomer fsCompanyCustomer);
+
+    /**
+     * 删除客户信息(逻辑删除)
+     */
+    public int deleteFsCompanyCustomerById(Long id);
+
+    /**
+     * 批量删除客户信息(逻辑删除)
+     */
+    public int deleteFsCompanyCustomerByIds(Long[] ids);
+}

+ 22 - 0
fs-service/src/main/java/com/fs/qw/service/IFsCompanyCustomerService.java

@@ -0,0 +1,22 @@
+package com.fs.qw.service;
+
+import com.fs.qw.domain.FsCompanyCustomer;
+import java.util.List;
+
+/**
+ * 客户基础信息Service接口
+ *
+ * @author yourname
+ * @date 2026-04-30
+ */
+public interface IFsCompanyCustomerService {
+    FsCompanyCustomer selectFsCompanyCustomerById(Long id);
+
+    List<FsCompanyCustomer> selectFsCompanyCustomerList(FsCompanyCustomer fsCompanyCustomer);
+
+    int insertFsCompanyCustomer(FsCompanyCustomer fsCompanyCustomer);
+
+    int updateFsCompanyCustomer(FsCompanyCustomer fsCompanyCustomer);
+
+    int deleteFsCompanyCustomerByIds(Long[] ids);
+}

+ 46 - 0
fs-service/src/main/java/com/fs/qw/service/impl/FsCompanyCustomerServiceImpl.java

@@ -0,0 +1,46 @@
+package com.fs.qw.service.impl;
+
+import com.fs.qw.domain.FsCompanyCustomer;
+import com.fs.qw.mapper.FsCompanyCustomerMapper;
+import com.fs.qw.service.IFsCompanyCustomerService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 客户基础信息Service业务层处理
+ *
+ * @author yourname
+ * @date 2026-04-30
+ */
+@Service
+public class FsCompanyCustomerServiceImpl implements IFsCompanyCustomerService {
+    @Autowired
+    private FsCompanyCustomerMapper fsCompanyCustomerMapper;
+
+    @Override
+    public FsCompanyCustomer selectFsCompanyCustomerById(Long id) {
+        return fsCompanyCustomerMapper.selectFsCompanyCustomerById(id);
+    }
+
+    @Override
+    public List<FsCompanyCustomer> selectFsCompanyCustomerList(FsCompanyCustomer fsCompanyCustomer) {
+        return fsCompanyCustomerMapper.selectFsCompanyCustomerList(fsCompanyCustomer);
+    }
+
+    @Override
+    public int insertFsCompanyCustomer(FsCompanyCustomer fsCompanyCustomer) {
+        return fsCompanyCustomerMapper.insertFsCompanyCustomer(fsCompanyCustomer);
+    }
+
+    @Override
+    public int updateFsCompanyCustomer(FsCompanyCustomer fsCompanyCustomer) {
+        return fsCompanyCustomerMapper.updateFsCompanyCustomer(fsCompanyCustomer);
+    }
+
+    @Override
+    public int deleteFsCompanyCustomerByIds(Long[] ids) {
+        return fsCompanyCustomerMapper.deleteFsCompanyCustomerByIds(ids);
+    }
+}

+ 11 - 0
fs-service/src/main/java/com/fs/qw/vo/CompanyUserAndDoctorVO.java

@@ -0,0 +1,11 @@
+package com.fs.qw.vo;
+
+import lombok.Data;
+
+@Data
+public class CompanyUserAndDoctorVO {
+    private Long CompanyUserId;
+    private String CompanyUserName;
+    private Long DoctorId;
+    private String DoctorName;
+}

+ 9 - 0
fs-service/src/main/resources/mapper/his/FsDoctorMapper.xml

@@ -125,6 +125,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{doctorId}
         </foreach>
     </select>
+
+    <select id="selectDoctorByIds" resultMap="FsDoctorResult">
+        <include refid="selectFsDoctorVo"/>
+        WHERE doctor_id IN
+        <foreach collection="ids" item="doctorId" open="(" close=")" separator=",">
+            #{doctorId}
+        </foreach>
+    </select>
+
     <select id="selectRandomOnlineDoctorForPackage" resultMap="FsDoctorResult">
         SELECT d.*
         FROM fs_doctor d

+ 10 - 0
fs-service/src/main/resources/mapper/his/FsPrescribeMapper.xml

@@ -582,6 +582,16 @@
         LIMIT 1
     </select>
 
+    <select id="selectFsPrescribeListByPrescribeIds" resultType="com.fs.his.domain.FsPrescribe">
+        select *
+        from fs_prescribe
+        where
+        prescribe_id in
+        <foreach collection="prescribeIds" item="prescribeId" separator="," open="(" close=")">
+            #{prescribeId}
+        </foreach>
+    </select>
+
     <update id="updateFsPrescribeListDataCPWByPrescribeIds" parameterType="java.util.List">
         update fs_prescribe
         set

+ 116 - 0
fs-service/src/main/resources/mapper/qw/FsCompanyCustomerMapper.xml

@@ -0,0 +1,116 @@
+<?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.qw.mapper.FsCompanyCustomerMapper">
+
+    <resultMap type="com.fs.qw.domain.FsCompanyCustomer" id="FsCompanyCustomerResult">
+        <result property="id"                column="id"                 />
+        <result property="customerName"      column="customer_name"      />
+        <result property="sex"               column="sex"                />
+        <result property="age"               column="age"                />
+        <result property="address"           column="address"            />
+        <result property="phone"             column="phone"              />
+        <result property="filingTime"        column="filing_time"        />
+        <result property="companyUserId"     column="company_user_id"    />
+        <result property="companyUserName"   column="company_user_name"  />
+        <result property="appointmentTime"   column="appointment_time"   />
+        <result property="doctorId"          column="doctor_id"          />
+        <result property="doctorName"        column="doctor_name"        />
+        <result property="presentIllness"    column="present_illness"    />
+        <result property="currentMedication" column="current_medication" />
+        <result property="allergyHistory"    column="allergy_history"    />
+        <result property="createBy"          column="create_by"          />
+        <result property="createTime"        column="create_time"        />
+        <result property="updateBy"          column="update_by"          />
+        <result property="updateTime"        column="update_time"        />
+        <result property="remark"            column="remark"             />
+    </resultMap>
+
+    <sql id="selectFsCompanyCustomerVo">
+        select id, customer_name, sex, age, address, phone, filing_time,
+               company_user_id, company_user_name, appointment_time, doctor_id, doctor_name,
+               present_illness, current_medication, allergy_history,
+               create_by, create_time, update_by, update_time, remark, del_flag
+        from fs_company_customer
+    </sql>
+
+    <select id="selectFsCompanyCustomerList" parameterType="com.fs.qw.domain.FsCompanyCustomer" resultMap="FsCompanyCustomerResult">
+        <include refid="selectFsCompanyCustomerVo"/>
+        where del_flag = '0'
+        <if test="customerName != null and customerName != ''">
+            and customer_name like concat('%', #{customerName}, '%')
+        </if>
+        <if test="phone != null and phone != ''">
+            and phone like concat('%', #{phone}, '%')
+        </if>
+        <if test="companyUserName != null and companyUserName != ''">
+            and company_user_name like concat('%', #{companyUserName}, '%')
+        </if>
+        <if test="companyUserId != null">
+            and company_user_id = #{companyUserId}
+        </if>
+        <if test="beginTime != null and beginTime != ''">
+            and filing_time &gt;= #{params.beginTime}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and filing_time &lt;= #{params.endTime}
+        </if>
+        order by filing_time desc
+    </select>
+
+    <select id="selectFsCompanyCustomerById" parameterType="Long" resultMap="FsCompanyCustomerResult">
+        <include refid="selectFsCompanyCustomerVo"/>
+        where id = #{id} and del_flag = '0'
+    </select>
+
+    <insert id="insertFsCompanyCustomer" parameterType="com.fs.qw.domain.FsCompanyCustomer" useGeneratedKeys="true" keyProperty="id">
+        insert into fs_company_customer (
+            customer_name, sex, age, address, phone, filing_time,
+            company_user_id, company_user_name, appointment_time, doctor_id, doctor_name,
+            present_illness, current_medication, allergy_history,
+            create_by, create_time, remark
+        ) values (
+                     #{customerName}, #{sex}, #{age}, #{address}, #{phone}, #{filingTime},
+                     #{companyUserId}, #{companyUserName}, #{appointmentTime}, #{doctorId}, #{doctorName},
+                     #{presentIllness}, #{currentMedication}, #{allergyHistory},
+                     #{createBy}, sysdate(), #{remark}
+                 )
+    </insert>
+
+    <update id="updateFsCompanyCustomer" parameterType="com.fs.qw.domain.FsCompanyCustomer">
+        update fs_company_customer
+        <set>
+            <if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
+            <if test="sex != null">sex = #{sex},</if>
+            <if test="age != null">age = #{age},</if>
+            <if test="address != null">address = #{address},</if>
+            <if test="phone != null">phone = #{phone},</if>
+            <if test="filingTime != null">filing_time = #{filingTime},</if>
+            <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
+            <if test="companyUserName != null">company_user_name = #{companyUserName},</if>
+            <if test="appointmentTime != null">appointment_time = #{appointmentTime},</if>
+            <if test="doctorId != null">doctor_id = #{doctorId},</if>
+            <if test="doctorName != null">doctor_name = #{doctorName},</if>
+            <if test="presentIllness != null">present_illness = #{presentIllness},</if>
+            <if test="currentMedication != null">current_medication = #{currentMedication},</if>
+            <if test="allergyHistory != null">allergy_history = #{allergyHistory},</if>
+            <if test="remark != null">remark = #{remark},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            update_time = sysdate()
+        </set>
+        where id = #{id}
+    </update>
+
+    <update id="deleteFsCompanyCustomerById" parameterType="Long">
+        update fs_company_customer set del_flag = '2' where id = #{id}
+    </update>
+
+    <update id="deleteFsCompanyCustomerByIds" parameterType="String">
+        update fs_company_customer set del_flag = '2' where id in
+        <foreach collection="array" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
+</mapper>