| @@ -4,8 +4,10 @@ import com.stdiet.common.core.controller.BaseController; | |||||||
| import com.stdiet.common.core.domain.AjaxResult; | import com.stdiet.common.core.domain.AjaxResult; | ||||||
| import com.stdiet.common.core.page.TableDataInfo; | import com.stdiet.common.core.page.TableDataInfo; | ||||||
| import com.stdiet.common.enums.BusinessType; | import com.stdiet.common.enums.BusinessType; | ||||||
|  | import com.stdiet.common.utils.HealthyUtils; | ||||||
| import com.stdiet.common.utils.StringUtils; | import com.stdiet.common.utils.StringUtils; | ||||||
| import com.stdiet.common.utils.sign.AesUtils; | import com.stdiet.common.utils.sign.AesUtils; | ||||||
|  | import com.stdiet.common.utils.uuid.IdUtils; | ||||||
| import com.stdiet.custom.domain.*; | import com.stdiet.custom.domain.*; | ||||||
| import com.stdiet.custom.dto.request.CustomerInvestigateRequest; | import com.stdiet.custom.dto.request.CustomerInvestigateRequest; | ||||||
| import com.stdiet.custom.dto.request.FoodHeatCalculatorRequest; | import com.stdiet.custom.dto.request.FoodHeatCalculatorRequest; | ||||||
| @@ -18,6 +20,7 @@ import org.springframework.web.bind.annotation.*; | |||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
|  | import java.util.UUID; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * 客户相关信息调查Controller |  * 客户相关信息调查Controller | ||||||
| @@ -139,6 +142,7 @@ public class InvestigateController extends BaseController { | |||||||
|         if(oldSysPreSale != null){ |         if(oldSysPreSale != null){ | ||||||
|             return AjaxResult.error("已提交过问卷,无法重复提交"); |             return AjaxResult.error("已提交过问卷,无法重复提交"); | ||||||
|         } |         } | ||||||
|  |         sysPreSaleSurvey.setQuestionType(0); | ||||||
|         return toAjax(sysPreSaleSurveyService.insertSysPreSaleSurvey(sysPreSaleSurvey)); |         return toAjax(sysPreSaleSurveyService.insertSysPreSaleSurvey(sysPreSaleSurvey)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -155,4 +159,21 @@ public class InvestigateController extends BaseController { | |||||||
|         SysPreSaleSurvey preSaleSurvey = sysPreSaleSurveyService.getSysPreSaleSurveyByKey(customerKey); |         SysPreSaleSurvey preSaleSurvey = sysPreSaleSurveyService.getSysPreSaleSurveyByKey(customerKey); | ||||||
|         return AjaxResult.success(preSaleSurvey); |         return AjaxResult.success(preSaleSurvey); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 添加用户简易问卷 | ||||||
|  |      */ | ||||||
|  |     @PostMapping("/addSimpleCustomerSurvey") | ||||||
|  |     public AjaxResult addSimpleCustomerSurvey(@RequestBody SysPreSaleSurvey sysPreSaleSurvey) | ||||||
|  |     { | ||||||
|  |         sysPreSaleSurvey.setQuestionType(1); | ||||||
|  |         sysPreSaleSurvey.setCustomerKey(IdUtils.fastSimpleUUID()); | ||||||
|  |         int row = sysPreSaleSurveyService.insertSysPreSaleSurvey(sysPreSaleSurvey); | ||||||
|  |         if(row > 0){ | ||||||
|  |             //获取标准体重 | ||||||
|  |             Double standardWeight = HealthyUtils.calculateStandardWeightByBMI(sysPreSaleSurvey.getTall(), sysPreSaleSurvey.getAge(), sysPreSaleSurvey.getSex()); | ||||||
|  |             return AjaxResult.success(standardWeight); | ||||||
|  |         } | ||||||
|  |         return AjaxResult.error("提交失败"); | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -0,0 +1,112 @@ | |||||||
|  | package com.stdiet.web.controller.custom; | ||||||
|  |  | ||||||
|  | import java.util.List; | ||||||
|  |  | ||||||
|  | import com.stdiet.common.utils.HealthyUtils; | ||||||
|  | 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.SysPreSaleSurvey; | ||||||
|  | import com.stdiet.custom.service.ISysPreSaleSurveyService; | ||||||
|  | import com.stdiet.common.utils.poi.ExcelUtil; | ||||||
|  | import com.stdiet.common.core.page.TableDataInfo; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 简易问卷调查Controller | ||||||
|  |  * | ||||||
|  |  * @author xzj | ||||||
|  |  * @date 2021-07-21 | ||||||
|  |  */ | ||||||
|  | @RestController | ||||||
|  | @RequestMapping("/custom/preSaleSurvey") | ||||||
|  | public class SysPreSaleSurveyController extends BaseController | ||||||
|  | { | ||||||
|  |     @Autowired | ||||||
|  |     private ISysPreSaleSurveyService sysPreSaleSurveyService; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询简易问卷调查列表 | ||||||
|  |      */ | ||||||
|  |     @PreAuthorize("@ss.hasPermi('custom:preSaleSurvey:list')") | ||||||
|  |     @GetMapping("/list") | ||||||
|  |     public TableDataInfo list(SysPreSaleSurvey sysPreSaleSurvey) | ||||||
|  |     { | ||||||
|  |         startPage(); | ||||||
|  |         sysPreSaleSurvey.setQuestionType(1); | ||||||
|  |         List<SysPreSaleSurvey> list = sysPreSaleSurveyService.selectSysPreSaleSurveyList(sysPreSaleSurvey); | ||||||
|  |         if(list != null && list.size() > 0){ | ||||||
|  |             for (SysPreSaleSurvey survey : list) { | ||||||
|  |                 //计算标准体重 | ||||||
|  |                 survey.setStandardWeight(HealthyUtils.calculateStandardWeightByBMI(survey.getTall(), survey.getAge(), survey.getSex())); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return getDataTable(list); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 导出简易问卷调查列表 | ||||||
|  |      */ | ||||||
|  |     @PreAuthorize("@ss.hasPermi('custom:preSaleSurvey:export')") | ||||||
|  |     @Log(title = "简易问卷调查", businessType = BusinessType.EXPORT) | ||||||
|  |     @GetMapping("/export") | ||||||
|  |     public AjaxResult export(SysPreSaleSurvey sysPreSaleSurvey) | ||||||
|  |     { | ||||||
|  |         List<SysPreSaleSurvey> list = sysPreSaleSurveyService.selectSysPreSaleSurveyList(sysPreSaleSurvey); | ||||||
|  |         ExcelUtil<SysPreSaleSurvey> util = new ExcelUtil<SysPreSaleSurvey>(SysPreSaleSurvey.class); | ||||||
|  |         return util.exportExcel(list, "preSaleSurvey"); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取简易问卷调查详细信息 | ||||||
|  |      */ | ||||||
|  |     @PreAuthorize("@ss.hasPermi('custom:preSaleSurvey:query')") | ||||||
|  |     @GetMapping(value = "/{id}") | ||||||
|  |     public AjaxResult getInfo(@PathVariable("id") Long id) | ||||||
|  |     { | ||||||
|  |         return AjaxResult.success(sysPreSaleSurveyService.selectSysPreSaleSurveyById(id)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 新增简易问卷调查 | ||||||
|  |      */ | ||||||
|  |     @PreAuthorize("@ss.hasPermi('custom:preSaleSurvey:add')") | ||||||
|  |     @Log(title = "简易问卷调查", businessType = BusinessType.INSERT) | ||||||
|  |     @PostMapping | ||||||
|  |     public AjaxResult add(@RequestBody SysPreSaleSurvey sysPreSaleSurvey) | ||||||
|  |     { | ||||||
|  |         return toAjax(sysPreSaleSurveyService.insertSysPreSaleSurvey(sysPreSaleSurvey)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 修改简易问卷调查 | ||||||
|  |      */ | ||||||
|  |     @PreAuthorize("@ss.hasPermi('custom:preSaleSurvey:edit')") | ||||||
|  |     @Log(title = "简易问卷调查", businessType = BusinessType.UPDATE) | ||||||
|  |     @PutMapping | ||||||
|  |     public AjaxResult edit(@RequestBody SysPreSaleSurvey sysPreSaleSurvey) | ||||||
|  |     { | ||||||
|  |         return toAjax(sysPreSaleSurveyService.updateSysPreSaleSurvey(sysPreSaleSurvey)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 删除简易问卷调查 | ||||||
|  |      */ | ||||||
|  |     @PreAuthorize("@ss.hasPermi('custom:preSaleSurvey:remove')") | ||||||
|  |     @Log(title = "简易问卷调查", businessType = BusinessType.DELETE) | ||||||
|  |     @DeleteMapping("/{ids}") | ||||||
|  |     public AjaxResult remove(@PathVariable Long[] ids) | ||||||
|  |     { | ||||||
|  |         return toAjax(sysPreSaleSurveyService.deleteSysPreSaleSurveyByIds(ids)); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -507,6 +507,12 @@ public class WechatAppletController extends BaseController { | |||||||
|  |  | ||||||
|             sysWxUserInfo.setCusId(sysCustomer.getId()); |             sysWxUserInfo.setCusId(sysCustomer.getId()); | ||||||
|             sysWxUserInfo.setUpdateTime(DateUtils.getNowDate()); |             sysWxUserInfo.setUpdateTime(DateUtils.getNowDate()); | ||||||
|  |             //先根据cusId查询是否已经绑定过微信用户 | ||||||
|  |             SysWxUserInfo cusIdWxUserInfo = sysWxUserInfoService.selectSysWxUserInfoByCusId(sysCustomer.getId()); | ||||||
|  |             if(cusIdWxUserInfo != null && !sysWxUserInfo.getOpenid().equals(curWxUserInfo.getOpenid())){ | ||||||
|  |                 //解绑之前记录 | ||||||
|  |                 sysWxUserInfoService.removeCusIdByOpenId(curWxUserInfo.getOpenid()); | ||||||
|  |             } | ||||||
|             if (StringUtils.isNull(curWxUserInfo)) { |             if (StringUtils.isNull(curWxUserInfo)) { | ||||||
|                 // 新增sys_wx_user_info |                 // 新增sys_wx_user_info | ||||||
|                 sysWxUserInfo.setCreateTime(DateUtils.getNowDate()); |                 sysWxUserInfo.setCreateTime(DateUtils.getNowDate()); | ||||||
|   | |||||||
| @@ -0,0 +1,82 @@ | |||||||
|  | package com.stdiet.common.enums; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 年龄、性别对应BMI值枚举类 | ||||||
|  |  */ | ||||||
|  | public enum AgeBMI { | ||||||
|  |  | ||||||
|  |     age7_7(7, 7, "15.5_15"), | ||||||
|  |     age8_8(8, 8, "16_15"), | ||||||
|  |     age9_9(9, 9, "16.5_16"), | ||||||
|  |     age10_10(10, 10, "17_16"), | ||||||
|  |     age11_11(11, 11, "17.5_17"), | ||||||
|  |     age12_12(12, 12, "18_17"), | ||||||
|  |     age13_13(13, 13, "19_18"), | ||||||
|  |     age14_14(14, 14, "19.5_19"), | ||||||
|  |     age15_15(15, 15, "20_20"), | ||||||
|  |     age16_16(16, 16, "20.5_20"), | ||||||
|  |     age17_17(17, 17, "21_20"), | ||||||
|  |     age18_27(18, 27, "22_20"), | ||||||
|  |     age28_32(28, 32, "22.5_20.5"), | ||||||
|  |     age33_37(33, 37, "23_21"), | ||||||
|  |     age38_42(38, 42, "23.5_21.5"), | ||||||
|  |     age43_47(43, 47, "24_22"), | ||||||
|  |     age48_52(48, 52, "24.5_22.5"); | ||||||
|  |  | ||||||
|  |     private final int minAge; | ||||||
|  |  | ||||||
|  |     private final int maxAge; | ||||||
|  |  | ||||||
|  |     //BMI数值,0男 1女 | ||||||
|  |     private final double[] bmi; | ||||||
|  |  | ||||||
|  |     //等于或大于该年龄之后就五岁一个阶梯,五岁BMI加0.5 | ||||||
|  |     private static final int beyondAge = 53; | ||||||
|  |  | ||||||
|  |     //超过beyondAge年龄之后的起始BMI值,0男 1女 | ||||||
|  |     private static final double[] beyondAgeBmi = {25, 23}; | ||||||
|  |  | ||||||
|  |     AgeBMI(int minAge, int maxAge, String bmi) | ||||||
|  |     { | ||||||
|  |         this.bmi = new double[2]; | ||||||
|  |         this.bmi[0] = Double.parseDouble(bmi.split("_")[0]); | ||||||
|  |         this.bmi[1] = Double.parseDouble(bmi.split("_")[1]); | ||||||
|  |         this.minAge = minAge; | ||||||
|  |         this.maxAge = maxAge; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 根据年龄、性别获取BMI值 | ||||||
|  |      * @param age 年龄 | ||||||
|  |      * @param sex 性别 | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     public static double getBmiByAgeAndSex(int age, int sex){ | ||||||
|  |         if(age < beyondAge){ | ||||||
|  |             double bmi = 0.0; | ||||||
|  |             for (AgeBMI ageBMI : AgeBMI.values()) { | ||||||
|  |                 if(age >= ageBMI.minAge && age <= ageBMI.maxAge){ | ||||||
|  |                     bmi = ageBMI.bmi[sex]; | ||||||
|  |                     break; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |             return bmi; | ||||||
|  |         }else{ | ||||||
|  |             return getBeyondAgeBmi(age, sex); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 大年龄计算BMI,五岁一个阶梯 | ||||||
|  |      * @param age | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     public static double getBeyondAgeBmi(int age, int sex){ | ||||||
|  |         return beyondAgeBmi[sex] + (0.5 * ((age - beyondAge)/5)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public static void main(String[] args) { | ||||||
|  |         System.out.println(getBmiByAgeAndSex(20,0)); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -1,5 +1,9 @@ | |||||||
| package com.stdiet.common.utils; | package com.stdiet.common.utils; | ||||||
|  |  | ||||||
|  | import com.stdiet.common.enums.AgeBMI; | ||||||
|  |  | ||||||
|  | import java.math.BigDecimal; | ||||||
|  |  | ||||||
| public class HealthyUtils { | public class HealthyUtils { | ||||||
|  |  | ||||||
|     public static final long maxHeatEveryDayLess = 250; |     public static final long maxHeatEveryDayLess = 250; | ||||||
| @@ -174,4 +178,19 @@ public class HealthyUtils { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 根据年龄、性别获取BMI值,再根据BMI值、身高计算标准体重 | ||||||
|  |      * @param tall 身高(厘米) | ||||||
|  |      * @param age 年龄 | ||||||
|  |      * @param sex 性别 0男 1女 | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     public static Double calculateStandardWeightByBMI(int tall, int age, int sex){ | ||||||
|  |         double bmi = AgeBMI.getBmiByAgeAndSex(age, sex); | ||||||
|  |         if(bmi > 0){ | ||||||
|  |             BigDecimal standardWeight = NumberUtils.getNumberByRoundHalfUp(bmi * Math.pow(tall/100.0, 2) * 2, 2); | ||||||
|  |             return standardWeight.doubleValue(); | ||||||
|  |         } | ||||||
|  |         return null; | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -104,4 +104,8 @@ public class AesUtils { | |||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     public static void main(String[] args) { | ||||||
|  |         System.out.println(encrypt("4470")); | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -80,6 +80,15 @@ public class SysPreSaleSurvey extends BaseEntity | |||||||
|     @Excel(name = "售前ID") |     @Excel(name = "售前ID") | ||||||
|     private Long preSaleId; |     private Long preSaleId; | ||||||
|  |  | ||||||
|  |     /** 问卷类型 0售前简易问卷  1简易评估问卷 */ | ||||||
|  |     @Excel(name = "问卷类型 0售前简易问卷  1简易评估问卷") | ||||||
|  |     private Integer questionType; | ||||||
|  |  | ||||||
|     /** 删除标识 0未删除 1已删除 */ |     /** 删除标识 0未删除 1已删除 */ | ||||||
|     private Integer delFlag; |     private Integer delFlag; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 标准体重 | ||||||
|  |      */ | ||||||
|  |     private Double standardWeight; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,6 +1,8 @@ | |||||||
| package com.stdiet.custom.service; | package com.stdiet.custom.service; | ||||||
|  |  | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  | import java.util.Map; | ||||||
|  |  | ||||||
| import com.stdiet.custom.domain.SysPreSaleSurvey; | import com.stdiet.custom.domain.SysPreSaleSurvey; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|   | |||||||
| @@ -1,7 +1,12 @@ | |||||||
| package com.stdiet.custom.service.impl; | package com.stdiet.custom.service.impl; | ||||||
|  |  | ||||||
|  | import java.util.HashMap; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  | import java.util.Map; | ||||||
|  |  | ||||||
| import com.stdiet.common.utils.DateUtils; | import com.stdiet.common.utils.DateUtils; | ||||||
|  | import com.stdiet.common.utils.HealthyUtils; | ||||||
|  | import com.stdiet.custom.utils.NutritionalUtils; | ||||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||||
| import com.stdiet.custom.mapper.SysPreSaleSurveyMapper; | import com.stdiet.custom.mapper.SysPreSaleSurveyMapper; | ||||||
|   | |||||||
| @@ -21,6 +21,7 @@ | |||||||
|         <result property="bloodData"    column="blood_data"    /> |         <result property="bloodData"    column="blood_data"    /> | ||||||
|         <result property="moistureData"    column="moisture_data"    /> |         <result property="moistureData"    column="moisture_data"    /> | ||||||
|         <result property="preSaleId"    column="pre_sale_id"    /> |         <result property="preSaleId"    column="pre_sale_id"    /> | ||||||
|  |         <result property="questionType"    column="question_type"    /> | ||||||
|         <result property="createTime"    column="create_time"    /> |         <result property="createTime"    column="create_time"    /> | ||||||
|         <result property="updateTime"    column="update_time"    /> |         <result property="updateTime"    column="update_time"    /> | ||||||
|         <result property="createBy"    column="create_by"    /> |         <result property="createBy"    column="create_by"    /> | ||||||
| @@ -34,7 +35,10 @@ | |||||||
|  |  | ||||||
|     <select id="selectSysPreSaleSurveyList" parameterType="SysPreSaleSurvey" resultMap="SysPreSaleSurveyResult"> |     <select id="selectSysPreSaleSurveyList" parameterType="SysPreSaleSurvey" resultMap="SysPreSaleSurveyResult"> | ||||||
|         <include refid="selectSysPreSaleSurveyVo"/> where del_flag = 0 |         <include refid="selectSysPreSaleSurveyVo"/> where del_flag = 0 | ||||||
|         <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if> |         <if test="questionType != null"> | ||||||
|  |             and question_type = #{questionType} | ||||||
|  |         </if> | ||||||
|  |         <if test="name != null  and name != ''"> and (name like concat('%', #{name}, '%') or phone like concat('%',#{name},'%'))</if> | ||||||
|     </select> |     </select> | ||||||
|  |  | ||||||
|     <select id="selectSysPreSaleSurveyById" parameterType="Long" resultMap="SysPreSaleSurveyResult"> |     <select id="selectSysPreSaleSurveyById" parameterType="Long" resultMap="SysPreSaleSurveyResult"> | ||||||
| @@ -60,6 +64,7 @@ | |||||||
|             <if test="bloodData != null">blood_data,</if> |             <if test="bloodData != null">blood_data,</if> | ||||||
|             <if test="moistureData != null">moisture_data,</if> |             <if test="moistureData != null">moisture_data,</if> | ||||||
|             <if test="preSaleId != null">pre_sale_id,</if> |             <if test="preSaleId != null">pre_sale_id,</if> | ||||||
|  |             <if test="questionType != null">question_type,</if> | ||||||
|             <if test="createTime != null">create_time,</if> |             <if test="createTime != null">create_time,</if> | ||||||
|             <if test="updateTime != null">update_time,</if> |             <if test="updateTime != null">update_time,</if> | ||||||
|             <if test="createBy != null">create_by,</if> |             <if test="createBy != null">create_by,</if> | ||||||
| @@ -82,6 +87,7 @@ | |||||||
|             <if test="bloodData != null">#{bloodData},</if> |             <if test="bloodData != null">#{bloodData},</if> | ||||||
|             <if test="moistureData != null">#{moistureData},</if> |             <if test="moistureData != null">#{moistureData},</if> | ||||||
|             <if test="preSaleId != null">#{preSaleId},</if> |             <if test="preSaleId != null">#{preSaleId},</if> | ||||||
|  |             <if test="questionType != null">#{questionType},</if> | ||||||
|             <if test="createTime != null">#{createTime},</if> |             <if test="createTime != null">#{createTime},</if> | ||||||
|             <if test="updateTime != null">#{updateTime},</if> |             <if test="updateTime != null">#{updateTime},</if> | ||||||
|             <if test="createBy != null">#{createBy},</if> |             <if test="createBy != null">#{createBy},</if> | ||||||
| @@ -108,6 +114,7 @@ | |||||||
|             <if test="bloodData != null">blood_data = #{bloodData},</if> |             <if test="bloodData != null">blood_data = #{bloodData},</if> | ||||||
|             <if test="moistureData != null">moisture_date = #{moistureData},</if> |             <if test="moistureData != null">moisture_date = #{moistureData},</if> | ||||||
|             <if test="preSaleId != null">pre_sale_id = #{preSaleId},</if> |             <if test="preSaleId != null">pre_sale_id = #{preSaleId},</if> | ||||||
|  |             <if test="questionType != null">question_type = #{questionType},</if> | ||||||
|             <if test="createTime != null">create_time = #{createTime},</if> |             <if test="createTime != null">create_time = #{createTime},</if> | ||||||
|             <if test="updateTime != null">update_time = #{updateTime},</if> |             <if test="updateTime != null">update_time = #{updateTime},</if> | ||||||
|             <if test="createBy != null">create_by = #{createBy},</if> |             <if test="createBy != null">create_by = #{createBy},</if> | ||||||
|   | |||||||
| @@ -70,4 +70,15 @@ export function addCustomerSurvey(customerSurvey) { | |||||||
|   }) |   }) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // 添加客户建议评估信息问卷,并返回标准体重,用于生成报告 | ||||||
|  | export function addSimpleCustomerSurvey(customerSurvey) { | ||||||
|  |   return request({ | ||||||
|  |     url: '/investigate/addSimpleCustomerSurvey', | ||||||
|  |     method: 'post', | ||||||
|  |     data: customerSurvey | ||||||
|  |   }) | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										261
									
								
								stdiet-ui/src/components/SimpleSurveyReport/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										261
									
								
								stdiet-ui/src/components/SimpleSurveyReport/index.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,261 @@ | |||||||
|  | <template> | ||||||
|  |     <div class="report_div" v-show="showFlag"> | ||||||
|  |         <div class="report_title_div"> | ||||||
|  |             <div class="report_title">{{reportData.name ? reportData.name : '您的'}}身体评估报告</div> | ||||||
|  |             <div class="report_weight"> | ||||||
|  |                 <div style="text-align:center"> | ||||||
|  |                     <span><span class="weight_name">{{reportData.overWeight > 0 ? '超重' : '增重'}}</span>{{Math.abs(reportData.overWeight).toFixed(2)}} 斤</span> <span style="margin-left:30px"><span class="weight_name">标准体重</span>{{reportData.standardWeight.toFixed(2)}} 斤</span> | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  |             <div> | ||||||
|  |                 <div class="sign_div_title"> | ||||||
|  |                     病史体征 | ||||||
|  |                 </div> | ||||||
|  |                 <div class="sign_div_title_small"> | ||||||
|  |                     选择准确的体征,获得更精准的评估、内容与服务 | ||||||
|  |                 </div> | ||||||
|  |                 <div class="sign_type"> | ||||||
|  |                     <div class="sign_type_div" v-for="(item,index) in reportData.signTypeArray" :key="index"> | ||||||
|  |                       <span class="sign_type_div_value">{{item}}</span> | ||||||
|  |                     </div> | ||||||
|  |                 </div> | ||||||
|  |                 | ||||||
|  |             </div> | ||||||
|  |             <div class="blood_moisture"> | ||||||
|  |                 <div style="float: left;"> | ||||||
|  |                     <div class="blood_moisture_title">湿气指数</div><div :class="getBloodMoistureIndexClass(reportData.moistureIndex)"></div> | ||||||
|  |                 </div> | ||||||
|  |                 <div style="float: left;margin-top:20px"> | ||||||
|  |                     <div class="blood_moisture_title">气血指数</div><div :class="getBloodMoistureIndexClass(reportData.bloodIndex)"></div> | ||||||
|  |                 </div> | ||||||
|  |                  | ||||||
|  |                 <div class="clear"></div>  | ||||||
|  |                 <div class="sign_div_title_small" style="margin-top:20px"> | ||||||
|  |                     绿色、橙色、红色分别表示轻度、中度、重度 | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  |             <div class="bottom_content"> | ||||||
|  |                 改善身体情况请和营养顾问详谈 | ||||||
|  |             </div> | ||||||
|  |         </div> | ||||||
|  |     </div> | ||||||
|  | </template> | ||||||
|  |  | ||||||
|  | <script> | ||||||
|  | import { | ||||||
|  |   getDictData, | ||||||
|  |   getCustomerSurvey, | ||||||
|  |   addSimpleCustomerSurvey | ||||||
|  | } from "@/api/custom/customerInvestigation"; | ||||||
|  | export default { | ||||||
|  |   name: "index", | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |       showFlag: false, | ||||||
|  |       data: null, | ||||||
|  |       moistureDataList:[], | ||||||
|  |       bloodDataList:[], | ||||||
|  |       physicalSignsList:[], | ||||||
|  |       reportData:{ | ||||||
|  |         name: "", | ||||||
|  |         overWeight: 0.0, | ||||||
|  |         standardWeight: 0.0, | ||||||
|  |         signTypeArray: [], | ||||||
|  |         moistureIndex: 0, | ||||||
|  |         bloodIndex: 0 | ||||||
|  |       } | ||||||
|  |     }; | ||||||
|  |   }, | ||||||
|  |   components: { | ||||||
|  |      | ||||||
|  |   }, | ||||||
|  |   methods: { | ||||||
|  |     showReportView(data, moistureDataList, bloodDataList, physicalSignsList){ | ||||||
|  |         this.moistureDataList = moistureDataList; | ||||||
|  |         this.bloodDataList = bloodDataList; | ||||||
|  |         this.physicalSignsList = physicalSignsList; | ||||||
|  |         this.reportData.name = data.name; | ||||||
|  |         this.data = data; | ||||||
|  |         if(data.standardWeight != undefined && data.standardWeight != null){ | ||||||
|  |             this.reportData.standardWeight = data.standardWeight; | ||||||
|  |             this.reportData.overWeight = data.weight - data.standardWeight; | ||||||
|  |         } | ||||||
|  |         data.physicalSignsIdArray.forEach((item,index) => { | ||||||
|  |             let signName = this.getSignLabelByValue(item); | ||||||
|  |             if(signName != null){ | ||||||
|  |                 this.reportData.signTypeArray.push(signName); | ||||||
|  |             } | ||||||
|  |         }); | ||||||
|  |         if(data.otherPhysicalSigns != null && data.otherPhysicalSigns != ""){ | ||||||
|  |             data.otherPhysicalSigns = data.otherPhysicalSigns.replace(",", ","); | ||||||
|  |             this.reportData.signTypeArray = this.reportData.signTypeArray.concat(data.otherPhysicalSigns.split(",")); | ||||||
|  |         } | ||||||
|  |         this.reportData.moistureIndex = data.moistureDataArray.length; | ||||||
|  |         this.reportData.bloodIndex = data.bloodDataArray.length; | ||||||
|  |         this.showFlag = true; | ||||||
|  |          | ||||||
|  |     }, | ||||||
|  |     getSignLabelByValue(value){ | ||||||
|  |         let signObj = this.physicalSignsList.find((obj) => obj.dictValue === value); | ||||||
|  |         return signObj != null ? signObj.dictLabel : null; | ||||||
|  |     }, | ||||||
|  |     getBloodMoistureIndexClass(num){ | ||||||
|  |       let className = "blood_moisture_value"; | ||||||
|  |       if(num <= 3){ | ||||||
|  |         className += " light"; | ||||||
|  |       }else if(num <= 6){ | ||||||
|  |         className += " moderate"; | ||||||
|  |       }else{ | ||||||
|  |         className += " severe"; | ||||||
|  |       } | ||||||
|  |       return className; | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |   created() { | ||||||
|  |      | ||||||
|  |   }, | ||||||
|  | }; | ||||||
|  | </script> | ||||||
|  |  | ||||||
|  |  <style scoped> | ||||||
|  |  | ||||||
|  |   .report_div{ | ||||||
|  |       width: 100%; | ||||||
|  |       padding-top: 25px; | ||||||
|  |       padding-bottom: 200px; | ||||||
|  |       background: linear-gradient(30deg, #4B8AFF, #329FFE); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .report_title_div{ | ||||||
|  |       padding: 25px 15px; | ||||||
|  |       width: 90%; | ||||||
|  |       margin:0 auto; | ||||||
|  |       background: #FFFFFF; | ||||||
|  |       box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1); | ||||||
|  |       border-radius: 20px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .report_title{ | ||||||
|  |       margin:0 auto; | ||||||
|  |       text-align: center; | ||||||
|  |       font-size: 20px; | ||||||
|  |       font-family: Source Han Sans CN; | ||||||
|  |       font-weight: 500; | ||||||
|  |       color: #4B8AFF; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |    | ||||||
|  |   .report_weight{ | ||||||
|  |       margin-top: 25px; | ||||||
|  |       border-top:2px solid #F1F1F1; | ||||||
|  |       border-bottom:2px solid #F1F1F1; | ||||||
|  |       padding: 0px 10px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .weight_name{ | ||||||
|  |       font-size: 18px; | ||||||
|  |       font-family: Source Han Sans CN; | ||||||
|  |       font-weight: 500; | ||||||
|  |       color: #4B8AFF; | ||||||
|  |       line-height: 50px; | ||||||
|  |       margin-right:5px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .weight_value{ | ||||||
|  |     font-size: 18px; | ||||||
|  |     font-family: Source Han Sans CN; | ||||||
|  |     font-weight: 400; | ||||||
|  |     color: #333333; | ||||||
|  |     line-height: 50px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .sign_div_title{ | ||||||
|  |       font-size: 18px; | ||||||
|  |     font-family: Source Han Sans CN; | ||||||
|  |     font-weight: 500; | ||||||
|  |     color: #4B8AFF; | ||||||
|  |     line-height: 40px; | ||||||
|  |     margin-top:10px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .sign_div_title_small{ | ||||||
|  |     font-size: 15px; | ||||||
|  |     font-family: Source Han Sans CN; | ||||||
|  |     font-weight: 400; | ||||||
|  |     color: #999999; | ||||||
|  |     line-height: 20px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .sign_type{ | ||||||
|  |       margin-top:10px; | ||||||
|  |       padding-bottom:20px; | ||||||
|  |       border-bottom:2px solid #F1F1F1; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .sign_type_div{ | ||||||
|  |     height: 30px; | ||||||
|  |     background: #F1F1F1; | ||||||
|  |     border-radius: 24px; | ||||||
|  |     text-align: center; | ||||||
|  |     margin:10px 5px; | ||||||
|  |     padding: 0px 12px; | ||||||
|  |     width:auto;  | ||||||
|  |     display:inline-block !important;  | ||||||
|  |     display:inline;  | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .sign_type_div_value{ | ||||||
|  |     font-size: 15px; | ||||||
|  |     font-family: Source Han Sans CN; | ||||||
|  |     font-weight: 400; | ||||||
|  |     color: #333333; | ||||||
|  |     line-height: 30px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .blood_moisture{ | ||||||
|  |       margin-top: 20px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .blood_moisture_title{ | ||||||
|  |       float: left; | ||||||
|  |       font-size: 16px; | ||||||
|  |      font-family: Source Han Sans CN; | ||||||
|  |      font-weight: 500; | ||||||
|  |     color: #4B8AFF; | ||||||
|  |     line-height: 30px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .blood_moisture_value{ | ||||||
|  |        margin-left:10px; | ||||||
|  |        float: left; | ||||||
|  |        width: 220px; | ||||||
|  |        height:30px; | ||||||
|  |        border-radius: 20px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .clear{ clear:both}  | ||||||
|  |  | ||||||
|  |   .light{ | ||||||
|  |       background: #20d866; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .moderate{ | ||||||
|  |       background: #f0a70b; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .severe{ | ||||||
|  |       background: #e94545; | ||||||
|  |   } | ||||||
|  |    | ||||||
|  |   .bottom_content{ | ||||||
|  |         font-size: 14px; | ||||||
|  |         font-family: Source Han Sans CN; | ||||||
|  |         font-weight: 400; | ||||||
|  |         color: #4B8AFF; | ||||||
|  |         line-height: 30px; | ||||||
|  |         text-align:center; | ||||||
|  |         margin-top:20px; | ||||||
|  |   } | ||||||
|  |   | ||||||
|  |    | ||||||
|  | </style> | ||||||
| @@ -65,7 +65,8 @@ router.beforeEach((to, from, next) => { | |||||||
|       to.path.startsWith("/recipes/detail/") || |       to.path.startsWith("/recipes/detail/") || | ||||||
|       to.path.startsWith("/subhealthyInvestigation/") || |       to.path.startsWith("/subhealthyInvestigation/") || | ||||||
|       to.path.startsWith("/foodHeatCalculator/") || |       to.path.startsWith("/foodHeatCalculator/") || | ||||||
|       to.path.startsWith("/preSaleSurvey/") |       to.path.startsWith("/preSaleSurvey/") ||  | ||||||
|  |       to.path.startsWith("/simple/preSaleSurvey") | ||||||
|     ) { |     ) { | ||||||
|       // 在免登录白名单,直接进入 |       // 在免登录白名单,直接进入 | ||||||
|       next(); |       next(); | ||||||
|   | |||||||
| @@ -187,6 +187,13 @@ export const constantRoutes = [ | |||||||
|     hidden: true, |     hidden: true, | ||||||
|     meta: { title: "胜唐体控基础问卷表" } |     meta: { title: "胜唐体控基础问卷表" } | ||||||
|   }, |   }, | ||||||
|  |   { | ||||||
|  |     path: "/simple/preSaleSurvey", | ||||||
|  |     component: resolve => | ||||||
|  |       require(["@/views/custom/preSaleSurvey/simpleSurvey"], resolve), | ||||||
|  |     hidden: true, | ||||||
|  |     meta: { title: "胜唐体控基础问卷表" } | ||||||
|  |   }, | ||||||
| ]; | ]; | ||||||
|  |  | ||||||
| export default new Router({ | export default new Router({ | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ const service = axios.create({ | |||||||
|   // axios中请求配置有baseURL选项,表示请求URL公共部分 |   // axios中请求配置有baseURL选项,表示请求URL公共部分 | ||||||
|   baseURL: process.env.VUE_APP_BASE_API, |   baseURL: process.env.VUE_APP_BASE_API, | ||||||
|   // 超时 |   // 超时 | ||||||
|   timeout: 10000 |   timeout: 100000 | ||||||
| }) | }) | ||||||
| // request拦截器 | // request拦截器 | ||||||
| service.interceptors.request.use(config => { | service.interceptors.request.use(config => { | ||||||
|   | |||||||
| @@ -0,0 +1,486 @@ | |||||||
|  | <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" | ||||||
|  |         /> | ||||||
|  |       </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:preSaleSurvey: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:preSaleSurvey:edit']" | ||||||
|  |         >修改</el-button> | ||||||
|  |       </el-col>--> | ||||||
|  |       <el-col :span="1.5"> | ||||||
|  |       <el-button | ||||||
|  |             icon="el-icon-share" | ||||||
|  |           type="primary" | ||||||
|  |           size="mini" | ||||||
|  |           class="copyBtn" | ||||||
|  |           :data-clipboard-text="copyValue" | ||||||
|  |           @click="handleCopy" | ||||||
|  |           title="点击复制问卷链接" | ||||||
|  |         >问卷链接</el-button> | ||||||
|  |         <el-popover | ||||||
|  |               placement="bottom" | ||||||
|  |               trigger="click" | ||||||
|  |               style="margin: 0 12px" | ||||||
|  |             > | ||||||
|  |               <VueQr :text="copyValue" :logoSrc="logo" :size="256" /> | ||||||
|  |               <el-button | ||||||
|  |                 slot="reference" | ||||||
|  |                 size="mini" | ||||||
|  |                 icon="el-icon-picture-outline" | ||||||
|  |                 type="primary" | ||||||
|  |                 title="点击查看二维码" | ||||||
|  |                 >二维码 | ||||||
|  |               </el-button> | ||||||
|  |             </el-popover> | ||||||
|  |       </el-col> | ||||||
|  |  | ||||||
|  |       <el-col :span="1.5"> | ||||||
|  |         <el-button | ||||||
|  |           type="danger" | ||||||
|  |           icon="el-icon-delete" | ||||||
|  |           size="mini" | ||||||
|  |           :disabled="multiple" | ||||||
|  |           @click="handleDelete" | ||||||
|  |           v-hasPermi="['custom:preSaleSurvey: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:preSaleSurvey:export']" | ||||||
|  |         >导出</el-button> | ||||||
|  |       </el-col>--> | ||||||
|  | 	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | ||||||
|  |     </el-row> | ||||||
|  |  | ||||||
|  |     <el-table v-loading="loading" :data="preSaleSurveyList" @selection-change="handleSelectionChange"> | ||||||
|  |       <el-table-column type="selection" width="55" align="center" /> | ||||||
|  |       <el-table-column label="姓名" align="center" prop="name" width="100"/> | ||||||
|  |       <el-table-column label="年龄" align="center" prop="age" width="60"/> | ||||||
|  |       <el-table-column label="性别" align="center" prop="sex" width="60"> | ||||||
|  |           <template slot-scope="scope"> | ||||||
|  |                 {{scope.row.sex == 0 ? '男' : '女'}} | ||||||
|  |           </template> | ||||||
|  |       </el-table-column> | ||||||
|  |       <el-table-column label="身高(厘米)" align="center" prop="tall" width="100"/> | ||||||
|  |       <el-table-column label="体重(斤)" align="center" prop="weight" width="80"/> | ||||||
|  |       <el-table-column label="标准体重(斤)" align="center" prop="standardWeight" width="100"> | ||||||
|  |           <template slot-scope="scope"> | ||||||
|  |                 {{(scope.row.standardWeight.toFixed(2))}} | ||||||
|  |           </template> | ||||||
|  |       </el-table-column> | ||||||
|  |       <el-table-column label="超重(斤)" align="center" prop="overWeight" width="80"> | ||||||
|  |           <template slot-scope="scope"> | ||||||
|  |                 {{(scope.row.overWeight.toFixed(2))}} | ||||||
|  |           </template> | ||||||
|  |       </el-table-column> | ||||||
|  |       <el-table-column label="电话" align="center" prop="phone" width="110"/> | ||||||
|  |       <el-table-column label="特殊体征" align="center" prop="physicalSignsNameArray" > | ||||||
|  |            <template slot-scope="scope"> | ||||||
|  |                <AutoHideInfo :data="scope.row.physicalSignsNameArray" :line="1"></AutoHideInfo> | ||||||
|  |            </template> | ||||||
|  |       </el-table-column> | ||||||
|  |       <el-table-column label="作息时间" align="center" prop="timeTableArray"> | ||||||
|  |             <template slot-scope="scope"> | ||||||
|  |                 <div>{{scope.row.timeTableArray[0] != null && scope.row.timeTableArray[0] != '' ? ('睡觉:'+scope.row.timeTableArray[0]) : ''}}</div> | ||||||
|  |                 <div>{{scope.row.timeTableArray[1] != null && scope.row.timeTableArray[1] != '' ? ('起床:'+scope.row.timeTableArray[1]) : ''}}</div> | ||||||
|  |             </template> | ||||||
|  |       </el-table-column> | ||||||
|  |       <el-table-column label="调理经历" align="center" prop="experience" > | ||||||
|  |           <template slot-scope="scope"> | ||||||
|  |                 <AutoHideMessage :data="scope.row.experience" :maxLength="10"></AutoHideMessage> | ||||||
|  |           </template> | ||||||
|  |       </el-table-column> | ||||||
|  |       <el-table-column label="职业" align="center" prop="occupation" > | ||||||
|  |           <template slot-scope="scope"> | ||||||
|  |                <AutoHideMessage :data="scope.row.occupation" :maxLength="10"></AutoHideMessage> | ||||||
|  |            </template> | ||||||
|  |       </el-table-column> | ||||||
|  |       <el-table-column label="湿气数据" align="center" prop="moistureDataNameArray"  > | ||||||
|  |           <template slot-scope="scope"> | ||||||
|  |                <AutoHideInfo :data="scope.row.moistureDataNameArray" :line="1"></AutoHideInfo> | ||||||
|  |            </template> | ||||||
|  |       </el-table-column> | ||||||
|  |       <el-table-column label="气血数据" align="center" prop="bloodDataNameArray"  > | ||||||
|  |           <template slot-scope="scope"> | ||||||
|  |                <AutoHideInfo :data="scope.row.bloodDataNameArray" :line="1"></AutoHideInfo> | ||||||
|  |            </template> | ||||||
|  |       </el-table-column> | ||||||
|  |        <el-table-column label="创建时间" align="center" prop="createTime" width="140"> | ||||||
|  |            <template slot-scope="scope"> | ||||||
|  |           <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}</span> | ||||||
|  |         </template> | ||||||
|  |       </el-table-column> | ||||||
|  |       <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:preSaleSurvey:edit']" | ||||||
|  |           >修改</el-button>--> | ||||||
|  |           <el-button | ||||||
|  |             size="mini" | ||||||
|  |             type="text" | ||||||
|  |             icon="el-icon-delete" | ||||||
|  |             @click="handleDelete(scope.row)" | ||||||
|  |             v-hasPermi="['custom:preSaleSurvey: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"> | ||||||
|  |         <el-form-item label="姓名" prop="name"> | ||||||
|  |           <el-input v-model="form.name" 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="age"> | ||||||
|  |           <el-input v-model="form.age" placeholder="请输入年龄" /> | ||||||
|  |         </el-form-item> | ||||||
|  |         <el-form-item label="0男 1女" prop="sex"> | ||||||
|  |           <el-select v-model="form.sex" placeholder="请选择0男 1女"> | ||||||
|  |             <el-option label="请选择字典生成" value="" /> | ||||||
|  |           </el-select> | ||||||
|  |         </el-form-item> | ||||||
|  |         <el-form-item label="电话" prop="phone"> | ||||||
|  |           <el-input v-model="form.phone" placeholder="请输入电话" /> | ||||||
|  |         </el-form-item> | ||||||
|  |         <el-form-item label="特殊体征ID" prop="physicalSignsId"> | ||||||
|  |           <el-input v-model="form.physicalSignsId" placeholder="请输入特殊体征ID" /> | ||||||
|  |         </el-form-item> | ||||||
|  |         <el-form-item label="体重" prop="weight"> | ||||||
|  |           <el-input v-model="form.weight" placeholder="请输入体重" /> | ||||||
|  |         </el-form-item> | ||||||
|  |         <el-form-item label="其他体征" prop="otherPhysicalSigns"> | ||||||
|  |           <el-input v-model="form.otherPhysicalSigns" placeholder="请输入其他体征" /> | ||||||
|  |         </el-form-item> | ||||||
|  |         <el-form-item label="作息时间" prop="timeTable"> | ||||||
|  |           <el-input v-model="form.timeTable" placeholder="请输入作息时间" /> | ||||||
|  |         </el-form-item> | ||||||
|  |         <el-form-item label="减脂或慢病调理经历" prop="experience"> | ||||||
|  |           <el-input v-model="form.experience" placeholder="请输入减脂或慢病调理经历" /> | ||||||
|  |         </el-form-item> | ||||||
|  |         <el-form-item label="职业" prop="occupation"> | ||||||
|  |           <el-input v-model="form.occupation" placeholder="请输入职业" /> | ||||||
|  |         </el-form-item> | ||||||
|  |         <el-form-item label="气血数据" prop="bloodData"> | ||||||
|  |           <el-input v-model="form.bloodData" placeholder="请输入气血数据" /> | ||||||
|  |         </el-form-item> | ||||||
|  |         <el-form-item label="售前ID" prop="preSaleId"> | ||||||
|  |           <el-input v-model="form.preSaleId" placeholder="请输入售前ID" /> | ||||||
|  |         </el-form-item> | ||||||
|  |         <el-form-item label="湿气数据" prop="moistureData"> | ||||||
|  |           <el-input v-model="form.moistureData" placeholder="请输入湿气数据" /> | ||||||
|  |         </el-form-item> | ||||||
|  |         <el-form-item label="问卷类型 0售前简易问卷  1简易评估问卷" prop="questionType"> | ||||||
|  |           <el-select v-model="form.questionType" placeholder="请选择问卷类型 0售前简易问卷  1简易评估问卷"> | ||||||
|  |             <el-option label="请选择字典生成" value="" /> | ||||||
|  |           </el-select> | ||||||
|  |         </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 { listPreSaleSurvey, getPreSaleSurvey, delPreSaleSurvey, addPreSaleSurvey, updatePreSaleSurvey, exportPreSaleSurvey } from "@/api/custom/preSaleSurvey"; | ||||||
|  | import Clipboard from "clipboard"; | ||||||
|  | import AutoHideInfo from "@/components/AutoHideInfo"; | ||||||
|  | import AutoHideMessage from "@/components/AutoHideMessage" | ||||||
|  | import VueQr from "vue-qr"; | ||||||
|  | const logo = require("@/assets/logo/logo_b.png"); | ||||||
|  | export default { | ||||||
|  |   name: "PreSaleSurvey", | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |         logo, | ||||||
|  |       // 遮罩层 | ||||||
|  |       loading: true, | ||||||
|  |       // 选中数组 | ||||||
|  |       ids: [], | ||||||
|  |       // 非单个禁用 | ||||||
|  |       single: true, | ||||||
|  |       // 非多个禁用 | ||||||
|  |       multiple: true, | ||||||
|  |       // 显示搜索条件 | ||||||
|  |       showSearch: true, | ||||||
|  |       // 总条数 | ||||||
|  |       total: 0, | ||||||
|  |       // 简易问卷调查表格数据 | ||||||
|  |       preSaleSurveyList: [], | ||||||
|  |       // 弹出层标题 | ||||||
|  |       title: "", | ||||||
|  |       // 是否显示弹出层 | ||||||
|  |       open: false, | ||||||
|  |       // 查询参数 | ||||||
|  |       queryParams: { | ||||||
|  |         pageNum: 1, | ||||||
|  |         pageSize: 10, | ||||||
|  |         name: null | ||||||
|  |       }, | ||||||
|  |       // 表单参数 | ||||||
|  |       form: {}, | ||||||
|  |       // 表单校验 | ||||||
|  |       rules: { | ||||||
|  |          | ||||||
|  |       }, | ||||||
|  |       simpleSignTypeOption: [], | ||||||
|  |       moistureDataExtendedOption:[], | ||||||
|  |       bloodDataExtendedOption:[], | ||||||
|  |       copyValue: "" | ||||||
|  |     }; | ||||||
|  |   }, | ||||||
|  |   created() { | ||||||
|  |       this.copyValue = window.location.origin.replace("manage", "sign") +"/simple/preSaleSurvey" | ||||||
|  |      this.getDicts("simple_sign_type").then((response) => { | ||||||
|  |       this.simpleSignTypeOption = response.data; | ||||||
|  |     }); | ||||||
|  |      this.getDicts("moisture_data_extended").then((response) => { | ||||||
|  |       this.moistureDataExtendedOption = response.data; | ||||||
|  |     }); | ||||||
|  |      this.getDicts("blood_data_extended").then((response) => { | ||||||
|  |       this.bloodDataExtendedOption = response.data; | ||||||
|  |       this.getList(); | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  |   }, | ||||||
|  |   components:{ | ||||||
|  |       AutoHideInfo,AutoHideMessage,VueQr | ||||||
|  |   }, | ||||||
|  |   methods: { | ||||||
|  |     /** 查询简易问卷调查列表 */ | ||||||
|  |     getList() { | ||||||
|  |       this.loading = true; | ||||||
|  |       listPreSaleSurvey(this.queryParams).then(response => { | ||||||
|  |         response.rows.forEach(item => { | ||||||
|  |             item.physicalSignsIdArray = item.physicalSignsId.split(","); | ||||||
|  |             item.timeTableArray = item.timeTable.split(","); | ||||||
|  |             item.bloodDataArray = item.bloodData.split(","); | ||||||
|  |             item.moistureDataArray = item.moistureData.split(","); | ||||||
|  |             item.physicalSignsNameArray = this.getPhysicalSignsArray(item); | ||||||
|  |             item.moistureDataNameArray = this.getMoistureDataNameArray(item); | ||||||
|  |             item.bloodDataNameArray = this.getBloodDataNameArray(item); | ||||||
|  |             if(item.standardWeight != null && item.standardWeight > 0){ | ||||||
|  |                 item.overWeight = item.weight - item.standardWeight; | ||||||
|  |             }else{ | ||||||
|  |                 item.overWeight = 0.0; | ||||||
|  |             } | ||||||
|  |         }); | ||||||
|  |         this.preSaleSurveyList = response.rows; | ||||||
|  |         this.total = response.total; | ||||||
|  |         this.loading = false; | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     getPhysicalSignsArray(item){ | ||||||
|  |         let array = []; | ||||||
|  |         item.physicalSignsIdArray.forEach((sign,index) => { | ||||||
|  |             array.push(this.getSignLabelByValue(sign, 1)); | ||||||
|  |         }); | ||||||
|  |         if(item.otherPhysicalSigns != null && item.otherPhysicalSigns != ""){ | ||||||
|  |             item.otherPhysicalSigns = item.otherPhysicalSigns.replace(",", ","); | ||||||
|  |             array = array.concat(item.otherPhysicalSigns.split(",")); | ||||||
|  |         } | ||||||
|  |         return array; | ||||||
|  |     }, | ||||||
|  |     getMoistureDataNameArray(item){ | ||||||
|  |         let array = []; | ||||||
|  |         item.moistureDataArray.forEach((moisture,index) => { | ||||||
|  |             array.push(this.getSignLabelByValue(moisture, 2)); | ||||||
|  |         }); | ||||||
|  |         return array; | ||||||
|  |     }, | ||||||
|  |     getBloodDataNameArray(item){ | ||||||
|  |         let array = []; | ||||||
|  |         item.bloodDataArray.forEach((blood,index) => { | ||||||
|  |             array.push(this.getSignLabelByValue(blood, 3)); | ||||||
|  |         }); | ||||||
|  |         return array; | ||||||
|  |     }, | ||||||
|  |     getSignLabelByValue(value, type){ | ||||||
|  |         if(type == 1){ | ||||||
|  |             let signObj = this.simpleSignTypeOption.find((obj) => obj.dictValue === value); | ||||||
|  |             return signObj != null ? signObj.dictLabel : null; | ||||||
|  |         }else if(type == 2){ | ||||||
|  |             let signObj = this.moistureDataExtendedOption.find((obj) => obj.dictValue === value); | ||||||
|  |             return signObj != null ? signObj.dictLabel : null; | ||||||
|  |         }else{ | ||||||
|  |             let signObj = this.bloodDataExtendedOption.find((obj) => obj.dictValue === value); | ||||||
|  |             return signObj != null ? signObj.dictLabel : null; | ||||||
|  |         } | ||||||
|  |     }, | ||||||
|  |      | ||||||
|  |     // 取消按钮 | ||||||
|  |     cancel() { | ||||||
|  |       this.open = false; | ||||||
|  |       this.reset(); | ||||||
|  |     }, | ||||||
|  |     // 表单重置 | ||||||
|  |     reset() { | ||||||
|  |       this.form = { | ||||||
|  |         id: null, | ||||||
|  |         name: null, | ||||||
|  |         customerKey: null, | ||||||
|  |         tall: null, | ||||||
|  |         age: null, | ||||||
|  |         sex: null, | ||||||
|  |         phone: null, | ||||||
|  |         physicalSignsId: null, | ||||||
|  |         weight: null, | ||||||
|  |         otherPhysicalSigns: null, | ||||||
|  |         timeTable: null, | ||||||
|  |         experience: null, | ||||||
|  |         occupation: null, | ||||||
|  |         bloodData: null, | ||||||
|  |         preSaleId: null, | ||||||
|  |         createTime: null, | ||||||
|  |         moistureData: null, | ||||||
|  |         updateTime: null, | ||||||
|  |         createBy: null, | ||||||
|  |         questionType: null, | ||||||
|  |         updateBy: null, | ||||||
|  |         delFlag: null | ||||||
|  |       }; | ||||||
|  |       this.resetForm("form"); | ||||||
|  |     }, | ||||||
|  |     handleCopy() { | ||||||
|  |       new Clipboard(".copyBtn"); | ||||||
|  |       this.$message({ | ||||||
|  |         message: "拷贝成功", | ||||||
|  |         type: "success", | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     /** 搜索按钮操作 */ | ||||||
|  |     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 | ||||||
|  |       getPreSaleSurvey(id).then(response => { | ||||||
|  |         this.form = response.data; | ||||||
|  |         this.open = true; | ||||||
|  |         this.title = "修改简易问卷调查"; | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     /** 提交按钮 */ | ||||||
|  |     submitForm() { | ||||||
|  |       this.$refs["form"].validate(valid => { | ||||||
|  |         if (valid) { | ||||||
|  |           if (this.form.id != null) { | ||||||
|  |             updatePreSaleSurvey(this.form).then(response => { | ||||||
|  |               if (response.code === 200) { | ||||||
|  |                 this.msgSuccess("修改成功"); | ||||||
|  |                 this.open = false; | ||||||
|  |                 this.getList(); | ||||||
|  |               } | ||||||
|  |             }); | ||||||
|  |           } else { | ||||||
|  |             addPreSaleSurvey(this.form).then(response => { | ||||||
|  |               if (response.code === 200) { | ||||||
|  |                 this.msgSuccess("新增成功"); | ||||||
|  |                 this.open = false; | ||||||
|  |                 this.getList(); | ||||||
|  |               } | ||||||
|  |             }); | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     /** 删除按钮操作 */ | ||||||
|  |     handleDelete(row) { | ||||||
|  |       const ids = row.id || this.ids; | ||||||
|  |       this.$confirm('是否确认删除简易问卷调查编号为"' + ids + '"的数据项?', "警告", { | ||||||
|  |           confirmButtonText: "确定", | ||||||
|  |           cancelButtonText: "取消", | ||||||
|  |           type: "warning" | ||||||
|  |         }).then(function() { | ||||||
|  |           return delPreSaleSurvey(ids); | ||||||
|  |         }).then(() => { | ||||||
|  |           this.getList(); | ||||||
|  |           this.msgSuccess("删除成功"); | ||||||
|  |         }).catch(function() {}); | ||||||
|  |     }, | ||||||
|  |     /** 导出按钮操作 */ | ||||||
|  |     handleExport() { | ||||||
|  |       const queryParams = this.queryParams; | ||||||
|  |       this.$confirm('是否确认导出所有简易问卷调查数据项?', "警告", { | ||||||
|  |           confirmButtonText: "确定", | ||||||
|  |           cancelButtonText: "取消", | ||||||
|  |           type: "warning" | ||||||
|  |         }).then(function() { | ||||||
|  |           return exportPreSaleSurvey(queryParams); | ||||||
|  |         }).then(response => { | ||||||
|  |           this.download(response.msg); | ||||||
|  |         }).catch(function() {}); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | }; | ||||||
|  | </script> | ||||||
							
								
								
									
										462
									
								
								stdiet-ui/src/views/custom/preSaleSurvey/simpleSurvey/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										462
									
								
								stdiet-ui/src/views/custom/preSaleSurvey/simpleSurvey/index.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,462 @@ | |||||||
|  | <template> | ||||||
|  |   <div> | ||||||
|  |   <section v-show="!submitSuccessFlag"> | ||||||
|  |     <div style="padding: 5px; text-align: center;margin-top:5px"> | ||||||
|  |       <img :src="logo" style="width: auto; height: 40px" alt="logo" /> | ||||||
|  |     </div> | ||||||
|  |     <el-form | ||||||
|  |       ref="form" | ||||||
|  |       label-position="top" | ||||||
|  |       :model="form" | ||||||
|  |       :rules="rules" | ||||||
|  |       label-width="100px" | ||||||
|  |       style="padding: 16px" | ||||||
|  |     > | ||||||
|  |     <p class="p_title_1 text-span-title" style="margin-top: 0px;" align="center">胜唐体控基础信息问卷表</p> | ||||||
|  |     <!--<p style="font-size: 15px; margin-bottom: 12px;margin-top: 10px;">请您确保下方姓名、手机号正确</p>--> | ||||||
|  |     <el-form-item label="1、真实姓名" prop="name" style="margin-top: 2px;"> | ||||||
|  |       <el-input v-model="form.name" placeholder="请输入真实姓名" maxlength="20" /> | ||||||
|  |     </el-form-item> | ||||||
|  |     <el-form-item label="2、手机号" prop="phone" > | ||||||
|  |       <el-input v-model="form.phone" type="number" placeholder="请输入手机号" /> | ||||||
|  |     </el-form-item> | ||||||
|  |     <el-form-item label="3、性别" prop="sex"> | ||||||
|  |       <el-radio-group  v-model="form.sex" size="small"> | ||||||
|  |         <el-radio :label="parseInt('0')"  border>男</el-radio> | ||||||
|  |         <el-radio :label="parseInt('1')" border>女</el-radio> | ||||||
|  |       </el-radio-group> | ||||||
|  |     </el-form-item> | ||||||
|  |     <el-form-item label="4、年龄" prop="age" > | ||||||
|  |       <el-input type="number" v-model="form.age" placeholder="请输入年龄(整数)"  autocomplete="off" ></el-input> | ||||||
|  |     </el-form-item> | ||||||
|  |     <el-form-item label="5、身高(厘米)" prop="tall" > | ||||||
|  |       <el-input type="number" v-model="form.tall" placeholder="请输入身高(整数)"  autocomplete="off" ></el-input> | ||||||
|  |     </el-form-item> | ||||||
|  |     <el-form-item label="6、体重(斤)" prop="weight" > | ||||||
|  |       <el-input v-model="form.weight" placeholder="请输入体重(可保留一位小数)" autocomplete="off"></el-input> | ||||||
|  |     </el-form-item> | ||||||
|  |     <el-form-item label="7、职业" prop="occupation"> | ||||||
|  |       <el-input placeholder="请输入职业名称"  v-model="form.occupation" maxlength="50" | ||||||
|  |       ></el-input> | ||||||
|  |     </el-form-item> | ||||||
|  |     <el-form-item label="8、病史体征(可多选)" prop="physicalSignsIdArray" > | ||||||
|  |       <el-select v-model="form.physicalSignsIdArray" multiple placeholder="请选择"> | ||||||
|  |         <el-option  | ||||||
|  |           v-for="physicalSign in physicalSignsList" | ||||||
|  |           :key="physicalSign.dictValue" | ||||||
|  |           :label="physicalSign.dictLabel" | ||||||
|  |           :value="physicalSign.dictValue" | ||||||
|  |         > | ||||||
|  |         </el-option> | ||||||
|  |       </el-select> | ||||||
|  |       <div><span class="text-span">其他病史体征</span> | ||||||
|  |         <el-input type="textarea" | ||||||
|  |                   placeholder="请输入其他病史体征,使用,隔开" | ||||||
|  |                   v-model="form.otherPhysicalSigns" | ||||||
|  |                   maxlength="200" | ||||||
|  |                   show-word-limit | ||||||
|  |                   rows="2" | ||||||
|  |         ></el-input> | ||||||
|  |       </div> | ||||||
|  |     </el-form-item> | ||||||
|  |     <el-form-item label="9、作息时间" > | ||||||
|  |         <div class="margin-left"> | ||||||
|  |             <span class="text-span">睡觉时间</span> | ||||||
|  |             <el-input placeholder="请输入睡觉时间" maxlength="20"  v-model="form.timeTableArray[0]" style="width:60%;margin-left:10px"/> | ||||||
|  |         </div>           | ||||||
|  |         <div class="margin-left" style="margin-top:8px;"> | ||||||
|  |             <span class="text-span">起床时间</span> | ||||||
|  |             <el-input placeholder="请输入起床时间" maxlength="20"  v-model="form.timeTableArray[1]" style="width:60%;margin-left:10px"/> | ||||||
|  |         </div> | ||||||
|  |     </el-form-item> | ||||||
|  |     <el-form-item label="10、减脂经历" prop="experience" > | ||||||
|  |       <el-input | ||||||
|  |         type="textarea" | ||||||
|  |         placeholder="请描述下减脂经历" | ||||||
|  |         v-model="form.experience" | ||||||
|  |         maxlength="200" | ||||||
|  |         show-word-limit | ||||||
|  |         rows="3" | ||||||
|  |       ></el-input> | ||||||
|  |     </el-form-item> | ||||||
|  |     <el-form-item label="11、湿气测试(可多选)" prop="moistureDataArray" > | ||||||
|  |       <el-checkbox-group v-model="form.moistureDataArray" > | ||||||
|  |         <el-checkbox v-for="moistureItem in moistureDataList" style="width:100%" :label="moistureItem.dictValue" :key="moistureItem.dictValue">{{ moistureItem.dictLabel }}</el-checkbox> | ||||||
|  |       </el-checkbox-group> | ||||||
|  |     </el-form-item> | ||||||
|  |     <el-form-item label="12、气血测试(可多选)" prop="bloodDataArray" > | ||||||
|  |       <el-checkbox-group v-model="form.bloodDataArray" > | ||||||
|  |         <el-checkbox v-for="bloodItem in bloodDataList"  style="width:100%" :label="bloodItem.dictValue" :key="bloodItem.dictValue">{{ bloodItem.dictLabel }}</el-checkbox> | ||||||
|  |       </el-checkbox-group> | ||||||
|  |     </el-form-item> | ||||||
|  |     <el-form-item style="text-align: center; margin: 0 auto"> | ||||||
|  |         <el-button | ||||||
|  |           type="primary" | ||||||
|  |           @click="addCustomerSurvey()" | ||||||
|  |           style="width:80%" | ||||||
|  |           :disabled="submitFlag" | ||||||
|  |           >填写完成,提交问卷</el-button | ||||||
|  |         > | ||||||
|  |       </el-form-item> | ||||||
|  |     </el-form> | ||||||
|  |      | ||||||
|  |   </section> | ||||||
|  |   <SimpleSurveyReport ref="simpleSurveyReportRef"></SimpleSurveyReport> | ||||||
|  |   </div> | ||||||
|  | </template> | ||||||
|  | <script> | ||||||
|  | import { | ||||||
|  |   getDictData, | ||||||
|  |   getCustomerSurvey, | ||||||
|  |   addSimpleCustomerSurvey | ||||||
|  | } from "@/api/custom/customerInvestigation"; | ||||||
|  | const logo = require("@/assets/logo/st_logo.png"); | ||||||
|  | import SimpleSurveyReport from "@/components/SimpleSurveyReport" | ||||||
|  | export default { | ||||||
|  |   name: "index", | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |       logo, | ||||||
|  |       submitFlag: false, | ||||||
|  |       submitSuccessFlag: false, | ||||||
|  |       moistureDataList:[], | ||||||
|  |       bloodDataList:[], | ||||||
|  |       physicalSignsList:[], | ||||||
|  |       form:{ | ||||||
|  |         customerKey: null, | ||||||
|  |         name: "", | ||||||
|  |         phone: "", | ||||||
|  |         sex: 1, | ||||||
|  |         age: null, | ||||||
|  |         tall: null, | ||||||
|  |         weight: null, | ||||||
|  |         physicalSignsIdArray:[], | ||||||
|  |         physicalSignsId: "", | ||||||
|  |         otherPhysicalSigns: "", | ||||||
|  |         timeTableArray:["",""], | ||||||
|  |         timeTable: "", | ||||||
|  |         experience: "", | ||||||
|  |         occupation: "", | ||||||
|  |         bloodDataArray: [], | ||||||
|  |         bloodData: "", | ||||||
|  |         moistureDataArray: [], | ||||||
|  |         moistureData: "", | ||||||
|  |       }, | ||||||
|  |       rules: { | ||||||
|  |         name: [{ required: true, trigger: "blur", message: "请填写姓名" }], | ||||||
|  |         phone: [ | ||||||
|  |             //{ required: false, trigger: "blur", message: "请选择手机号" }, | ||||||
|  |             { | ||||||
|  |                 required: false, | ||||||
|  |                 trigger: "blur", | ||||||
|  |                 pattern: /^\d{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: /^(\d+)(\.\d{1})?$/, | ||||||
|  |             message: "体重格式不正确", | ||||||
|  |           }, | ||||||
|  |         ] | ||||||
|  |       } | ||||||
|  |     }; | ||||||
|  |   }, | ||||||
|  |   components: { | ||||||
|  |     SimpleSurveyReport | ||||||
|  |   }, | ||||||
|  |   methods: { | ||||||
|  |     addCustomerSurvey(){ | ||||||
|  |         this.submitFlag = true; | ||||||
|  |         this.form.physicalSignsId =  this.form.physicalSignsIdArray.join(","); | ||||||
|  |         this.form.timeTable = this.form.timeTableArray.join(","); | ||||||
|  |         this.form.bloodData = this.form.bloodDataArray.join(","); | ||||||
|  |         this.form.moistureData = this.form.moistureDataArray.join(","); | ||||||
|  |         this.$refs.form.validate((valid) => { | ||||||
|  |           if (valid){ | ||||||
|  |               addSimpleCustomerSurvey(this.form).then((response) => { | ||||||
|  |                 if(response.code == 200){ | ||||||
|  |                     this.goTop(); | ||||||
|  |                     this.submitFlag = true; | ||||||
|  |                     this.form.standardWeight = response.data; | ||||||
|  |                     let self = this; | ||||||
|  |                     this.$notify({ | ||||||
|  |                         title: "提交成功,正在生成报告...", | ||||||
|  |                         message: "", | ||||||
|  |                         type: "success", | ||||||
|  |                         duration: "1000", | ||||||
|  |                         onClose: function(){ | ||||||
|  |                             self.submitSuccessFlag = true; | ||||||
|  |                             self.$refs.simpleSurveyReportRef.showReportView(self.form, self.moistureDataList, self.bloodDataList, self.physicalSignsList); | ||||||
|  |                         } | ||||||
|  |                     }); | ||||||
|  |                 }else{ | ||||||
|  |                     this.submitFlag = false; | ||||||
|  |                 }          | ||||||
|  |               }); | ||||||
|  |           }else{ | ||||||
|  |             this.$message({ | ||||||
|  |               message: "数据未填写完整", | ||||||
|  |               type: "warning", | ||||||
|  |             }); | ||||||
|  |             this.submitFlag = false; | ||||||
|  |           } | ||||||
|  |         }) | ||||||
|  |     }, | ||||||
|  |     goTop() { | ||||||
|  |       window.scroll(0, 0); | ||||||
|  |     }, | ||||||
|  |     //获取湿气 | ||||||
|  |     getMoistureDictData() { | ||||||
|  |       getDictData("moisture_data_extended").then((response) => { | ||||||
|  |           this.moistureDataList = response.data; | ||||||
|  |         }); | ||||||
|  |     }, | ||||||
|  |     //获取气血 | ||||||
|  |     getBloodDictData() { | ||||||
|  |         getDictData("blood_data_extended").then((response) => { | ||||||
|  |           this.bloodDataList = response.data; | ||||||
|  |         }); | ||||||
|  |     }, | ||||||
|  |     /** 查询体征列表 */ | ||||||
|  |     getPhysicalSignsList() { | ||||||
|  |         getDictData("simple_sign_type").then((response) => { | ||||||
|  |           this.physicalSignsList = response.data; | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |   created() { | ||||||
|  |     //this.form.customerKey = this.$route.params.customerKey; | ||||||
|  |     //this.getCustomerSurvey(this.form.customerKey); | ||||||
|  |     this.getPhysicalSignsList(); | ||||||
|  |     this.getMoistureDictData(); | ||||||
|  |     this.getBloodDictData(); | ||||||
|  |   }, | ||||||
|  |   beforeCreate() { | ||||||
|  |     document.title = this.$route.meta.title; | ||||||
|  |   } | ||||||
|  | }; | ||||||
|  | </script> | ||||||
|  |  | ||||||
|  |  <style scoped> | ||||||
|  | .el-form-item { | ||||||
|  |   margin-bottom: 8px; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .p_title_1 { | ||||||
|  |   font-size: 18px; | ||||||
|  |   font-weight: bold; | ||||||
|  |   margin-top: 30px; | ||||||
|  | } | ||||||
|  | .p_title_2 { | ||||||
|  |   font-size: 16px; | ||||||
|  |   font-weight: bold; | ||||||
|  |   margin-top: 30px; | ||||||
|  | } | ||||||
|  | .p_title_3 { | ||||||
|  |   font-size: 14px; | ||||||
|  |   font-weight: bold; | ||||||
|  |   margin-top: 30px; | ||||||
|  | } | ||||||
|  | .margin-left { | ||||||
|  |   margin-left: 14px; | ||||||
|  | } | ||||||
|  | .el-input__inner { | ||||||
|  |   width: 30%; | ||||||
|  | } | ||||||
|  | .margin-top-10 { | ||||||
|  |   margin-top: 10px; | ||||||
|  | } | ||||||
|  | .width-50-left-8-right-5 { | ||||||
|  |   width: 50%; | ||||||
|  |   margin-left: 8px; | ||||||
|  |   margin-right: 5px; | ||||||
|  | } | ||||||
|  | .width-70-left-8-right-5 { | ||||||
|  |   width: 70%; | ||||||
|  |   margin-left: 8px; | ||||||
|  |   margin-right: 5px; | ||||||
|  | } | ||||||
|  | .text-span{ | ||||||
|  |     color:#606266; | ||||||
|  |     font-weight: 700; | ||||||
|  |     font-size: 14px | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .text-span-title{ | ||||||
|  |     color:#606266; | ||||||
|  |     font-weight: 800; | ||||||
|  |     font-size: 16px | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .report_div{ | ||||||
|  |       width: 100%; | ||||||
|  |       padding-top: 25px; | ||||||
|  |       padding-bottom: 200px; | ||||||
|  |       background: linear-gradient(30deg, #4B8AFF, #329FFE); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .report_title_div{ | ||||||
|  |       padding: 25px 15px; | ||||||
|  |       width: 90%; | ||||||
|  |       margin:0 auto; | ||||||
|  |       background: #FFFFFF; | ||||||
|  |       box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1); | ||||||
|  |       border-radius: 20px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .report_title{ | ||||||
|  |       margin:0 auto; | ||||||
|  |       text-align: center; | ||||||
|  |       font-size: 20px; | ||||||
|  |       font-family: Source Han Sans CN; | ||||||
|  |       font-weight: 500; | ||||||
|  |       color: #4B8AFF; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |    | ||||||
|  |   .report_weight{ | ||||||
|  |       margin-top: 25px; | ||||||
|  |       border-top:2px solid #F1F1F1; | ||||||
|  |       border-bottom:2px solid #F1F1F1; | ||||||
|  |       padding: 0px 5% | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .weight_name{ | ||||||
|  |       font-size: 18px; | ||||||
|  |       font-family: Source Han Sans CN; | ||||||
|  |       font-weight: 500; | ||||||
|  |       color: #4B8AFF; | ||||||
|  |       line-height: 50px; | ||||||
|  |       margin-right:5px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .weight_value{ | ||||||
|  |     font-size: 18px; | ||||||
|  |     font-family: Source Han Sans CN; | ||||||
|  |     font-weight: 400; | ||||||
|  |     color: #333333; | ||||||
|  |     line-height: 50px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .sign_div_title{ | ||||||
|  |       font-size: 18px; | ||||||
|  |     font-family: Source Han Sans CN; | ||||||
|  |     font-weight: 500; | ||||||
|  |     color: #4B8AFF; | ||||||
|  |     line-height: 40px; | ||||||
|  |     margin-top:10px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .sign_div_title_small{ | ||||||
|  |     font-size: 15px; | ||||||
|  |     font-family: Source Han Sans CN; | ||||||
|  |     font-weight: 400; | ||||||
|  |     color: #999999; | ||||||
|  |     line-height: 20px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .sign_type{ | ||||||
|  |       margin-top:10px; | ||||||
|  |       padding-bottom:20px; | ||||||
|  |       border-bottom:2px solid #F1F1F1; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .sign_type_div{ | ||||||
|  |     height: 30px; | ||||||
|  |     background: #F1F1F1; | ||||||
|  |     border-radius: 24px; | ||||||
|  |     text-align: center; | ||||||
|  |     margin:10px 5px; | ||||||
|  |     padding: 0px 12px; | ||||||
|  |     width:auto;  | ||||||
|  |     display:inline-block !important;  | ||||||
|  |     display:inline;  | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .sign_type_div_value{ | ||||||
|  |     font-size: 15px; | ||||||
|  |     font-family: Source Han Sans CN; | ||||||
|  |     font-weight: 400; | ||||||
|  |     color: #333333; | ||||||
|  |     line-height: 30px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .blood_moisture{ | ||||||
|  |       margin-top: 20px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .blood_moisture_title{ | ||||||
|  |       float: left; | ||||||
|  |       font-size: 16px; | ||||||
|  |      font-family: Source Han Sans CN; | ||||||
|  |      font-weight: 500; | ||||||
|  |     color: #4B8AFF; | ||||||
|  |     line-height: 30px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .blood_moisture_value{ | ||||||
|  |        margin-left:10px; | ||||||
|  |        float: left; | ||||||
|  |        width: 220px; | ||||||
|  |        height:30px; | ||||||
|  |        border-radius: 20px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .clear{ clear:both}  | ||||||
|  |  | ||||||
|  |   .light{ | ||||||
|  |       background: #20d866; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .moderate{ | ||||||
|  |       background: #f0a70b; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .severe{ | ||||||
|  |       background: #e94545; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   body{ | ||||||
|  |     width: 100%; | ||||||
|  |  | ||||||
|  |     height: 100%; | ||||||
|  |  | ||||||
|  |     background-color: #20d866; | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
|  |    | ||||||
|  |  | ||||||
|  |   | ||||||
|  |  | ||||||
|  |    | ||||||
|  |  | ||||||
|  |   | ||||||
|  |  | ||||||
|  |   | ||||||
|  |   | ||||||
|  |    | ||||||
|  | </style> | ||||||
		Reference in New Issue
	
	Block a user