| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- /**
- * 解析舌象异常数据
- * @param {{title: string; cover: string; descriptions: string[]; tags: string[];}[]} exception
- * @param {{actualList: Record<string, any>[]}} [data]
- * @return {string}
- */
- function fromReportTongueExceptionData(exception, data) {
- if (data == null || !Array.isArray(data.actualList)) return '';
- return data.actualList.map(item => {
- if (!item) return '';
- let title = item.actualValue || '';
- const suffix = item.contrast || 's';
- if (suffix !== 's') {
- title += ` (${suffix || ''}) `;
- exception.push({
- title, cover: item.splitImage,
- descriptions: [
- item.features ? `【特征】${item.features}` : '',
- item.clinicalSignificance ? `【临床意义】${item.clinicalSignificance}` : '',
- ].filter(Boolean),
- tags: item.attrs ?? [],
- });
- }
- return title;
- }).join('<br>');
- }
- /**
- * 解析舌面象数据
- * @param {Record<string, any>} data
- */
- export function fromTongueAndFaceAnalysisModel(data) {
- if (data == null || typeof data !== 'object') data = {};
- const tongueException = [];
- const fromTongueException = fromReportTongueExceptionData.bind(null, tongueException);
- const fromTongueValue = (data) => data && typeof data === 'object' ? data.standardValue || '' : '';
- return {
- tongueTable: {
- column: ['舌象维度', '检测结果', '标准值'],
- data: [
- ['舌色', fromTongueException(data.tongueColor), fromTongueValue(data.tongueColor)],
- ['苔色', fromTongueException(data.tongueCoatingColor), fromTongueValue(data.tongueCoatingColor)],
- ['舌形', fromTongueException(data.tongueShape), fromTongueValue(data.tongueShape)],
- ['苔质', fromTongueException(data.tongueCoating), fromTongueValue(data.tongueCoating)],
- ['津液', fromTongueException(data.bodyFluid), fromTongueValue(data.bodyFluid)],
- ['舌下', fromTongueException(data.sublingualVein), fromTongueValue(data.sublingualVein)],
- ],
- },
- tongueException,
- tongueAnalysis: {
- ['结果']: data.tongueAnalysisResult,
- ['舌上']: data.upImg,
- ['舌下']: data.downImg,
- },
- faceAnalysis: {
- ['结果']: data.faceAnalysisResult,
- ['面象']: data.faceImg,
- },
- }
- }
|