客户体征相关

This commit is contained in:
xiezhijun 2021-01-04 16:51:56 +08:00
parent b1a94bc630
commit f76356da68
24 changed files with 3636 additions and 3 deletions

View File

@ -0,0 +1,73 @@
package com.stdiet.web.controller.common;
import com.stdiet.common.core.controller.BaseController;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.core.page.TableDataInfo;
import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.domain.SysPhysicalSigns;
import com.stdiet.custom.dto.request.CustomerInvestigateRequest;
import com.stdiet.custom.service.ISysCustomerService;
import com.stdiet.custom.service.ISysPhysicalSignsService;
import com.stdiet.system.service.ISysDictTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 客户信息调查Controller
*
* @author xzj
* @date 2020-12-31
*/
@RestController
@RequestMapping("/investigate")
public class InvestigateController extends BaseController {
@Autowired
private ISysCustomerService iSysCustomerService;
@Autowired
private ISysPhysicalSignsService iSysPhysicalSignsService;
@Autowired
private ISysDictTypeService dictTypeService;
/**
* 建立客户信息档案
*/
@PostMapping("/customerInvestigate")
public AjaxResult customerInvestigate(@RequestBody CustomerInvestigateRequest customerInvestigateRequest) throws Exception
{
//验证是否已存在该手机号
SysCustomer phoneCustomer = iSysCustomerService.getCustomerByPhone(customerInvestigateRequest.getPhone());
if(phoneCustomer != null){
return AjaxResult.error("该手机号已存在");
}
customerInvestigateRequest.setId(null); //只能添加无法修改
return AjaxResult.success(iSysCustomerService.addOrupdateCustomerAndSign(customerInvestigateRequest));
}
/**
* 获取体征列表
*/
@GetMapping("/physicalSignsList")
public TableDataInfo physicalSignsList() throws Exception
{
List<SysPhysicalSigns> physicalSignsList = iSysPhysicalSignsService.selectSysPhysicalSignsList(new SysPhysicalSigns());
//System.out.println(physicalSignsList.size());
return getDataTable(physicalSignsList);
}
/**
* 根据字典类型查询字典数据信息
*/
@GetMapping(value = "/type/{dictType}")
public AjaxResult dictType(@PathVariable String dictType)
{
return AjaxResult.success(dictTypeService.selectDictDataByType(dictType));
}
}

View File

@ -0,0 +1,118 @@
package com.stdiet.web.controller.custom;
import java.util.List;
import com.stdiet.custom.dto.request.CustomerInvestigateRequest;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.stdiet.common.annotation.Log;
import com.stdiet.common.core.controller.BaseController;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.enums.BusinessType;
import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.service.ISysCustomerService;
import com.stdiet.common.utils.poi.ExcelUtil;
import com.stdiet.common.core.page.TableDataInfo;
/**
* 客户体征信息Controller
*
* @author xzj
* @date 2021-01-03
*/
@RestController
@RequestMapping("/custom/customer")
public class SysCustomerController extends BaseController
{
@Autowired
private ISysCustomerService sysCustomerService;
/**
* 查询客户信息列表
*/
@PreAuthorize("@ss.hasPermi('custom:customer:list')")
@GetMapping("/list")
public TableDataInfo list(SysCustomer sysCustomer)
{
startPage();
List<SysCustomer> list = sysCustomerService.selectSysCustomerAndSignList(sysCustomer);
return getDataTable(list);
}
/**
* 导出客户信息列表
*/
@PreAuthorize("@ss.hasPermi('custom:customer:export')")
@Log(title = "客户信息", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(SysCustomer sysCustomer)
{
List<SysCustomer> list = sysCustomerService.selectSysCustomerList(sysCustomer);
ExcelUtil<SysCustomer> util = new ExcelUtil<SysCustomer>(SysCustomer.class);
return util.exportExcel(list, "customer");
}
/**
* 获取客户信息详细信息
*/
@PreAuthorize("@ss.hasPermi('custom:customer:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(sysCustomerService.getCustomerAndSignById(id));
}
/**
* 新增客户信息
*/
@PreAuthorize("@ss.hasPermi('custom:customer:add')")
@Log(title = "客户信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CustomerInvestigateRequest customerInvestigateRequest) throws Exception
{
//验证是否已存在该手机号
SysCustomer phoneCustomer = sysCustomerService.getCustomerByPhone(customerInvestigateRequest.getPhone());
if(phoneCustomer != null){
return AjaxResult.error("该手机号已存在");
}
return toAjax(sysCustomerService.addOrupdateCustomerAndSign(customerInvestigateRequest));
}
/**
* 修改客户信息
*/
@PreAuthorize("@ss.hasPermi('custom:customer:edit')")
@Log(title = "客户信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CustomerInvestigateRequest customerInvestigateRequest) throws Exception
{
SysCustomer oldCustomer = sysCustomerService.selectSysCustomerById(customerInvestigateRequest.getId());
if(oldCustomer != null && !oldCustomer.getPhone().equals(customerInvestigateRequest.getPhone())){
//验证是否已存在该手机号
SysCustomer phoneCustomer = sysCustomerService.getCustomerByPhone(customerInvestigateRequest.getPhone());
if(phoneCustomer != null){
return AjaxResult.error("该手机号已存在");
}
}
return toAjax(sysCustomerService.addOrupdateCustomerAndSign(customerInvestigateRequest));
}
/**
* 删除客户信息
*/
@PreAuthorize("@ss.hasPermi('custom:customer:remove')")
@Log(title = "客户信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sysCustomerService.delCustomerAndSignById(ids));
}
}

View File

@ -0,0 +1,78 @@
package com.stdiet.common.utils.bean;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class BeanHelper{
/**
* 去掉bean中所有属性为字符串的前后空格
* @param bean
* @throws Exception
*/
public static void beanAttributeValueTrim(Object bean) throws Exception {
if(bean!=null){
//获取所有的字段包括public,private,protected,private
Field[] fields = bean.getClass().getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
Field f = fields[i];
if (f.getType().getName().equals("java.lang.String")) {
String key = f.getName();//获取字段名
Object value = getFieldValue(bean, key);
if (value == null)
continue;
setFieldValue(bean, key, value.toString().trim());
}
}
}
}
/**
* 利用反射通过get方法获取bean中字段fieldName的值
* @param bean
* @param fieldName
* @return
* @throws Exception
*/
private static Object getFieldValue(Object bean, String fieldName)
throws Exception {
StringBuffer result = new StringBuffer();
String methodName = result.append("get")
.append(fieldName.substring(0, 1).toUpperCase())
.append(fieldName.substring(1)).toString();
Object rObject = null;
Method method = null;
@SuppressWarnings("rawtypes")
Class[] classArr = new Class[0];
method = bean.getClass().getMethod(methodName, classArr);
rObject = method.invoke(bean, new Object[0]);
return rObject;
}
/**
* 利用发射调用bean.set方法将value设置到字段
* @param bean
* @param fieldName
* @param value
* @throws Exception
*/
private static void setFieldValue(Object bean, String fieldName, Object value)
throws Exception {
StringBuffer result = new StringBuffer();
String methodName = result.append("set")
.append(fieldName.substring(0, 1).toUpperCase())
.append(fieldName.substring(1)).toString();
/**
* 利用发射调用bean.set方法将value设置到字段
*/
Class[] classArr = new Class[1];
classArr[0]="java.lang.String".getClass();
Method method=bean.getClass().getMethod(methodName,classArr);
method.invoke(bean,value);
}
}

View File

@ -0,0 +1,67 @@
package com.stdiet.common.utils.bean;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 对象相关工具类
* </p>
*
* @author xzj
* @since 2020-11-27
*/
public class ObjectUtils {
/**
* @Author xzj
* @Description 利用反射机制将一个对象中的所有属性值赋值给另一个对象
* @Date 2020/12/3 18:17
* @Param object: 原对象
* @Param clazz: 目标对象对应Class
* @Return T 目标对象
**/
public static <T> T getObjectByObject(Object object, Class<T> clazz) throws Exception {
return getObjectByObject(object, clazz, new ArrayList<String>(1));
}
/**
* @Author xzj
* @Description 利用反射机制将一个对象中的所有属性值赋值给另一个对象
* @Date 2020/12/3 18:17
* @Param object: 原对象
* @Param clazz: 目标对象对应Class
* @Param filterField: 需要过滤掉的属性名称集合
* @Return T 目标对象
**/
public static <T> T getObjectByObject(Object object, Class<T> clazz, List<String> filterField) throws Exception {
T t = null;
if (clazz != null && object != null) {
t = clazz.newInstance();
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
//属性名
String key = field.getName();
//以整数形式返回由此 Field 对象表示的字段的 Java 语言修饰符
int modifierValue = field.getModifiers();
//PUBLIC: 1 PRIVATE: 2 PROTECTED: 4 只设置4以下修饰词属性过滤掉filterField中的属性
if(modifierValue > 4 || (filterField != null && filterField.contains(key)) ){
continue;
}
try {
field.setAccessible(true);
Field objectField = object.getClass().getDeclaredField(key);
objectField.setAccessible(true);
//返回指定对象obj上此 Field 表示的字段的值
Object val = objectField.get(object);
//将指定对象变量上此 Field 对象表示的字段设置为指定的新值
field.set(t, val);
}catch (Exception e){
System.out.println(object.getClass().getName() + "没有该属性: " + field.getName());
}
}
}
return t;
}
}

View File

@ -0,0 +1,253 @@
package com.stdiet.custom.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.stdiet.common.annotation.Excel;
import com.stdiet.common.core.domain.BaseEntity;
/**
* 客户信息对象 sys_customer
*
* @author xzj
* @date 2020-12-31
*/
public class SysCustomer extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 名字 */
@Excel(name = "名字")
private String name;
/** 手机号 */
@Excel(name = "手机号")
private String phone;
/** 邮箱 */
@Excel(name = "邮箱")
private String email;
/** 地址 */
@Excel(name = "地址")
private String address;
/** 付款日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "付款日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date payDate;
/** 开始日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date startDate;
/** 购买月数 */
@Excel(name = "购买月数")
private Long purchaseNum;
/** 累计总金额 */
@Excel(name = "累计总金额")
private BigDecimal payTotal;
/** 主营养师 */
@Excel(name = "主营养师")
private Long mainDietitian;
/** 营养师助理 */
@Excel(name = "营养师助理")
private Long assistantDietitian;
/** 售后营养师 */
@Excel(name = "售后营养师")
private Long afterDietitian;
/** 销售人员 */
@Excel(name = "销售人员")
private Long salesman;
/** 负责人 */
@Excel(name = "负责人")
private Long chargePerson;
/** 跟进状态 */
@Excel(name = "跟进状态")
private Long followStatus;
/** 体征数据,非持久化字段 */
private SysCustomerPhysicalSigns sign;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setEmail(String email)
{
this.email = email;
}
public String getEmail()
{
return email;
}
public void setAddress(String address)
{
this.address = address;
}
public String getAddress()
{
return address;
}
public void setPayDate(Date payDate)
{
this.payDate = payDate;
}
public Date getPayDate()
{
return payDate;
}
public void setStartDate(Date startDate)
{
this.startDate = startDate;
}
public Date getStartDate()
{
return startDate;
}
public void setPurchaseNum(Long purchaseNum)
{
this.purchaseNum = purchaseNum;
}
public Long getPurchaseNum()
{
return purchaseNum;
}
public void setPayTotal(BigDecimal payTotal)
{
this.payTotal = payTotal;
}
public BigDecimal getPayTotal()
{
return payTotal;
}
public void setMainDietitian(Long mainDietitian)
{
this.mainDietitian = mainDietitian;
}
public Long getMainDietitian()
{
return mainDietitian;
}
public void setAssistantDietitian(Long assistantDietitian)
{
this.assistantDietitian = assistantDietitian;
}
public Long getAssistantDietitian()
{
return assistantDietitian;
}
public void setAfterDietitian(Long afterDietitian)
{
this.afterDietitian = afterDietitian;
}
public Long getAfterDietitian()
{
return afterDietitian;
}
public void setSalesman(Long salesman)
{
this.salesman = salesman;
}
public Long getSalesman()
{
return salesman;
}
public void setChargePerson(Long chargePerson)
{
this.chargePerson = chargePerson;
}
public Long getChargePerson()
{
return chargePerson;
}
public void setFollowStatus(Long followStatus)
{
this.followStatus = followStatus;
}
public Long getFollowStatus()
{
return followStatus;
}
public SysCustomerPhysicalSigns getSign() {
return sign;
}
public void setSign(SysCustomerPhysicalSigns sign) {
this.sign = sign;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("phone", getPhone())
.append("email", getEmail())
.append("address", getAddress())
.append("payDate", getPayDate())
.append("startDate", getStartDate())
.append("purchaseNum", getPurchaseNum())
.append("payTotal", getPayTotal())
.append("mainDietitian", getMainDietitian())
.append("assistantDietitian", getAssistantDietitian())
.append("afterDietitian", getAfterDietitian())
.append("salesman", getSalesman())
.append("chargePerson", getChargePerson())
.append("followStatus", getFollowStatus())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.append("updateTime", getUpdateTime())
.append("updateBy", getUpdateBy())
.toString();
}
}

View File

@ -0,0 +1,444 @@
package com.stdiet.custom.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.stdiet.common.annotation.Excel;
import com.stdiet.common.core.domain.BaseEntity;
import java.util.List;
/**
* 客户数据对象 sys_customer_physical_signs
*
* @author xzj
* @date 2020-12-31
*/
public class SysCustomerPhysicalSigns extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 客户id */
@Excel(name = "客户id")
private Long customerId;
/** 客户性别 0男 1女 */
@Excel(name = "客户性别 0男 1女")
private Integer sex;
/** 客户年龄(岁) */
@Excel(name = "客户年龄", readConverterExp = "岁=")
private Integer age;
/** 客户身高(厘米) */
@Excel(name = "客户身高", readConverterExp = "厘=米")
private Integer tall;
/** 客户体重(斤) */
@Excel(name = "客户体重", readConverterExp = "斤=")
private Integer weight;
/** 客户病史体征id */
@Excel(name = "客户病史体征id")
private String physicalSignsId;
/** 客户忌口不爱吃食材id */
@Excel(name = "客户忌口不爱吃食材id")
private String dishesIngredientId;
/** 客户照片 */
@Excel(name = "客户照片")
private String photo;
/** 是否便秘 0是 1否 */
@Excel(name = "是否便秘 0是 1否")
private Integer constipation;
/** 是否熬夜、失眠 0是 1否 */
@Excel(name = "是否熬夜、失眠 0是 1否")
private Integer staylate;
/** 是否经常运动 0是 1否 */
@Excel(name = "是否经常运动 0是 1否")
private Integer motion;
/** 饮食方式 0自己做 1外面吃 */
@Excel(name = "饮食方式 0自己做 1外面吃")
private Integer makeFoodType;
/** 饮食特点 0清淡 1重口味 */
@Excel(name = "饮食特点 0清淡 1重口味")
private Integer makeFoodTaste;
/** 平时是否久坐 0久坐多 1走动多 */
@Excel(name = "平时是否久坐 0久坐多 1走动多")
private Integer walk;
/** 减脂过程遇到的困难 */
@Excel(name = "减脂过程遇到的困难")
private String difficulty;
/** 是否浑身乏力 0是 1否 */
@Excel(name = "是否浑身乏力 0是 1否")
private Integer weakness;
/** 是否减脂反弹 0是 1否 */
@Excel(name = "是否减脂反弹 0是 1否")
private Integer rebound;
/** 能否认识到生活习惯的改善才是减脂的关键 0是 1否 */
@Excel(name = "能否认识到生活习惯的改善才是减脂的关键 0是 1否")
private Integer crux;
/** 南方人还是北方人 0南方 1北方 */
@Excel(name = "南方人还是北方人 0南方 1北方")
private Integer position;
/** 睡觉时间24小时制 */
@Excel(name = "睡觉时间", readConverterExp = "2=4小时制")
private Integer sleepTime;
/** 起床时间24小时制 */
@Excel(name = "起床时间", readConverterExp = "2=4小时制")
private Integer getupTime;
/** 联系沟通时间24小时制 */
@Excel(name = "联系沟通时间", readConverterExp = "2=4小时制")
private Integer connectTime;
/** 备注 */
@Excel(name = "备注")
private String remarks;
/** 湿气数据 */
@Excel(name = "湿气数据")
private String bloodData;
/** 气血数据 */
@Excel(name = "气血数据")
private String moistureDate;
/** 工作职业 */
@Excel(name = "工作职业")
private String vocation;
/** 是否上夜班 */
@Excel(name = "是否上夜班")
private Integer night;
/** 减脂经历 */
@Excel(name = "减脂经历")
private String experience;
/** 体征对象集合 **/
private List<SysPhysicalSigns> signList;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCustomerId(Long customerId)
{
this.customerId = customerId;
}
public Long getCustomerId()
{
return customerId;
}
public void setSex(Integer sex)
{
this.sex = sex;
}
public Integer getSex()
{
return sex;
}
public void setAge(Integer age)
{
this.age = age;
}
public Integer getAge()
{
return age;
}
public void setTall(Integer tall)
{
this.tall = tall;
}
public Integer getTall()
{
return tall;
}
public void setWeight(Integer weight)
{
this.weight = weight;
}
public Integer getWeight()
{
return weight;
}
public void setPhysicalSignsId(String physicalSignsId)
{
this.physicalSignsId = physicalSignsId;
}
public String getPhysicalSignsId()
{
return physicalSignsId;
}
public void setDishesIngredientId(String dishesIngredientId)
{
this.dishesIngredientId = dishesIngredientId;
}
public String getDishesIngredientId()
{
return dishesIngredientId;
}
public void setPhoto(String photo)
{
this.photo = photo;
}
public String getPhoto()
{
return photo;
}
public void setConstipation(Integer constipation)
{
this.constipation = constipation;
}
public Integer getConstipation()
{
return constipation;
}
public void setStaylate(Integer staylate)
{
this.staylate = staylate;
}
public Integer getStaylate()
{
return staylate;
}
public void setMotion(Integer motion)
{
this.motion = motion;
}
public Integer getMotion()
{
return motion;
}
public void setMakeFoodType(Integer makeFoodType)
{
this.makeFoodType = makeFoodType;
}
public Integer getMakeFoodType()
{
return makeFoodType;
}
public void setMakeFoodTaste(Integer makeFoodTaste)
{
this.makeFoodTaste = makeFoodTaste;
}
public Integer getMakeFoodTaste()
{
return makeFoodTaste;
}
public void setWalk(Integer walk)
{
this.walk = walk;
}
public Integer getWalk()
{
return walk;
}
public void setDifficulty(String difficulty)
{
this.difficulty = difficulty;
}
public String getDifficulty()
{
return difficulty;
}
public void setWeakness(Integer weakness)
{
this.weakness = weakness;
}
public Integer getWeakness()
{
return weakness;
}
public void setRebound(Integer rebound)
{
this.rebound = rebound;
}
public Integer getRebound()
{
return rebound;
}
public void setCrux(Integer crux)
{
this.crux = crux;
}
public Integer getCrux()
{
return crux;
}
public void setPosition(Integer position)
{
this.position = position;
}
public Integer getPosition()
{
return position;
}
public void setSleepTime(Integer sleepTime)
{
this.sleepTime = sleepTime;
}
public Integer getSleepTime()
{
return sleepTime;
}
public void setGetupTime(Integer getupTime)
{
this.getupTime = getupTime;
}
public Integer getGetupTime()
{
return getupTime;
}
public void setConnectTime(Integer connectTime)
{
this.connectTime = connectTime;
}
public Integer getConnectTime()
{
return connectTime;
}
public void setRemarks(String remarks)
{
this.remarks = remarks;
}
public String getRemarks()
{
return remarks;
}
public void setBloodData(String bloodData)
{
this.bloodData = bloodData;
}
public String getBloodData()
{
return bloodData;
}
public void setMoistureDate(String moistureDate)
{
this.moistureDate = moistureDate;
}
public String getMoistureDate()
{
return moistureDate;
}
public String getVocation() {
return vocation;
}
public void setVocation(String vocation) {
this.vocation = vocation;
}
public Integer getNight() {
return night;
}
public void setNight(Integer night) {
this.night = night;
}
public String getExperience() {
return experience;
}
public void setExperience(String experience) {
this.experience = experience;
}
public List<SysPhysicalSigns> getSignList() {
return signList;
}
public void setSignList(List<SysPhysicalSigns> signList) {
this.signList = signList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("customerId", getCustomerId())
.append("sex", getSex())
.append("age", getAge())
.append("tall", getTall())
.append("weight", getWeight())
.append("physicalSignsId", getPhysicalSignsId())
.append("dishesIngredientId", getDishesIngredientId())
.append("photo", getPhoto())
.append("constipation", getConstipation())
.append("staylate", getStaylate())
.append("motion", getMotion())
.append("makeFoodType", getMakeFoodType())
.append("makeFoodTaste", getMakeFoodTaste())
.append("walk", getWalk())
.append("difficulty", getDifficulty())
.append("weakness", getWeakness())
.append("rebound", getRebound())
.append("crux", getCrux())
.append("position", getPosition())
.append("sleepTime", getSleepTime())
.append("getupTime", getGetupTime())
.append("connectTime", getConnectTime())
.append("remarks", getRemarks())
.append("bloodData", getBloodData())
.append("moistureDate", getMoistureDate())
.append("vocation", getVocation())
.append(" night", getNight())
.append("experience", getExperience())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.append("updateTime", getUpdateTime())
.append("updateBy", getUpdateBy())
.toString();
}
}

View File

@ -0,0 +1,402 @@
package com.stdiet.custom.dto.request;
import com.stdiet.common.annotation.Excel;
import com.stdiet.common.core.domain.BaseEntity;
/**
* 客户信息建档调查DTO
*
* @author xzj
* @date 2020-12-31
*/
public class CustomerInvestigateRequest extends BaseEntity
{
private static final long serialVersionUID = 1L;
//基础信息
/** $column.columnComment */
private Long id;
/** 名字 */
@Excel(name = "名字")
private String name;
/** 手机号 */
@Excel(name = "手机号")
private String phone;
/** 邮箱 */
@Excel(name = "邮箱")
private String email;
/** 地址 */
@Excel(name = "地址")
private String address;
//体征信息
/** 客户性别 0男 1女 */
@Excel(name = "客户性别 0男 1女")
private Integer sex;
/** 客户年龄(岁) */
@Excel(name = "客户年龄", readConverterExp = "岁=")
private Integer age;
/** 客户身高(厘米) */
@Excel(name = "客户身高", readConverterExp = "厘=米")
private Integer tall;
/** 客户体重(斤) */
@Excel(name = "客户体重", readConverterExp = "斤=")
private Integer weight;
/** 客户病史体征id */
@Excel(name = "客户病史体征id")
private String physicalSignsId;
/** 客户忌口不爱吃食材id */
@Excel(name = "客户忌口不爱吃食材id")
private String dishesIngredientId;
/** 客户照片 */
@Excel(name = "客户照片")
private String photo;
/** 是否便秘 0是 1否 */
@Excel(name = "是否便秘 0是 1否")
private Integer constipation;
/** 是否熬夜、失眠 0是 1否 */
@Excel(name = "是否熬夜、失眠 0是 1否")
private Integer staylate;
/** 是否经常运动 0是 1否 */
@Excel(name = "是否经常运动 0是 1否")
private Integer motion;
/** 饮食方式 0自己做 1外面吃 */
@Excel(name = "饮食方式 0自己做 1外面吃")
private Integer makeFoodType;
/** 饮食特点 0清淡 1重口味 */
@Excel(name = "饮食特点 0清淡 1重口味")
private Integer makeFoodTaste;
/** 平时是否久坐 0久坐多 1走动多 */
@Excel(name = "平时是否久坐 0久坐多 1走动多")
private Integer walk;
/** 减脂过程遇到的困难 */
@Excel(name = "减脂过程遇到的困难")
private String difficulty;
/** 是否浑身乏力 0是 1否 */
@Excel(name = "是否浑身乏力 0是 1否")
private Integer weakness;
/** 是否减脂反弹 0是 1否 */
@Excel(name = "是否减脂反弹 0是 1否")
private Integer rebound;
/** 能否认识到生活习惯的改善才是减脂的关键 0是 1否 */
@Excel(name = "能否认识到生活习惯的改善才是减脂的关键 0是 1否")
private Integer crux;
/** 南方人还是北方人 0南方 1北方 */
@Excel(name = "南方人还是北方人 0南方 1北方")
private Integer position;
/** 睡觉时间24小时制 */
@Excel(name = "睡觉时间", readConverterExp = "2=4小时制")
private Integer sleepTime;
/** 起床时间24小时制 */
@Excel(name = "起床时间", readConverterExp = "2=4小时制")
private Integer getupTime;
/** 联系沟通时间24小时制 */
@Excel(name = "联系沟通时间", readConverterExp = "2=4小时制")
private Integer connectTime;
/** 备注 */
@Excel(name = "备注")
private String remarks;
/** 湿气数据 */
@Excel(name = "湿气数据")
private String bloodData;
/** 气血数据 */
@Excel(name = "气血数据")
private String moistureDate;
/** 工作职业 */
@Excel(name = "工作职业")
private String vocation;
/** 是否上夜班 */
@Excel(name = "是否上夜班")
private Integer night;
/** 减脂经历 */
@Excel(name = "减脂经历")
private String experience;
public Long getId() {
return id;
}
public String getName() {
return name;
}
public String getPhone() {
return phone;
}
public String getEmail() {
return email;
}
public String getAddress() {
return address;
}
public void setId(Long id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setPhone(String phone) {
this.phone = phone;
}
public void setEmail(String email) {
this.email = email;
}
public void setAddress(String address) {
this.address = address;
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public Integer getTall() {
return tall;
}
public void setTall(Integer tall) {
this.tall = tall;
}
public Integer getWeight() {
return weight;
}
public void setWeight(Integer weight) {
this.weight = weight;
}
public String getPhysicalSignsId() {
return physicalSignsId;
}
public void setPhysicalSignsId(String physicalSignsId) {
this.physicalSignsId = physicalSignsId;
}
public String getDishesIngredientId() {
return dishesIngredientId;
}
public void setDishesIngredientId(String dishesIngredientId) {
this.dishesIngredientId = dishesIngredientId;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public Integer getConstipation() {
return constipation;
}
public void setConstipation(Integer constipation) {
this.constipation = constipation;
}
public Integer getStaylate() {
return staylate;
}
public void setStaylate(Integer staylate) {
this.staylate = staylate;
}
public Integer getMotion() {
return motion;
}
public void setMotion(Integer motion) {
this.motion = motion;
}
public Integer getMakeFoodType() {
return makeFoodType;
}
public void setMakeFoodType(Integer makeFoodType) {
this.makeFoodType = makeFoodType;
}
public Integer getMakeFoodTaste() {
return makeFoodTaste;
}
public void setMakeFoodTaste(Integer makeFoodTaste) {
this.makeFoodTaste = makeFoodTaste;
}
public Integer getWalk() {
return walk;
}
public void setWalk(Integer walk) {
this.walk = walk;
}
public String getDifficulty() {
return difficulty;
}
public void setDifficulty(String difficulty) {
this.difficulty = difficulty;
}
public Integer getWeakness() {
return weakness;
}
public void setWeakness(Integer weakness) {
this.weakness = weakness;
}
public Integer getRebound() {
return rebound;
}
public void setRebound(Integer rebound) {
this.rebound = rebound;
}
public Integer getCrux() {
return crux;
}
public void setCrux(Integer crux) {
this.crux = crux;
}
public Integer getPosition() {
return position;
}
public void setPosition(Integer position) {
this.position = position;
}
public Integer getSleepTime() {
return sleepTime;
}
public void setSleepTime(Integer sleepTime) {
this.sleepTime = sleepTime;
}
public Integer getGetupTime() {
return getupTime;
}
public void setGetupTime(Integer getupTime) {
this.getupTime = getupTime;
}
public Integer getConnectTime() {
return connectTime;
}
public void setConnectTime(Integer connectTime) {
this.connectTime = connectTime;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public String getBloodData() {
return bloodData;
}
public void setBloodData(String bloodData) {
this.bloodData = bloodData;
}
public String getMoistureDate() {
return moistureDate;
}
public void setMoistureDate(String moistureDate) {
this.moistureDate = moistureDate;
}
public String getVocation() {
return vocation;
}
public void setVocation(String vocation) {
this.vocation = vocation;
}
public Integer getNight() {
return night;
}
public void setNight(Integer night) {
this.night = night;
}
public String getExperience() {
return experience;
}
public void setExperience(String experience) {
this.experience = experience;
}
}

View File

@ -0,0 +1,73 @@
package com.stdiet.custom.mapper;
import java.util.List;
import com.stdiet.custom.domain.SysCustomer;
import org.apache.ibatis.annotations.Param;
/**
* 客户信息Mapper接口
*
* @author xzj
* @date 2020-12-31
*/
public interface SysCustomerMapper
{
/**
* 查询客户信息
*
* @param id 客户信息ID
* @return 客户信息
*/
public SysCustomer selectSysCustomerById(Long id);
/**
* 查询客户信息列表
*
* @param sysCustomer 客户信息
* @return 客户信息集合
*/
public List<SysCustomer> selectSysCustomerList(SysCustomer sysCustomer);
/**
* 新增客户信息
*
* @param sysCustomer 客户信息
* @return 结果
*/
public int insertSysCustomer(SysCustomer sysCustomer);
/**
* 修改客户信息
*
* @param sysCustomer 客户信息
* @return 结果
*/
public int updateSysCustomer(SysCustomer sysCustomer);
/**
* 删除客户信息
*
* @param id 客户信息ID
* @return 结果
*/
public int deleteSysCustomerById(Long id);
/**
* 批量删除客户信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysCustomerByIds(Long[] ids);
/**
* 根据手机号查询客户信息
*
* @param phone 手机号
* @return 结果
*/
SysCustomer getCustomerByPhone(@Param("phone")String phone);
//查询客户基础信息以及体征信息
List<SysCustomer> selectSysCustomerAndSignList(SysCustomer sysCustomer);
}

View File

@ -0,0 +1,72 @@
package com.stdiet.custom.mapper;
import java.util.List;
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
import org.apache.ibatis.annotations.Param;
/**
* 客户体征信息Mapper接口
*
* @author xzj
* @date 2020-12-31
*/
public interface SysCustomerPhysicalSignsMapper
{
/**
* 查询客户体征信息
*
* @param id 客户体征信息ID
* @return 客户体征信息
*/
public SysCustomerPhysicalSigns selectSysCustomerPhysicalSignsById(Long id);
/**
* 查询客户体征信息列表
*
* @param sysCustomerPhysicalSigns 客户体征信息
* @return 客户体征信息集合
*/
public List<SysCustomerPhysicalSigns> selectSysCustomerPhysicalSignsList(SysCustomerPhysicalSigns sysCustomerPhysicalSigns);
/**
* 新增客户体征信息
*
* @param sysCustomerPhysicalSigns 客户体征信息
* @return 结果
*/
public int insertSysCustomerPhysicalSigns(SysCustomerPhysicalSigns sysCustomerPhysicalSigns);
/**
* 修改客户体征信息
*
* @param sysCustomerPhysicalSigns 客户体征信息
* @return 结果
*/
public int updateSysCustomerPhysicalSigns(SysCustomerPhysicalSigns sysCustomerPhysicalSigns);
/**
* 删除客户体征信息
*
* @param id 客户体征信息ID
* @return 结果
*/
public int deleteSysCustomerPhysicalSignsById(Long id);
/**
* 批量删除客户体征信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysCustomerPhysicalSignsByIds(Long[] ids);
/**
* 根据客户id修改客户体征信息
*
* @param sysCustomerPhysicalSigns 客户体征信息
* @return 结果
*/
int updateSysCustomerPhysicalSignsByCustomerId(SysCustomerPhysicalSigns sysCustomerPhysicalSigns);
int deleteSysCustomerPhysicalSignsByCustomerIds(Long[] ids);
}

View File

@ -0,0 +1,60 @@
package com.stdiet.custom.service;
import java.util.List;
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
/**
* 客户体征信息Service接口
*
* @author xzj
* @date 2020-12-31
*/
public interface ISysCustomerPhysicalSignsService {
/**
* 查询客户体征信息
*
* @param id 客户体征信息ID
* @return 客户体征信息
*/
public SysCustomerPhysicalSigns selectSysCustomerPhysicalSignsById(Long id);
/**
* 查询客户体征信息列表
*
* @param sysCustomerPhysicalSigns 客户体征信息
* @return 客户体征信息集合
*/
public List<SysCustomerPhysicalSigns> selectSysCustomerPhysicalSignsList(SysCustomerPhysicalSigns sysCustomerPhysicalSigns);
/**
* 新增客户体征信息
*
* @param sysCustomerPhysicalSigns 客户体征信息
* @return 结果
*/
public int insertSysCustomerPhysicalSigns(SysCustomerPhysicalSigns sysCustomerPhysicalSigns);
/**
* 修改客户体征信息
*
* @param sysCustomerPhysicalSigns 客户体征信息
* @return 结果
*/
public int updateSysCustomerPhysicalSigns(SysCustomerPhysicalSigns sysCustomerPhysicalSigns);
/**
* 批量删除客户体征信息
*
* @param ids 需要删除的客户体征信息ID
* @return 结果
*/
public int deleteSysCustomerPhysicalSignsByIds(Long[] ids);
/**
* 删除客户体征信息信息
*
* @param id 客户体征信息ID
* @return 结果
*/
public int deleteSysCustomerPhysicalSignsById(Long id);
}

View File

@ -0,0 +1,96 @@
package com.stdiet.custom.service;
import java.util.List;
import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.dto.request.CustomerInvestigateRequest;
/**
* 客户信息Service接口
*
* @author xzj
* @date 2020-12-31
*/
public interface ISysCustomerService
{
/**
* 查询客户信息
*
* @param id 客户信息ID
* @return 客户信息
*/
public SysCustomer selectSysCustomerById(Long id);
/**
* 查询客户信息列表
*
* @param sysCustomer 客户信息
* @return 客户信息集合
*/
public List<SysCustomer> selectSysCustomerList(SysCustomer sysCustomer);
/**
* 新增客户信息
*
* @param sysCustomer 客户信息
* @return 结果
*/
public int insertSysCustomer(SysCustomer sysCustomer);
/**
* 修改客户信息
*
* @param sysCustomer 客户信息
* @return 结果
*/
public int updateSysCustomer(SysCustomer sysCustomer);
/**
* 批量删除客户信息
*
* @param ids 需要删除的客户信息ID
* @return 结果
*/
public int deleteSysCustomerByIds(Long[] ids);
/**
* 删除客户信息信息
*
* @param id 客户信息ID
* @return 结果
*/
public int deleteSysCustomerById(Long id);
/**
* 根据手机号查询
*
* @param phone 手机号
* @return 结果
*/
SysCustomer getCustomerByPhone(String phone);
/**
* 客户建档资料填写
*
* @param customerInvestigateRequest 客户建档相关资料
* @return 结果
*/
int addOrupdateCustomerAndSign( CustomerInvestigateRequest customerInvestigateRequest) throws Exception;
/**
* 查询客户基础信息以及体征信息列表
*
* @param sysCustomer 查询条件
* @return 结果
*/
List<SysCustomer> selectSysCustomerAndSignList(SysCustomer sysCustomer);
/**
* 根据id查询客户信息基础信息以及体征信息
*
* @param id 客户id
* @return 结果
*/
SysCustomer getCustomerAndSignById(Long id);
int delCustomerAndSignById(Long[] ids);
}

View File

@ -0,0 +1,96 @@
package com.stdiet.custom.service.impl;
import java.util.List;
import com.stdiet.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.stdiet.custom.mapper.SysCustomerPhysicalSignsMapper;
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
import com.stdiet.custom.service.ISysCustomerPhysicalSignsService;
/**
* 客户体征信息Service业务层处理
*
* @author xzj
* @date 2020-12-31
*/
@Service
public class SysCustomerPhysicalSignsServiceImpl implements ISysCustomerPhysicalSignsService
{
@Autowired
private SysCustomerPhysicalSignsMapper sysCustomerPhysicalSignsMapper;
/**
* 查询客户体征信息
*
* @param id 客户体征信息ID
* @return 客户体征信息
*/
@Override
public SysCustomerPhysicalSigns selectSysCustomerPhysicalSignsById(Long id)
{
return sysCustomerPhysicalSignsMapper.selectSysCustomerPhysicalSignsById(id);
}
/**
* 查询客户体征信息列表
*
* @param sysCustomerPhysicalSigns 客户体征信息
* @return 客户体征信息
*/
@Override
public List<SysCustomerPhysicalSigns> selectSysCustomerPhysicalSignsList(SysCustomerPhysicalSigns sysCustomerPhysicalSigns)
{
return sysCustomerPhysicalSignsMapper.selectSysCustomerPhysicalSignsList(sysCustomerPhysicalSigns);
}
/**
* 新增客户体征信息
*
* @param sysCustomerPhysicalSigns 客户体征信息
* @return 结果
*/
@Override
public int insertSysCustomerPhysicalSigns(SysCustomerPhysicalSigns sysCustomerPhysicalSigns)
{
sysCustomerPhysicalSigns.setCreateTime(DateUtils.getNowDate());
return sysCustomerPhysicalSignsMapper.insertSysCustomerPhysicalSigns(sysCustomerPhysicalSigns);
}
/**
* 修改客户体征信息
*
* @param sysCustomerPhysicalSigns 客户体征信息
* @return 结果
*/
@Override
public int updateSysCustomerPhysicalSigns(SysCustomerPhysicalSigns sysCustomerPhysicalSigns)
{
sysCustomerPhysicalSigns.setUpdateTime(DateUtils.getNowDate());
return sysCustomerPhysicalSignsMapper.updateSysCustomerPhysicalSigns(sysCustomerPhysicalSigns);
}
/**
* 批量删除客户体征信息
*
* @param ids 需要删除的客户体征信息ID
* @return 结果
*/
@Override
public int deleteSysCustomerPhysicalSignsByIds(Long[] ids)
{
return sysCustomerPhysicalSignsMapper.deleteSysCustomerPhysicalSignsByIds(ids);
}
/**
* 删除客户体征信息信息
*
* @param id 客户体征信息ID
* @return 结果
*/
@Override
public int deleteSysCustomerPhysicalSignsById(Long id)
{
return sysCustomerPhysicalSignsMapper.deleteSysCustomerPhysicalSignsById(id);
}
}

View File

@ -0,0 +1,181 @@
package com.stdiet.custom.service.impl;
import java.util.List;
import com.stdiet.common.core.domain.model.LoginUser;
import com.stdiet.common.utils.DateUtils;
import com.stdiet.common.utils.SecurityUtils;
import com.stdiet.common.utils.bean.ObjectUtils;
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
import com.stdiet.custom.dto.request.CustomerInvestigateRequest;
import com.stdiet.custom.mapper.SysCustomerPhysicalSignsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.stdiet.custom.mapper.SysCustomerMapper;
import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.service.ISysCustomerService;
import org.springframework.transaction.annotation.Transactional;
/**
* 客户信息Service业务层处理
*
* @author xzj
* @date 2020-12-31
*/
@Service
@Transactional
public class SysCustomerServiceImpl implements ISysCustomerService
{
@Autowired
private SysCustomerMapper sysCustomerMapper;
@Autowired
private SysCustomerPhysicalSignsMapper sysCustomerPhysicalSignsMapper;
/**
* 查询客户信息
*
* @param id 客户信息ID
* @return 客户信息
*/
@Override
public SysCustomer selectSysCustomerById(Long id)
{
return sysCustomerMapper.selectSysCustomerById(id);
}
/**
* 查询客户信息列表
*
* @param sysCustomer 客户信息
* @return 客户信息
*/
@Override
public List<SysCustomer> selectSysCustomerList(SysCustomer sysCustomer)
{
return sysCustomerMapper.selectSysCustomerList(sysCustomer);
}
/**
* 新增客户信息
*
* @param sysCustomer 客户信息
* @return 结果
*/
@Override
public int insertSysCustomer(SysCustomer sysCustomer)
{
sysCustomer.setCreateTime(DateUtils.getNowDate());
return sysCustomerMapper.insertSysCustomer(sysCustomer);
}
/**
* 修改客户信息
*
* @param sysCustomer 客户信息
* @return 结果
*/
@Override
public int updateSysCustomer(SysCustomer sysCustomer)
{
sysCustomer.setUpdateTime(DateUtils.getNowDate());
return sysCustomerMapper.updateSysCustomer(sysCustomer);
}
/**
* 批量删除客户信息
*
* @param ids 需要删除的客户信息ID
* @return 结果
*/
@Override
public int deleteSysCustomerByIds(Long[] ids)
{
return sysCustomerMapper.deleteSysCustomerByIds(ids);
}
/**
* 删除客户信息信息
*
* @param id 客户信息ID
* @return 结果
*/
@Override
public int deleteSysCustomerById(Long id)
{
return sysCustomerMapper.deleteSysCustomerById(id);
}
/**
* 根据手机号查询
*
* @param phone 手机号
* @return 结果
*/
public SysCustomer getCustomerByPhone(String phone){
return sysCustomerMapper.getCustomerByPhone(phone);
}
/**
* 客户建档资料填写
*
* @param customerInvestigateRequest 客户建档相关资料
* @return 结果
*/
public int addOrupdateCustomerAndSign(CustomerInvestigateRequest customerInvestigateRequest) throws Exception{
//当前登录用户
//LoginUser loginUser = SecurityUtils.getLoginUser();
SysCustomer sysCustomer = new SysCustomer();
sysCustomer.setId(customerInvestigateRequest.getId());
sysCustomer.setName(customerInvestigateRequest.getName());
sysCustomer.setPhone(customerInvestigateRequest.getPhone());
//添加人更新人
/*if(loginUser != null){
if(customerInvestigateRequest.getId() == null){
sysCustomer.setCreateBy(loginUser.getUser().getUserId()+"");
}else{
sysCustomer.setUpdateBy(loginUser.getUser().getUserId()+"");
}
}*/
//sysCustomer.setEmail(customerInvestigateRequest.getEmail());
//sysCustomer.setAddress(customerInvestigateRequest.getAddress());
int addOrUpdateRow = customerInvestigateRequest.getId() == null ? insertSysCustomer(sysCustomer) : updateSysCustomer(sysCustomer);
if(addOrUpdateRow > 0){
SysCustomerPhysicalSigns customerSigns = ObjectUtils.getObjectByObject(customerInvestigateRequest, SysCustomerPhysicalSigns.class);
customerSigns.setCustomerId(sysCustomer.getId());
customerSigns.setId(null);
addOrUpdateRow = customerInvestigateRequest.getId() == null ? sysCustomerPhysicalSignsMapper.insertSysCustomerPhysicalSigns(customerSigns) : sysCustomerPhysicalSignsMapper.updateSysCustomerPhysicalSignsByCustomerId(customerSigns);
}
return addOrUpdateRow;
}
/**
* 查询客户基础信息以及体征信息列表
*
* @param sysCustomer 查询条件
* @return 结果
*/
public List<SysCustomer> selectSysCustomerAndSignList(SysCustomer sysCustomer){
return sysCustomerMapper.selectSysCustomerAndSignList(sysCustomer);
}
/**
* 根据id查询客户信息基础信息以及体征信息
*
* @param id 客户id
* @return 结果
*/
public SysCustomer getCustomerAndSignById(Long id){
SysCustomer sysCustomer = new SysCustomer();
sysCustomer.setId(id);
List<SysCustomer> list = sysCustomerMapper.selectSysCustomerAndSignList(sysCustomer);
return list.size() > 0 ? list.get(0) : null;
}
public int delCustomerAndSignById(Long[] ids){
if(deleteSysCustomerByIds(ids) > 0){
return sysCustomerPhysicalSignsMapper.deleteSysCustomerPhysicalSignsByCustomerIds(ids);
}
return 0;
}
}

View File

@ -0,0 +1,218 @@
<?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.stdiet.custom.mapper.SysCustomerMapper">
<resultMap type="SysCustomer" id="SysCustomerResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="address" column="address" />
<result property="payDate" column="pay_date" />
<result property="startDate" column="start_date" />
<result property="purchaseNum" column="purchase_num" />
<result property="payTotal" column="pay_total" />
<result property="mainDietitian" column="main_dietitian" />
<result property="assistantDietitian" column="assistant_dietitian" />
<result property="afterDietitian" column="after_dietitian" />
<result property="salesman" column="salesman" />
<result property="chargePerson" column="charge_person" />
<result property="followStatus" column="follow_status" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
</resultMap>
<resultMap type="SysCustomer" id="SysCustomerSignResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="address" column="address" />
<result property="payDate" column="pay_date" />
<result property="startDate" column="start_date" />
<result property="purchaseNum" column="purchase_num" />
<result property="payTotal" column="pay_total" />
<result property="mainDietitian" column="main_dietitian" />
<result property="assistantDietitian" column="assistant_dietitian" />
<result property="afterDietitian" column="after_dietitian" />
<result property="salesman" column="salesman" />
<result property="chargePerson" column="charge_person" />
<result property="followStatus" column="follow_status" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<association property="sign" javaType="com.stdiet.custom.domain.SysCustomerPhysicalSigns">
<result property="id" column="id" />
<result property="customerId" column="customer_id" />
<result property="sex" column="sex" />
<result property="age" column="age" />
<result property="tall" column="tall" />
<result property="weight" column="weight" />
<result property="physicalSignsId" column="physical_signs_id" />
<result property="dishesIngredientId" column="dishes_ingredient_id" />
<result property="photo" column="photo" />
<result property="constipation" column="constipation" />
<result property="staylate" column="stayLate" />
<result property="motion" column="motion" />
<result property="makeFoodType" column="make_food_type" />
<result property="makeFoodTaste" column="make_food_taste" />
<result property="walk" column="walk" />
<result property="difficulty" column="difficulty" />
<result property="weakness" column="weakness" />
<result property="rebound" column="rebound" />
<result property="crux" column="crux" />
<result property="position" column="position" />
<result property="sleepTime" column="sleep_time" />
<result property="getupTime" column="getup_time" />
<result property="connectTime" column="connect_time" />
<result property="remarks" column="remarks" />
<result property="bloodData" column="blood_data" />
<result property="moistureDate" column="moisture_date" />
<result property="vocation" column="vocation" />
<result property="night" column="night" />
<result property="experience" column="experience" />
<!-- column是传的参数, select是调用的查询 -->
<association property="signList" column="physical_signs_id" select="getSignByIds"/>
</association>
</resultMap>
<sql id="selectSysCustomerVo">
select id, name, phone, email, address, pay_date, start_date, purchase_num, pay_total, main_dietitian, assistant_dietitian, after_dietitian, salesman, charge_person, follow_status, create_time, create_by, update_time, update_by from sys_customer
</sql>
<select id="selectSysCustomerList" parameterType="SysCustomer" resultMap="SysCustomerResult">
<include refid="selectSysCustomerVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if>
</where>
</select>
<select id="selectSysCustomerById" parameterType="Long" resultMap="SysCustomerResult">
<include refid="selectSysCustomerVo"/>
where id = #{id}
</select>
<insert id="insertSysCustomer" parameterType="SysCustomer" useGeneratedKeys="true" keyProperty="id">
insert into sys_customer
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="phone != null">phone,</if>
<if test="email != null">email,</if>
<if test="address != null">address,</if>
<if test="payDate != null">pay_date,</if>
<if test="startDate != null">start_date,</if>
<if test="purchaseNum != null">purchase_num,</if>
<if test="payTotal != null">pay_total,</if>
<if test="mainDietitian != null">main_dietitian,</if>
<if test="assistantDietitian != null">assistant_dietitian,</if>
<if test="afterDietitian != null">after_dietitian,</if>
<if test="salesman != null">salesman,</if>
<if test="chargePerson != null">charge_person,</if>
<if test="followStatus != null">follow_status,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="phone != null">#{phone},</if>
<if test="email != null">#{email},</if>
<if test="address != null">#{address},</if>
<if test="payDate != null">#{payDate},</if>
<if test="startDate != null">#{startDate},</if>
<if test="purchaseNum != null">#{purchaseNum},</if>
<if test="payTotal != null">#{payTotal},</if>
<if test="mainDietitian != null">#{mainDietitian},</if>
<if test="assistantDietitian != null">#{assistantDietitian},</if>
<if test="afterDietitian != null">#{afterDietitian},</if>
<if test="salesman != null">#{salesman},</if>
<if test="chargePerson != null">#{chargePerson},</if>
<if test="followStatus != null">#{followStatus},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
</insert>
<update id="updateSysCustomer" parameterType="SysCustomer">
update sys_customer
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="email != null">email = #{email},</if>
<if test="address != null">address = #{address},</if>
<if test="payDate != null">pay_date = #{payDate},</if>
<if test="startDate != null">start_date = #{startDate},</if>
<if test="purchaseNum != null">purchase_num = #{purchaseNum},</if>
<if test="payTotal != null">pay_total = #{payTotal},</if>
<if test="mainDietitian != null">main_dietitian = #{mainDietitian},</if>
<if test="assistantDietitian != null">assistant_dietitian = #{assistantDietitian},</if>
<if test="afterDietitian != null">after_dietitian = #{afterDietitian},</if>
<if test="salesman != null">salesman = #{salesman},</if>
<if test="chargePerson != null">charge_person = #{chargePerson},</if>
<if test="followStatus != null">follow_status = #{followStatus},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysCustomerById" parameterType="Long">
delete from sys_customer where id = #{id}
</delete>
<delete id="deleteSysCustomerByIds" parameterType="String">
delete from sys_customer where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!-- 根据手机号查询客户 -->
<select id="getCustomerByPhone" parameterType="String" resultMap="SysCustomerResult">
<include refid="selectSysCustomerVo"/>
where phone = #{phone}
</select>
<sql id="selectSysCustomerAndSign">
<!--sc.email, sc.address, sc.pay_date, sc.start_date, sc.purchase_num, sc.pay_total, sc.main_dietitian, sc.assistant_dietitian,
sc.after_dietitian, sc.salesman, sc.charge_person, sc.follow_status, -->
select sc.id, sc.name, sc.phone, sc.create_time, sc.create_by, sc.update_time, sc.update_by,
<include refid="selectSysCustomerPhysicalSigns"></include>
from sys_customer sc
left join sys_customer_physical_signs scps on scps.customer_id = sc.id
</sql>
<sql id="selectSysCustomerPhysicalSigns">
scps.sex, scps.age, scps.tall, scps.weight, scps.physical_signs_id, scps.dishes_ingredient_id, scps.photo, scps.constipation,
scps.stayLate, scps.motion, scps.make_food_type, scps.make_food_taste, scps.walk, scps.difficulty, scps.weakness, scps.rebound, scps.crux, scps.position,
scps.sleep_time, scps.getup_time, scps.connect_time, scps.remarks, scps.blood_data, scps.moisture_date, scps.vocation,
scps.night, scps.experience
</sql>
<select id="selectSysCustomerAndSignList" parameterType="SysCustomer" resultMap="SysCustomerSignResult">
<include refid="selectSysCustomerAndSign"/>
<where>
<if test="id != null"> and sc.id = #{id} </if>
<if test="name != null and name != ''"> and sc.name like concat('%', #{name}, '%')</if>
<if test="phone != null and phone != ''"> and sc.phone like concat('%', #{phone}, '%')</if>
</where>
order by id desc
</select>
<!-- 根据体征id获取体征 -->
<select id="getSignByIds" parameterType="String" resultType="SysPhysicalSigns">
select * from sys_physical_signs sps where FIND_IN_SET(id, #{physical_signs_id})
</select>
</mapper>

View File

@ -0,0 +1,257 @@
<?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.stdiet.custom.mapper.SysCustomerPhysicalSignsMapper">
<resultMap type="SysCustomerPhysicalSigns" id="SysCustomerPhysicalSignsResult">
<result property="id" column="id" />
<result property="customerId" column="customer_id" />
<result property="sex" column="sex" />
<result property="age" column="age" />
<result property="tall" column="tall" />
<result property="weight" column="weight" />
<result property="physicalSignsId" column="physical_signs_id" />
<result property="dishesIngredientId" column="dishes_ingredient_id" />
<result property="photo" column="photo" />
<result property="constipation" column="constipation" />
<result property="staylate" column="stayLate" />
<result property="motion" column="motion" />
<result property="makeFoodType" column="make_food_type" />
<result property="makeFoodTaste" column="make_food_taste" />
<result property="walk" column="walk" />
<result property="difficulty" column="difficulty" />
<result property="weakness" column="weakness" />
<result property="rebound" column="rebound" />
<result property="crux" column="crux" />
<result property="position" column="position" />
<result property="sleepTime" column="sleep_time" />
<result property="getupTime" column="getup_time" />
<result property="connectTime" column="connect_time" />
<result property="remarks" column="remarks" />
<result property="bloodData" column="blood_data" />
<result property="moistureDate" column="moisture_date" />
<result property="vocation" column="vocation" />
<result property="night" column="night" />
<result property="experience" column="experience" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectSysCustomerPhysicalSignsVo">
select id, customer_id, sex, age, tall, weight, physical_signs_id, dishes_ingredient_id, photo, constipation, stayLate, motion, make_food_type, make_food_taste, walk, difficulty, weakness, rebound, crux, position, sleep_time, getup_time, connect_time, remarks, blood_data, moisture_date, vocation,
night, experience, create_time, create_by, update_time, update_by from sys_customer_physical_signs
</sql>
<select id="selectSysCustomerPhysicalSignsList" parameterType="SysCustomerPhysicalSigns" resultMap="SysCustomerPhysicalSignsResult">
<include refid="selectSysCustomerPhysicalSignsVo"/>
<where>
<if test="customerId != null "> and customer_id = #{customerId}</if>
<if test="sex != null "> and sex = #{sex}</if>
<if test="age != null "> and age = #{age}</if>
<if test="tall != null "> and tall = #{tall}</if>
<if test="weight != null "> and weight = #{weight}</if>
<if test="physicalSignsId != null and physicalSignsId != ''"> and physical_signs_id = #{physicalSignsId}</if>
<if test="dishesIngredientId != null and dishesIngredientId != ''"> and dishes_ingredient_id = #{dishesIngredientId}</if>
<if test="photo != null and photo != ''"> and photo = #{photo}</if>
<if test="constipation != null "> and constipation = #{constipation}</if>
<if test="staylate != null "> and stayLate = #{staylate}</if>
<if test="motion != null "> and motion = #{motion}</if>
<if test="makeFoodType != null "> and make_food_type = #{makeFoodType}</if>
<if test="makeFoodTaste != null "> and make_food_taste = #{makeFoodTaste}</if>
<if test="walk != null "> and walk = #{walk}</if>
<if test="difficulty != null and difficulty != ''"> and difficulty = #{difficulty}</if>
<if test="weakness != null "> and weakness = #{weakness}</if>
<if test="rebound != null "> and rebound = #{rebound}</if>
<if test="crux != null "> and crux = #{crux}</if>
<if test="position != null "> and position = #{position}</if>
<if test="sleepTime != null "> and sleep_time = #{sleepTime}</if>
<if test="getupTime != null "> and getup_time = #{getupTime}</if>
<if test="connectTime != null "> and connect_time = #{connectTime}</if>
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
<if test="bloodData != null and bloodData != ''"> and blood_data = #{bloodData}</if>
<if test="moistureDate != null and moistureDate != ''"> and moisture_date = #{moistureDate}</if>
<if test="vocation != null and vocation != ''"> and vocation = #{vocation}</if>
<if test="night != null "> and night = #{night}</if>
<if test="experience != null and experience != ''"> and experience = #{experience}</if>
</where>
</select>
<select id="selectSysCustomerPhysicalSignsById" parameterType="Long" resultMap="SysCustomerPhysicalSignsResult">
<include refid="selectSysCustomerPhysicalSignsVo"/>
where id = #{id}
</select>
<insert id="insertSysCustomerPhysicalSigns" parameterType="SysCustomerPhysicalSigns" useGeneratedKeys="true" keyProperty="id">
insert into sys_customer_physical_signs
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerId != null">customer_id,</if>
<if test="sex != null">sex,</if>
<if test="age != null">age,</if>
<if test="tall != null">tall,</if>
<if test="weight != null">weight,</if>
<if test="physicalSignsId != null">physical_signs_id,</if>
<if test="dishesIngredientId != null">dishes_ingredient_id,</if>
<if test="photo != null">photo,</if>
<if test="constipation != null">constipation,</if>
<if test="staylate != null">stayLate,</if>
<if test="motion != null">motion,</if>
<if test="makeFoodType != null">make_food_type,</if>
<if test="makeFoodTaste != null">make_food_taste,</if>
<if test="walk != null">walk,</if>
<if test="difficulty != null">difficulty,</if>
<if test="weakness != null">weakness,</if>
<if test="rebound != null">rebound,</if>
<if test="crux != null">crux,</if>
<if test="position != null">position,</if>
<if test="sleepTime != null">sleep_time,</if>
<if test="getupTime != null">getup_time,</if>
<if test="connectTime != null">connect_time,</if>
<if test="remarks != null">remarks,</if>
<if test="bloodData != null">blood_data,</if>
<if test="moistureDate != null">moisture_date,</if>
<if test="vocation != null">vocation,</if>
<if test="
night != null">
night,</if>
<if test="experience != null">experience,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="customerId != null">#{customerId},</if>
<if test="sex != null">#{sex},</if>
<if test="age != null">#{age},</if>
<if test="tall != null">#{tall},</if>
<if test="weight != null">#{weight},</if>
<if test="physicalSignsId != null">#{physicalSignsId},</if>
<if test="dishesIngredientId != null">#{dishesIngredientId},</if>
<if test="photo != null">#{photo},</if>
<if test="constipation != null">#{constipation},</if>
<if test="staylate != null">#{staylate},</if>
<if test="motion != null">#{motion},</if>
<if test="makeFoodType != null">#{makeFoodType},</if>
<if test="makeFoodTaste != null">#{makeFoodTaste},</if>
<if test="walk != null">#{walk},</if>
<if test="difficulty != null">#{difficulty},</if>
<if test="weakness != null">#{weakness},</if>
<if test="rebound != null">#{rebound},</if>
<if test="crux != null">#{crux},</if>
<if test="position != null">#{position},</if>
<if test="sleepTime != null">#{sleepTime},</if>
<if test="getupTime != null">#{getupTime},</if>
<if test="connectTime != null">#{connectTime},</if>
<if test="remarks != null">#{remarks},</if>
<if test="bloodData != null">#{bloodData},</if>
<if test="moistureDate != null">#{moistureDate},</if>
<if test="vocation != null">#{vocation},</if>
<if test="night != null">#{night},</if>
<if test="experience != null">#{experience},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
</insert>
<update id="updateSysCustomerPhysicalSigns" parameterType="SysCustomerPhysicalSigns">
update sys_customer_physical_signs
<trim prefix="SET" suffixOverrides=",">
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="age != null">age = #{age},</if>
<if test="tall != null">tall = #{tall},</if>
<if test="weight != null">weight = #{weight},</if>
<if test="physicalSignsId != null">physical_signs_id = #{physicalSignsId},</if>
<if test="dishesIngredientId != null">dishes_ingredient_id = #{dishesIngredientId},</if>
<if test="photo != null">photo = #{photo},</if>
<if test="constipation != null">constipation = #{constipation},</if>
<if test="staylate != null">stayLate = #{staylate},</if>
<if test="motion != null">motion = #{motion},</if>
<if test="makeFoodType != null">make_food_type = #{makeFoodType},</if>
<if test="makeFoodTaste != null">make_food_taste = #{makeFoodTaste},</if>
<if test="walk != null">walk = #{walk},</if>
<if test="difficulty != null">difficulty = #{difficulty},</if>
<if test="weakness != null">weakness = #{weakness},</if>
<if test="rebound != null">rebound = #{rebound},</if>
<if test="crux != null">crux = #{crux},</if>
<if test="position != null">position = #{position},</if>
<if test="sleepTime != null">sleep_time = #{sleepTime},</if>
<if test="getupTime != null">getup_time = #{getupTime},</if>
<if test="connectTime != null">connect_time = #{connectTime},</if>
<if test="remarks != null">remarks = #{remarks},</if>
<if test="bloodData != null">blood_data = #{bloodData},</if>
<if test="moistureDate != null">moisture_date = #{moistureDate},</if>
<if test="vocation != null">vocation = #{vocation},</if>
<if test="night != null">night = #{night},</if>
<if test="experience != null">experience = #{experience},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysCustomerPhysicalSignsById" parameterType="Long">
delete from sys_customer_physical_signs where id = #{id}
</delete>
<delete id="deleteSysCustomerPhysicalSignsByIds" parameterType="String">
delete from sys_customer_physical_signs where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!-- 根据客户id更新体征信息 -->
<update id="updateSysCustomerPhysicalSignsByCustomerId" parameterType="SysCustomerPhysicalSigns">
update sys_customer_physical_signs
<trim prefix="SET" suffixOverrides=",">
<if test="sex != null">sex = #{sex},</if>
<if test="age != null">age = #{age},</if>
<if test="tall != null">tall = #{tall},</if>
<if test="weight != null">weight = #{weight},</if>
<if test="physicalSignsId != null">physical_signs_id = #{physicalSignsId},</if>
<if test="dishesIngredientId != null">dishes_ingredient_id = #{dishesIngredientId},</if>
<if test="photo != null">photo = #{photo},</if>
<if test="constipation != null">constipation = #{constipation},</if>
<if test="staylate != null">stayLate = #{staylate},</if>
<if test="motion != null">motion = #{motion},</if>
<if test="makeFoodType != null">make_food_type = #{makeFoodType},</if>
<if test="makeFoodTaste != null">make_food_taste = #{makeFoodTaste},</if>
<if test="walk != null">walk = #{walk},</if>
<if test="difficulty != null">difficulty = #{difficulty},</if>
<if test="weakness != null">weakness = #{weakness},</if>
<if test="rebound != null">rebound = #{rebound},</if>
<if test="crux != null">crux = #{crux},</if>
<if test="position != null">position = #{position},</if>
<if test="sleepTime != null">sleep_time = #{sleepTime},</if>
<if test="getupTime != null">getup_time = #{getupTime},</if>
<if test="connectTime != null">connect_time = #{connectTime},</if>
<if test="remarks != null">remarks = #{remarks},</if>
<if test="bloodData != null">blood_data = #{bloodData},</if>
<if test="moistureDate != null">moisture_date = #{moistureDate},</if>
<if test="vocation != null">vocation = #{vocation},</if>
<if test="night != null">night = #{night},</if>
<if test="experience != null">experience = #{experience},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where customer_id = #{customerId}
</update>
<delete id="deleteSysCustomerPhysicalSignsByCustomerIds" parameterType="String">
delete from sys_customer_physical_signs where customer_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -100,7 +100,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/custom/contract/sign", "/custom/contract/sign",
"/custom/contract/file/**", "/custom/contract/file/**",
"/custom/wxUserInfo/wx/**", "/custom/wxUserInfo/wx/**",
"/custom/wxUserLog/wx/**" "/custom/wxUserLog/wx/**",
"/investigate/**",
"/investigate/physicalSignsList"
).anonymous() ).anonymous()
.antMatchers( .antMatchers(
HttpMethod.GET, HttpMethod.GET,

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询客户信息列表
export function listCustomer(query) {
return request({
url: '/custom/customer/list',
method: 'get',
params: query
})
}
// 查询客户信息详细
export function getCustomer(id) {
return request({
url: '/custom/customer/' + id,
method: 'get'
})
}
// 新增客户信息
export function addCustomer(data) {
return request({
url: '/custom/customer',
method: 'post',
data: data
})
}
// 修改客户信息
export function updateCustomer(data) {
return request({
url: '/custom/customer',
method: 'put',
data: data
})
}
// 删除客户信息
export function delCustomer(id) {
return request({
url: '/custom/customer/' + id,
method: 'delete'
})
}
// 导出客户信息
export function exportCustomer(query) {
return request({
url: '/custom/customer/export',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,27 @@
import request from '@/utils/request'
// 调查页面查询体征列表
export function physicalSignsList(query) {
return request({
url: '/investigate/physicalSignsList',
method: 'get',
params: query
})
}
// 调查页面新增客户资料
export function addCustomer(data) {
return request({
url: '/investigate/customerInvestigate',
method: 'post',
data: data
})
}
// 根据字典类型查询字典数据信息
export function getDictData(dictType) {
return request({
url: '/investigate/type/' + dictType,
method: 'get'
})
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

View File

@ -7,7 +7,7 @@ import {getToken} from '@/utils/auth'
NProgress.configure({showSpinner: false}) NProgress.configure({showSpinner: false})
const whiteList = ['/login', '/auth-redirect', '/bind', '/register'] const whiteList = ['/login', '/auth-redirect', '/bind', '/register', '/question']
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
NProgress.start() NProgress.start()

View File

@ -129,7 +129,13 @@ export const constantRoutes = [
hidden: true, hidden: true,
component: (resolve) => require(['@/views/custom/signContract'], resolve), component: (resolve) => require(['@/views/custom/signContract'], resolve),
meta: { title: '合同' } meta: { title: '合同' }
} },
{
path: '/question',
component: (resolve) => require(['@/views/custom/investigate/questionnaire'], resolve),
hidden: true,
meta: { title: '营养体征调查表'}
}
] ]
export default new Router({ export default new Router({

View File

@ -0,0 +1,704 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="名字" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入名字"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input
v-model="queryParams.phone"
placeholder="请输入手机号"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['custom:customer:add']"
>新增</el-button>
</el-col>
<!--<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['custom:customer:edit']"
>修改</el-button>
</el-col>-->
<!--<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['custom:customer:remove']"
>删除</el-button>
</el-col>-->
<!--<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['custom:customer:export']"
>导出</el-button>
</el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="customerList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!--<el-table-column label="序号" align="center" prop="id" />-->
<el-table-column label="姓名" align="center" prop="name" />
<el-table-column label="手机号" align="center" prop="phone" />
<el-table-column label="性别" align="center" prop="sign.sex" width="80">
<template slot-scope="scope">
{{scope.row.sign.sex == 0 ? `` : '女'}}
</template>
</el-table-column>
<el-table-column label="年龄(岁)" align="center" prop="sign.age" />
<el-table-column label="身高(厘米)" align="center" prop="sign.tall" />
<el-table-column label="体重(斤)" align="center" prop="sign.weight" />
<el-table-column label="北方、南方" align="center" prop="sign.position" width="80">
<template slot-scope="scope">
{{scope.row.sign.position == 0 ? `南方` : '北方'}}
</template>
</el-table-column>
<el-table-column label="病史" align="center" prop="sign.signList" width="80">
<template slot-scope="scope">
{{getSignString(scope.row.sign.signList)}}
</template>
</el-table-column>
<el-table-column label="忌口或过敏源" align="center" prop="sign.dishesIngredientId" width="80">
<template slot-scope="scope">
{{scope.row.sign.dishesIngredientId}}
</template>
</el-table-column>
<el-table-column label="是否便秘" align="center" prop="sign.constipation" width="80">
<template slot-scope="scope">
{{scope.row.sign.constipation == 0 ? `` : '否'}}
</template>
</el-table-column>
<el-table-column label="是否熬夜失眠" align="center" prop="sign.staylate" width="80">
<template slot-scope="scope">
{{scope.row.sign.staylate == 0 ? `` : '否'}}
</template>
</el-table-column>
<el-table-column label="是否经常运动" align="center" prop="sign.motion" width="80">
<template slot-scope="scope">
{{scope.row.sign.motion == 0 ? `` : '否'}}
</template>
</el-table-column>
<el-table-column label="饮食方式" align="center" prop="sign.makeFoodType" width="80">
<template slot-scope="scope">
{{scope.row.sign.makeFoodType == 0 ? `自己做` : '外面吃'}}
</template>
</el-table-column>
<el-table-column label="饮食特点" align="center" prop="sign.makeFoodTaste" width="80">
<template slot-scope="scope">
{{scope.row.sign.makeFoodTaste == 0 ? `清淡` : '重口味'}}
</template>
</el-table-column>
<el-table-column label="工作职业" align="center" prop="sign.vocation" width="80">
<template slot-scope="scope">
{{scope.row.sign.vocation}}
</template>
</el-table-column>
<el-table-column label="是否上夜班" align="center" prop="sign.night" width="80">
<template slot-scope="scope">
{{scope.row.sign.night == 0 ? `` : '否'}}
</template>
</el-table-column>
<el-table-column label="久坐多还是运动多" align="center" prop="sign.walk" width="80">
<template slot-scope="scope">
{{scope.row.sign.walk == 0 ? `久坐多` : '走动多'}}
</template>
</el-table-column>
<el-table-column label="是否浑身乏力" align="center" prop="sign.weakness" width="80">
<template slot-scope="scope">
{{scope.row.sign.weakness == 0 ? `久坐多` : '走动多'}}
</template>
</el-table-column>
<el-table-column label="是否减脂反弹" align="center" prop="sign.rebound" width="80">
<template slot-scope="scope">
{{scope.row.sign.rebound == 0 ? `` : '否'}}
</template>
</el-table-column>
<el-table-column label="意识到生活习惯是减脂关键" align="center" prop="sign.crux" width="80">
<template slot-scope="scope">
{{scope.row.sign.crux == 0 ? `` : '否'}}
</template>
</el-table-column>
<el-table-column label="睡觉时间" align="center" prop="sign.sleepTime" width="80">
<template slot-scope="scope">
{{scope.row.sign.sleepTime}}
</template>
</el-table-column>
<el-table-column label="起床时间" align="center" prop="sign.getupTime" width="80">
<template slot-scope="scope">
{{scope.row.sign.getupTime}}
</template>
</el-table-column>
<el-table-column label="方便沟通时间" align="center" prop="sign.connectTime" width="80">
<template slot-scope="scope">
{{scope.row.sign.connectTime}}
</template>
</el-table-column>
<el-table-column label="湿气数据" align="center" prop="sign.bloodData" width="80">
<template slot-scope="scope">
{{scope.row.sign.bloodData}}
</template>
</el-table-column>
<el-table-column label="气血数据" align="center" prop="sign.moistureDate" width="80">
<template slot-scope="scope">
{{scope.row.sign.moistureDate}}
</template>
</el-table-column>
<el-table-column label="减脂经历" align="center" prop="sign.experience" width="80">
<template slot-scope="scope">
{{scope.row.sign.experience}}
</template>
</el-table-column>
<el-table-column label="减脂遇到的困难" align="center" prop="sign.difficulty" width="80">
<template slot-scope="scope">
{{scope.row.sign.difficulty}}
</template>
</el-table-column>
<!--<el-table-column label="主营养师" align="center" prop="mainDietitian" />
<el-table-column label="营养师助理" align="center" prop="assistantDietitian" />
<el-table-column label="售后营养师" align="center" prop="afterDietitian" />
<el-table-column label="销售人员" align="center" prop="salesman" />
<el-table-column label="负责人" align="center" prop="chargePerson" />-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['custom:customer:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['custom:customer:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改客户信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<!--<p>现在要先为您建立更加详细的档案以便为您定制专属的减脂计划</p>-->
<el-form-item label="真实姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入真实姓名" />
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input v-model="form.phone" placeholder="请输入手机号" />
</el-form-item>
<!--<el-form-item label="邮箱" prop="email">
<el-input v-model="form.email" placeholder="请输入邮箱" />
</el-form-item>-->
<!--<el-form-item label="您的居住地址" prop="address">
<el-input v-model="form.address" placeholder="请输入地址" />
</el-form-item>-->
<el-form-item label="性别" prop="sex">
<el-select v-model="form.sex" placeholder="请选择性别">
<el-option label="男" value="0" />
<el-option label="女" value="1" />
</el-select>
</el-form-item>
<el-form-item label="年龄(岁)" prop="age">
<el-input v-model="form.age" placeholder="请输入年龄" />
</el-form-item>
<el-form-item label="身高(厘米)" prop="tall">
<el-input v-model="form.tall" placeholder="请输入身高" />
</el-form-item>
<el-form-item label="体重(斤)" prop="weight">
<el-input v-model="form.weight" placeholder="请输入体重" />
</el-form-item>
<el-form-item label="南方人还是北方人" prop="position">
<el-select v-model="form.position" placeholder="请选择">
<el-option label="南方" value="0" />
<el-option label="北方" value="1" />
</el-select>
</el-form-item>
<el-form-item label="病史(多选)" prop="physicalSignsId">
<el-select v-model="form.physicalSignsId" multiple placeholder="请选择">
<el-option
v-for="physicalSign in physicalSignsList"
:key="physicalSign.id" :label="physicalSign.name" :value="physicalSign.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="忌口或过敏源" prop="dishesIngredientId">
<el-input v-model="form.dishesIngredientId" placeholder="请输入名称" />
</el-form-item>
<!--<el-form-item label="您的照片" prop="photo">
<el-input v-model="form.photo" placeholder="请输入客户照片" />
</el-form-item>-->
<el-form-item label="是否便秘" prop="constipation">
<el-select v-model="form.constipation" placeholder="请选择">
<el-option label="是" value="0" />
<el-option label="否" value="1" />
</el-select>
</el-form-item>
<el-form-item label="是否熬夜、失眠" prop="staylate">
<el-select v-model="form.staylate" placeholder="请选择">
<el-option label="是" value="0" />
<el-option label="否" value="1" />
</el-select>
</el-form-item>
<el-form-item label="是否经常运动" prop="motion">
<el-select v-model="form.motion" placeholder="请选择">
<el-option label="是" value="0" />
<el-option label="否" value="1" />
</el-select>
</el-form-item>
<el-form-item label="饮食方式" prop="makeFoodType">
<el-select v-model="form.makeFoodType" placeholder="请选择">
<el-option label="自己做" value="0" />
<el-option label="外面吃" value="1" />
</el-select>
</el-form-item>
<el-form-item label="饮食特点" prop="makeFoodTaste">
<el-select v-model="form.makeFoodTaste" placeholder="请选择">
<el-option label="清淡" value="0" />
<el-option label="重口味" value="1" />
</el-select>
</el-form-item>
<el-form-item label="工作职业" prop="vocation">
<el-input v-model="form.vocation" placeholder="请输入工作职业" />
</el-form-item>
<el-form-item label="是否上夜班" prop="night">
<el-select v-model="form.night" placeholder="请选择">
<el-option label="是" value="0" />
<el-option label="否" value="1" />
</el-select>
</el-form-item>
<el-form-item label="平时久坐多还是走动多" prop="walk">
<el-select v-model="form.walk" placeholder="请选择">
<el-option label="久坐多" value="0" />
<el-option label="走动多" value="1" />
</el-select>
</el-form-item>
<el-form-item label="是否浑身乏力" prop="weakness">
<el-select v-model="form.weakness" placeholder="请选择">
<el-option label="是" value="0" />
<el-option label="否" value="1" />
</el-select>
</el-form-item>
<el-form-item label="是否减脂反弹" prop="rebound">
<el-select v-model="form.rebound" placeholder="请选择">
<el-option label="是" value="0" />
<el-option label="否" value="1" />
</el-select>
</el-form-item>
<el-form-item label="是否意识到生活习惯是减脂关键" prop="crux">
<el-select v-model="form.crux" placeholder="请选择">
<el-option label="是" value="0" />
<el-option label="否" value="1" />
</el-select>
</el-form-item>
<el-form-item label="睡觉时间" prop="sleepTime">
<el-time-select v-model="form.sleepTime" :picker-options="{start: '00:00',step: '01:00',end: '24:00'}" placeholder="请选择时间" :editable=false />
</el-form-item>
<el-form-item label="起床时间" prop="getupTime">
<el-time-select v-model="form.getupTime" :picker-options="{start: '00:00',step: '01:00',end: '24:00'}" placeholder="请选择时间" :editable=false />
</el-form-item>
<el-form-item label="方便沟通时间" prop="connectTime">
<el-time-select v-model="form.connectTime" :picker-options="{start: '00:00',step: '01:00',end: '24:00'}" placeholder="请选择时间" :editable=false />
</el-form-item>
<!--<el-form-item label="备注信息" prop="remarks">
<el-input v-model="form.remarks" placeholder="请输入备注信息" />
</el-form-item>-->
<!--<p>好的我现在给您测一下湿气和气血有以下出现情况的请直接选择</p>-->
<el-form-item label="湿气(多选)" prop="bloodData">
<el-checkbox-group v-model="form.bloodData">
<el-checkbox v-for="bloodItem in bloodDataList" :label="bloodItem.dictValue" :key="bloodItem.dictValue">{{bloodItem.dictLabel}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="气血(多选)" prop="moistureDate">
<el-checkbox-group v-model="form.moistureDate">
<el-checkbox v-for="moistureItem in moistureDataList" :label="moistureItem.dictValue" :key="moistureItem.dictValue">{{moistureItem.dictLabel}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="减脂经历(重点详细填写)" prop="experience">
<el-input v-model="form.experience" placeholder="请输入" />
</el-form-item>
<el-form-item label="减脂遇到的困难" prop="difficulty">
<el-input v-model="form.difficulty" placeholder="请输入" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listCustomer, getCustomer, delCustomer, addCustomer, updateCustomer, exportCustomer } from "@/api/custom/customer";
import { listPhysicalSigns } from "@/api/custom/physicalSigns";
export default {
name: "Customer",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
customerList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
phone: null
},
//
form: {},
//
bloodDataList:[],
//湿
moistureDataList:[],
//
physicalSignsList:[],
//
rules: {
name: [
{ required: true, trigger: "blur", message: "请填写姓名" },
{ min: 1, max: 20, trigger: "blur", message: "姓名过长" }
],
phone: [
{ required: true, trigger: "blur", message: "请填写手机号" },
{ required: true, trigger: "blur", message: "请填写正确的手机号" },
{ required: true, trigger: "blur", pattern: /^[0-9]{5,11}$/ , message: '手机号格式不正确'}
],
sex:[
{ required: true, trigger: "blur", message: "请选择性别" }
],
age:[
{ required: true, trigger: "blur", message: "请填写年龄" },
{required: true, trigger: "blur", pattern: /^[1-9]\d*$/ , message: '年龄格式不正确'}
],
tall:[
{ required: true, trigger: "blur", message: "请填写身高" },
{required: true, trigger: "blur", pattern: /^[1-9]\d*$/ , message: '身高格式不正确'}
],
weight:[
{ required: true, trigger: "blur", message: "请填写体重" },
{required: true, trigger: "blur", pattern: /^[1-9]\d*$/ , message: '体重格式不正确'}
],
constipation:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
staylate:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
motion:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
makeFoodType:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
makeFoodTaste:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
walk:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
weakness:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
rebound:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
crux:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
position:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
sleepTime:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
getupTime:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
connectTime:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
night:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
/*bloodData:[
{ required: true, trigger: "blur", message: "请测试气血" }
],
moistureDate:[
{ required: true, trigger: "blur", message: "请测试湿气" }
]*/
}
};
},
created() {
this.getList();
this.getPhysicalSign();
this.getDicts("sys_blood_data").then(response => {
this.bloodDataList = response.data;
});
this.getDicts("sys_moisture_data").then(response => {
this.moistureDataList = response.data;
});
},
methods: {
/** 查询客户信息列表 */
getList() {
this.loading = true;
listCustomer(this.queryParams).then(response => {
this.customerList = response.rows;
this.total = response.total;
this.loading = false;
});
},
getSignString(signList){
if(signList == null){
return "";
}
let signStr = "";
for(let i in signList){
signStr += ""+signList[i].name;
}
return signList.length > 0 ? signStr.substring(1) : signStr;
},
/** 查询体征列表 */
getPhysicalSign() {
listPhysicalSigns().then(response => {
this.physicalSignsList = response.rows;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
name: '',
phone: '',
address: "",
sex: "1",
age: null,
tall: null,
weight: null,
physicalSignsId: [],
dishesIngredientId: null,
photo: null,
constipation: "0",
staylate: "0",
motion: "1",
makeFoodType: "1",
makeFoodTaste: "1",
walk: "0",
difficulty: null,
weakness: "0",
rebound: "0",
crux: "0",
position: "1",
sleepTime: null,
getupTime: null,
connectTime: null,
remarks: null,
bloodData: [],
moistureDate: [],
night: "0",
vocation: null,
experience: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加客户信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getCustomer(id).then(response => {
let cusMessage = response.data.sign;
cusMessage.id = response.data.id;
cusMessage.bloodData = (cusMessage.bloodData != null && cusMessage.bloodData.trim() != "") ? cusMessage.bloodData.split(",") : [];
cusMessage.moistureDate = (cusMessage.moistureDate != null && cusMessage.moistureDate.trim() != "") ? cusMessage.moistureDate.split(",") : [];
cusMessage.physicalSignsId = (cusMessage.physicalSignsId != null && cusMessage.physicalSignsId.trim() != "") ? cusMessage.physicalSignsId.split(",") : [];
for(let i =0; i < cusMessage.physicalSignsId.length; i++) {
cusMessage.physicalSignsId[i] = parseInt(cusMessage.physicalSignsId[i]);
console.log(cusMessage.physicalSignsId[i]);
}
cusMessage.sleepTime = this.deltime(cusMessage.sleepTime);
cusMessage.getupTime = this.deltime(cusMessage.getupTime);
cusMessage.connectTime = this.deltime(cusMessage.connectTime);
cusMessage.name = response.data.name;
cusMessage.phone = response.data.phone;
cusMessage.sex += '';
cusMessage.constipation += '';
cusMessage.staylate += '';
cusMessage.motion += '';
cusMessage.makeFoodType += '';
cusMessage.makeFoodTaste += '';
cusMessage.walk += '';
cusMessage.weakness += '';
cusMessage.rebound += '';
cusMessage.crux += '';
cusMessage.position += '';
cusMessage.night += '';
this.form = cusMessage;
this.open = true;
this.title = "修改客户信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateCustomer(this.getDealSubmitData()).then(response => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addCustomer(this.getDealSubmitData()).then(response => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}else{
this.$message({
message: '数据未填写完整',
type: 'warning'
});
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除客户信息编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delCustomer(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(function() {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有客户信息数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportCustomer(queryParams);
}).then(response => {
this.download(response.msg);
}).catch(function() {});
},
getDealSubmitData(){
let cusMessage = Object.assign({}, this.form);
cusMessage.bloodData = cusMessage.bloodData != null ? cusMessage.bloodData.join(",") : null;
cusMessage.moistureDate = cusMessage.moistureDate != null ? cusMessage.moistureDate.join(",") : null;
cusMessage.physicalSignsId = cusMessage.physicalSignsId != null ? cusMessage.physicalSignsId.join(",") : null;
cusMessage.sleepTime = cusMessage.sleepTime.substring(0,2);
cusMessage.getupTime = cusMessage.getupTime.substring(0,2);
cusMessage.connectTime = cusMessage.connectTime.substring(0,2);
return cusMessage;
},
//
deltime(time){
if(time != null){
return time > 9 ? (time + ":00") : ("0"+time+":00");
}
return null;
}
}
};
</script>

View File

@ -0,0 +1,353 @@
<template>
<section class="el-container is-vertical"><header class="el-header" style="height: 60px;">
<div class="block" style="margin-top:18px;text-align:center;margin:0 auto;">
<!--<span class="demonstration"></span> require('@/assets/logo/st_logo.png')-->
<img src="@/assets/logo/st_logo.png" style="width:240px;height:80px;"/>
</div>
</header> <main class="el-main">
<el-form ref="form" :model="form" :rules="rules" label-width="80px" style="margin-top:40px;">
<!--<p>现在要先为您建立更加详细的档案以便为您定制专属的减脂计划</p>-->
<el-form-item label="真实姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入真实姓名" />
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input v-model="form.phone" placeholder="请输入手机号" />
</el-form-item>
<!--<el-form-item label="邮箱" prop="email">
<el-input v-model="form.email" placeholder="请输入邮箱" />
</el-form-item>-->
<!--<el-form-item label="您的居住地址" prop="address">
<el-input v-model="form.address" placeholder="请输入地址" />
</el-form-item>-->
<el-form-item label="性别" prop="sex">
<el-select v-model="form.sex" placeholder="请选择性别">
<el-option label="男" value="0" />
<el-option label="女" value="1" />
</el-select>
</el-form-item>
<el-form-item label="年龄(岁)" prop="age">
<el-input v-model="form.age" placeholder="请输入年龄" />
</el-form-item>
<el-form-item label="身高(厘米)" prop="tall">
<el-input v-model="form.tall" placeholder="请输入身高" />
</el-form-item>
<el-form-item label="体重(斤)" prop="weight">
<el-input v-model="form.weight" placeholder="请输入体重" />
</el-form-item>
<el-form-item label="南方人还是北方人" prop="position">
<el-select v-model="form.position" placeholder="请选择">
<el-option label="南方" value="0" />
<el-option label="北方" value="1" />
</el-select>
</el-form-item>
<el-form-item label="病史(多选)" prop="physicalSignsId">
<el-select v-model="form.physicalSignsId" multiple placeholder="请选择">
<el-option
v-for="physicalSign in physicalSignsList"
:key="physicalSign.id" :label="physicalSign.name" :value="physicalSign.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="忌口或过敏源" prop="dishesIngredientId">
<el-input v-model="form.dishesIngredientId" placeholder="请输入名称" />
</el-form-item>
<!--<el-form-item label="您的照片" prop="photo">
<el-input v-model="form.photo" placeholder="请输入客户照片" />
</el-form-item>-->
<el-form-item label="是否便秘" prop="constipation">
<el-select v-model="form.constipation" placeholder="请选择">
<el-option label="是" value="0" />
<el-option label="否" value="1" />
</el-select>
</el-form-item>
<el-form-item label="是否熬夜、失眠" prop="staylate">
<el-select v-model="form.staylate" placeholder="请选择">
<el-option label="是" value="0" />
<el-option label="否" value="1" />
</el-select>
</el-form-item>
<el-form-item label="是否经常运动" prop="motion">
<el-select v-model="form.motion" placeholder="请选择">
<el-option label="是" value="0" />
<el-option label="否" value="1" />
</el-select>
</el-form-item>
<el-form-item label="饮食方式" prop="makeFoodType">
<el-select v-model="form.makeFoodType" placeholder="请选择">
<el-option label="自己做" value="0" />
<el-option label="外面吃" value="1" />
</el-select>
</el-form-item>
<el-form-item label="饮食特点" prop="makeFoodTaste">
<el-select v-model="form.makeFoodTaste" placeholder="请选择">
<el-option label="清淡" value="0" />
<el-option label="重口味" value="1" />
</el-select>
</el-form-item>
<el-form-item label="工作职业" prop="vocation">
<el-input v-model="form.vocation" placeholder="请输入工作职业" />
</el-form-item>
<el-form-item label="是否上夜班" prop="night">
<el-select v-model="form.night" placeholder="请选择">
<el-option label="是" value="0" />
<el-option label="否" value="1" />
</el-select>
</el-form-item>
<el-form-item label="平时久坐多还是走动多" prop="walk">
<el-select v-model="form.walk" placeholder="请选择">
<el-option label="久坐多" value="0" />
<el-option label="走动多" value="1" />
</el-select>
</el-form-item>
<el-form-item label="是否浑身乏力" prop="weakness">
<el-select v-model="form.weakness" placeholder="请选择">
<el-option label="是" value="0" />
<el-option label="否" value="1" />
</el-select>
</el-form-item>
<el-form-item label="是否减脂反弹" prop="rebound">
<el-select v-model="form.rebound" placeholder="请选择">
<el-option label="是" value="0" />
<el-option label="否" value="1" />
</el-select>
</el-form-item>
<el-form-item label="是否意识到生活习惯是减脂关键" prop="crux">
<el-select v-model="form.crux" placeholder="请选择">
<el-option label="是" value="0" />
<el-option label="否" value="1" />
</el-select>
</el-form-item>
<el-form-item label="睡觉时间" prop="sleepTime">
<el-time-select v-model="form.sleepTime" :picker-options="{start: '00:00',step: '01:00',end: '24:00'}" placeholder="请选择时间" :editable=false />
</el-form-item>
<el-form-item label="起床时间" prop="getupTime">
<el-time-select v-model="form.getupTime" :picker-options="{start: '00:00',step: '01:00',end: '24:00'}" placeholder="请选择时间" :editable=false />
</el-form-item>
<el-form-item label="方便沟通时间" prop="connectTime">
<el-time-select v-model="form.connectTime" :picker-options="{start: '00:00',step: '01:00',end: '24:00'}" placeholder="请选择时间" :editable=false />
</el-form-item>
<!--<el-form-item label="备注信息" prop="remarks">
<el-input v-model="form.remarks" placeholder="请输入备注信息" />
</el-form-item>-->
<!--<p>好的我现在给您测一下湿气和气血有以下出现情况的请直接选择</p>-->
<el-form-item label="湿气(多选)" prop="bloodData">
<el-checkbox-group v-model="form.bloodData">
<el-checkbox v-for="bloodItem in bloodDataList" :label="bloodItem.dictValue" :key="bloodItem.dictValue">{{bloodItem.dictLabel}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="气血(多选)" prop="moistureDate">
<el-checkbox-group v-model="form.moistureDate">
<el-checkbox v-for="moistureItem in moistureDataList" :label="moistureItem.dictValue" :key="moistureItem.dictValue">{{moistureItem.dictLabel}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="减脂经历(重点详细填写)" prop="experience">
<el-input v-model="form.experience" placeholder="请输入" />
</el-form-item>
<el-form-item label="减脂遇到的困难" prop="difficulty">
<el-input v-model="form.difficulty" placeholder="请输入" />
</el-form-item>
<el-form-item style="text-align:center;margin:0 auto;">
<el-button type="primary" @click="addCustomer()" style="margin-right:50px;">已填写完成提交数据</el-button>
</el-form-item>
</el-form>
</main></section>
</template>
<script>
import { physicalSignsList,addCustomer,getDictData } from "@/api/custom/customerInvestigation";
import { listPhysicalSigns } from "@/api/custom/physicalSigns";
//imgUrl = require('@/assets/logo/st_logo.png')
export default {
name: "Questionnaire",
data() {
return {
imagePath: "../assets/logo/st_logo.png",
submitFlag: false,
form: {
name: '',
phone: '',
address: "",
sex: "1",
age: null,
tall: null,
weight: null,
physicalSignsId: [],
dishesIngredientId: null,
photo: null,
constipation: "0",
staylate: "0",
motion: "1",
makeFoodType: "1",
makeFoodTaste: "1",
walk: "0",
difficulty: null,
weakness: "0",
rebound: "0",
crux: "0",
position: "1",
sleepTime: null,
getupTime: null,
connectTime: null,
remarks: null,
bloodData: [],
moistureDate: [],
night: "0",
vocation: null,
experience: null
},
rules: {
name: [
{ required: true, trigger: "blur", message: "请填写姓名" },
{ min: 1, max: 20, trigger: "blur", message: "姓名过长" }
],
phone: [
{ required: true, trigger: "blur", message: "请填写手机号" },
{ required: true, trigger: "blur", message: "请填写正确的手机号" },
{ required: true, trigger: "blur", pattern: /^[0-9]{5,11}$/ , message: '手机号格式不正确'}
],
sex:[
{ required: true, trigger: "blur", message: "请选择性别" }
],
age:[
{ required: true, trigger: "blur", message: "请填写年龄" },
{required: true, trigger: "blur", pattern: /^[1-9]\d*$/ , message: '年龄格式不正确'}
],
tall:[
{ required: true, trigger: "blur", message: "请填写身高" },
{required: true, trigger: "blur", pattern: /^[1-9]\d*$/ , message: '身高格式不正确'}
],
weight:[
{ required: true, trigger: "blur", message: "请填写体重" },
{required: true, trigger: "blur", pattern: /^[1-9]\d*$/ , message: '体重格式不正确'}
],
constipation:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
staylate:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
motion:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
makeFoodType:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
makeFoodTaste:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
walk:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
weakness:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
rebound:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
crux:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
position:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
sleepTime:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
getupTime:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
connectTime:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
night:[
{ required: true, trigger: "blur", message: "请选择一个答案" }
],
/*bloodData:[
{ required: true, trigger: "blur", message: "请测试气血" }
],
moistureDate:[
{ required: true, trigger: "blur", message: "请测试湿气" }
]*/
},
physicalSignsList: [],
bloodDataList:[
],
moistureDataList:[
]
}
},
methods: {
onSubmit() {
console.log('submit!');
},
/** 查询体征列表 */
getPhysicalSignsList() {
physicalSignsList().then(response => {
this.physicalSignsList = response.rows;
});
},
addCustomer(){
if(this.submitFlag){
return;
}
this.$refs.form.validate(valid => {
if(valid) {
let cusMessage = Object.assign({}, this.form);
cusMessage.bloodData = cusMessage.bloodData != null ? cusMessage.bloodData.join(",") : null;
cusMessage.moistureDate = cusMessage.moistureDate != null ? cusMessage.moistureDate.join(",") : null;
cusMessage.physicalSignsId = cusMessage.physicalSignsId != null ? cusMessage.physicalSignsId.join(",") : null;
cusMessage.sleepTime = cusMessage.sleepTime.substring(0,2);
cusMessage.getupTime = cusMessage.getupTime.substring(0,2);
cusMessage.connectTime = cusMessage.connectTime.substring(0,2);
addCustomer(cusMessage).then(response => {
if (response.code === 200) {
console.log('成功');
this.$notify({
title: '提交成功',
message: '',
type: 'success'
});
this.submitFlag = true;
}
});
}else{
this.$message({
message: '数据未填写完整',
type: 'warning'
});
}
//console.log(this.form.bloodData);
})
},
getBloodDictData(type){
getDictData(type).then(response => {
this.bloodDataList = response.data;
});
},
getMoistureDictData(type){
getDictData(type).then(response => {
this.moistureDataList = response.data;
});
}
},
created() {
this.getPhysicalSignsList();
this.getBloodDictData("sys_blood_data");
this.getMoistureDictData("sys_moisture_data");
},
beforeCreate () {
document.title = this.$route.meta.title;
console.log(this.$route.meta.title);
}
}
</script>
<style scoped>
</style>