feat:增加行居中
This commit is contained in:
@@ -172,7 +172,7 @@ export class Draw {
|
|||||||
height: 0,
|
height: 0,
|
||||||
ascent: 0,
|
ascent: 0,
|
||||||
elementList: [],
|
elementList: [],
|
||||||
rowFlex: this.elementList[0].rowFlex
|
rowFlex: this.elementList?.[1].rowFlex
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
for (let i = 0; i < this.elementList.length; i++) {
|
for (let i = 0; i < this.elementList.length; i++) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { Draw } from './core/draw/Draw'
|
|||||||
import { Command } from './core/command/Command'
|
import { Command } from './core/command/Command'
|
||||||
import { CommandAdapt } from './core/command/CommandAdapt'
|
import { CommandAdapt } from './core/command/CommandAdapt'
|
||||||
import { Listener } from './core/listener/Listener'
|
import { Listener } from './core/listener/Listener'
|
||||||
|
import { RowFlex } from './dataset/enum/Row'
|
||||||
|
|
||||||
export default class Editor {
|
export default class Editor {
|
||||||
|
|
||||||
@@ -55,3 +56,9 @@ export default class Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 对外属性
|
||||||
|
export {
|
||||||
|
Editor,
|
||||||
|
RowFlex
|
||||||
|
}
|
||||||
+15
-2
@@ -1,11 +1,17 @@
|
|||||||
import './style.css'
|
import './style.css'
|
||||||
import Editor from './editor'
|
import Editor, { RowFlex } from './editor'
|
||||||
|
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
|
|
||||||
const canvas = document.querySelector<HTMLCanvasElement>('canvas')
|
const canvas = document.querySelector<HTMLCanvasElement>('canvas')
|
||||||
if (!canvas) return
|
if (!canvas) return
|
||||||
const text = `\n主诉:\n发热三天,咳嗽五天。\n现病史:\n发病前14天内有病历报告社区的旅行时或居住史;发病前14天内与新型冠状病毒感染的患者或无症状感染者有接触史;发病前14天内解除过来自病历报告社区的发热或有呼吸道症状的患者;聚集性发病,2周内在小范围如家庭、办公室、学校班级等场所,出现2例及以上发热或呼吸道症状的病例。\n既往史:\n有糖尿病10年,有高血压2年,有传染性疾病1年。\n体格检查:\nT:36.5℃,P:80bpm,R:20次/分,BP:120/80mmHg;\n辅助检查:\n2020年6月10日,普放:血细胞比容36.50%(偏低)40~50;单核细胞绝对值0.75*10^9/L(偏高)参考值:0.1~0.6;\n门诊诊断:\n1.高血压\n处置治疗:\n1.超声引导下甲状腺细针穿刺术;\n2.乙型肝炎表面抗体测定;\n3.膜式病变细胞采集术、后颈皮下肤层;\n4.氯化钠注射液 250ml/袋、1袋;\n5.七叶皂苷钠片(欧开)、30mg/片*24/盒、1片、口服、BID(每日两次)、1天`
|
const text = `人民医院门诊病历\n\n主诉:\n发热三天,咳嗽五天。\n现病史:\n发病前14天内有病历报告社区的旅行时或居住史;发病前14天内与新型冠状病毒感染的患者或无症状感染者有接触史;发病前14天内解除过来自病历报告社区的发热或有呼吸道症状的患者;聚集性发病,2周内在小范围如家庭、办公室、学校班级等场所,出现2例及以上发热或呼吸道症状的病例。\n既往史:\n有糖尿病10年,有高血压2年,有传染性疾病1年。\n体格检查:\nT:36.5℃,P:80bpm,R:20次/分,BP:120/80mmHg;\n辅助检查:\n2020年6月10日,普放:血细胞比容36.50%(偏低)40~50;单核细胞绝对值0.75*10^9/L(偏高)参考值:0.1~0.6;\n门诊诊断:\n1.高血压\n处置治疗:\n1.超声引导下甲状腺细针穿刺术;\n2.乙型肝炎表面抗体测定;\n3.膜式病变细胞采集术、后颈皮下肤层;\n4.氯化钠注射液 250ml/袋、1袋;\n5.七叶皂苷钠片(欧开)、30mg/片*24/盒、1片、口服、BID(每日两次)、1天`
|
||||||
|
// 模拟行居中
|
||||||
|
const centerText = ['人民医院门诊病历']
|
||||||
|
const centerIndex: number[] = centerText.map(c => {
|
||||||
|
const i = text.indexOf(c)
|
||||||
|
return ~i ? Array(c.length).fill(i).map((_, j) => i + j) : []
|
||||||
|
}).flat()
|
||||||
// 模拟加粗字
|
// 模拟加粗字
|
||||||
const boldText = ['主诉:', '现病史:', '既往史:', '体格检查:', '辅助检查:', '门诊诊断:', '处置治疗:']
|
const boldText = ['主诉:', '现病史:', '既往史:', '体格检查:', '辅助检查:', '门诊诊断:', '处置治疗:']
|
||||||
const boldIndex: number[] = boldText.map(b => {
|
const boldIndex: number[] = boldText.map(b => {
|
||||||
@@ -26,6 +32,13 @@ window.onload = function () {
|
|||||||
}).flat()
|
}).flat()
|
||||||
// 组合数据
|
// 组合数据
|
||||||
const data = text.split('').map((value, index) => {
|
const data = text.split('').map((value, index) => {
|
||||||
|
if (centerIndex.includes(index)) {
|
||||||
|
return {
|
||||||
|
value,
|
||||||
|
size: 32,
|
||||||
|
rowFlex: RowFlex.CENTER
|
||||||
|
}
|
||||||
|
}
|
||||||
if (boldIndex.includes(index)) {
|
if (boldIndex.includes(index)) {
|
||||||
return {
|
return {
|
||||||
value,
|
value,
|
||||||
|
|||||||
Reference in New Issue
Block a user