Revert "```"

This reverts commit abc0674531.
This commit is contained in:
2025-12-26 22:21:21 +08:00
parent ae6c486114
commit 3115e38cc4
920 changed files with 14452 additions and 107025 deletions

View File

@@ -1,4 +1,4 @@
import { bodyTemperature, TOP_KEYS, HEAD_HEIGHT, LINE_HEIGHT } from './config';
import { bodyTemperature, TOP_KEYS, HEAD_HEIGHT, LINE_HEIGHT } from './config'
export default class viewConfig {
constructor({
@@ -12,44 +12,47 @@ export default class viewConfig {
strokeWidth = 2, // stroke width of line and dots
strokeLinecap = 'round', // stroke line cap of line
strokeLinejoin = 'round', // stroke line join of line
renderData,
renderData
} = {}) {
// 基础配置赋值
this.width = width;
this.height = height;
this.stroke = stroke;
this.strokeWidth = strokeWidth;
this.strokeLinecap = strokeLinecap;
this.renderData = renderData;
this.strokeLinejoin = strokeLinejoin;
this.marginRight = marginRight;
this.marginLeft = marginLeft;
this.marginBottom = marginBottom;
this.marginTop = marginTop;
this.width = width
this.height = height
this.stroke = stroke
this.strokeWidth = strokeWidth
this.strokeLinecap = strokeLinecap
this.renderData = renderData
this.strokeLinejoin = strokeLinejoin
this.marginRight = marginRight
this.marginLeft = marginLeft
this.marginBottom = marginBottom
this.marginTop = marginTop
// 计算属性赋值
this.contentWidth = width - marginLeft - marginRight;
this.step = this.contentWidth / 8;
this.bottomPos = height - HEAD_HEIGHT - marginTop - (marginBottom - 30); // 底部坐标30是因为默认的30忘记计算了后续的按照30的偏移量计算
this.tableHeight = height - marginBottom - HEAD_HEIGHT;
const { micoStep, verticalHeight } = this.utilsGetMicoPos(this.step, this.bottomPos);
this.micoStep = micoStep;
this.verticalHeight = verticalHeight;
this.X_OFFSET = micoStep / 2; // 为了让图标在小格子居中展示,需要进行一个偏移
this.xRange = [this.step, width - marginLeft - marginRight]; // [60, 860]
this.topPos = marginTop + HEAD_HEIGHT;
this.topKeysPos = LINE_HEIGHT * (TOP_KEYS.length + 1); // 1 是时间那一行
this.bottomKeysPosStart = this.topKeysPos + verticalHeight + 20;
this.yRange = [this.bottomKeysPosStart - 20, this.topKeysPos];
this.contentWidth = width - marginLeft - marginRight
this.step = this.contentWidth / 8
this.bottomPos = height - HEAD_HEIGHT - marginTop - (marginBottom - 30) // 底部坐标30是因为默认的30忘记计算了后续的按照30的偏移量计算
this.tableHeight = height - marginBottom - HEAD_HEIGHT
const { micoStep, verticalHeight } = this.utilsGetMicoPos(
this.step,
this.bottomPos
)
this.micoStep = micoStep
this.verticalHeight = verticalHeight
this.X_OFFSET = micoStep / 2 // 为了让图标在小格子居中展示,需要进行一个偏移
this.xRange = [this.step, width - marginLeft - marginRight] // [60, 860]
this.topPos = marginTop + HEAD_HEIGHT
this.topKeysPos = LINE_HEIGHT * (TOP_KEYS.length + 1) // 1 是时间那一行
this.bottomKeysPosStart = this.topKeysPos + verticalHeight + 20
this.yRange = [this.bottomKeysPosStart - 20, this.topKeysPos]
}
// 获取折线区域的高度
utilsGetMicoPos(step, botpos) {
const micoStep = (step * 7) / 42; // 折线小格子的宽度
const verticalLength = bodyTemperature[1] - bodyTemperature[0]; // 根据体温来计算格子
const verticalHeight = micoStep * 5 * verticalLength;
const micoStep = (step * 7) / 42 // 折线小格子的宽度
const verticalLength = bodyTemperature[1] - bodyTemperature[0] // 根据体温来计算格子
const verticalHeight = micoStep * 5 * verticalLength
return {
micoStep,
verticalHeight,
};
verticalHeight
}
}
}

View File

@@ -1,215 +1,271 @@
import dayjs from 'dayjs';
import dayjs from 'dayjs'
import {
HospitalName,
temperatureName,
showPainFlag,
getInfoKeys,
getBottomKeys,
} from './template';
getBottomKeys
} from './template'
// 存放体温单的配置信息
export const Header = {
HospitalName,
temperatureName,
};
temperatureName
}
// 患者信息
export const INFO_KEYS = getInfoKeys();
export const INFO_KEYS = getInfoKeys()
// 头部信息标签
export const TOP_KEYS = [
//{
// name: '患病日数',
// getValue: (i, renderData) => {
// const { beginDate, hospDays, outdate = '', dateClosed } = renderData.infoData
// const tieml = new Date()
// const timeNew = new Date((tieml / 1000 + 86400) * 1000)
// const todayDate = dayjs(timeNew).format('YYYY-MM-DD')
// const endDate = dayjs(outdate).add(1, 'day').format('YYYY-MM-DD')
// const eachTime = dayjs(beginDate)
// .add(i, 'day')
// .format('YYYY-MM-DD')
// if (eachTime === endDate || todayDate === eachTime) {
// dateClosed.stopNumber = true
// }
// return dateClosed.stopNumber ? hospDays + i + 1 : ''
// }
//},
{
name: '日 期',
getValue: (i, renderData) => {
const { beginDate, outdate = '', hospDate = '', dateClosed } = renderData.infoData;
const tieml = new Date();
const timeNew = new Date((tieml / 1000 + 86400) * 1000);
const todayDate = dayjs(timeNew).format('YYYY-MM-DD');
const endDate = dayjs(outdate).format('YYYY-MM-DD');
const startDate = dayjs(hospDate).format('YYYY-MM-DD');
let eachTime = dayjs(beginDate).add(i, 'day').format('YYYY-MM-DD');
const { beginDate, outdate = '', hospDate = '', dateClosed } = renderData.infoData
const tieml = new Date()
const timeNew = new Date((tieml / 1000 + 86400) * 1000)
const todayDate = dayjs(timeNew).format('YYYY-MM-DD')
const endDate = dayjs(outdate).format('YYYY-MM-DD')
const startDate = dayjs(hospDate).format('YYYY-MM-DD')
let eachTime = dayjs(beginDate).add(i, 'day').format('YYYY-MM-DD')
if (eachTime === endDate || eachTime === todayDate) {
dateClosed.stopTime = true;
dateClosed.stopTime = true
}
if ((startDate === eachTime && i === 0) || dayjs(eachTime).format('MM-DD') === '01-01') {
eachTime = dayjs(eachTime).format('YYYY年MM月DD日');
eachTime = dayjs(eachTime).format('YYYY年MM月DD日')
} else if (i === 0 || dayjs(eachTime).format('DD') === '01') {
eachTime = dayjs(eachTime).format('MM月DD日');
eachTime = dayjs(eachTime).format('MM月DD日')
} else {
eachTime = dayjs(eachTime).format('DD日');
eachTime = dayjs(eachTime).format('DD日')
}
return dateClosed.stopTime ? eachTime : '';
},
return dateClosed.stopTime ? eachTime : ''
}
},
{
name: '住院日数',
getValue: (i, renderData) => {
const { beginDate, hospDays, outdate = '', dateClosed } = renderData.infoData;
const tieml = new Date();
const timeNew = new Date((tieml / 1000 + 86400) * 1000);
const todayDate = dayjs(timeNew).format('YYYY-MM-DD');
const endDate = dayjs(outdate).add(1, 'day').format('YYYY-MM-DD');
const eachTime = dayjs(beginDate).add(i, 'day').format('YYYY-MM-DD');
const { beginDate, hospDays, outdate = '', dateClosed } = renderData.infoData
const tieml = new Date()
const timeNew = new Date((tieml / 1000 + 86400) * 1000)
const todayDate = dayjs(timeNew).format('YYYY-MM-DD')
const endDate = dayjs(outdate).add(1, 'day').format('YYYY-MM-DD')
const eachTime = dayjs(beginDate).add(i, 'day').format('YYYY-MM-DD')
if (eachTime === endDate || todayDate === eachTime) {
dateClosed.stopNumber = false;
dateClosed.stopNumber = false
}
const num = dateClosed.stopNumber ? hospDays + i + 1 : '';
let hosNum = '';
const num = dateClosed.stopNumber ? hospDays + i + 1 : ''
let hosNum = ''
if (num !== '') {
hosNum = '第' + '\xa0\xa0\xa0' + num + '\xa0\xa0\xa0' + '日';
hosNum = '第' + "\xa0\xa0\xa0" + num + "\xa0\xa0\xa0" + '日'
} else {
hosNum = '第' + '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0' + '日';
hosNum = '第' + "\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0" + '日'
}
return hosNum;
},
return hosNum
}
},
{
name: '术/娩后日数',
getValue: (i, renderData) => {
const { beginDate } = renderData.infoData;
const surgeryNumDays = renderData.surgeryNumDays;
const eachTime = dayjs(beginDate).add(i, 'day').format('YYYY-MM-DD');
let num = surgeryNumDays.filter((item) => item.date === eachTime);
let hosNum = '';
const { beginDate } = renderData.infoData
const surgeryNumDays = renderData.surgeryNumDays
const eachTime = dayjs(beginDate).add(i, 'day').format('YYYY-MM-DD')
let num = surgeryNumDays.filter(item => item.date === eachTime)
let hosNum = ''
if (num.length > 0) {
hosNum = '第' + '\xa0\xa0\xa0' + num[0].typeValue + '\xa0\xa0\xa0' + '日';
hosNum = '第' + "\xa0\xa0\xa0" + num[0].typeValue + "\xa0\xa0\xa0" + '日'
} else {
hosNum = '第' + '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0' + '日';
hosNum = '第' + "\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0" + '日'
}
return hosNum;
},
},
];
return hosNum
}
}
]
// 最底部的字段绘制
export const BOTTOM_KEYS = getBottomKeys();
export const BOTTOM_KEYS = getBottomKeys()
// 是否显示疼痛评分
export const showPain = showPainFlag;
export const showPain = showPainFlag
/** *********** 以下是固定选项 **************************/
export const timeNumber = [2, 6, 10, 14, 18, 22]; // 时间展示
export const nightTime = [2, 18, 22]; // 夜间红色高亮时间
export const timeNumber = [2, 6, 10, 14, 18, 22] // 时间展示
export const nightTime = [2, 18, 22] // 夜间红色高亮时间
//export const leftTEXT1 = [
// // ['脉3搏,(次/分), 180', '160', '140', '120', '100', '80', '60', '40'],
// // ['体4温,(℃), 42', '41', '40', '39', '38', '37', '36', '35']
// // ['华氏,( °F), 107.6', '105.8', '104', '102.2', '100.4', '98.6', '96.8', '95']
// ['华氏,( °F), ', '', '107', '106', '105', '104', '103', '102', '101', '100', '99', '98', '97', '96', '95', '94']
// // ['摄氏,(℃), 42', '41', '40', '39', '38', '37', '36', '35']
//]
//export const leftTEXT2 = [
// ['摄氏,(℃), ', '42', '41', '40', '39', '38', '37', '36', '35']
//]
//export const rightTEXT = [
// [',, ', '180', '160', '140', '120', '100', '80', '60', '40']
//]
//export const painTEXT = [
// ['疼 痛'],
// ['8', '6', '4', '2']
//]
export const leftTEXT = [
['脉搏,(次/分),', '180', '160', '140', '120', '100', '80', '60', '40'],
['体温,(℃), ', '42', '41', '40', '39', '38', '37', '36', '35'],
];
export const painTEXT = [['疼 痛 强 度'], ['10', '8', '6', '4', '2', '0']];
export const inOutItem = ['入观', '分娩', '手术', '转入', '出观', '死亡'];
export const otherItem = ['外出', '请假', '拒测', '离院', '其他'];
['体温,(℃), ', '42', '41', '40', '39', '38', '37', '36', '35']
]
export const painTEXT = [['疼 痛 强 度'], ['10', '8', '6', '4', '2', '0']]
export const inOutItem = ['入观', '分娩', '手术', '转入', '出观', '死亡']
export const otherItem = ['外出', '请假', '拒测', '离院', '其他']
export const sheetOptions = {
locations: [
{
code: '1',
display: '体温',
},
{
code: '2',
display: '口温',
},
{
code: '3',
display: '温',
},
{
code: '4',
display: '耳温',
},
],
breath: [
{
code: '',
display: '自主呼吸',
},
{
code: '®',
display: '机械通气',
},
],
poop: [
{
code: '',
display: '正常',
},
{
code: '',
display: '失禁',
},
{
code: '☆',
display: '人工肛门',
},
{
code: '/E',
display: '灌肠',
},
],
pee: [
{
code: '',
display: '正常',
},
{
code: '※',
display: '失禁',
},
{
code: 'C+',
display: '导尿',
},
],
locations: [{
code: '1',
display: '体温'
}, {
code: '2',
display: '口温'
}, {
code: '3',
display: '肛温'
}, {
code: '4',
display: '温'
}],
breath: [{
code: '',
display: '自主呼吸'
}, {
code: '®',
display: '机械通气'
}],
poop: [{
code: '',
display: '正常'
}, {
code: '',
display: '失禁'
}, {
code: '☆',
display: '人工肛门'
}, {
code: '/E',
display: '灌肠'
}],
pee: [{
code: '',
display: '正常'
}, {
code: '※',
display: '失禁'
}, {
code: 'C+',
display: '导尿'
}],
heart: ['窦性心律', '起搏心律', '房性心律', '异常心律'],
weight: ['正常', '卧床', '轮椅', '平车'],
};
weight: ['正常', '卧床', '轮椅', '平车']
}
// 此处是显示数字的 要和leftTEXT保持一直
export const bodyTemperature = [33, 43];
export const starNumEnv = bodyTemperature[0]; // 开始体温
export const endNumEnv = bodyTemperature[1]; // 结束体温
export const heartRange = [0, 200];
export const painScore = [0, 10];
// export const bodyTemperature1 = [94, 107]
// export const starNumEnv1 = bodyTemperature1[0] // 开始体温
// export const endNumEnv1 = bodyTemperature1[1] // 结束体温
export const bodyTemperature = [33, 43]
export const starNumEnv = bodyTemperature[0] // 开始体温
export const endNumEnv = bodyTemperature[1] // 结束体温
export const heartRange = [0, 200]
export const painScore = [0, 10]
// 中间图表字段对应
export const CHART_KEYS = [
{
key: '001',
code: 'breath',
name: '呼吸',
name: '呼吸'
},
{
key: '002',
code: 'sphygmus',
name: '脉搏',
name: '脉搏'
},
{
key: '003',
code: 'temperature',
name: '体温',
name: '体温'
},
{
key: '012',
code: 'inOut',
name: '特殊标记',
name: '特殊标记'
},
{
key: '013',
code: 'refuse',
name: '标记内容',
name: '标记内容'
},
{
key: '014',
code: 'heartRate',
name: '心率',
name: '心率'
},
{
key: '015',
code: 'lowerTemp',
name: '物理降温',
name: '物理降温'
},
{
key: '016',
code: 'painScore',
name: '疼痛评分',
},
];
name: '疼痛评分'
}
// {
// key: '017',
// code: 'admission',
// name: '入院'
// },
// {
// key: '018',
// code: 'bigSurgery',
// name: '大手术'
// },
// {
// key: '019',
// code: 'smallSurgery',
// name: '小手术'
// },
// {
// key: '020',
// code: 'discharge',
// name: '出院'
// },
// {
// key: '021',
// code: 'parturition',
// name: '分娩'
// },
// {
// key: '022',
// code: 'transfer',
// name: '转科'
// },
// {
// key: '9507',
// code: 'death',
// name: '死亡'
// }
]
export const HEAD_HEIGHT = 80 // 头部文字预留位置
export const LINE_HEIGHT = 20 // 一行的行高
export const textLeftMargin = 4 // 文字左边边距
export const TEXT_MARGIN_BOTTOM = 6 // 文字向上偏移量
export const symbolArrowHeight = 20
export const HEAD_HEIGHT = 120; // 头部文字预留位置
export const LINE_HEIGHT = 20; // 一行的行高
export const textLeftMargin = 4; // 文字左边边距
export const TEXT_MARGIN_BOTTOM = 6; // 文字向上偏移量
export const symbolArrowHeight = 20;

View File

@@ -4,32 +4,42 @@
// index: 0
// value: 36
// }
export function getMaxList({ list = [], max = 0, min = 0, maxDefault = 0, minDefault = 0 } = {}) {
return list.map((item) => {
if ((item.value > max || item.value < min) && item.value !== null) {
const ismax = item.value > max;
export function getMaxList({
list = [],
max = 0,
min = 0,
maxDefault = 0,
minDefault = 0
} = {}) {
return list.map(item => {
if (((item.value > max) || (item.value < min)) && item.value !== null) {
const ismax = item.value > max
return {
...item,
value: ismax ? maxDefault : minDefault,
sourceValue: item.value,
ismax: ismax,
max,
min,
};
min
}
} else {
return null;
return null
}
});
})
}
export function levelingData({ list = [], maxDefault = 0, minDefault = 0 }) {
return list.map((item) => {
if (item.value === null) return item;
export function levelingData({
list = [],
maxDefault = 0,
minDefault = 0
}) {
return list.map(item => {
if (item.value === null) return item
if (item.value > maxDefault) {
item.value = maxDefault;
item.value = maxDefault
} else if (item.value < minDefault) {
item.value = minDefault;
item.value = minDefault
}
return item;
});
return item
})
}

View File

@@ -1,6 +1,6 @@
// 数据处理
import * as d3 from 'd3';
import { symbol } from 'd3-shape';
import * as d3 from 'd3'
import { symbol } from 'd3-shape'
import {
getTypeData,
getTypeDatas,
@@ -13,19 +13,12 @@ import {
getType,
getHeartRate,
disconnectEvents,
getBrokenLine,
} from './utils';
import {
HEAD_HEIGHT,
LINE_HEIGHT,
TOP_KEYS,
BOTTOM_KEYS,
symbolArrowHeight,
textLeftMargin,
} from './config';
getBrokenLine
} from './utils'
import { HEAD_HEIGHT, LINE_HEIGHT, TOP_KEYS, BOTTOM_KEYS, symbolArrowHeight, textLeftMargin} from './config'
export const iconDrawObj = {
// 绘制圆形图标
getDrawRoundIcon: ({ content, data, x, y, fill = 'blue', stroke = 'blue', r = 5 }) => {
getDrawRoundIcon: ({ content,data, x, y, fill = 'blue',stroke = 'blue', r = 5 }) => {
// 增加icon 红色空心
content
.append('g')
@@ -36,32 +29,23 @@ export const iconDrawObj = {
.data(data)
.join('circle')
.attr('transform', (i) => {
const yVal = y(i) || 0;
const yVal = y(i) || 0
if (!yVal) {
return 'scale(0)';
return 'scale(0)'
}
return '';
return ''
})
.attr('cx', x)
.attr('cy', y)
.attr('r', (i) => {
if (y(i)) {
return r;
return r
}
return 0;
});
return 0
})
},
// 绘制圆形点图标
getDrawRoundDotIcon: ({
content,
data,
x,
y,
fill = 'white',
stroke = 'blue',
deepFill = 'blue',
r = 6,
}) => {
getDrawRoundDotIcon: ({ content, data, x, y, fill = 'white', stroke = 'blue', deepFill = 'blue', r = 6 }) => {
content
.append('g')
.attr('fill', fill)
@@ -71,11 +55,11 @@ export const iconDrawObj = {
.data(data)
.join('circle')
.attr('transform', (i) => {
const yVal = y(i) || 0;
const yVal = y(i) || 0
if (!yVal) {
return 'scale(0)';
return 'scale(0)'
}
return '';
return ''
})
.attr('cx', x)
.attr('cy', y)
@@ -84,7 +68,7 @@ export const iconDrawObj = {
.attr('cx', x)
.attr('cy', y)
.attr('r', 1)
.attr('fill', deepFill);
.attr('fill', deepFill)
},
// 绘制x
getDrawXIcon: ({ content, data, x, y, fill = 'blue', stroke = 'blue' }) => {
@@ -97,43 +81,43 @@ export const iconDrawObj = {
.data(data)
.join('line')
.attr('transform', (i) => {
let yVal = y;
let yVal = y
if (typeof y === 'function') {
yVal = y(i) || 0;
yVal = y(i) || 0
}
if (!yVal) {
return 'scale(0)';
return 'scale(0)'
}
return '';
return ''
})
.attr('x1', function (d) {
return x(d) - 4;
.attr('x1', function(d) {
return x(d) - 4
})
.attr('y1', function (d) {
return y(d) - 4;
.attr('y1', function(d) {
return y(d) - 4
})
.attr('x2', function (d) {
return x(d) + 4;
.attr('x2', function(d) {
return x(d) + 4
})
.attr('y2', function (d) {
return y(d) + 4;
.attr('y2', function(d) {
return y(d) + 4
})
.clone()
.attr('x1', function (d) {
return x(d) + 4;
.attr('x1', function(d) {
return x(d) + 4
})
.attr('y1', function (d) {
return y(d) - 4;
.attr('y1', function(d) {
return y(d) - 4
})
.attr('x2', function (d) {
return x(d) - 4;
.attr('x2', function(d) {
return x(d) - 4
})
.attr('y2', function(d) {
return y(d) + 4
})
.attr('y2', function (d) {
return y(d) + 4;
});
},
// 绘制三角形
drawThreeIcon: ({ content, data, x, y, fill = 'blue', stroke = 'blue', riangle = 48 }) => {
drawThreeIcon: ({ content, data, x,y, fill = 'blue', stroke = 'blue', riangle = 48 }) => {
// 蓝色三角形
content
.append('g')
@@ -142,82 +126,74 @@ export const iconDrawObj = {
.data(data)
.join('g')
.attr('transform', (i) => {
const yVal = y(i) || 0;
const yVal = y(i) || 0
if (!yVal) {
return 'scale(0)';
return 'scale(0)'
}
return `translate(${x(i)},${yVal})`;
return `translate(${x(i)},${yVal})`
})
.append('path')
.call((path) => {
const symbolThree = symbol();
const symbolIndex = 5;
symbolThree.type(d3.symbols[symbolIndex]);
path.attr('d', symbolThree.size(riangle)).attr('fill', fill).attr('stroke', stroke);
const symbolThree = symbol()
const symbolIndex = 5
symbolThree.type(d3.symbols[symbolIndex])
path.attr('d', symbolThree.size(riangle)).attr('fill', fill) .attr('stroke', stroke)
// .transition()
// .duration(1500)
// .attr('d', symbolThree.size(48))
});
},
};
})
}
}
export function getG(svg, viewConfig) {
return svg
.append('g')
.attr('transform', `translate(${viewConfig.marginLeft},${viewConfig.marginTop + HEAD_HEIGHT})`);
return svg .append('g') .attr( 'transform', `translate(${viewConfig.marginLeft},${viewConfig.marginTop + HEAD_HEIGHT})` )
}
// 设置数据
export function getData(allData) {
const rowsData = allData.rows; // allData, '【全部数据】'
const infoData = allData.grParamBOS;
const typesData = getTypeDatas(allData.types, allData.grParamBOS.beginDate);
const selectOp = allData.selectOp;
const symbolTextArr = getTypeData('018', rowsData, false, allData.grParamBOS.beginDate); // 【特殊标记】
const symbolGoUp = getType('003', rowsData, allData.grParamBOS.beginDate); // 不升
const rowsData = allData.rows // allData, '【全部数据】'
const infoData = allData.grParamBOS
const typesData = getTypeDatas(allData.types, allData.grParamBOS.beginDate)
const selectOp = allData.selectOp
const symbolTextArr = getTypeData('018', rowsData, false, allData.grParamBOS.beginDate) // 【特殊标记】
const symbolGoUp = getType('003', rowsData, allData.grParamBOS.beginDate) // 不升
// 体温单特殊数据
const dicData = JSON.parse(window.localStorage.getItem('transDictCode'));
const signsManagementList = dicData
? dicData
.filter((item) => item.name === '95')[0]
.concept.sort((a, b) => {
return a.displayOrder - b.displayOrder;
})
: [];
const otherArr = [];
const dicData = JSON.parse(window.localStorage.getItem('transDictCode'))
const signsManagementList = dicData ? dicData.filter(item => item.name === '95')[0].concept.sort((a, b) => { return a.displayOrder - b.displayOrder }) :[]
const otherArr = []
if (signsManagementList.length > 0) {
for (let j = 0; j < signsManagementList.length; j++) {
if ((signsManagementList[j].code !== '9502') & (signsManagementList[j].code !== '9503')) {
const otherArrItem = getTypeData(
signsManagementList[j].code,
rowsData,
false,
allData.grParamBOS.beginDate
);
otherArr.push(otherArrItem);
if (signsManagementList[j].code !== '9502' & signsManagementList[j].code !== '9503') {
const otherArrItem = getTypeData(signsManagementList[j].code, rowsData, false, allData.grParamBOS.beginDate)
otherArr.push(otherArrItem)
}
}
}
const surgeryNumDays = allData.types.filter((item) => item.typeCode === '031');
const surgeryArr = getTypeData('9502', rowsData, false, allData.grParamBOS.beginDate); // '【手术】'
const minSurgeryArr = getTypeData('9503', rowsData, false, allData.grParamBOS.beginDate); // '【小手术】'
const temArr = getTypeData('00301', rowsData, false, allData.grParamBOS.beginDate); // '【体温拒测等】'
// const symbolGoUp = getType('003', rowsData, allData.grParamBOS.beginDate) // symbolGoUp, '不升'
const surgeryNumDays = allData.types.filter(item => item.typeCode === '031')
const surgeryArr = getTypeData('9502', rowsData, false, allData.grParamBOS.beginDate) // '【手术】'
const minSurgeryArr = getTypeData('9503', rowsData, false, allData.grParamBOS.beginDate) // '【小手术】'
const temArr = getTypeData('00301', rowsData, false, allData.grParamBOS.beginDate) // '【体温拒测等】'
// const symbolGoUp = getType('003', rowsData, allData.grParamBOS.beginDate) // symbolGoUp, '不升'
// 35度线上的内容
const symbolDegreesEvents = degreesOnline(symbolTextArr, selectOp, 0);
const symbolDegreesOnline = disconnectEvents(symbolTextArr, selectOp, 'isBeforeAfter', 0);
const symbolDegreesEvents = degreesOnline(symbolTextArr, selectOp, 0)
const symbolDegreesOnline = disconnectEvents( symbolTextArr, selectOp, 'isBeforeAfter', 0 )
// 40~42线上的内容
const symbolTopOnline = degreesOnline(symbolTextArr, selectOp, 1);
const symbolTopDegreesOnline = disconnectEvents(symbolTextArr, selectOp, 'isBeforeAfter', 1);
const symbolContent = getTypeData('013', rowsData, false, allData.grParamBOS.beginDate); // symbolContent, '【标记内容】'
const mergeTag = setMergeTag(symbolTopOnline, symbolContent); // mergeTag, '【合并标记,标记内容】'
const symbolTopOnline = degreesOnline(symbolTextArr, selectOp, 1)
const symbolTopDegreesOnline = disconnectEvents(
symbolTextArr,
selectOp,
'isBeforeAfter',
1
)
const symbolContent = getTypeData('013', rowsData, false, allData.grParamBOS.beginDate) // symbolContent, '【标记内容】'
const mergeTag = setMergeTag(symbolTopOnline, symbolContent) // mergeTag, '【合并标记,标记内容】'
// 产后日数
infoData.postpartum = postpartumDays('031', typesData); // infoData, '产后日数'
infoData.postpartum = postpartumDays('031', typesData) // infoData, '产后日数'
// 写死的先
infoData.dateClosed = {
stopTime: true, // 控制结束日期
stopNumber: true, // 控制住院天数
};
stopNumber: true // 控制住院天数
}
// 折线
const brokenLineData = getBrokenLine(
'003',
@@ -226,23 +202,22 @@ export function getData(allData) {
symbolGoUp,
symbolTopDegreesOnline,
allData.grParamBOS.beginDate
);
)
// 模拟数据 体温
const datasetAnus = getTypeAnimalHeat('003', rowsData, '1', allData.grParamBOS.beginDate); // datasetAnus, '腋温【x】'
const bodyData = getTypeAnimalHeat('003', rowsData, '2', allData.grParamBOS.beginDate); // dbodyData, '口温'
const datasetAnus = getTypeAnimalHeat('003', rowsData, '1', allData.grParamBOS.beginDate) // datasetAnus, '腋温【x】'
const bodyData = getTypeAnimalHeat('003', rowsData, '2', allData.grParamBOS.beginDate) // dbodyData, '口温'
// const datasetHeartrate = getTypeAnimalHeat('003', rowsData)
const datasetHeartrate = getTypeAnimalHeat('003', rowsData, '3', allData.grParamBOS.beginDate); // datasetHeartrate, '肛温【红空圆】'
const earCool = getTypeAnimalHeat('003', rowsData, '4', allData.grParamBOS.beginDate); // earCool, '耳朵温'
const painScore = getHeartRate(
// painScore, '疼痛'
const datasetHeartrate = getTypeAnimalHeat('003', rowsData, '3', allData.grParamBOS.beginDate) // datasetHeartrate, '肛温【红空圆】'
const earCool = getTypeAnimalHeat('003', rowsData, '4', allData.grParamBOS.beginDate) // earCool, '耳朵温'
const painScore = getHeartRate( // painScore, '疼痛'
'016',
rowsData,
symbolDegreesOnline,
symbolTopDegreesOnline,
true,
allData.grParamBOS.beginDate
);
const allTemperatureData = [bodyData, datasetAnus, datasetHeartrate, earCool]; // 所有的温度记录
)
const allTemperatureData = [bodyData, datasetAnus, datasetHeartrate, earCool] // 所有的温度记录
// '脉搏【红实圆】'
const datasetPulse = getHeartRate(
'002',
@@ -251,7 +226,7 @@ export function getData(allData) {
symbolTopDegreesOnline,
true,
allData.grParamBOS.beginDate
);
)
// 心率【空心】
const datasetHeartRate = getHeartRate(
'014',
@@ -260,14 +235,14 @@ export function getData(allData) {
symbolTopDegreesOnline,
true,
allData.grParamBOS.beginDate
);
)
// const allTemperatureData = getDrawData('003', rowsData, '1', allData.grParamBOS.beginDate) // datasetAnus, '腋温【x】'
// const dataCool = getDrawCoolData('015', rowsData, true, allData.grParamBOS.beginDate) // dataCool, '【物理降温】'
const dataCool = getTypeData('015', rowsData, true, allData.grParamBOS.beginDate); // 【物理降温】
const dataCool = getTypeData('015', rowsData, true, allData.grParamBOS.beginDate) // 【物理降温】
// 呼吸【黑实圆】
const datasetPain = getTypeData('001', rowsData, false, allData.grParamBOS.beginDate); // 呼吸
const datasetPain = getTypeData('001', rowsData, false, allData.grParamBOS.beginDate)// 呼吸
const title = infoData.title;
const title = infoData.title
return {
title,
datasetHeartRate,
@@ -294,8 +269,8 @@ export function getData(allData) {
temArr,
surgeryArr,
minSurgeryArr,
surgeryNumDays,
};
surgeryNumDays
}
}
export function drawTopMask(svg, viewConfig) {
@@ -314,17 +289,19 @@ export function drawTopMask(svg, viewConfig) {
.attr('height', LINE_HEIGHT * (TOP_KEYS.length + 7.5) - 1)
.attr('stroke', viewConfig.stroke)
.attr('fill', '#fff')
.attr('style', 'stroke-width: 0');
.attr('style', 'stroke-width: 0')
drawTopVerticalLine(svg, viewConfig);
drawTopVerticalLine(svg, viewConfig)
}
export function drawTopVerticalLine(svg, viewConfig) {
// 补上下竖线
let start = viewConfig.step;
const lineG = getG(svg, viewConfig).append('g').attr('class', 'maskline-top');
let start = viewConfig.step
const lineG = getG(svg, viewConfig)
.append('g')
.attr('class', 'maskline-top')
while (start < viewConfig.contentWidth) {
// const isLastLine = (start + viewConfig.step) >= viewConfig.contentWidth
// const isLastLine = (start + viewConfig.step) >= viewConfig.contentWidth
lineG
.append('line')
.attr('fill', 'stroke')
@@ -334,13 +311,13 @@ export function drawTopVerticalLine(svg, viewConfig) {
.attr('x2', start)
.attr('stroke', start > viewConfig.step ? '#B22222' : viewConfig.stroke)
// .attr('stroke', isLastLine ? 'black' : (start > viewConfig.step ? '#B22222' : viewConfig.stroke))
.attr('stroke-width', 4); // 设置线条宽度为2
start = start + viewConfig.step;
.attr('stroke-width', 4) // 设置线条宽度为2
start = start + viewConfig.step
}
}
export function drawBottomMask(svg, viewConfig) {
const g = getG(svg, viewConfig);
const g = getG(svg, viewConfig)
// 遮罩层挡住超出的折线
g.append('rect')
.attr('class', 'mask-rect')
@@ -350,16 +327,18 @@ export function drawBottomMask(svg, viewConfig) {
.attr('height', LINE_HEIGHT * (BOTTOM_KEYS.length + 5))
.attr('stroke', viewConfig.stroke)
.attr('fill', '#ffffff')
.attr('style', 'stroke-width: 0');
drawBottomMaskLine(svg, viewConfig);
.attr('style', 'stroke-width: 0')
drawBottomMaskLine(svg, viewConfig)
}
function drawBottomMaskLine(svg, viewConfig) {
// 补上下竖线
let start = viewConfig.step;
const lineG = getG(svg, viewConfig).append('g').attr('class', 'maskline');
let start = viewConfig.step
const lineG = getG(svg, viewConfig)
.append('g')
.attr('class', 'maskline')
while (start < viewConfig.contentWidth) {
// const isLastLine = (start + viewConfig.step) >= viewConfig.contentWidth;
// const isLastLine = (start + viewConfig.step) >= viewConfig.contentWidth;
lineG
.append('line')
.attr('fill', 'stroke')
@@ -369,14 +348,14 @@ function drawBottomMaskLine(svg, viewConfig) {
.attr('x2', start)
.attr('stroke', start > viewConfig.step ? '#B22222' : viewConfig.stroke)
//.attr('stroke', isLastLine ? 'black' : (start > viewConfig.step ? '#B22222' : viewConfig.stroke))
.attr('stroke-width', 4); // 设置线条宽度为2
start = start + viewConfig.step;
.attr('stroke-width', 4) // 设置线条宽度为2
start = start + viewConfig.step
}
}
// 绘制特殊事件文字 --- 有时间
export function drawSpecialText(svg, viewConfig, textData) {
const g = getG(svg, viewConfig);
const g = getG(svg, viewConfig)
g.append('g')
.selectAll('text')
.data(textData)
@@ -384,46 +363,43 @@ export function drawSpecialText(svg, viewConfig, textData) {
.attr('style', 'font-size:14px; fill: red;')
.attr('class', 'mytext')
.html((d, i) => {
const t = (d?.value || '').split(',');
let time = '';
const t = (d?.value || '').split(',')
let time = ''
if (t.length > 1) {
time =
t[0] + '于' + transNum(t[1].split(':')[0]) + '时' + transNum(t[1].split(':')[1]) + '分';
time = t[0] + '于' + transNum(t[1].split(':')[0]) + '时' + transNum(t[1].split(':')[1]) + '分'
// time = t[0] + '㇑' + transNum(t[1].split(':')[0]) + '时' + transNum(t[1].split(':')[1]) + '分'
}
const texts = time.split('');
const texts = time.split('')
return texts
.map((text, i) => {
return `<tspan dx="${
i === 1 ? -14 : i === 0 ? 0 : Number(text) ? -8 : -14
}" dy="${20}">${text}</tspan>`;
return `<tspan dx="${i === 1 ? -14 : i === 0 ? 0 : Number(text) ? -8 : -14}" dy="${20}">${text}</tspan>`
})
.join('');
.join('')
})
.attr('x', (d, i) => {
return viewConfig.step + d.index * viewConfig.micoStep + textLeftMargin;
return viewConfig.step + d.index * viewConfig.micoStep + textLeftMargin
})
.attr('y', () => {
return viewConfig.topKeysPos - textLeftMargin;
});
return viewConfig.topKeysPos - textLeftMargin
})
}
// 绘制特殊事件文字 --- 大手术小手术
export function drawSurgery(svg, viewConfig, textData) {
const g = getG(svg, viewConfig);
const textDatas = [];
const g = getG(svg, viewConfig)
const textDatas = []
if (textData.length > 0) {
for (let j = 0; j < textData.length; j++) {
let item = {};
let item = {}
if (textData[j].value) {
item = {
index: textData[j].index,
value: textData[j].value.split(',')[0],
date: textData[j].date,
};
date: textData[j].date
}
} else {
item = textData[j];
item = textData[j]
}
textDatas.push(item);
textDatas.push(item)
}
}
g.append('g')
@@ -433,39 +409,40 @@ export function drawSurgery(svg, viewConfig, textData) {
.attr('style', 'font-size:15px; fill: red;')
.attr('class', 'mytext')
.html((d, i) => {
const texts = (d?.value || '').split('');
const texts = (d?.value || '').split('')
return texts
.map((text, i) => {
return `<tspan dx="${
i === 1 ? -15 : i === 0 ? 0 : Number(text) ? -8 : -15
}" dy="${20}">${text}</tspan>`;
}" dy="${20}">${text}</tspan>`
})
.join('');
})
.attr('x', (d, i) => {
return viewConfig.step + d.index * viewConfig.micoStep + textLeftMargin - 2;
.join('')
})
.attr(
'x',
(d, i) => { return viewConfig.step + d.index * viewConfig.micoStep + textLeftMargin - 2 }
)
.attr('y', () => {
return viewConfig.topKeysPos - textLeftMargin;
});
return viewConfig.topKeysPos - textLeftMargin
})
}
// 绘制特殊事件文字 --- 无时间
export function drawSpecialNoTimeText(svg, viewConfig, textData) {
const g = getG(svg, viewConfig);
const textDatas = [];
const g = getG(svg, viewConfig)
const textDatas = []
if (textData.length > 0) {
for (let j = 0; j < textData.length; j++) {
let item = {};
let item = {}
if (textData[j].value) {
item = {
index: textData[j].index,
value: textData[j].value.split(',')[0],
date: textData[j].date,
};
date: textData[j].date
}
} else {
item = textData[j];
item = textData[j]
}
textDatas.push(item);
textDatas.push(item)
}
}
g.append('g')
@@ -475,7 +452,7 @@ export function drawSpecialNoTimeText(svg, viewConfig, textData) {
.attr('style', 'font-size:15px; fill: red;')
.attr('class', 'mytext')
.html((d, i) => {
const texts = (d?.value || '').split('');
const texts = (d?.value || '').split('')
// let time = ''
// if (t.length > 1) {
// time = t[0] + '㇑' + transNum(t[1].split(':')[0]) + '时' + transNum(t[1].split(':')[1]) + '分'
@@ -483,38 +460,39 @@ export function drawSpecialNoTimeText(svg, viewConfig, textData) {
// const texts = time.split('')
return texts
.map((text, i) => {
return `<tspan dx="${i === 1 ? -15 : i === 0 ? 0 : Number(text) ? -8 : -15}" dy="${
i === 0 ? 20 : 80
}">${text}</tspan>`;
return `<tspan dx="${
i === 1 ? -15 : i === 0 ? 0 : Number(text) ? -8 : -15
}" dy="${ i === 0 ? 20 : 80}">${text}</tspan>`
})
.join('');
})
.attr('x', (d, i) => {
return viewConfig.step + d.index * viewConfig.micoStep + textLeftMargin - 2;
.join('')
})
.attr(
'x',
(d, i) => { return viewConfig.step + d.index * viewConfig.micoStep + textLeftMargin - 2 }
)
.attr('y', () => {
return viewConfig.topKeysPos - textLeftMargin;
});
return viewConfig.topKeysPos - textLeftMargin
})
}
// 数字转换成文字
function transNum(num) {
const arr1 = ['', '十'];
const arr2 = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
const sw = num.split('')[0];
const gw = num.split('')[1];
const str1 = sw > 1 ? arr2[sw] + '十' : arr1[sw];
let strNum = str1 + arr2[gw];
const arr1 = ['', '十']
const arr2 = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九']
const sw = num.split('')[0]
const gw = num.split('')[1]
const str1 = sw > 1 ? arr2[sw] + '十' : arr1[sw]
let strNum = str1 + arr2[gw]
// 若H为十点整小时则把零去掉若m为十分,则去掉零
if (strNum.indexOf('十') > 0 || strNum.indexOf('零') === 1) {
strNum = strNum.replace('零', '');
strNum = strNum.replace('零', '')
}
return strNum;
return strNum
}
// 绘制标签文字
export function drawTagText(svg, viewConfig, textData) {
const g = getG(svg, viewConfig);
const g = getG(svg, viewConfig)
g.append('g')
.selectAll('text')
.data(textData)
@@ -522,24 +500,25 @@ export function drawTagText(svg, viewConfig, textData) {
.attr('style', 'font-size:14px; fill: black;')
.attr('class', 'mytext')
.html((d, i) => {
const texts = (d?.value || '').split('');
const texts = (d?.value || '').split('')
return texts
.map((text, i) => {
return `<tspan dx="${
i === 1 ? -14 : i === 0 ? 0 : Number(text) ? -8 : -14
}" dy="${20}">${text}</tspan>`;
return `<tspan dx="${i === 1 ? -14 : i === 0 ? 0 : Number(text) ? -8 : -14}" dy="${20}">${text}</tspan>`
})
.join('');
.join('')
})
.attr('x', (d, i) => viewConfig.step + d.index * viewConfig.micoStep + textLeftMargin)
.attr(
'x',
(d, i) => viewConfig.step + d.index * viewConfig.micoStep + textLeftMargin
)
.attr('y', () => {
return viewConfig.topKeysPos - textLeftMargin + 198;
});
return viewConfig.topKeysPos - textLeftMargin + 198
})
}
// 绘制特殊事件文字底部
export function drawBottomSpecialText(svg, viewConfig, textData) {
const g = getG(svg, viewConfig);
const g = getG(svg, viewConfig)
g.append('g')
.selectAll('text')
.data(textData)
@@ -547,20 +526,23 @@ export function drawBottomSpecialText(svg, viewConfig, textData) {
.attr('style', 'font-size:14px; fill: blue;')
.attr('class', 'mytext')
.html((d, i) => {
const texts = (d?.value || '').split('');
const texts = (d?.value || '').split('')
return texts
.map((text, i) => {
return `<tspan dx="${
i === 1 ? -14 : i === 0 ? 0 : Number(text) ? -8 : -14
}" dy="${20}">${text}</tspan>`;
}" dy="${20}">${text}</tspan>`
})
.join('');
.join('')
})
.attr('x', (d, i) => viewConfig.step + d.index * viewConfig.micoStep + textLeftMargin)
.attr(
'x',
(d, i) => viewConfig.step + d.index * viewConfig.micoStep + textLeftMargin
)
.attr('y', (d) => {
const texts = (d?.value || '').split('');
return viewConfig.bottomKeysPosStart - texts.length * LINE_HEIGHT - 6 - 58;
});
const texts = (d?.value || '').split('')
return viewConfig.bottomKeysPosStart - texts.length * LINE_HEIGHT - 6 - 58
})
}
export function initArrow(svg) {
@@ -574,9 +556,12 @@ export function initArrow(svg) {
.attr('viewBox', '0 0 12 12')
.attr('refX', '6')
.attr('refY', '6')
.attr('orient', 'auto');
const arrowPath = 'M2,2 L10,6 L2,10 L6,6 L2,2';
arrowMarkerRed.append('path').attr('d', arrowPath).attr('fill', 'red');
.attr('orient', 'auto')
const arrowPath = 'M2,2 L10,6 L2,10 L6,6 L2,2'
arrowMarkerRed
.append('path')
.attr('d', arrowPath)
.attr('fill', 'red')
const arrowMarkerBlue = svg
.append('defs')
.append('marker')
@@ -587,13 +572,16 @@ export function initArrow(svg) {
.attr('viewBox', '0 0 12 12')
.attr('refX', '6')
.attr('refY', '6')
.attr('orient', 'auto');
arrowMarkerBlue.append('path').attr('d', arrowPath).attr('fill', 'blue');
.attr('orient', 'auto')
arrowMarkerBlue
.append('path')
.attr('d', arrowPath)
.attr('fill', 'blue')
}
export function lineArrow({ svg, viewConfig, scale, data } = {}) {
const g = getG(svg, viewConfig);
const vaildData = data.filter((item) => item);
const g = getG(svg, viewConfig)
const vaildData = data.filter((item) => item)
// {
// ...item,
// value: ismax ? maxDefault : minDefault,
@@ -607,85 +595,96 @@ export function lineArrow({ svg, viewConfig, scale, data } = {}) {
.data(vaildData)
.join('line')
.attr('x1', (d, i) => {
return scale(d.index) + +viewConfig.X_OFFSET;
return scale(d.index) + +viewConfig.X_OFFSET
})
.attr('y1', (d, i) => {
if (d.ismax) {
// 顶部箭头
return viewConfig.topKeysPos + symbolArrowHeight * 1.5;
return viewConfig.topKeysPos + symbolArrowHeight * 1.5
} else {
// 底部箭头
return viewConfig.bottomKeysPosStart - symbolArrowHeight * 1.5;
return viewConfig.bottomKeysPosStart - symbolArrowHeight * 1.5
}
})
.attr('x2', (d, i) => {
return scale(d.index) + +viewConfig.X_OFFSET;
return scale(d.index) + +viewConfig.X_OFFSET
})
.attr('y2', (d, i) => {
if (d.ismax) {
// 顶部箭头
return viewConfig.topKeysPos + symbolArrowHeight / 2;
return viewConfig.topKeysPos + symbolArrowHeight / 2
} else {
// 底部箭头
return viewConfig.bottomKeysPosStart - symbolArrowHeight / 2;
return viewConfig.bottomKeysPosStart - symbolArrowHeight / 2
}
})
.attr('stroke', (d) => {
return d.ismax ? 'red' : 'blue';
return d.ismax ? 'red' : 'blue'
})
.attr('stroke-width', 2)
.attr('marker-end', (d, i) => {
return d.ismax ? 'url(#redArrow)' : 'url(#blueArrow)';
});
return d.ismax ? 'url(#redArrow)' : 'url(#blueArrow)'
})
g.selectAll('text')
.data(vaildData)
.join('text')
.attr('class', 'desctextname')
.html((item, i) => {
const value = `${item.sourceValue}`.split('');
const dotIndex = value.indexOf('.');
const value = `${item.sourceValue}`.split('')
const dotIndex = value.indexOf('.')
return value
.map((d, index) => {
let y;
let multiple = index;
let addition = 0; // dot height
let y
let multiple = index
let addition = 0 // dot height
if (item.ismax) {
if (index >= dotIndex) {
addition = 8;
multiple = index - 1;
addition = 8
multiple = index - 1
}
y =
viewConfig.topKeysPos +
symbolArrowHeight * 1.5 +
(2 + multiple * 1.5) * viewConfig.X_OFFSET +
addition;
addition
} else {
if (index >= dotIndex) {
addition = 9;
multiple = index - 1;
addition = 9
multiple = index - 1
}
y =
viewConfig.bottomKeysPosStart -
(2 + (value.length - multiple) * 1.5) * viewConfig.X_OFFSET +
addition;
addition
}
return `
<tspan rotate="90" x="${scale(item.index) + viewConfig.X_OFFSET - 4}"
y="${y}">${d}</tspan>`;
<tspan rotate="90" x="${scale(item.index) +
viewConfig.X_OFFSET -
4}"
y="${y}">${d}</tspan>`
})
.join('');
.join('')
})
.attr('x', (item, i) => {
return scale(item.index) + viewConfig.X_OFFSET - 4;
return scale(item.index) + viewConfig.X_OFFSET - 4
})
.attr('y', (item) => {
.attr('y', item => {
if (item.ismax) {
return viewConfig.topKeysPos + symbolArrowHeight * 1.5 + LINE_HEIGHT / 2;
return (
viewConfig.topKeysPos + symbolArrowHeight * 1.5 + LINE_HEIGHT / 2
)
} else {
return viewConfig.bottomKeysPosStart - symbolArrowHeight / 2 - LINE_HEIGHT / 2;
return (
viewConfig.bottomKeysPosStart -
symbolArrowHeight / 2 -
LINE_HEIGHT / 2
)
}
})
.attr('style', (item) => {
return `font-size:14px;fill:${item.ismax ? 'red' : 'blue'};font-weight: bold;`;
});
.attr('style', item => {
return `font-size:14px;fill:${
item.ismax ? 'red' : 'blue'
};font-weight: bold;`
})
}

View File

@@ -5,13 +5,14 @@
* @LastEditors: 程堡
* @Description: 体温单
* @FilePath: src\action\nurseStation\temperatureSheet\index.js
*/
import Request from '@/axios/index.js';
const temperaturePath = 'app/temperature';
const getTemperaturePath = 'app/temperature/by-encounter-id';
const delTemperaturePath = 'app/temperature/retired';
*/
import Request from '@/axios/index.js'
const temperaturePath = 'app/temperature'
const getTemperaturePath = 'app/temperature/by-encounter-id'
const delTemperaturePath = 'app/temperature/retired'
// import data from '../temperatureSheet/datas.js';
export const API = {
/**
* @description 查询患者体温单
* @param encounterId
@@ -22,24 +23,27 @@ export const API = {
method: 'get', // 提交方法get
verification: true, // 是否统一拦截验证
untoken: false, // 是否不带token
params: {
// 参数列表
id,
},
});
params: { // 参数列表
id
}
})
},
/**
* @description 创建体温单
* @param encounterId
*/
createTemperature(encounterId, hisNo, clinicCode, recordTime, type, content) {
createTemperature(encounterId,
hisNo,
clinicCode,
recordTime,
type,
content) {
return Request({
url: temperaturePath,
method: 'post',
verification: true,
untoken: false,
data: {
// 参数列表
data: { // 参数列表
encounterId,
hisNo,
clinicCode,
@@ -48,23 +52,28 @@ export const API = {
operName: sessionStorage.getItem('userName'),
type,
content,
hospitalOrgId: sessionStorage.getItem('hospitalOrgId'),
},
});
hospitalOrgId: sessionStorage.getItem('hospitalOrgId')
}
})
},
/**
* @description 修改体温单
* @param encounterId
*/
updateTemperature(encounterId, hisNo, clinicCode, recordTime, type, content, id) {
updateTemperature(encounterId,
hisNo,
clinicCode,
recordTime,
type,
content,
id) {
return Request({
url: temperaturePath,
method: 'put',
verification: true,
untoken: false,
data: {
// 参数列表
data: { // 参数列表
encounterId,
hisNo,
clinicCode,
@@ -73,9 +82,9 @@ export const API = {
operName: sessionStorage.getItem('userName'),
type,
content,
id,
},
});
id
}
})
},
/**
* @description 删除记录
@@ -87,11 +96,10 @@ export const API = {
method: 'post',
verification: true,
untoken: false,
data: {
// 参数列表
id,
},
});
data: { // 参数列表
id
}
})
},
/**
* @description 获取患者时间线
@@ -99,22 +107,24 @@ export const API = {
*/
NewSheet(patientInfo) {
return {
grParamBOS: {
age: patientInfo.age,
birth: 868723200000,
cwh: patientInfo.bedName,
cardNo: patientInfo.hisId,
hospDate: patientInfo.firstInBedTime.substring(0, 10),
inDate: patientInfo.firstInBedTime,
inDiagName: patientInfo.diag,
name: patientInfo.patientName,
deptName: patientInfo.deptName,
operaDays: null,
outdate: patientInfo.checkOutWardTime,
sex: patientInfo.gender.display,
},
grParamBOS:
{
age: patientInfo.age,
birth: 868723200000,
cwh: patientInfo.bedName,
cardNo: patientInfo.hisId,
hospDate: patientInfo.firstInBedTime.substring(0, 10),
inDate: patientInfo.firstInBedTime,
inDiagName: patientInfo.diag,
name: patientInfo.patientName,
deptName: patientInfo.deptName,
operaDays: null,
outdate: patientInfo.checkOutWardTime,
sex: patientInfo.gender.display
},
rows: [],
types: [],
};
},
};
types: []
}
}
}

View File

@@ -1,296 +1,264 @@
// 医院名称
export const HospitalName = '';
// export const HospitalName = '中国人民解放军联勤保障部队第九六四医院'
export const HospitalName = ''
// 体温单名称
export const temperatureName = '体 温 单';
export const temperatureName = '体 温 单'
// 患者信息显示项目(修改显示顺序及是否显示)
export const INFO_KEYS = [
{
name: '姓名',
key: 'name',
order: 1,
show: true,
show: true
},
{
name: '性别',
key: 'sex',
order: 2,
show: true,
},
{
name: '年龄',
key: 'age',
order: 3,
show: true,
},
{
name: '病室',
name: '科室',
key: 'deptName',
order: 4,
show: true,
order: 2,
show: true
},
{
name: '床号',
key: 'cwh',
order: 5,
show: true,
order: 3,
show: true
},
{
name: '病历号',
name: '病人ID',
key: 'patientId',
order: 4,
show: true
},
{
name: '住院号',
key: 'hosNum',
order: 6,
show: true,
order: 5,
show: true
},
{
name: '入院日期',
key: 'hospDate',
order: 6,
show: false,
},
{
name: '诊断',
key: 'inDiagName',
order: 8,
show: false,
},
];
// {
// name: '入院日期',
// key: 'hospDate',
// order: 6,
// show: true
// }
]
// 体温单录入项目(修改显示顺序及是否显示)
// 新增项目注意 key值、code值唯一性不要与之前的项目重复
export const BOTTOM_KEYS = [
{
name: '血mmHg',
name: '血\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0压',
code: 'bloodPressure',
key: '008',
times: 2,
order: 1,
show: true,
show: true
},
{
name: '大\u00A0便\u00A0次\u00A0数',
name: '大便次数',
code: 'poop',
key: '005',
order: 2,
show: true,
show: true
},
{
name: '\u00A0便\u00A0\u00A0',
code: 'urine',
key: '004',
order: 3,
show: true,
},
{
name: '液体总入量ml',
code: 'input',
key: '006',
order: 4,
show: true,
},
{
name: '其\u00A0\u00A0他ml',
code: 'output',
key: '007',
order: 5,
show: true,
},
{
name: '尿\u00A0\u00A0量ml',
code: 'urineOutput',
key: '011',
order: 6,
show: true,
},
{
name: '体\u00A0\u00A0重kg',
name: '体\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0重',
code: 'weight',
key: '009',
order: 8,
show: true,
order: 3,
show: true
},
{
name: '身\u00A0\u00A0高cm',
code: 'height',
key: '030',
order: 9,
show: true,
name: '尿\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0量',
code: 'urine',
key: '004',
order: 4,
show: true
},
{
name: 'SPO2',
code: 'SPO2',
key: '021',
times: 2,
order: 10,
show: false,
name: '摄入液量',
code: 'input',
key: '006',
order: 5,
show: true
},
{
name: '皮\u00A0试\u00A0阳\u00A0性',
code: 'allergy',
key: '017',
order: 11,
show: true,
lines: 2,
name: '排出液量',
code: 'output',
key: '007',
order: 6,
show: true
},
{
name: '过\u00A0敏\u00A0试\u00A0验',
code: 'allergyTest',
key: '020',
order: 12,
show: false,
lines: 2,
},
{
name: '其\u00A0\u00A0他',
code: 'other',
key: '025',
name: '术后天数',
code: 'output',
key: '010',
order: 7,
show: false,
lines: 2,
show: true
},
{
name: '',
code: 'useless1',
key: '100',
order: 20,
show: true,
show: true
},
];
{
name: '',
code: 'useless2',
key: '100',
order: 21,
show: true
},
{
name: '',
code: 'useless3',
key: '100',
order: 22,
show: true
},
{
name: '',
code: 'useless4',
key: '100',
order: 23,
show: true
},
{
name: '',
code: 'useless5',
key: '100',
order: 24,
show: true
},
{
name: '',
code: 'useless6',
key: '100',
order: 25,
show: true
}
]
// 是否显示疼痛评分
export const showPainFlag = true;
export const showPainFlag = true
/** *********** 以上信息是本地化可以修改的部分 **************************/
// 获取患者信息显示项目
export function getInfoKeys() {
return INFO_KEYS.filter((x) => x.show).sort((a, b) => a.order - b.order);
return INFO_KEYS.filter(x => x.show).sort((a, b) => a.order - b.order)
}
// 获取患者信息显示项目
export function getBottomKeys() {
return BOTTOM_KEYS.filter((x) => x.show).sort((a, b) => a.order - b.order);
return BOTTOM_KEYS.filter(x => x.show).sort((a, b) => a.order - b.order)
}
export const timeNumber = [2, 6, 10, 14, 18, 22]; // 时间展示
export const nightTime = [2, 18, 22]; // 夜间红色高亮时间
export const timeNumber = [2, 6, 10, 14, 18, 22] // 时间展示
export const nightTime = [2, 18, 22] // 夜间红色高亮时间
export const leftTEXT = [
['脉搏,(次/分),180', '160', '140', '120', '100', '80', '60', '40'],
['体温,(℃), 42', '41', '40', '39', '38', '37', '36', '35'],
];
['体温,(℃), 42', '41', '40', '39', '38', '37', '36', '35']
]
export const inOutItem = ['入观', '分娩', '手术', '转入', '出观', '死亡'];
export const otherItem = ['外出', '请假', '拒测', '离院', '其他'];
export const inOutItem = ['入观', '分娩', '手术', '转入', '出观', '死亡']
export const otherItem = ['外出', '请假', '拒测', '离院', '其他']
export const sheetOptions = {
locations: [
{
code: '1',
display: '体温',
},
{
code: '2',
display: '口温',
},
{
code: '3',
display: '温',
},
{
code: '4',
display: '耳温',
},
],
breath: [
{
code: '',
display: '自主呼吸',
},
{
code: '®',
display: '机械通气',
},
],
poop: [
{
code: '',
display: '正常',
},
{
code: '',
display: '失禁',
},
{
code: '☆',
display: '人工肛门',
},
{
code: '/E',
display: '灌肠',
},
],
pee: [
{
code: '',
display: '正常',
},
{
code: '※',
display: '失禁',
},
{
code: 'C+',
display: '导尿',
},
],
locations: [{
code: '1',
display: '体温'
}, {
code: '2',
display: '口温'
}, {
code: '3',
display: '肛温'
}, {
code: '4',
display: '温'
}],
breath: [{
code: '',
display: '自主呼吸'
}, {
code: '®',
display: '机械通气'
}],
poop: [{
code: '',
display: '正常'
}, {
code: '',
display: '失禁'
}, {
code: '☆',
display: '人工肛门'
}, {
code: '/E',
display: '灌肠'
}],
pee: [{
code: '',
display: '正常'
}, {
code: '※',
display: '失禁'
}, {
code: 'C+',
display: '导尿'
}],
heart: ['窦性心律', '起搏心律', '房性心律', '异常心律'],
weight: ['正常', '卧床', '轮椅', '平车'],
};
weight: ['正常', '卧床', '轮椅', '平车']
}
// 此处是显示数字的 要和leftTEXT保持一直
export const bodyTemperature = [34, 42];
export const starNumEnv = bodyTemperature[0]; // 开始体温
export const endNumEnv = bodyTemperature[1]; // 结束体温
export const heartRange = [20, 180];
export const bodyTemperature = [34, 42]
export const starNumEnv = bodyTemperature[0] // 开始体温
export const endNumEnv = bodyTemperature[1] // 结束体温
export const heartRange = [20, 180]
// 中间图表字段对应
export const CHART_KEYS = [
{
key: '001',
code: 'breath',
name: '呼吸',
name: '呼吸'
},
{
key: '002',
code: 'sphygmus',
name: '脉搏',
name: '脉搏'
},
{
key: '003',
code: 'temperature',
name: '不升',
name: '不升'
},
{
key: '012',
code: 'inOut',
name: '特殊标记',
name: '特殊标记'
},
{
key: '013',
code: 'refuse',
name: '标记内容',
name: '标记内容'
},
{
key: '014',
code: 'heartRate',
name: '心率',
name: '心率'
},
{
key: '015',
code: 'lowerTemp',
name: '物理降温',
name: '物理降温'
},
{
key: '016',
code: 'painScore',
name: '疼痛评分',
},
];
name: '疼痛评分'
}
]
export const HEAD_HEIGHT = 120; // 头部文字预留位置
export const LINE_HEIGHT = 20; // 一行的行高
export const textLeftMargin = 4; // 文字左边边距
export const TEXT_MARGIN_BOTTOM = 6; // 文字向上偏移量
export const symbolArrowHeight = 20;
export const HEAD_HEIGHT = 120 // 头部文字预留位置
export const LINE_HEIGHT = 20 // 一行的行高
export const textLeftMargin = 4 // 文字左边边距
export const TEXT_MARGIN_BOTTOM = 6 // 文字向上偏移量
export const symbolArrowHeight = 20

View File

@@ -1,7 +1,9 @@
import moment from 'moment';
import moment from 'moment'
export function getG(svg, translateX, translateY) {
return svg.append('g').attr('transform', `translate(${translateX},${translateY})`);
return svg
.append('g')
.attr('transform', `translate(${translateX},${translateY})`)
}
// function generatePointer ({ pathData, type, yScaleInstance }) {
@@ -49,259 +51,247 @@ export function getG(svg, translateX, translateY) {
// }
// }
export function getTypeDatas(typeData, beginDate) {
const types = typeData.sort((a, b) => new Date(a.date) - new Date(b.date));
return types.map((item) => {
const types = typeData.sort((a, b) => new Date(a.date) - new Date(b.date))
return types.map(item => {
return {
index: getIndex(beginDate, item.date, '00:00:00') / 6,
times: 0,
date: item.date,
typeCode: item.typeCode,
typeValue: item.typeValue || null,
};
});
typeValue: (item.typeValue) || null
}
})
}
export function getTypeData(type, allData = [], isNumber = true, beginDate) {
const getList = allData
.map((rowBOSItem, index) => {
const rowBOS = rowBOSItem.rowBOS;
const rowBOS = rowBOSItem.rowBOS
const cur =
rowBOS.find((item) => {
return item.typeCode === type;
}) || {};
return item.typeCode === type
}) || {}
return {
index: getIndex(beginDate, cur.date, cur.times),
date: cur.date,
value: (isNumber ? +cur.typeValue : cur.typeValue) || null,
};
value: (isNumber ? +cur.typeValue : cur.typeValue) || null
}
})
.map((item) => {
if (item.value) {
// item.value = NaN
}
return item;
});
return getList.sort((a, b) => a.index - b.index);
return item
})
return getList.sort((a, b) => a.index - b.index)
}
// 获取不升
export function getType(type, allData = [], beginDate) {
const getList = allData
.map((rowBOSItem, index) => {
const rowBOS = rowBOSItem.rowBOS;
const rowBOS = rowBOSItem.rowBOS
const cur =
rowBOS.find((item) => {
return item.typeCode === type;
}) || {};
return item.typeCode === type
}) || {}
return {
index: getIndex(beginDate, cur.date, cur.times),
date: cur.date,
value: cur.typeValue !== '' ? (parseFloat(cur.typeValue) <= 35 ? '不升' : null) : null,
};
value: cur.typeValue !== '' ? (parseFloat(cur.typeValue) <= 35 ? '不升' : null) : null
}
})
.map((item) => {
if (item.value) {
// item.value = NaN
}
return item;
});
return getList.sort((a, b) => a.index - b.index);
return item
})
return getList.sort((a, b) => a.index - b.index)
}
// 合并标记内容
export function setMergeTag(ymbolTextArr = [], symbolContent = []) {
const arr = [];
ymbolTextArr.forEach((item) => {
symbolContent.forEach((res) => {
const arr = []
ymbolTextArr.forEach(item => {
symbolContent.forEach(res => {
if (item.index === res.index) {
arr.push({
...item,
...res,
value: (item.value !== null ? item.value : '') + (res.value !== null ? res.value : ''),
});
arr.push({ ...item, ...res, value: (item.value !== null ? item.value : '') + (res.value !== null ? res.value : '') })
}
});
});
return arr;
})
})
return arr
}
// 筛选手术产后日数
export function postpartumDays(type, arr) {
return arr.filter((item) => item.typeCode === type).map((i) => i.typeValue);
return arr.filter(item => item.typeCode === type).map(i => i.typeValue)
}
// 筛选体温
export function getTypeAnimalHeat(type, allData = [], code, beginDate) {
const getList = allData
.map((rowBOSItem, index) => {
const rowBOS = rowBOSItem.rowBOS;
const cur =
rowBOS.find((item) => {
return item.typeCode === type;
}) || {};
return {
console.log(rowBOSItem.rowBOS, 'rowBOSItem.rowBOS')
const rowBOS = rowBOSItem.rowBOS
const curList = // 改为 filter 来获取所有符合条件的项
rowBOS.filter((item) => {
return item.typeCode === type
}) || []
// 针对每个 cur 处理并生成新的对象数组
return curList.map((cur) => ({
index: getIndex(beginDate, cur.date, cur.times),
date: cur.date,
value: (+cur.collectionMode === +code ? +cur.typeValue : null) || null,
};
value: (+cur.collectionMode === +code ? +cur.typeValue : null) || null
}))
})
.flat() // 将二维数组展平为一维数组
.map((item) => {
if (item.value) {
// item.value = NaN
}
return item;
});
return getList.sort((a, b) => a.index - b.index);
return item
})
console.log(getList, 'getList')
return getList.sort((a, b) => a.index - b.index)
}
// 设置折线
export function getBrokenLine(type, allData = [], arr = [], list = [], topList = [], beginDate) {
const result = [];
const result = []
const getList = allData
.map((rowBOSItem, index) => {
const rowBOS = rowBOSItem.rowBOS;
const rowBOS = rowBOSItem.rowBOS
const cur =
rowBOS.find((item) => {
return item.typeCode === type;
}) || {};
rowBOS.find((item) => {
return item.typeCode === type
}) || {}
return {
index: getIndex(beginDate, cur.date, cur.times),
date: cur.date,
value: +cur.typeValue,
};
value: +cur.typeValue
}
})
.map((item) => {
if (item.value) {
// item.value = NaN
}
return item;
});
const _a = arr.filter((item) => item.value);
const _b = list.filter((item) => item.value);
const _c = topList.filter((item) => item.value);
const mergingData = [..._a, ..._b, ..._c, { index: 50 }].sort((a, b) => a.index - b.index);
let start = 0;
mergingData.forEach((item) => {
const _p = getList.sort((a, b) => a.index - b.index).slice(start, item.index);
start = item.index + 1;
result.push(_p);
});
return result;
return item
})
const _a = arr.filter(item => item.value)
const _b = list.filter(item => item.value)
const _c = topList.filter(item => item.value)
const mergingData = [..._a, ..._b, ..._c, { index: 50 }].sort((a, b) => a.index - b.index)
let start = 0
mergingData.forEach(item => {
const _p = getList.sort((a, b) => a.index - b.index).slice(start, item.index)
start = item.index + 1
result.push(_p)
})
return result
}
// 处理脉搏心率
export function getHeartRate(
type,
allData = [],
arr = [],
topList = [],
isNumber = true,
beginDate
) {
const result = [];
export function getHeartRate(type, allData = [], arr = [], topList = [], isNumber = true, beginDate) {
const result = []
const getList = allData
.map((rowBOSItem, index) => {
const rowBOS = rowBOSItem.rowBOS;
const rowBOS = rowBOSItem.rowBOS
const cur =
rowBOS.find((item) => {
return item.typeCode === type;
}) || {};
rowBOS.find((item) => {
return item.typeCode === type
}) || {}
return {
index: getIndex(beginDate, cur.date, cur.times),
date: cur.date,
value: (isNumber ? +cur.typeValue : cur.typeValue) || null,
};
value: (isNumber ? +cur.typeValue : cur.typeValue) || null
}
})
.map((item) => {
if (item.value) {
// item.value = NaN
}
return item;
});
const _a = arr.filter((item) => item.value);
const _c = topList.filter((item) => item.value);
const mergingData = [..._a, ..._c, { index: 50 }].sort((a, b) => a.index - b.index);
let start = 0;
mergingData.forEach((item) => {
const _p = getList.slice(start, item.index).sort((a, b) => {
return a.index - b.index;
});
start = item.index;
result.push(_p);
});
return result;
return item
})
const _a = arr.filter(item => item.value)
const _c = topList.filter(item => item.value)
const mergingData = [..._a, ..._c, { index: 50 }].sort((a, b) => a.index - b.index)
let start = 0
mergingData.forEach(item => {
const _p = getList.slice(start, item.index).sort((a, b) => { return a.index - b.index })
start = item.index
result.push(_p)
})
return result
}
function getIndex(beginDate, date, time) {
if (beginDate === undefined || date === undefined) return;
const diffTime =
moment(date.substring(0, 10)).diff(moment(beginDate.substring(0, 10))) / 1000 / 3600 / 24;
const diffIndex = parseInt(time.substring(0, 2));
return diffTime * 6 + Math.floor(diffIndex / 4);
if (beginDate === undefined || date === undefined) return
const diffTime = moment(date.substring(0, 10)).diff(moment(beginDate.substring(0, 10))) / 1000 / 3600 / 24
const diffIndex = parseInt(time.substring(0, 2))
return diffTime * 6 + Math.floor(diffIndex / 4)
}
// 筛选35和40~42数据
export function degreesOnline(allData, data, type) {
const arr = allData.map((item, index) => {
const cur = data?.find((res) => item.value === res.name && +res.isShowPlace === type) || null;
const cur = data?.find(res => item.value === res.name && +res.isShowPlace === type) || null
return {
index: index,
date: item.date,
value: cur?.name || null,
};
});
return arr;
value: cur?.name || null
}
})
return arr
}
// 35或42上断开的事件
export function disconnectEvents(allData, data, code, type) {
const arr = allData.map((item, index) => {
const cur =
data?.find(
(res) => item.value === res.name && +res.isShowPlace === type && +res[code] === 1
) || null;
const cur = data?.find(res => item.value === res.name && +res.isShowPlace === type && +res[code] === 1) || null
return {
index: index,
date: item.date,
value: cur?.name || null,
};
});
return arr;
value: cur?.name || null
}
})
return arr
}
export function getDrawCoolData(type, allData = [], isNumber = true, beginDate) {
const getList = allData
.map((rowBOSItem, index) => {
const rowBOS = rowBOSItem.rowBOS;
const rowBOS = rowBOSItem.rowBOS
const cur =
rowBOS.find((item) => {
return item.typeCode === type;
}) || {};
return item.typeCode === type
}) || {}
return {
index: getIndex(beginDate, cur.date, cur.times),
date: cur.date + cur.times,
value: (isNumber ? +cur.typeValue : cur.typeValue) || null,
};
value: (isNumber ? +cur.typeValue : cur.typeValue) || null
}
})
.map((item) => {
if (item.value) {
// item.value = NaN
}
return item;
});
return getList.sort((a, b) => a.index - b.index);
return item
})
return getList.sort((a, b) => a.index - b.index)
}
// 筛选降温getDrawData
export function getDrawData(type, allData = [], code, beginDate) {
const getList = allData
.map((rowBOSItem, index) => {
const rowBOS = rowBOSItem.rowBOS;
const rowBOS = rowBOSItem.rowBOS
const cur =
rowBOS.find((item) => {
return item.typeCode === type;
}) || {};
return item.typeCode === type
}) || {}
return {
index: getIndex(beginDate, cur.date, cur.times),
date: cur.date + cur.times,
value: (+cur.collectionMode === +code ? +cur.typeValue : null) || null,
};
value: (+cur.collectionMode === +code ? +cur.typeValue : null) || null
}
})
.map((item) => {
if (item.value) {
// item.value = NaN
}
return item;
});
return getList.sort((a, b) => a.index - b.index);
return item
})
return getList.sort((a, b) => a.index - b.index)
}