幼儿评估-图表

This commit is contained in:
paidaxing444 2020-11-07 17:39:08 +08:00
parent 34d87f3db6
commit fe79121520
14 changed files with 469 additions and 188 deletions

View File

@ -17,6 +17,14 @@ export function getAssessmentchild(id) {
})
}
// 查询幼儿评估字典
export function getAssessmentDictData(id) {
return request({
url: '/benyi/assessmentchild/getdicdata/' + id,
method: 'get'
})
}
// 新增幼儿评估
export function addAssessmentchild(data) {
return request({

View File

@ -77,3 +77,11 @@ export function exportAssessmentcontent(query) {
params: query
})
}
// 查询评估统计
export function getAssessmentStatistics(childid, scope) {
return request({
url: '/benyi/assessmentcontent/getassessmentstatistics/' + childid + '/' + scope,
method: 'get'
})
}

View File

@ -2,17 +2,22 @@
<div class="app-container">
<div class="flex align-center justify-between">
<p class="title flex align-center">
<span>{{ this.childName }}同学评估结果图表 </span>
<span>幼儿{{ this.childName }} 评估结果图表 </span>
</p>
</div>
<el-tabs v-model="activeName" type="card" @tab-click="handleClick">
<el-tab-pane label="儿童学习与发展评估(36-48)" name="first">
<el-tab-pane
v-for="item in tabsList"
:key="item.dictValue"
:label="item.dictLabel"
:name="item.dictLabel"
>
<div>
<radar-chart />
<radar-chart :psMsg="item.dictValue" />
</div>
<div class="block">
<h2 class="block-item-title flex align-center">评估建议</h2>
<ul class="block-content">
<!-- <ul class="block-content">
<li>
<p class="block-content-title">
<span class="num">1. </span>具有健康的体态
@ -50,11 +55,9 @@
<div class="check-info"></div>
</div>
</li>
</ul>
</ul> -->
</div>
</el-tab-pane>
<el-tab-pane label="儿童学习与发展评估(48-60)" name="second">配置管理</el-tab-pane>
<el-tab-pane label="儿童学习与发展评估(60-72)" name="third">角色管理</el-tab-pane>
</el-tabs>
</div>
</template>
@ -62,17 +65,9 @@
import {
listAssessmentcontent,
getAssessmentcontent,
delAssessmentcontent,
addAssessmentcontent,
updateAssessmentcontent,
exportAssessmentcontent,
} from "@/api/benyi/assessmentcontent";
import { getChildByAssessment } from "@/api/benyi/child";
import {
addAssessmentchild,
updateAssessmentchild,
} from "@/api/benyi/assessmentchild";
import { getAssessmentDictData } from "@/api/benyi/assessmentchild";
import RadarChart from "@/views/dashboard/RadarChart";
export default {
@ -84,31 +79,13 @@ export default {
return {
childId: "",
childName: "",
childCsrq: "",
bjmc: "",
classid: "",
trem: "",
zbjsxm: "",
assessmentscope: "",
// tabs
tabsList: [],
//
loading: true,
//
ids: [],
//
assessmentcontentList: [],
//
form: {},
//
queryParams: {
parentid: undefined,
name: undefined,
iselement: undefined,
scope: undefined,
sort: undefined,
},
activeName: "first",
checked: false,
checkList: [],
activeName: "",
};
},
created() {
@ -117,6 +94,7 @@ export default {
this.childId = childId;
// console.log("childId:" + childId);
this.getChild(childId);
this.getList(childId);
},
methods: {
getChild(childId) {
@ -124,45 +102,25 @@ export default {
// console.log(response);
if (response.code == "200") {
this.childName = response.data.name;
this.childCsrq = response.data.csrq;
this.trem = response.trem;
this.bjmc = response.data.bjmc;
this.classid = response.data.classid;
this.zbjsxm = response.data.zbjsmc;
response.ByAssessmentchild.forEach((item) =>
this.checkList.push(item.contentid)
);
if (response.isAssessment == "0") {
this.msgError(
"当前幼儿出生日期不符合评估范围幼儿评估范围为36-72个月"
);
} else {
this.assessmentscope = response.isAssessment;
this.getList();
}
}
});
},
/** 查询评估内容列表 */
getList() {
this.loading = true;
listAssessmentcontent(this.queryParams).then((response) => {
// console.log("rows:" + response.rows);
this.assessmentcontentList = response.rows;
this.loading = false;
getList(childId) {
getAssessmentDictData(childId).then((response) => {
// console.log("rows:" + response.dictdata.length);
if (response.dictdata.length > 0) {
this.activeName = response.dictdata[0].dictLabel;
this.tabsList = response.dictdata;
} else {
this.msgError("该幼儿尚未提交评估数据,无法展示数据");
}
});
},
handleClick(tab) {
// this.activeName = tab
},
handlecheckedItemsChange(value) {
// var items = "";
// this.checkList.forEach((item) => {
// //
// items = items + item + ",";
// });
// console.log(items);
// this.activeName = tab.name;
// console.log(tab.name);
},
},
};

View File

@ -1,111 +1,274 @@
<template>
<div :class="className" :style="{height:height,width:width}" />
<div :class="className" :style="{ height: height, width: width }" />
</template>
<script>
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize'
import echarts from "echarts";
require("echarts/theme/macarons"); // echarts theme
import resize from "./mixins/resize";
import { getAssessmentStatistics } from "@/api/benyi/assessmentcontent";
const animationDuration = 3000
const animationDuration = 3000;
export default {
values: [],
mixins: [resize],
props: {
className: {
type: String,
default: 'chart'
default: "chart",
},
width: {
type: String,
default: '100%'
default: "100%",
},
height: {
type: String,
default: '300px'
}
default: "300px",
},
psMsg: {
type: String,
default: "",
}, //psMsg
},
data() {
return {
chart: null
}
chart: null,
childId: "",
};
},
mounted() {
var childId = this.$route.params && this.$route.params.id;
this.childId = childId;
// console.log("child-chart:" + childId);
// console.log("psMsg:" + this.psMsg);
this.$nextTick(() => {
this.initChart()
})
this.initChart();
});
},
beforeDestroy() {
if (!this.chart) {
return
return;
}
this.chart.dispose()
this.chart = null
this.chart.dispose();
this.chart = null;
},
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'macarons')
async getData() {
await getAssessmentStatistics(this.childId, this.psMsg).then(
(response) => {
console.log(response);
let value = [];
let len = response.statistics;
for (var j = 0; j < len.length; j++) {
console.log(len[j]);
if (len[j] == "NaN") {
value.push(0);
} else {
value.push(len[j]);
}
}
this.values = value;
//console.log(this.names);
//console.log(this.values);
}
);
},
async initChart() {
await this.getData();
this.chart = echarts.init(this.$el, "macarons");
if (this.psMsg == "3") {
this.chart.setOption({
tooltip: {
trigger: 'axis',
axisPointer: { //
type: 'shadow' // 线'line' | 'shadow'
}
trigger: "axis",
axisPointer: {
//
type: "shadow", // 线'line' | 'shadow'
},
},
radar: {
radius: '66%',
center: ['50%', '42%'],
radius: "66%",
center: ["50%", "42%"],
splitNumber: 8,
splitArea: {
areaStyle: {
color: 'rgba(127,95,132,.3)',
color: "rgba(127,95,132,.3)",
opacity: 1,
shadowBlur: 45,
shadowColor: 'rgba(0,0,0,.5)',
shadowColor: "rgba(0,0,0,.5)",
shadowOffsetX: 0,
shadowOffsetY: 15
}
shadowOffsetY: 15,
},
},
indicator: [
{ name: '健康', max: 100 },
{ name: '语言', max: 100 },
{ name: '社会', max: 100 },
{ name: '科学', max: 100 },
{ name: '艺术', max: 100 }
]
{ name: "健康", max: 100 },
{ name: "语言", max: 100 },
{ name: "社会", max: 100 },
{ name: "科学", max: 100 },
{ name: "艺术", max: 100 },
],
},
legend: {
left: 'center',
bottom: '10',
data: ['36-48个月幼儿测评范围值', '幼儿实际测评值']
left: "center",
bottom: "10",
data: ["60-72个月幼儿测评范围值", "幼儿实际测评值"],
},
series: [{
type: 'radar',
series: [
{
type: "radar",
symbolSize: 0,
areaStyle: {
normal: {
shadowBlur: 13,
shadowColor: 'rgba(0,0,0,.2)',
shadowColor: "rgba(0,0,0,.2)",
shadowOffsetX: 0,
shadowOffsetY: 10,
opacity: 1
}
opacity: 1,
},
},
data: [
{
value: [72, 72, 72, 72, 72],
name: "60-72个月幼儿测评范围值",
},
{
value: this.values,
name: "幼儿实际测评值",
},
],
animationDuration: animationDuration,
},
],
});
} else if (this.psMsg == "2") {
this.chart.setOption({
tooltip: {
trigger: "axis",
axisPointer: {
//
type: "shadow", // 线'line' | 'shadow'
},
},
radar: {
radius: "66%",
center: ["50%", "42%"],
splitNumber: 8,
splitArea: {
areaStyle: {
color: "rgba(127,95,132,.3)",
opacity: 1,
shadowBlur: 45,
shadowColor: "rgba(0,0,0,.5)",
shadowOffsetX: 0,
shadowOffsetY: 15,
},
},
indicator: [
{ name: "健康", max: 100 },
{ name: "语言", max: 100 },
{ name: "社会", max: 100 },
{ name: "科学", max: 100 },
{ name: "艺术", max: 100 },
],
},
legend: {
left: "center",
bottom: "10",
data: ["48-60个月幼儿测评范围值", "幼儿实际测评值"],
},
series: [
{
type: "radar",
symbolSize: 0,
areaStyle: {
normal: {
shadowBlur: 13,
shadowColor: "rgba(0,0,0,.2)",
shadowOffsetX: 0,
shadowOffsetY: 10,
opacity: 1,
},
},
data: [
{
value: [60, 60, 60, 60, 60],
name: "48-60个月幼儿测评范围值",
},
{
value: this.values,
name: "幼儿实际测评值",
},
],
animationDuration: animationDuration,
},
],
});
} else if (this.psMsg == "1") {
this.chart.setOption({
tooltip: {
trigger: "axis",
axisPointer: {
//
type: "shadow", // 线'line' | 'shadow'
},
},
radar: {
radius: "66%",
center: ["50%", "42%"],
splitNumber: 8,
splitArea: {
areaStyle: {
color: "rgba(127,95,132,.3)",
opacity: 1,
shadowBlur: 45,
shadowColor: "rgba(0,0,0,.5)",
shadowOffsetX: 0,
shadowOffsetY: 15,
},
},
indicator: [
{ name: "健康", max: 100 },
{ name: "语言", max: 100 },
{ name: "社会", max: 100 },
{ name: "科学", max: 100 },
{ name: "艺术", max: 100 },
],
},
legend: {
left: "center",
bottom: "10",
data: ["36-48个月幼儿测评范围值", "幼儿实际测评值"],
},
series: [
{
type: "radar",
symbolSize: 0,
areaStyle: {
normal: {
shadowBlur: 13,
shadowColor: "rgba(0,0,0,.2)",
shadowOffsetX: 0,
shadowOffsetY: 10,
opacity: 1,
},
},
data: [
{
value: [48, 48, 48, 48, 48],
name: '36-48个月幼儿测评范围值'
name: "36-48个月幼儿测评范围值",
},
{
value: [36, 48, 36, 33, 20],
name: '幼儿实际测评值'
}
value: this.values,
name: "幼儿实际测评值",
},
],
animationDuration: animationDuration
}]
})
animationDuration: animationDuration,
},
],
});
}
}
}
},
},
};
</script>

View File

@ -4,6 +4,8 @@ import java.util.List;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.project.common.SchoolCommon;
import com.ruoyi.project.system.domain.SysDictData;
import com.ruoyi.project.system.service.ISysDictDataService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -36,6 +38,8 @@ public class ByAssessmentchildController extends BaseController {
private IByAssessmentchildService byAssessmentchildService;
@Autowired
private SchoolCommon schoolCommon;
@Autowired
private ISysDictDataService dictDataService;
/**
* 查询幼儿评估列表
@ -48,6 +52,14 @@ public class ByAssessmentchildController extends BaseController {
return getDataTable(list);
}
@GetMapping(value = "/getdicdata/{id}")
public AjaxResult getListDicData(@PathVariable("id") Long id) {
AjaxResult ajaxResult = AjaxResult.success();
List<SysDictData> list = dictDataService.selectDictDataByChildId(id);
ajaxResult.put("dictdata", list);
return ajaxResult;
}
/**
* 导出幼儿评估列表
*/

View File

@ -1,5 +1,6 @@
package com.ruoyi.project.benyi.controller;
import java.util.ArrayList;
import java.util.List;
import com.ruoyi.common.utils.ServletUtils;
@ -65,8 +66,8 @@ public class ByAssessmentcontentController extends BaseController {
@PreAuthorize("@ss.hasPermi('benyi:assessmentcontent:query')")
@GetMapping(value = "/byparentid/{id}")
public AjaxResult getInfobyparentId(@PathVariable("id") Long id) {
System.out.println("start:"+id);
ByAssessmentcontent byAssessmentcontent=new ByAssessmentcontent();
System.out.println("start:" + id);
ByAssessmentcontent byAssessmentcontent = new ByAssessmentcontent();
byAssessmentcontent.setParentId(id);
return AjaxResult.success(byAssessmentcontentService.selectByAssessmentcontentList(byAssessmentcontent));
}
@ -144,4 +145,35 @@ public class ByAssessmentcontentController extends BaseController {
}
return toAjax(byAssessmentcontentService.deleteByAssessmentcontentById(id));
}
@GetMapping(value = "/getassessmentstatistics/{childid}/{scope}")
public AjaxResult getAssessmentStatistics(@PathVariable("childid") Long childid, @PathVariable("scope") String scope) {
AjaxResult ajaxResult = AjaxResult.success();
String[] strArr = new String[]{"健康", "语言", "社会", "科学", "艺术"};
List<Double> douArr = new ArrayList<Double>();
for (int i = 0; i < strArr.length; i++) {
ByAssessmentcontent byAssessmentcontent = new ByAssessmentcontent();
byAssessmentcontent.setScope(scope);
byAssessmentcontent.setName(strArr[i]);
//获取{"健康", "语言", "社会", "科学", "艺术"} 对应的值
List<ByAssessmentcontent> list = byAssessmentcontentService.selectByAssessmentcontentList(byAssessmentcontent);
if (list != null && list.size() > 0) {
Long id = list.get(0).getId();
byAssessmentcontent.setId(id);
byAssessmentcontent.setSort(childid);
int count = byAssessmentcontentService.selectCountElement(byAssessmentcontent);
int countChild = byAssessmentcontentService.selectCountElementByChild(byAssessmentcontent);
if (scope.equals("1")) {
douArr.add((((double) 48 / count) * countChild));
} else if (scope.equals("2")) {
douArr.add((((double) 60 / count) * countChild));
} else if (scope.equals("3")) {
douArr.add((((double) 72 / count) * countChild));
}
}
}
ajaxResult.put("statistics", douArr);
return ajaxResult;
}
}

View File

@ -74,4 +74,20 @@ public interface ByAssessmentcontentMapper {
* @return 结果
*/
public int hasChildByAssessmentcontentId(Long id);
/**
* 节点元素个数
*
* @param byAssessmentcontent 内容ID
* @return 结果
*/
public int selectCountElement(ByAssessmentcontent byAssessmentcontent);
/**
* 节点元素个数根据child
*
* @param byAssessmentcontent 内容ID
* @return 结果
*/
public int selectCountElementByChild(ByAssessmentcontent byAssessmentcontent);
}

View File

@ -91,4 +91,20 @@ public interface IByAssessmentcontentService {
* @return 结果
*/
public int deleteByAssessmentcontentById(Long id);
/**
* 节点元素个数
*
* @param byAssessmentcontent 内容ID
* @return 结果
*/
public int selectCountElement(ByAssessmentcontent byAssessmentcontent);
/**
* 节点元素个数根据child
*
* @param byAssessmentcontent 内容ID
* @return 结果
*/
public int selectCountElementByChild(ByAssessmentcontent byAssessmentcontent);
}

View File

@ -202,4 +202,26 @@ public class ByAssessmentcontentServiceImpl implements IByAssessmentcontentServi
return getChildList(list, t).size() > 0 ? true : false;
}
/**
* 节点元素个数
*
* @param byAssessmentcontent 内容ID
* @return 结果
*/
@Override
public int selectCountElement(ByAssessmentcontent byAssessmentcontent){
return byAssessmentcontentMapper.selectCountElement(byAssessmentcontent);
}
/**
* 节点元素个数根据child
*
* @param byAssessmentcontent 内容ID
* @return 结果
*/
@Override
public int selectCountElementByChild(ByAssessmentcontent byAssessmentcontent){
return byAssessmentcontentMapper.selectCountElementByChild(byAssessmentcontent);
}
}

View File

@ -44,6 +44,14 @@ public interface SysDictDataMapper
*/
public SysDictData selectDictDataById(Long dictCode);
/**
* 根据条件分页查询字典数据
*
* @param childId 字典数据信息
* @return 字典数据集合信息
*/
public List<SysDictData> selectDictDataByChildId(Long childId);
/**
* 查询字典数据
*

View File

@ -43,6 +43,14 @@ public interface ISysDictDataService
*/
public SysDictData selectDictDataById(Long dictCode);
/**
* 根据条件分页查询字典数据
*
* @param childId 字典数据信息
* @return 字典数据集合信息
*/
public List<SysDictData> selectDictDataByChildId(Long childId);
/**
* 通过字典ID删除字典数据信息
*

View File

@ -67,6 +67,17 @@ public class SysDictDataServiceImpl implements ISysDictDataService
return dictDataMapper.selectDictDataById(dictCode);
}
/**
* 根据条件分页查询字典数据
*
* @param childId 字典数据信息
* @return 字典数据集合信息
*/
@Override
public List<SysDictData> selectDictDataByChildId(Long childId){
return dictDataMapper.selectDictDataByChildId(childId);
}
/**
* 通过字典ID删除字典数据信息
*

View File

@ -57,6 +57,18 @@ order by t.sort
where parentId = #{id}
</select>
<select id="selectCountElement" parameterType="ByAssessmentcontent" resultType="int">
select count(*) from by_assessmentcontent where find_in_set(id, getChildLst(#{id})) and scope=#{scope} and iselement='Y';
</select>
<!--sort 暂且代替childid-->
<select id="selectCountElementByChild" parameterType="ByAssessmentcontent" resultType="int">
select count(*) from (
select a.* from by_assessmentcontent a
right join by_assessmentchild b on a.id=b.contentid where b.childid=#{sort} and b.scope=#{scope}) temp
where find_in_set(id, getChildLst(#{id})) ;
</select>
<insert id="insertByAssessmentcontent" parameterType="ByAssessmentcontent" useGeneratedKeys="true" keyProperty="id">
insert into by_assessmentcontent
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -55,6 +55,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where dict_code = #{dictCode}
</select>
<!--获取评估代码 根据幼儿id幼儿id暂且用sort代替一下 传参-->
<select id="selectDictDataByChildId" parameterType="Long" resultMap="SysDictDataResult">
select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark from sys_dict_data where dict_type='sys_dm_pgyssyfw'
and dict_value in ( select distinct scope from by_assessmentchild where childid= #{dictSort})
order by dict_sort desc
</select>
<select id="countDictDataByType" resultType="Integer">
select count(1) from sys_dict_data where dict_type=#{dictType}
</select>