健康评估报告

This commit is contained in:
xiezhijun 2021-02-27 16:55:31 +08:00
parent 488a149ec3
commit 5de80fd57f
11 changed files with 263 additions and 45 deletions

View File

@ -9,6 +9,8 @@ import com.stdiet.common.annotation.Excel.ColumnType;
import com.stdiet.common.constant.UserConstants;
import com.stdiet.common.core.domain.BaseEntity;
import java.util.List;
/**
* 字典数据表 sys_dict_data
*
@ -34,8 +36,10 @@ public class SysDictData extends BaseEntity
@Excel(name = "字典键值")
private String dictValue;
/** 字典类型 */
@Excel(name = "字典类型")
private List<String> dictValueList;
/** 字典类型 */
@Excel(name = "字典类型")
private String dictType;
/** 样式属性(其他样式扩展) */
@ -153,7 +157,15 @@ public class SysDictData extends BaseEntity
{
this.status = status;
}
public List<String> getDictValueList() {
return dictValueList;
}
public void setDictValueList(List<String> dictValueList) {
this.dictValueList = dictValueList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -416,7 +416,7 @@ public class ReflectUtils
Field field = object.getClass().getDeclaredField(fieldName);
//设置对象的访问权限保证对private的属性的访问
field.setAccessible(true);
return field.get(object).toString();
return field.get(object) == null ? "" : field.get(object).toString();
} catch (Exception e) {
return "";
}

View File

@ -433,6 +433,9 @@ public class SysCustomerHealthy extends BaseEntity
//备注
private String remark;
/** 减脂指导 */
private String guidance;
/** 湿气数据 */
@Excel(name = "湿气数据")
private String moistureDate;

View File

@ -281,6 +281,8 @@ public class HealthyDetailRequest implements Serializable {
/** 其他运动项目,使用,隔开 */
private String otherMotionClassify;
private String motion;
/** 运动场地,使用,隔开 */
private String motionField;
@ -372,8 +374,8 @@ public class HealthyDetailRequest implements Serializable {
/** 饮食习惯 */
private String makeFoodType;
/** 客户病史体征id,使用,隔开 */
private String physicalSignsId;
/** 客户病史体征,使用,隔开 */
private String physicalSigns;
/** 其他病史体征 **/
private String otherPhysicalSigns;
@ -387,4 +389,8 @@ public class HealthyDetailRequest implements Serializable {
/** 湿气数据 */
private String moistureDate;
/** 减脂指导 **/
private String guidance;
}

View File

@ -2,6 +2,7 @@ package com.stdiet.custom.mapper;
import java.util.List;
import com.stdiet.common.core.domain.entity.SysDictData;
import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.domain.SysCustomerHealthy;
import org.apache.ibatis.annotations.Param;
@ -79,4 +80,12 @@ public interface SysCustomerHealthyMapper
* @return
*/
int deleteCustomerHealthyByCustomerId(@Param("customerId")Long customerId);
/**
* 根据类型键值集合查询字典类型
* @param sysDictData
* @return
*/
public List<SysDictData> selectDictDataByTypeAndValue(SysDictData sysDictData);
}

View File

@ -3,6 +3,7 @@ package com.stdiet.custom.service;
import java.util.List;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.core.domain.entity.SysDictData;
import com.stdiet.custom.domain.SysCustomerHealthy;
import com.stdiet.custom.dto.request.HealthyDetailRequest;
import org.apache.ibatis.annotations.Param;
@ -85,4 +86,12 @@ public interface ISysCustomerHealthyService
* @return
*/
AjaxResult generateHealthyReport(HealthyDetailRequest healthyDetailRequest);
/**
* 根据类型键值集合查询字典类型
* @param sysDictData
* @return
*/
public List<SysDictData> selectDictDataByTypeAndValue(SysDictData sysDictData);
}

View File

@ -1,11 +1,11 @@
package com.stdiet.custom.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import com.stdiet.common.config.RuoYiConfig;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.core.domain.entity.SysDictData;
import com.stdiet.common.utils.DateUtils;
import com.stdiet.common.utils.StringUtils;
import com.stdiet.common.utils.bean.ObjectUtils;
import com.stdiet.common.utils.reflect.ReflectUtils;
@ -157,14 +157,13 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
@Override
public AjaxResult generateHealthyReport(HealthyDetailRequest healthyDetailRequest){
AjaxResult ajaxResult = AjaxResult.error();
String templatePath = "/home/workspace/ShengTangManage/running/pdf/healthyReport.pdf";
//String templatePath = "D:\\contract\\healthyReport.pdf";
//String templatePath = "/home/workspace/ShengTangManage/running/pdf/healthyReport.pdf";
String templatePath = "D:\\contract\\healthyReport.pdf";
String fileName = "healthyReport" + healthyDetailRequest.getCustomerId() + System.currentTimeMillis() + ".pdf";
String filePath = RuoYiConfig.getDownloadPath() + fileName;
//查询客户健康信息
SysCustomerHealthy sysCustomerHealthy = selectSysCustomerHealthyById(healthyDetailRequest.getId());
if(sysCustomerHealthy != null){
ajaxResult = PdfUtils.generatePdfFile(templatePath, filePath, getReportData(sysCustomerHealthy, healthyDetailRequest));
ajaxResult.put("path", fileName);
}
@ -192,10 +191,35 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
};
private Map<String,String> getReportData(SysCustomerHealthy sysCustomerHealthy, HealthyDetailRequest healthyDetailRequest){
if(StringUtils.isNotEmpty(sysCustomerHealthy.getBloodData())){
SysDictData param = new SysDictData();
param.setDictType("sys_moisture_data");
param.setDictValueList(Arrays.asList(sysCustomerHealthy.getBloodData().split(",")));
List<SysDictData> bloodData = selectDictDataByTypeAndValue(param);
String bloodString = "";
for (SysDictData blood : bloodData) {
bloodString += blood.getDictValue() + "" +blood.getDictLabel() + "\n";
}
healthyDetailRequest.setBloodData(bloodString);
}
if(StringUtils.isNotEmpty(sysCustomerHealthy.getMoistureDate())){
SysDictData param = new SysDictData();
param.setDictType("sys_blood_data");
param.setDictValueList(Arrays.asList(sysCustomerHealthy.getBloodData().split(",")));
List<SysDictData> moistureData = selectDictDataByTypeAndValue(param);
String moistureString = "";
for (SysDictData moisture : moistureData) {
moistureString += moisture.getDictValue() + "" + moisture.getDictLabel() + "\n";
}
healthyDetailRequest.setMoistureDate(moistureString);
}
Map<String,String> data = new HashMap<>();
for (String key : healthyAttrNameAray) {
data.put(key, ReflectUtils.getFieldValueByFieldName(key, healthyDetailRequest));
}
//减脂指导
data.put("guidance", sysCustomerHealthy.getGuidance());
//营养热量分析数据
NutritionalCalories nutritionalCalories = NutritionalUtils.getNutritionalCaloriesData(sysCustomerHealthy);
nutritionalCalories.setNutritionalHeat_one(nutritionalCalories.getNutritionalHeat()[0].toString());
nutritionalCalories.setNutritionalHeat_two(nutritionalCalories.getNutritionalHeat()[1].toString());
@ -208,13 +232,28 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
nutritionalCalories.setWeightNutritionalRate_three(nutritionalCalories.getWeightNutritionalRate()[2].toString());
for (String key : nutriAttrNameArray) {
if("targetEveryWeightHeat".equals(key)){
data.put(key, nutritionalCalories.getTargetEveryWeightHeat()[0].toString()+"-"+nutritionalCalories.getTargetEveryWeightHeat()[1].toString());
data.put(key, nutritionalCalories.getTargetEveryWeightHeat()[0].intValue()+"-"+nutritionalCalories.getTargetEveryWeightHeat()[1].intValue());
continue;
}
if("standardEveryWeightHeat".equals(key)){
data.put(key, nutritionalCalories.getStandardEveryWeightHeat()[0].toString()+"-"+nutritionalCalories.getStandardEveryWeightHeat()[1].toString());
data.put(key, nutritionalCalories.getStandardEveryWeightHeat()[0].intValue()+"-"+nutritionalCalories.getStandardEveryWeightHeat()[1].intValue());
continue;
}
data.put(key, ReflectUtils.getFieldValueByFieldName(key, nutritionalCalories));
}
data.put("company","深圳胜唐体控有限公司");
data.put("date", DateUtils.getDate());
return data;
}
/**
* 根据类型键值集合查询字典类型
* @param sysDictData
* @return
*/
@Override
public List<SysDictData> selectDictDataByTypeAndValue(SysDictData sysDictData){
return sysCustomerHealthyMapper.selectDictDataByTypeAndValue(sysDictData);
}
}

View File

@ -29,6 +29,7 @@ import java.util.List;
@Service("sysRecipesPlanService")
@Transactional
public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
public static final String generateRecipesPlanLockKey = "generateRecipesPlanLock::%s";
@Autowired
private SysRecipesPlanMapper sysRecipesPlanMapper;
@ -137,6 +138,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
//判断是否提成单拆分单中的副单体验单
if(sysOrder.getAfterSaleCommissOrder().intValue() == 1 || ("1".equals(sysOrder.getOrderType()) && sysOrder.getMainOrderId().intValue() == 1) ||
"2".equals(sysOrder.getOrderType())){
System.out.println("---------------------不生成食谱------------------------");
return;
}
try {
@ -144,7 +146,6 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
if (synchrolockUtil.lock(String.format(generateRecipesPlanLockKey, orderId))) {
SysRecipesPlan queryParam = new SysRecipesPlan();
queryParam.setOrderId(orderId);
List<SysRecipesPlan> oldRecipesPlanList = sysRecipesPlanMapper.selectSysRecipesPlanList(queryParam);
//判断是否已存在食谱
/*if (oldRecipesPlanList != null && oldRecipesPlanList.size() > 0) {
Long[] orderIdArray = new Long[1];
@ -156,10 +157,15 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
pauseParam.setOrderId(sysOrder.getOrderId());
//暂停记录列表
List<SysOrderPause> pauseList = sysOrderPauseService.selectSysOrderPauseList(pauseParam);
List<SysRecipesPlan> planList = generatePlan(sysOrder, oldRecipesPlanList,
DateUtils.dateToLocalDate(sysOrder.getStartTime()), DateUtils.dateToLocalDate(sysOrder.getServerEndTime()), pauseList);
if (planList != null && planList.size() > 0) {
sysRecipesPlanMapper.insertBatch(planList);
List<SysRecipesPlan> planList = generatePlan(sysOrder, DateUtils.dateToLocalDate(sysOrder.getStartTime()), DateUtils.dateToLocalDate(sysOrder.getServerEndTime()), pauseList);
//判断是否已存在食谱计划
List<SysRecipesPlan> oldRecipesPlanList = sysRecipesPlanMapper.selectSysRecipesPlanList(queryParam);
if(oldRecipesPlanList != null && oldRecipesPlanList.size() > 0){
}else{
if (planList != null && planList.size() > 0) {
sysRecipesPlanMapper.insertBatch(planList);
}
}
}
} catch (Exception e) {
@ -174,14 +180,12 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
* 根据订单ID订单开始服务时间结束时间暂停列表生成食谱计划列表
*
* @param sysOrder 订单对象
* @param oldRecipesPlanList 旧的食谱计划
* @param serverStartDate 服务开始时间
* @param serverEndDate 服务结束时间
* @param pauseList 暂停列表
* @return
*/
public List<SysRecipesPlan> generatePlan(SysOrder sysOrder, List<SysRecipesPlan> oldRecipesPlanList,
LocalDate serverStartDate, LocalDate serverEndDate, List<SysOrderPause> pauseList) {
public List<SysRecipesPlan> generatePlan(SysOrder sysOrder, LocalDate serverStartDate, LocalDate serverEndDate, List<SysOrderPause> pauseList) {
List<SysRecipesPlan> planList = new ArrayList<>();
boolean breakFlag = false;
LocalDate planStartDate = serverStartDate;
@ -200,17 +204,12 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
sysRecipesPlan.setEndDate(DateUtils.localDateToDate(planEndDate));
sysRecipesPlan.setOrderId(sysOrder.getOrderId());
sysRecipesPlan.setCusId(sysOrder.getCusId());
/*//当开始时间小于等于当前时间默认为已发送发送时间为前一天
if(ChronoUnit.DAYS.between(planStartDate, LocalDate.now()) >= 0){
sysRecipesPlan.setSendFlag(1);
sysRecipesPlan.setSendTime(DateUtils.localDateToDate(LocalDate.now().minusDays(1)));
}*/
sysRecipesPlan.setEndNumDay();
//将旧食谱计划中的发送状态发送时间食谱复制到新食谱计划中
boolean existFlag = oldRecipesPlanList.size() >= planList.size() + 1;
/*boolean existFlag = oldRecipesPlanList.size() >= planList.size() + 1;
sysRecipesPlan.setSendFlag(existFlag ? oldRecipesPlanList.get(planList.size()).getSendFlag() : 0);
sysRecipesPlan.setSendTime(existFlag ? oldRecipesPlanList.get(planList.size()).getSendTime() : null);
sysRecipesPlan.setRecipesId(existFlag ? oldRecipesPlanList.get(planList.size()).getRecipesId() : null);
sysRecipesPlan.setRecipesId(existFlag ? oldRecipesPlanList.get(planList.size()).getRecipesId() : null);*/
planList.add(sysRecipesPlan);
planStartDate = planEndDate.plusDays(1);

View File

@ -112,6 +112,7 @@
<result property="bloodData" column="blood_data" />
<result property="moistureDate" column="moisture_date" />
<result property="remark" column="remark"></result>
<result property="guidance" column="guidance" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
@ -123,7 +124,7 @@
<sql id="selectSysCustomerHealthyVo">
select sch.id, customer_id, conditioning_project_id, sex, age, weight, tall, condiment, other_condiment, cooking_style, cooking_style_rate, wash_vegetables_style, other_wash_vegetables_style, breakfast_type, breakfast_food, lunch_type, dinner, vegetable_rate, common_meat, dinner_time, supper_num, supper_food, diet_hot_and_cold, diet_flavor, vegetables_num, vegetables_rate_type, fruits_num, fruits_time, fruits_rate, rice_num, rice_full, eating_speed, snacks, other_snacks, health_products_flag, health_products_brand, health_products_name, health_products_week_rate, health_products_day_rate, water_num, water_type, water_habit, drinks_num, drink_wine_flag, drink_wine_classify, other_wine_classify, drink_wine_amount, smoke_flag, smoke_rate, second_smoke, work_industry, work_type, defecation_num, other_defecation_num, defecation_time, defecation_shape, defecation_smell, defecation_speed, defecation_color, motion_num, motion_duration, motion_time, aerobic_motion_classify, anaerobic_motion_classify, anaerobic_aerobic_motion_classify, other_motion_classify, motion_field, other_motion_field, sleep_time, sleep_quality, sleep_drug_flag, sleep_drug, stayup_late_flag, stayup_late_week_num, family_illness_history, other_family_illness_history, operation_history, other_operation_history, near_operation_flag, recoverye_situation, long_eat_drug_flag, long_eat_drug_classify, other_long_eat_drug_classify, allergy_flag, allergy_situation, allergen, other_allergen, medical_report, medical_report_name,
position,experience,rebound,difficulty,crux,dishes_ingredient,make_food_type,physical_signs_id,other_physical_signs,blood_data,moisture_date,sch.remark,
position,experience,rebound,difficulty,crux,dishes_ingredient,make_food_type,physical_signs_id,other_physical_signs,blood_data,moisture_date,sch.remark,sch.guidance,
sch.create_time, sch.create_by,sch. update_time, sch.update_by, sch.del_flag
</sql>
@ -261,6 +262,7 @@
<if test="bloodData != null">blood_data,</if>
<if test="moistureDate != null">moisture_date,</if>
<if test="remark != null">remark,</if>
<if test="guidance != null">guidance,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
@ -369,6 +371,7 @@
<if test="bloodData != null">#{bloodData},</if>
<if test="moistureDate != null">#{moistureDate},</if>
<if test="remark != null">#{remark},</if>
<if test="guidance != null">#{guidance},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
@ -480,6 +483,7 @@
<if test="bloodData != null">blood_data = #{bloodData},</if>
<if test="moistureDate != null">moisture_date = #{moistureDate},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="guidance != null">guidance = #{guidance},</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>
@ -517,4 +521,20 @@
update sys_customer_healthy set del_flag = 1 where customer_id = #{customerId}
</update>
<resultMap type="SysDictData" id="SysDictDataResult">
<id property="dictCode" column="dict_code" />
<result property="dictSort" column="dict_sort" />
<result property="dictLabel" column="dict_label" />
<result property="dictValue" column="dict_value" />
<result property="dictType" column="dict_type" />
</resultMap>
<select id="selectDictDataByTypeAndValue" parameterType="SysDictData" resultMap="SysDictDataResult">
select dict_code, dict_sort, dict_label, dict_value, dict_type from sys_dict_data
where status = '0' and dict_type = #{dictType}
and dict_value in <foreach collection="dictValueList" item="item" index="index"
open="(" separator="," close=")">#{item}</foreach>
order by dict_sort asc
</select>
</mapper>

View File

@ -3,7 +3,8 @@
<div v-if="showFlag">
<div style="float:right;margin-top:-10px;margin-bottom: 10px;" v-show="dataList.length > 0">
<!-- 只有新版健康评估信息才可修改旧的体征数据不支持修改 -->
<el-button type="info" v-show="dataType == 0" @click="generateReport()" plain>生成报告</el-button>
<el-button type="info" v-show="dataType == 0" @click="generateReport()" plain>下载报告</el-button>
<el-button type="info" v-show="dataType == 0" @click="handleEditGuidanceClick()" plain>减脂指导</el-button>
<el-button v-hasPermi="['custom:healthy:edit']" type="info" v-show="dataType == 0" @click="handleEditRemarkClick()" plain>修改备注</el-button>
<el-button v-hasPermi="['custom:healthy:edit']" type="warning" v-show="dataType == 0" @click="handleEditHealthyClick()" plain>修改信息</el-button>
<el-button type="danger" v-hasPermi="['custom:healthy:remove']" @click="handleDelete()" plain>删除信息</el-button>
@ -25,6 +26,15 @@
<auto-hide-message :data="scope.row.remarkValue" :maxLength="100"/></template>
</el-table-column>
</el-table>
<!-- 指导 -->
<el-table :data="guidanceList" :show-header="false" border :cell-style="remarkColumnStyle" style="width: 100%;">
<el-table-column width="140" prop="guidanceTitle">
</el-table-column>
<el-table-column prop="guidanceValue">
<template slot-scope="scope">
<auto-hide-message :data="scope.row.guidanceValue" :maxLength="100"/></template>
</el-table-column>
</el-table>
</div>
<!-- 其他信息 -->
<div style="height:400px;overflow: auto">
@ -72,6 +82,8 @@
<physicalSigns-edit ref="physicalSignsEditDialog" @refreshHealthyData="getCustomerHealthyByCusId()"></physicalSigns-edit>
<!-- 编辑备注 -->
<physicalSigns-remark ref="physicalSignsRemarkDialog" @refreshHealthyData="getCustomerHealthyByCusId()"></physicalSigns-remark>
<!-- 编辑减脂指导 -->
<physicalSigns-guidance ref="physicalSignsGuidanceDialog" @refreshHealthyData="getCustomerHealthyByCusId()"></physicalSigns-guidance>
</el-dialog>
</template>
<script>
@ -83,13 +95,15 @@ import * as healthyData from "@/utils/healthyData";
import Clipboard from 'clipboard';
import PhysicalSignsEdit from "@/components/PhysicalSignsEdit";
import PhysicalSignsRemark from "@/components/PhysicalSignsRemark";
import PhysicalSignsGuidance from "@/components/PhysicalSignsGuidance";
export default {
name: "PhysicalSignsDialog",
components: {
"auto-hide-message": AutoHideMessage,
"table-detail-message": TableDetailMessage,
"physicalSigns-edit":PhysicalSignsEdit,
"physicalSigns-remark":PhysicalSignsRemark
"physicalSigns-remark":PhysicalSignsRemark,
"physicalSigns-guidance":PhysicalSignsGuidance
},
data() {
return {
@ -101,6 +115,7 @@ export default {
dataType: 0,
healthyData: null,
remarkList:[{"remarkTitle": "备注信息", "remarkValue": ""}],
guidanceList:[{"guidanceTitle": "减脂指导", "guidanceValue": ""}],
//
signTitleData: [
["创建时间", "姓名", "年龄"],
@ -242,6 +257,7 @@ export default {
if(this.dataType == 0){
this.healthyData = Object.assign({}, res.data.customerHealthy);
this.remarkList[0].remarkValue = this.healthyData.remark;
this.guidanceList[0].guidanceValue = this.healthyData.guidance;
this.getDataListByHealthyMessage(res.data.customerHealthy);
}else{
this.getDataListBySignMessage(res.data.customerHealthy)
@ -362,7 +378,7 @@ export default {
});
}
detailHealthy.motion = this.trimComma(motionStr + (detailHealthy.otherMotionClassify ? ( ""+ detailHealthy.otherMotionClassify) : ""));
detailHealthy.motionField += this.trimComma(detailHealthy.otherMotionField ? (""+detailHealthy.otherMotionField) : "");
detailHealthy.motionField = this.trimComma(detailHealthy.motionField + (detailHealthy.otherMotionField ? (""+detailHealthy.otherMotionField) : ""));
detailHealthy.sleepDrugFlag = detailHealthy.sleepDrugFlag == 1 ? "有" : "无";
detailHealthy.stayupLateFlag = detailHealthy.stayupLateFlag == 1 ? "有" : "无";
detailHealthy.stayupLateWeekNum += "次/周";
@ -374,14 +390,13 @@ export default {
}*/
physicalSigns += "" + (detailHealthy.otherPhysicalSigns ? detailHealthy.otherPhysicalSigns : "");
detailHealthy.physicalSigns = this.trimComma(physicalSigns);
detailHealthy.familyIllnessHistory += this.trimComma(detailHealthy.otherFamilyIllnessHistory ? ("" + detailHealthy.otherFamilyIllnessHistory) : "");
detailHealthy.operationHistory += this.trimComma(detailHealthy.otherOperationHistory ? ("" + detailHealthy.otherOperationHistory) : "");
detailHealthy.familyIllnessHistory = this.trimComma(detailHealthy.familyIllnessHistory + ""+ (detailHealthy.otherFamilyIllnessHistory ? detailHealthy.otherFamilyIllnessHistory : ""));
detailHealthy.operationHistory = this.trimComma(detailHealthy.operationHistory + ""+ (detailHealthy.otherOperationHistory ? detailHealthy.otherOperationHistory : ""));
detailHealthy.nearOperationFlag = detailHealthy.nearOperationFlag == 1 ? "有" : "无";
detailHealthy.longEatDrugFlag = detailHealthy.longEatDrugFlag == 1 ? "有" : "无";
detailHealthy.longEatDrugClassify += detailHealthy.otherLongEatDrugClassify ? ("" + detailHealthy.otherLongEatDrugClassify) : "";
detailHealthy.longEatDrugClassify = this.trimComma(detailHealthy.longEatDrugClassify + "" + (detailHealthy.otherLongEatDrugClassify ? detailHealthy.otherLongEatDrugClassify : ""));
detailHealthy.allergyFlag = detailHealthy.allergyFlag == 1 ? "有" : "无";
detailHealthy.allergen += detailHealthy.otherAllergen ? ("" +detailHealthy.otherAllergen) : "";
detailHealthy.allergen = this.trimComma(detailHealthy.allergen);
detailHealthy.allergen = this.trimComma(detailHealthy.allergen + "" + (detailHealthy.otherAllergen ? detailHealthy.otherAllergen : ""));
let medicalReportPathArray = detailHealthy.medicalReport ? detailHealthy.medicalReport.split(",") : [];
let medicalReportNameArray = detailHealthy.medicalReportName ? detailHealthy.medicalReportName.split(",") : [];
this.medicalReportPathArray = medicalReportPathArray;
@ -432,12 +447,26 @@ export default {
this.downloadResource(fileName);
},
generateReport(){
//this.detailHealthy.customerId = this.data.id;
generateHealthyReport(this.detailHealthy).then((res) => {
if(res.code == 200 && res.path != null){
this.download(res.path);
}
});
let data = this.detailHealthy;
if(!this.guidanceList[0].guidanceValue || this.guidanceList[0].guidanceValue.length == 0){
this.$confirm("该客户还未添加减脂指导,是否确认下载报告?", "警告", {
confirmButtonText: "确定", cancelButtonText: "取消", type: "warning"
})
.then(function(){
return generateHealthyReport(data);
})
.then((response) => {
if(response.code == 200 && response.path != null){
this.download(response.path);
}
}).catch(function () {});
}else{
generateHealthyReport(data).then((res) => {
if(res.code == 200 && res.path != null){
this.download(res.path);
}
});
}
},
trimComma(str){
if(str.startsWith("") || str.startsWith(",")){
@ -480,7 +509,11 @@ export default {
},
handleEditRemarkClick(){
this.$refs["physicalSignsRemarkDialog"].showDialog(this.data, this.healthyData);
},
handleEditGuidanceClick(){
this.$refs["physicalSignsGuidanceDialog"].showDialog(this.data, this.healthyData);
}
}
};
</script>

View File

@ -0,0 +1,88 @@
<template>
<el-dialog :visible.sync="visible" :title="title" width="500px" append-to-body @closed="onClosed">
<el-form ref="form" :model="form" :rules="rules" label-position="top" label-width="100px">
<el-form-item label="" prop="guidance" >
<el-input
type="textarea"
:rows="8"
maxlength="300"
show-word-limit
placeholder="请输入减脂指导"
v-model="form.guidance">
</el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit()"> </el-button>
<el-button @click="onClosed()"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer";
import { updateHealthy } from "@/api/custom/healthy";
export default {
name: "PhysicalSignsGuidance",
components: {
},
data() {
return {
visible: false,
title: "",
data: undefined,
form: {
id: null,
guidance: null
},
rules: {
}
};
},
methods: {
showDialog(data, healthy) {
this.data = data;
this.title = "修改"+`${data.name}`+"减脂指导";
this.form.id = healthy.id;
this.form.guidance = healthy.guidance;
this.visible = true;
},
onClosed() {
this.visible = false;
this.data = null;
},
submit(){
this.$refs.form.validate((valid) => {
if (valid) {
this.editCustomerHealthy();
} else {
this.$message({message: "数据未填写完整", type: "warning"});
}
});
},
editCustomerHealthy(){
updateHealthy(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.onClosed();
this.$emit('refreshHealthyData');
}
}).catch(function() {
console.log("error");
});
}
}
};
</script>
<style scoped>
.margin-top-20{
margin-top:20px;
}
.p_title_1{
font-size: 18px;
font-weight: bold;
margin-top: 20px;
}
</style>