Procházet zdrojové kódy

完善客户信息表+患者信息表逻辑

cgp před 2 dny
rodič
revize
aa5c274b29

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

@@ -9,9 +9,11 @@ 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.his.domain.FsDoctorPatient;
 import com.fs.his.domain.FsPrescribe;
 import com.fs.his.param.CollectionPhoneParam;
 import com.fs.his.param.PrescribePhoneParam;
+import com.fs.his.service.IFsDoctorPatientService;
 import com.fs.his.service.IFsPrescribeService;
 import com.fs.hisStore.service.IFsUserInformationCollectionService;
 import com.fs.hisStore.vo.FsUserInformationCollectionOverviewVo;
@@ -19,6 +21,8 @@ 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 io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -52,6 +56,9 @@ public class FsCompanyCustomerController extends BaseController {
     @Autowired
     private IFsUserInformationCollectionService fsUserInformationCollectionService;
 
+    @Autowired
+    private IFsDoctorPatientService fsDoctorPatientService;
+
     /**
      * 查询客户列表
      */
@@ -147,5 +154,31 @@ public class FsCompanyCustomerController extends BaseController {
         List<FsUserInformationCollectionOverviewVo> list = fsUserInformationCollectionService.selectUserInformationCollectionByPhone(param.getPhone());
         return getDataTable(list);
     }
+    /**
+     * 销售端-查询医生设置指定可见的患者信息列表
+     */
+    @ApiOperation("查询医生设置指定可见的患者信息列表")
+    @GetMapping("/doctorPatientList")
+    public TableDataInfo doctorPatientList(FsDoctorPatient fsDoctorPatient) {
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        Long companyUserId = loginUser.getUser().getUserId();
+        if (companyUserId == null){
+            throw new CustomException("销售登录信息获取异常");
+        }
+        fsDoctorPatient.setCompanyUserId(companyUserId);
+        PageHelper.startPage(fsDoctorPatient.getPageNum(), fsDoctorPatient.getPageSize());
+        List<FsDoctorPatient> list = fsDoctorPatientService.selectFsDoctorPatientList(fsDoctorPatient);
+        PageInfo<FsDoctorPatient> listPageInfo=new PageInfo<>(list);
+        return getDataTable(list);
+    }
+
+    /**
+     * 销售端-查询绑定医生的患者详细信息
+     */
+    @ApiOperation("查询绑定医生的患者详细信息")
+    @GetMapping(value = "/getDoctorPatientInfo/{id}")
+    public AjaxResult getDoctorPatientInfo(@PathVariable("id") Long id) {
+        return AjaxResult.success(fsDoctorPatientService.selectFsDoctorPatientById(id));
+    }
 
 }

+ 59 - 0
fs-doctor-app/src/main/java/com/fs/app/controller/FsDoctorPatientController.java

@@ -2,9 +2,12 @@ package com.fs.app.controller;
 
 
 
+import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.exception.CustomException;
 import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.company.domain.CompanyUser;
+import com.fs.company.service.ICompanyUserService;
 import com.fs.his.domain.FsDoctor;
 import com.fs.his.domain.FsDoctorPatient;
 import com.fs.his.domain.FsPrescribe;
@@ -15,17 +18,22 @@ import com.fs.his.service.IFsDoctorService;
 import com.fs.his.service.IFsPrescribeService;
 import com.fs.hisStore.service.IFsUserInformationCollectionService;
 import com.fs.hisStore.vo.FsUserInformationCollectionOverviewVo;
+import com.fs.qw.domain.FsCompanyCustomer;
+import com.fs.qw.service.IFsCompanyCustomerService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import com.fs.common.core.domain.AjaxResult;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
+import java.util.Collections;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 患者信息Controller
@@ -51,6 +59,12 @@ public class FsDoctorPatientController extends AppBaseController {
     @Autowired
     private IFsUserInformationCollectionService fsUserInformationCollectionService;
 
+    @Autowired
+    private IFsCompanyCustomerService fsCompanyCustomerService;
+
+    @Autowired
+    private ICompanyUserService companyUserService;
+
     /**
      * 查询患者信息列表
      */
@@ -156,4 +170,49 @@ public class FsDoctorPatientController extends AppBaseController {
         PageInfo<FsUserInformationCollectionOverviewVo> listPageInfo=new PageInfo<>(list);
         return AjaxResult.success(listPageInfo);
     }
+
+    /**
+     * 医生端-查询可关联销售列表
+     */
+    @GetMapping("/companyUserList")
+    public AjaxResult companyUserList() {
+        String doctorId = getDoctorId();
+        if (StringUtils.isBlank(doctorId)){
+            return AjaxResult.error("请重新登录");
+        }
+        // 查询关联的销售集合
+        List<CompanyUser> companyUserList = companyUserService.selectCompanyUserListByDoctorId(Long.valueOf(doctorId));
+        return AjaxResult.success(companyUserList);
+    }
+
+    /**
+     * 医生端-查询关联销售的所有客户列表
+     */
+    @GetMapping("/companyCustomerList")
+    public AjaxResult companyCustomerList(FsCompanyCustomer fsCompanyCustomer) {
+        String doctorId = getDoctorId();
+        if (StringUtils.isBlank(doctorId)){
+            return AjaxResult.error("请重新登录");
+        }
+        AjaxResult AjaxResult = new AjaxResult();
+        // 查询关联的销售id集合
+        List<CompanyUser> companyUserList = companyUserService.selectCompanyUserListByDoctorId(Long.valueOf(doctorId));
+        List<Long> companyUserIds = companyUserList.stream().map(CompanyUser::getUserId).collect(Collectors.toList());
+        if (CollectionUtils.isEmpty(companyUserIds)){
+            AjaxResult.put("data", new PageInfo<>(Collections.emptyList()));
+        }
+        fsCompanyCustomer.setCompanyUserIds(companyUserIds);
+        PageHelper.startPage(fsCompanyCustomer.getPageNum(), fsCompanyCustomer.getPageSize());
+        List<FsCompanyCustomer> list = fsCompanyCustomerService.selectFsCompanyCustomerListByCompanyUserIds(fsCompanyCustomer);
+        AjaxResult.put("data", new PageInfo<>(list));
+        return AjaxResult;
+    }
+
+    /**
+     * 医生端-查询关联销售的客户详情
+     */
+    @GetMapping("/companyCustomer/{id}")
+    public AjaxResult getCompanyCustomerInfo(@PathVariable Long id) {
+        return AjaxResult.success(fsCompanyCustomerService.selectFsCompanyCustomerById(id));
+    }
 }

+ 3 - 0
fs-service/src/main/java/com/fs/company/mapper/CompanyUserMapper.java

@@ -337,4 +337,7 @@ public interface CompanyUserMapper
             "update company_user set ai_sip_call_user_id=#{aiSipCallId} where user_id=#{companyUserId} " +
             "</script>")
     public int updateCompanyUserByAiSipCall(@Param("companyUserId") Long companyUserId, @Param("aiSipCallId") Long aiSipCallId);
+
+    //根据医生id获取医生对应的销售
+    List<CompanyUser> selectCompanyUserListByDoctorId(Long doctorId);
 }

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

@@ -250,4 +250,7 @@ public interface ICompanyUserService {
 
     //根据销售id获取销售绑定的医生信息
     CompanyUserAndDoctorVO getCompanyUserAndDoctor(Long companyUserId);
+
+    //根据医生id获取绑定医生的销售列表
+    List<CompanyUser> selectCompanyUserListByDoctorId(Long doctorId);
 }

+ 10 - 0
fs-service/src/main/java/com/fs/company/service/impl/CompanyUserServiceImpl.java

@@ -49,6 +49,7 @@ 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.apache.commons.collections4.CollectionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -1101,4 +1102,13 @@ public class CompanyUserServiceImpl implements ICompanyUserService
         companyUserAndDoctorVO.setDoctorName(fsDoctor.getDoctorName());
         return companyUserAndDoctorVO;
     }
+
+    @Override
+    public List<CompanyUser> selectCompanyUserListByDoctorId(Long doctorId) {
+        List<CompanyUser> companyUserList=companyUserMapper.selectCompanyUserListByDoctorId(doctorId);
+        if (CollectionUtils.isEmpty(companyUserList)){
+            return Collections.emptyList();
+        }
+        return companyUserList;
+    }
 }

+ 6 - 0
fs-service/src/main/java/com/fs/his/domain/FsDoctorPatient.java

@@ -92,6 +92,12 @@ public class FsDoctorPatient extends BaseEntity {
     /** 接诊医生ID */
     private Long doctorId;
 
+    /** 可见销售ID */
+    private Long companyUserId;
+
+    /** 可见销售名称 */
+    private String companyUserName;
+
     //分页相关
     private Integer pageNum;
     private Integer pageSize;

+ 2 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsDoctorPatientServiceImpl.java

@@ -4,9 +4,11 @@ import com.fs.common.exception.CustomException;
 import com.fs.his.domain.FsDoctorPatient;
 import com.fs.his.mapper.FsDoctorPatientMapper;
 import com.fs.his.service.IFsDoctorPatientService;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Collections;
 import java.util.List;
 
 /**

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

@@ -6,6 +6,7 @@ import com.fs.common.core.domain.BaseEntity;
 import lombok.Data;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * 客户基础信息对象 fs_company_customer
@@ -48,6 +49,9 @@ public class FsCompanyCustomer extends BaseEntity {
     /** 销售id */
     private Long companyUserId;
 
+    /** 销售id集合 */
+    private List<Long> companyUserIds;
+
     /** 销售姓名 */
     @Excel(name = "客服姓名")
     private String companyUserName;

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

@@ -1,6 +1,8 @@
 package com.fs.qw.mapper;
 
 import com.fs.qw.domain.FsCompanyCustomer;
+import org.apache.ibatis.annotations.Param;
+
 import java.util.List;
 
 /**
@@ -39,4 +41,11 @@ public interface FsCompanyCustomerMapper {
      * 批量删除客户信息(逻辑删除)
      */
     public int deleteFsCompanyCustomerByIds(Long[] ids);
+
+    /**
+     * 根据销售ID集合(必传)和客服姓名(可选)查询客户列表
+     * @param fsCompanyCustomer 查询条件对象,必须包含 companyUserIds
+     * @return 客户列表
+     */
+    List<FsCompanyCustomer> selectFsCompanyCustomerListByCompanyUserIds(FsCompanyCustomer fsCompanyCustomer);
 }

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

@@ -19,4 +19,7 @@ public interface IFsCompanyCustomerService {
     int updateFsCompanyCustomer(FsCompanyCustomer fsCompanyCustomer);
 
     int deleteFsCompanyCustomerByIds(Long[] ids);
+
+    //查询关联销售的客户列表
+    List<FsCompanyCustomer> selectFsCompanyCustomerListByCompanyUserIds(FsCompanyCustomer fsCompanyCustomer);
 }

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

@@ -4,9 +4,11 @@ import com.fs.common.exception.CustomException;
 import com.fs.qw.domain.FsCompanyCustomer;
 import com.fs.qw.mapper.FsCompanyCustomerMapper;
 import com.fs.qw.service.IFsCompanyCustomerService;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -71,4 +73,17 @@ public class FsCompanyCustomerServiceImpl implements IFsCompanyCustomerService {
     public int deleteFsCompanyCustomerByIds(Long[] ids) {
         return fsCompanyCustomerMapper.deleteFsCompanyCustomerByIds(ids);
     }
+
+    @Override
+    public List<FsCompanyCustomer> selectFsCompanyCustomerListByCompanyUserIds(FsCompanyCustomer fsCompanyCustomer) {
+        if (CollectionUtils.isEmpty(fsCompanyCustomer.getCompanyUserIds())){
+            // 返回空列表
+            return Collections.emptyList();
+        }
+        List<FsCompanyCustomer> list =fsCompanyCustomerMapper.selectFsCompanyCustomerListByCompanyUserIds(fsCompanyCustomer);
+        if (CollectionUtils.isEmpty(list)){
+            return Collections.emptyList();
+        }
+        return list;
+    }
 }

+ 4 - 0
fs-service/src/main/resources/mapper/company/CompanyUserMapper.xml

@@ -618,6 +618,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </select>
+    <select id="selectCompanyUserListByDoctorId" resultType="com.fs.company.domain.CompanyUser">
+        SELECT * FROM company_user
+        WHERE doctor_id = #{doctorId}
+    </select>
 
     <update id="unbindCidServer" parameterType="java.lang.Long" >
         update company_user

+ 69 - 25
fs-service/src/main/resources/mapper/his/FsDoctorPatientMapper.xml

@@ -29,45 +29,51 @@
         <result property="updateTime"           column="update_time"           />
         <result property="remark"               column="remark"                />
         <result property="doctorId"             column="doctor_id"             />
+        <result property="companyUserId"             column="company_user_id"             />
     </resultMap>
 
     <sql id="selectFsDoctorPatientVo">
         select id, patient_name, sex, age, phone, reception_time, reception_doctor, city,
                present_illness, past_history, allergy_history, diagnosis, syndrome_type,
                syndrome_regulation, treatment_opinion, precautions, doctor_signature,
-               practice_certificate_no, doctor_id,
+               practice_certificate_no, doctor_id,company_user_id,
                create_by, create_time, update_by, update_time, remark, del_flag
         from fs_doctor_patient
     </sql>
 
     <select id="selectFsDoctorPatientList" parameterType="com.fs.his.domain.FsDoctorPatient" resultMap="FsDoctorPatientResult">
-        <include refid="selectFsDoctorPatientVo"/>
-        where del_flag = '0'
+        select fdp.*,cu.nick_name as companyUserName
+        from fs_doctor_patient fdp
+        left join company_user cu on fdp.company_user_id = cu.user_id
+        where fdp.del_flag = '0'
         <if test="patientName != null and patientName != ''">
-            and patient_name like concat('%', #{patientName}, '%')
+            and fdp.patient_name like concat('%', #{patientName}, '%')
         </if>
         <if test="sex != null and sex != ''">
-            and sex = #{sex}
+            and fdp.sex = #{sex}
         </if>
         <if test="phone != null and phone != ''">
-            and phone like concat('%', #{phone}, '%')
+            and fdp.phone like concat('%', #{phone}, '%')
         </if>
         <if test="receptionDoctor != null and receptionDoctor != ''">
-            and reception_doctor like concat('%', #{receptionDoctor}, '%')
+            and fdp.reception_doctor like concat('%', #{receptionDoctor}, '%')
         </if>
         <if test="receptionTime != null">
-            and reception_time = #{receptionTime}
+            and fdp.reception_time = #{receptionTime}
         </if>
         <if test="beginTime != null and beginTime != ''">
-            and reception_time &gt;= #{params.beginTime}
+            and fdp.reception_time &gt;= #{beginTime}
         </if>
         <if test="endTime != null and endTime != ''">
-            and reception_time &lt;= #{params.endTime}
+            andfdp.reception_time &lt;= #{endTime}
         </if>
         <if test="doctorId != null">
-            and doctor_id = #{doctorId}
+            and fdp.doctor_id = #{doctorId}
+        </if>
+        <if test="companyUserId != null">
+            and fdp.company_user_id = #{companyUserId}
         </if>
-        order by reception_time desc
+        order by fdp.reception_time desc
     </select>
 
     <select id="selectFsDoctorPatientById" parameterType="Long" resultMap="FsDoctorPatientResult">
@@ -75,20 +81,57 @@
         where id = #{id} and del_flag = '0'
     </select>
 
+    <!-- 动态 insert 语句 -->
     <insert id="insertFsDoctorPatient" parameterType="com.fs.his.domain.FsDoctorPatient" useGeneratedKeys="true" keyProperty="id">
-        insert into fs_doctor_patient (
-            patient_name, sex, age, phone, reception_time, reception_doctor, city,
-            present_illness, past_history, allergy_history, diagnosis, syndrome_type,
-            syndrome_regulation, treatment_opinion, precautions, doctor_signature,
-            practice_certificate_no, doctor_id,
-            create_by, create_time, remark
-        ) values (
-                     #{patientName}, #{sex}, #{age}, #{phone}, #{receptionTime}, #{receptionDoctor}, #{city},
-                     #{presentIllness}, #{pastHistory}, #{allergyHistory}, #{diagnosis}, #{syndromeType},
-                     #{syndromeRegulation}, #{treatmentOpinion}, #{precautions}, #{doctorSignature},
-                     #{practiceCertificateNo}, #{doctorId},
-                     #{createBy}, sysdate(), #{remark}
-                 )
+        insert into fs_doctor_patient
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="patientName != null">patient_name,</if>
+            <if test="sex != null">sex,</if>
+            <if test="age != null">age,</if>
+            <if test="phone != null">phone,</if>
+            <if test="receptionTime != null">reception_time,</if>
+            <if test="receptionDoctor != null">reception_doctor,</if>
+            <if test="city != null">city,</if>
+            <if test="presentIllness != null">present_illness,</if>
+            <if test="pastHistory != null">past_history,</if>
+            <if test="allergyHistory != null">allergy_history,</if>
+            <if test="diagnosis != null">diagnosis,</if>
+            <if test="syndromeType != null">syndrome_type,</if>
+            <if test="syndromeRegulation != null">syndrome_regulation,</if>
+            <if test="treatmentOpinion != null">treatment_opinion,</if>
+            <if test="precautions != null">precautions,</if>
+            <if test="doctorSignature != null">doctor_signature,</if>
+            <if test="practiceCertificateNo != null">practice_certificate_no,</if>
+            <if test="doctorId != null">doctor_id,</if>
+            <if test="companyUserId != null">company_user_id,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="remark != null">remark,</if>
+            create_time
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="patientName != null">#{patientName},</if>
+            <if test="sex != null">#{sex},</if>
+            <if test="age != null">#{age},</if>
+            <if test="phone != null">#{phone},</if>
+            <if test="receptionTime != null">#{receptionTime},</if>
+            <if test="receptionDoctor != null">#{receptionDoctor},</if>
+            <if test="city != null">#{city},</if>
+            <if test="presentIllness != null">#{presentIllness},</if>
+            <if test="pastHistory != null">#{pastHistory},</if>
+            <if test="allergyHistory != null">#{allergyHistory},</if>
+            <if test="diagnosis != null">#{diagnosis},</if>
+            <if test="syndromeType != null">#{syndromeType},</if>
+            <if test="syndromeRegulation != null">#{syndromeRegulation},</if>
+            <if test="treatmentOpinion != null">#{treatmentOpinion},</if>
+            <if test="precautions != null">#{precautions},</if>
+            <if test="doctorSignature != null">#{doctorSignature},</if>
+            <if test="practiceCertificateNo != null">#{practiceCertificateNo},</if>
+            <if test="doctorId != null">#{doctorId},</if>
+            <if test="companyUserId != null">#{companyUserId},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="remark != null">#{remark},</if>
+            NOW()
+        </trim>
     </insert>
 
     <update id="updateFsDoctorPatient" parameterType="com.fs.his.domain.FsDoctorPatient">
@@ -114,6 +157,7 @@
             <if test="remark != null">remark = #{remark},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="doctorId != null">doctor_id = #{doctorId},</if>
+            <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
             update_time = sysdate()
         </set>
         where id = #{id}

+ 64 - 13
fs-service/src/main/resources/mapper/qw/FsCompanyCustomerMapper.xml

@@ -51,10 +51,10 @@
             and company_user_id = #{companyUserId}
         </if>
         <if test="beginTime != null and beginTime != ''">
-            and filing_time &gt;= #{params.beginTime}
+            and filing_time &gt;= #{beginTime}
         </if>
         <if test="endTime != null and endTime != ''">
-            and filing_time &lt;= #{params.endTime}
+            and filing_time &lt;= #{endTime}
         </if>
         order by filing_time desc
     </select>
@@ -64,18 +64,69 @@
         where id = #{id} and del_flag = '0'
     </select>
 
+    <select id="selectFsCompanyCustomerListByCompanyUserIds" resultType="com.fs.qw.domain.FsCompanyCustomer">
+        <include refid="selectFsCompanyCustomerVo"/>
+        <where>
+            del_flag = '0'
+            <!-- 销售ID集合必传,不存在或为空时不生成任何条件(调用前必须确保有值) -->
+            <if test="companyUserIds != null and companyUserIds.size() > 0">
+                and company_user_id IN
+                <foreach collection="companyUserIds" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+            <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>
+        </where>
+    </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 into fs_company_customer
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="customerName != null">customer_name,</if>
+            <if test="sex != null">sex,</if>
+            <if test="age != null">age,</if>
+            <if test="address != null">address,</if>
+            <if test="phone != null">phone,</if>
+            <if test="filingTime != null">filing_time,</if>
+            <if test="companyUserId != null">company_user_id,</if>
+            <if test="companyUserName != null">company_user_name,</if>
+            <if test="appointmentTime != null">appointment_time,</if>
+            <if test="doctorId != null">doctor_id,</if>
+            <if test="doctorName != null">doctor_name,</if>
+            <if test="presentIllness != null">present_illness,</if>
+            <if test="currentMedication != null">current_medication,</if>
+            <if test="allergyHistory != null">allergy_history,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="remark != null">remark,</if>
+            create_time
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="customerName != null">#{customerName},</if>
+            <if test="sex != null">#{sex},</if>
+            <if test="age != null">#{age},</if>
+            <if test="address != null">#{address},</if>
+            <if test="phone != null">#{phone},</if>
+            <if test="filingTime != null">#{filingTime},</if>
+            <if test="companyUserId != null">#{companyUserId},</if>
+            <if test="companyUserName != null">#{companyUserName},</if>
+            <if test="appointmentTime != null">#{appointmentTime},</if>
+            <if test="doctorId != null">#{doctorId},</if>
+            <if test="doctorName != null">#{doctorName},</if>
+            <if test="presentIllness != null">#{presentIllness},</if>
+            <if test="currentMedication != null">#{currentMedication},</if>
+            <if test="allergyHistory != null">#{allergyHistory},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="remark != null">#{remark},</if>
+            sysdate()
+        </trim>
     </insert>
 
     <update id="updateFsCompanyCustomer" parameterType="com.fs.qw.domain.FsCompanyCustomer">