@ -8,13 +8,12 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil ;
import cn.hutool.core.util.StrUtil ;
import com.ccsens.ht.bean.dto.PatientReportDto ;
import com.ccsens.ht.bean.dto.PatientReportDto ;
import com.ccsens.ht.bean.dto.PatientReportSearchDto ;
import com.ccsens.ht.bean.dto.PatientReportSearchDto ;
import com.ccsens.ht.bean.dto.QuestionDto ;
import com.ccsens.ht.bean.po.* ;
import com.ccsens.ht.bean.po.* ;
import com.ccsens.ht.bean.vo.PatientReportSearchVo ;
import com.ccsens.ht.bean.vo.PatientReportSearchVo ;
import com.ccsens.ht.bean.vo.PatientReportVo ;
import com.ccsens.ht.bean.vo.PatientReportVo ;
import com.ccsens.ht.persist.dao.HtDoctorDao ;
import com.ccsens.ht.bean.vo.QuestionVo ;
import com.ccsens.ht.persist.dao.HtPatientReportDao ;
import com.ccsens.ht.persist.dao.* ;
import com.ccsens.ht.persist.dao.HtPositionDao ;
import com.ccsens.ht.persist.dao.HtReportDao ;
import com.ccsens.ht.persist.mapper.HtPatientFollowUpMapper ;
import com.ccsens.ht.persist.mapper.HtPatientFollowUpMapper ;
import com.ccsens.ht.persist.mapper.HtPatientMapper ;
import com.ccsens.ht.persist.mapper.HtPatientMapper ;
import com.ccsens.ht.persist.mapper.HtPatientReportRecordMapper ;
import com.ccsens.ht.persist.mapper.HtPatientReportRecordMapper ;
@ -26,6 +25,7 @@ import com.github.pagehelper.PageInfo;
import com.github.pagehelper.StringUtil ;
import com.github.pagehelper.StringUtil ;
import lombok.extern.slf4j.Slf4j ;
import lombok.extern.slf4j.Slf4j ;
import org.apache.poi.ss.usermodel.Workbook ;
import org.apache.poi.ss.usermodel.Workbook ;
import org.apache.poi.xssf.usermodel.XSSFWorkbook ;
import org.springframework.stereotype.Service ;
import org.springframework.stereotype.Service ;
import org.springframework.transaction.annotation.Propagation ;
import org.springframework.transaction.annotation.Propagation ;
import org.springframework.transaction.annotation.Transactional ;
import org.springframework.transaction.annotation.Transactional ;
@ -65,6 +65,12 @@ public class PatientReportService implements IPatientReportService {
private HtPatientFollowUpMapper htPatientFollowUpMapper ;
private HtPatientFollowUpMapper htPatientFollowUpMapper ;
@Resource
@Resource
private HtReportDao htReportDao ;
private HtReportDao htReportDao ;
@Resource
private RedisUtil redisUtil ;
@Resource
private HtQuestionDao htQuestionDao ;
@Resource
private IQuestionService questionService ;
@Override
@Override
public JsonResponse < PatientReportVo . Generate > generatePatientReport ( PatientReportDto . Generate generate , Long userId ) {
public JsonResponse < PatientReportVo . Generate > generatePatientReport ( PatientReportDto . Generate generate , Long userId ) {
@ -235,7 +241,7 @@ public class PatientReportService implements IPatientReportService {
}
}
private void initNPI ( long id , PatientReportVo . ReportScore score ) {
private void initNPI ( long id , PatientReportVo . ReportScore score ) {
List < Map < String , Object > > list = htPatientReportDao . queryNPI Score ( id ) ;
List < Map < String , Object > > list = htPatientReportDao . queryNpi Score ( id ) ;
Map < String , Object > npiScore = new HashMap < > ( ) ;
Map < String , Object > npiScore = new HashMap < > ( ) ;
list . forEach ( map - > npiScore . put ( ( String ) map . get ( "optionName" ) , map . get ( "score" ) ) ) ;
list . forEach ( map - > npiScore . put ( ( String ) map . get ( "optionName" ) , map . get ( "score" ) ) ) ;
PatientReportVo . ReportScore carer = new PatientReportVo . ReportScore ( ) ;
PatientReportVo . ReportScore carer = new PatientReportVo . ReportScore ( ) ;
@ -367,7 +373,9 @@ public class PatientReportService implements IPatientReportService {
content . add ( row ) ;
content . add ( row ) ;
initLast ( content , 8 ) ;
initLast ( content , 8 ) ;
String path = PropUtil . imgDomain + "/" + PdfUtil . createPdf ( PropUtil . path , detail . getPatient ( ) . getHospital ( ) , Constant . Ht . Report . PARENT_NAME , new PdfUtil . Margin ( ) , detail . getPatient ( ) . toPdfRow ( ) , content ) ;
String [ ] split = detail . getPatient ( ) . getHospital ( ) . split ( "" ) ;
String title = String . join ( " " , split ) ;
String path = PropUtil . imgDomain + "/" + PdfUtil . createPdf ( PropUtil . path , title , Constant . Ht . Report . PARENT_NAME , new PdfUtil . Margin ( ) , detail . getPatient ( ) . toPdfRow ( ) , content ) ;
report . setUrl ( path ) ;
report . setUrl ( path ) ;
htPatientReportDao . updateByPrimaryKeySelective ( report ) ;
htPatientReportDao . updateByPrimaryKeySelective ( report ) ;
log . info ( "生成文件路径:{}" , path ) ;
log . info ( "生成文件路径:{}" , path ) ;
@ -457,6 +465,19 @@ public class PatientReportService implements IPatientReportService {
@Override
@Override
public PageInfo < PatientReportVo . ReportName > queryAllReports ( PatientReportDto . AdminQueryReport adminQueryReport , Long userId ) {
public PageInfo < PatientReportVo . ReportName > queryAllReports ( PatientReportDto . AdminQueryReport adminQueryReport , Long userId ) {
PageHelper . startPage ( adminQueryReport . getPageNum ( ) , adminQueryReport . getPageSize ( ) ) ;
PageHelper . startPage ( adminQueryReport . getPageNum ( ) , adminQueryReport . getPageSize ( ) ) ;
List < PatientReportDto . Score > scores = adminQueryReport . getScores ( ) ;
if ( CollectionUtil . isNotEmpty ( scores ) ) {
Iterator < PatientReportDto . Score > iterator = scores . iterator ( ) ;
while ( iterator . hasNext ( ) ) {
PatientReportDto . Score next = iterator . next ( ) ;
if ( next . getStart ( ) = = null & & next . getEnd ( ) = = null ) {
iterator . remove ( ) ;
}
}
}
List < PatientReportVo . ReportName > reportNames = htPatientReportDao . queryAllReports ( adminQueryReport ) ;
List < PatientReportVo . ReportName > reportNames = htPatientReportDao . queryAllReports ( adminQueryReport ) ;
return new PageInfo < > ( reportNames ) ;
return new PageInfo < > ( reportNames ) ;
}
}
@ -624,33 +645,379 @@ public class PatientReportService implements IPatientReportService {
//查询报告单信息和病人信息
//查询报告单信息和病人信息
PatientReportVo . ReprotPatient reportPatient = htPatientReportDao . queryReportResult ( param . getId ( ) ) ;
PatientReportVo . ReprotPatient reportPatient = htPatientReportDao . queryReportResult ( param . getId ( ) ) ;
if ( reportPatient = = null ) {
throw new BaseException ( CodeEnum . PARAM_ERROR ) ;
}
//查询报告单分数
//查询报告单分数
List < PatientReportVo . ReportScore > reportScores = htPatientReportDao . queryReportScore2 ( param . getId ( ) , param . getCode ( ) ) ;
List < PatientReportVo . ReportScore > reportScores = htPatientReportDao . queryReportScore2 ( param . getId ( ) , param . getCode ( ) ) ;
if ( ! Constant . Ht . Report . ADL . equals ( param . getCode ( ) ) ) {
if ( ! Constant . Ht . Report . ADL . equals ( param . getCode ( ) ) ) {
getReportScores ( param , content , reportScores ) ;
getReportScores ( param , content , reportScores , reportPatient ) ;
}
}
String subHead = CollectionUtil . isEmpty ( reportScores ) ? "" : reportScores . get ( 0 ) . getName ( ) + "(" + reportScores . get ( 0 ) . getCode ( ) + ")报告单" ;
String subHead = CollectionUtil . isEmpty ( reportScores ) ? "" : reportScores . get ( 0 ) . getName ( ) + "(" + reportScores . get ( 0 ) . getCode ( ) + ")报告单" ;
PdfUtil . Margin margin = new PdfUtil . Margin ( ) ;
PdfUtil . Margin margin = new PdfUtil . Margin ( ) ;
margin . setTop ( 12 ) ;
margin . setTop ( 24 ) ;
margin . setBottom ( 12 ) ;
margin . setBottom ( 24 ) ;
margin . setLeft ( 36 ) ;
margin . setLeft ( 64 ) ;
String path = PropUtil . imgDomain + "/" + PdfUtil . createPdf ( PropUtil . path , reportPatient . getHospital ( ) , subHead , margin , reportPatient . toPdfSimpleCodeRow ( ) , questionTable , content ) ;
margin . setRight ( 64 ) ;
String [ ] split = reportPatient . getHospital ( ) . split ( "" ) ;
String title = String . join ( " " , split ) ;
String path = PropUtil . imgDomain + "/" + PdfUtil . createPdf ( PropUtil . path , title , subHead , margin , reportPatient . toPdfSimpleCodeRow ( ) , questionTable , content ) ;
log . info ( "{}报告单导出路径:{}" , param , path ) ;
log . info ( "{}报告单导出路径:{}" , param , path ) ;
return path ;
return path ;
}
}
@Override
@Override
public Workbook exportAnalyse ( List < PatientReportDto . ExportSpecial > param , Long userId ) {
public Workbook exportAnalyse ( List < Long > ids ) {
List < PatientReportVo . Analyse > analyses = htPatientReportDao . queryReportAnalyseScore ( ids ) ;
int total = 124 ;
List < List < PoiUtil . PoiUtilCell > > rows = new ArrayList < > ( ) ;
// 标题 表头
initAnalyseTitle ( rows , total ) ;
if ( CollectionUtil . isEmpty ( analyses ) ) {
Workbook workbook = new XSSFWorkbook ( ) ; ;
PoiUtil . exportWB ( "报告单详情" , rows , workbook ) ;
return workbook ;
}
// 填充数据
for ( int i = 0 ; i < analyses . size ( ) ; i + + ) {
List < PoiUtil . PoiUtilCell > row = new ArrayList < > ( ) ;
row . add ( new PoiUtil . PoiUtilCell ( String . valueOf ( i + 1 ) , 1 , 1 ) ) ;
for ( int j = 1 ; j < total ; j + + ) {
row . add ( new PoiUtil . PoiUtilCell ( "" , 1 , 1 ) ) ;
}
fillAnalyse ( row , analyses . get ( i ) ) ;
rows . add ( row ) ;
}
// PoiUtil.
return null ;
Workbook workbook = new XSSFWorkbook ( ) ; ;
PoiUtil . exportWB ( "报告单详情" , rows , workbook ) ;
return workbook ;
}
}
private List < PatientReportVo . ReportScore > getReportScores ( PatientReportDto . ExportCode param , List < PdfUtil . Row > content , List < PatientReportVo . ReportScore > reportScores ) {
private Long getQuestionId ( String code , int sort ) {
String key = "ht_question_" + code + "_" + sort ;
Object value = redisUtil . get ( key ) ;
if ( value ! = null ) {
return ( Long ) value ;
}
HtQuestionExample questionExample = new HtQuestionExample ( ) ;
questionExample . createCriteria ( ) . andParentCodeEqualTo ( code ) . andSortEqualTo ( sort ) ;
List < HtQuestion > htQuestions = htQuestionDao . selectByExample ( questionExample ) ;
if ( CollectionUtil . isEmpty ( htQuestions ) ) {
return null ;
}
Long id = htQuestions . get ( 0 ) . getId ( ) ;
redisUtil . set ( key , id ) ;
return id ;
}
/ * *
* 填充导出分析
* @param row 表格
* @param analyse 分析
* /
private void fillAnalyse ( List < PoiUtil . PoiUtilCell > row , PatientReportVo . Analyse analyse ) {
row . get ( 1 ) . setValue ( DateUtil . format ( new Date ( analyse . getReportTime ( ) ) , "yyyy.MM.dd" ) ) ;
row . get ( 2 ) . setValue ( analyse . getPatientName ( ) ) ;
row . get ( 3 ) . setValue ( analyse . getSex ( ) = = 0 ? "男" : "女" ) ;
row . get ( 4 ) . setValue ( String . valueOf ( analyse . getPatientAge ( ) ) ) ;
row . get ( 5 ) . setValue ( Constant . Ht . getEducational ( analyse . getEducationalStatus ( ) ) ) ;
row . get ( 6 ) . setValue ( Constant . Ht . getCareer ( analyse . getCareer ( ) ) ) ;
row . get ( 7 ) . setValue ( analyse . getClinicalDiagnosis ( ) ) ;
row . get ( 8 ) . setValue ( Constant . Ht . getPasi ( analyse . getPasi ( ) ) ) ;
// MMSE分数
if ( CollectionUtil . isNotEmpty ( analyse . getMmseScores ( ) ) ) {
analyse . getMmseScores ( ) . forEach ( score - > {
switch ( score . getCode ( ) ) {
case "DXL" : row . get ( 9 ) . setValue ( score . getScore ( ) . intValue ( ) + "" ) ; break ;
case "JYL" : row . get ( 10 ) . setValue ( score . getScore ( ) . intValue ( ) + "" ) ; break ;
case "ZYLHJSL" : row . get ( 11 ) . setValue ( score . getScore ( ) . intValue ( ) + "" ) ; break ;
case "HYNL" : row . get ( 12 ) . setValue ( score . getScore ( ) . intValue ( ) + "" ) ; break ;
case "YYNL" : row . get ( 13 ) . setValue ( score . getScore ( ) . intValue ( ) + "" ) ; break ;
case "JGNL" : row . get ( 14 ) . setValue ( score . getScore ( ) . intValue ( ) + "" ) ; break ;
}
} ) ;
}
// MOCA匹配
if ( CollectionUtil . isNotEmpty ( analyse . getMocaScores ( ) ) ) {
for ( int i = 0 ; i < analyse . getMocaScores ( ) . size ( ) ; i + + ) {
PatientReportVo . MoCAScore score = analyse . getMocaScores ( ) . get ( i ) ;
if ( score . getSort ( ) < = 3 ) {
row . get ( 15 + score . getSort ( ) ) . setValue ( score . getScore ( ) . intValue ( ) + "" ) ;
} else if ( score . getSort ( ) = = 4 | | score . getSort ( ) = = 5 | | score . getSort ( ) = = 6 ) {
String value = row . get ( 19 ) . getValue ( ) ;
int s = StrUtil . isEmpty ( value ) ? 0 : Integer . parseInt ( value ) ;
row . get ( 19 ) . setValue ( String . valueOf ( s + score . getScore ( ) . intValue ( ) ) ) ;
} else if ( score . getSort ( ) > = 7 & & score . getSort ( ) < = 12 ) {
row . get ( 13 + score . getSort ( ) ) . setValue ( score . getScore ( ) . intValue ( ) + "" ) ;
} else if ( score . getSort ( ) = = 13 | | score . getSort ( ) = = 14 ) {
String value = row . get ( 26 ) . getValue ( ) ;
int s = StrUtil . isEmpty ( value ) ? 0 : Integer . parseInt ( value ) ;
row . get ( 26 ) . setValue ( String . valueOf ( s + score . getScore ( ) . intValue ( ) ) ) ;
} else if ( score . getSort ( ) > = 15 & & score . getSort ( ) < = 17 ) {
row . get ( 12 + score . getSort ( ) ) . setValue ( score . getScore ( ) . intValue ( ) + "" ) ;
} else if ( score . getSort ( ) = = 20 | | score . getSort ( ) = = 21 ) {
row . get ( 10 + score . getSort ( ) ) . setValue ( score . getScore ( ) . intValue ( ) + "" ) ;
} else if ( score . getSort ( ) = = 18 ) {
row . get ( 32 ) . setValue ( score . getScore ( ) . intValue ( ) + "" ) ;
}
}
}
// 报告单一总成绩
if ( CollectionUtil . isNotEmpty ( analyse . getTotalScores ( ) ) ) {
analyse . getTotalScores ( ) . forEach ( totalScore - > {
switch ( totalScore . getEvaluationCode ( ) ) {
case "MMSE" : row . get ( 15 ) . setValue ( totalScore . getTotalScore ( ) . intValue ( ) + "" ) ; break ;
case "MoCA" : row . get ( 33 ) . setValue ( totalScore . getTotalScore ( ) . intValue ( ) + "" ) ; break ;
case "ADL" : row . get ( 34 ) . setValue ( totalScore . getTotalScore ( ) . intValue ( ) + "" ) ; break ;
case "HAMA" : row . get ( 35 ) . setValue ( totalScore . getTotalScore ( ) . intValue ( ) + "" ) ; break ;
case "HAMD" : row . get ( 36 ) . setValue ( totalScore . getTotalScore ( ) . intValue ( ) + "" ) ; break ;
case "NPI" : row . get ( 37 ) . setValue ( totalScore . getTotalScore ( ) . intValue ( ) + "" ) ; break ;
}
} ) ;
}
// 画钟
// 画钟题目ID
Long hzId = getQuestionId ( "HZ" , 3 ) ;
QuestionDto . QueryPatientCanvas hzQuery = new QuestionDto . QueryPatientCanvas ( ) ;
hzQuery . setPatientReportId ( analyse . getId ( ) ) ;
hzQuery . setQuestionId ( hzId ) ;
List < QuestionVo . PatientCanvas > patientCanvas = questionService . getCanvas ( hzQuery , null ) ;
if ( CollectionUtil . isNotEmpty ( patientCanvas ) ) {
Integer height = patientCanvas . get ( 0 ) . getCanvas ( ) . getHeight ( ) ;
QuestionVo . Parameter parameters = patientCanvas . get ( 0 ) . getParameters ( ) ;
// 完成总时间
row . get ( 38 ) . setValue ( parameters . getTotalDuration ( ) + "ms" ) ;
row . get ( 39 ) . setValue ( parameters . getPaintTime ( ) + "ms" ) ;
row . get ( 40 ) . setValue ( parameters . getReflectOnTime ( ) + "ms" ) ;
row . get ( 44 ) . setValue ( String . valueOf ( parameters . getLineParameterList ( ) . size ( ) ) ) ;
row . get ( 45 ) . setValue ( String . valueOf ( parameters . getAveTimes ( ) ) ) ;
row . get ( 46 ) . setValue ( pxToMm ( parameters . getAveLength ( ) , height ) + "mm" ) ;
row . get ( 47 ) . setValue ( pxToMm ( parameters . getLongLine ( ) , height ) + "mm" ) ;
row . get ( 51 ) . setValue ( pxToMm ( parameters . getLongSpeed ( ) * 1000 , height ) + "mm/s" ) ;
row . get ( 52 ) . setValue ( pxToSquare ( parameters . getMinCircleAcreage ( ) . doubleValue ( ) , height ) + "mm²" ) ;
row . get ( 53 ) . setValue ( pxToMm ( parameters . getShowCentreCoordinate ( ) . getX ( ) , height ) + "mm" ) ;
row . get ( 54 ) . setValue ( pxToMm ( parameters . getShowCentreCoordinate ( ) . getY ( ) , height ) + "mm" ) ;
}
Long simpleId = getQuestionId ( "EasyOne" , 4 ) ;
initSimple ( row , analyse , simpleId , 55 ) ;
Long simpleThreeId = getQuestionId ( "EasyTwo" , 5 ) ;
initSimple ( row , analyse , simpleThreeId , 78 ) ;
Long simpleTwentyId = getQuestionId ( "EasyThree" , 6 ) ;
initSimple ( row , analyse , simpleTwentyId , 101 ) ;
}
public String pxToMm ( double length , Integer height ) {
return new BigDecimal ( 144 ) . multiply ( new BigDecimal ( length ) ) . divide ( new BigDecimal ( height ) , 2 , BigDecimal . ROUND_HALF_UP ) . toString ( ) ;
}
public String pxToSquare ( double length , Integer height ) {
return new BigDecimal ( 144 * 144 ) . multiply ( new BigDecimal ( length ) ) . divide ( new BigDecimal ( height * height ) , 2 , BigDecimal . ROUND_HALF_UP ) . toString ( ) ;
}
private void initSimple ( List < PoiUtil . PoiUtilCell > row , PatientReportVo . Analyse analyse , Long simpleId , int startIndex ) {
QuestionDto . QueryPatientCanvas simpleQuery = new QuestionDto . QueryPatientCanvas ( ) ;
simpleQuery . setPatientReportId ( analyse . getId ( ) ) ;
simpleQuery . setQuestionId ( simpleId ) ;
List < QuestionVo . PatientCanvas > simpleCanvas = questionService . getCanvas ( simpleQuery , null ) ;
if ( CollectionUtil . isNotEmpty ( simpleCanvas ) ) {
QuestionVo . Parameter parameters = simpleCanvas . get ( 0 ) . getParameters ( ) ;
Integer height = simpleCanvas . get ( 0 ) . getCanvas ( ) . getHeight ( ) ;
// 完成总时间
row . get ( startIndex ) . setValue ( parameters . getTotalDuration ( ) + "ms" ) ;
row . get ( startIndex + 1 ) . setValue ( parameters . getPaintTime ( ) + "ms" ) ;
row . get ( startIndex + 2 ) . setValue ( parameters . getReflectOnTime ( ) + "ms" ) ;
row . get ( startIndex + 3 ) . setValue ( String . valueOf ( parameters . getLineParameterList ( ) . size ( ) ) ) ;
row . get ( startIndex + 4 ) . setValue ( parameters . getAveTimes ( ) + "" ) ;
row . get ( startIndex + 5 ) . setValue ( pxToMm ( parameters . getAveLength ( ) , height ) + "mm" ) ;
row . get ( startIndex + 6 ) . setValue ( pxToMm ( parameters . getLongLine ( ) , height ) + "mm" ) ;
row . get ( startIndex + 8 ) . setValue ( pxToMm ( parameters . getLongSpeed ( ) * 1000 , height ) + "mm/s" ) ;
row . get ( startIndex + 9 ) . setValue ( pxToSquare ( parameters . getMinRectangleAcreage ( ) , height ) + "mm²" ) ;
row . get ( startIndex + 10 ) . setValue ( pxToMm ( parameters . getShowCentreCoordinate ( ) . getX ( ) , height ) + "mm" ) ;
row . get ( startIndex + 11 ) . setValue ( pxToMm ( parameters . getShowCentreCoordinate ( ) . getY ( ) , height ) + "mm" ) ;
row . get ( startIndex + 12 ) . setValue ( pxToMm ( parameters . getRight ( ) . getX ( ) , height ) + "mm" ) ;
row . get ( startIndex + 13 ) . setValue ( pxToMm ( parameters . getRight ( ) . getY ( ) , height ) + "mm" ) ;
row . get ( startIndex + 15 ) . setValue ( String . valueOf ( parameters . getLongNums ( ) ) ) ;
row . get ( startIndex + 16 ) . setValue ( String . valueOf ( parameters . getShortNums ( ) ) ) ;
row . get ( startIndex + 17 ) . setValue ( parameters . getTransitionTime ( ) + "ms" ) ;
row . get ( startIndex + 18 ) . setValue ( parameters . getFiveLongLinesTime ( ) + "ms" ) ;
row . get ( startIndex + 19 ) . setValue ( parameters . getLongLineRate ( ) + "%" ) ;
}
}
private void initAnalyseTitle ( List < List < PoiUtil . PoiUtilCell > > rows , int total ) {
List < PoiUtil . PoiUtilCell > headRow = new ArrayList < > ( ) ;
PoiUtil . PoiUtilCell headCell = new PoiUtil . PoiUtilCell ( ) ;
headCell . setColspan ( total ) ;
headCell . setValue ( "认知功能神经心理量表检查报告单" ) ;
headRow . add ( headCell ) ;
rows . add ( headRow ) ;
log . info ( "标题:{}" , headCell ) ;
List < PoiUtil . PoiUtilCell > oneTitleRow = new ArrayList < > ( ) ;
oneTitleRow . add ( new PoiUtil . PoiUtilCell ( "序号" , 1 , 2 ) ) ;
oneTitleRow . add ( new PoiUtil . PoiUtilCell ( "基本信息" , 8 , 1 ) ) ;
for ( int i = 0 ; i < 7 ; i + + ) {
oneTitleRow . add ( new PoiUtil . PoiUtilCell ( "" , 1 , 1 ) ) ;
}
oneTitleRow . add ( new PoiUtil . PoiUtilCell ( "MMSE" , 7 , 1 ) ) ;
for ( int i = 0 ; i < 6 ; i + + ) {
oneTitleRow . add ( new PoiUtil . PoiUtilCell ( "" , 1 , 1 ) ) ;
}
oneTitleRow . add ( new PoiUtil . PoiUtilCell ( "MoCA" , 18 , 1 ) ) ;
for ( int i = 0 ; i < 17 ; i + + ) {
oneTitleRow . add ( new PoiUtil . PoiUtilCell ( "" , 1 , 1 ) ) ;
}
oneTitleRow . add ( new PoiUtil . PoiUtilCell ( "其他量表" , 4 , 1 ) ) ;
for ( int i = 0 ; i < 3 ; i + + ) {
oneTitleRow . add ( new PoiUtil . PoiUtilCell ( "" , 1 , 1 ) ) ;
}
oneTitleRow . add ( new PoiUtil . PoiUtilCell ( "画钟" , 17 , 1 ) ) ;
for ( int i = 0 ; i < 16 ; i + + ) {
oneTitleRow . add ( new PoiUtil . PoiUtilCell ( "" , 1 , 1 ) ) ;
}
oneTitleRow . add ( new PoiUtil . PoiUtilCell ( "简单图形测验" , 23 , 1 ) ) ;
for ( int i = 0 ; i < 22 ; i + + ) {
oneTitleRow . add ( new PoiUtil . PoiUtilCell ( "" , 1 , 1 ) ) ;
}
oneTitleRow . add ( new PoiUtil . PoiUtilCell ( "3min回忆" , 23 , 1 ) ) ;
for ( int i = 0 ; i < 22 ; i + + ) {
oneTitleRow . add ( new PoiUtil . PoiUtilCell ( "" , 1 , 1 ) ) ;
}
oneTitleRow . add ( new PoiUtil . PoiUtilCell ( "20min延迟回忆" , 23 , 1 ) ) ;
for ( int i = 0 ; i < 22 ; i + + ) {
oneTitleRow . add ( new PoiUtil . PoiUtilCell ( "" , 1 , 1 ) ) ;
}
rows . add ( oneTitleRow ) ;
List < PoiUtil . PoiUtilCell > titleRow = new ArrayList < > ( ) ;
// 基本信息
titleRow . add ( new PoiUtil . PoiUtilCell ( "" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "测评日期" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "姓名" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "性别" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "年龄" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "文化程度" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "职业" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "临床诊断" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "严重程度" ) ) ;
// MMSE
titleRow . add ( new PoiUtil . PoiUtilCell ( "定向力" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "记忆力" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "注意力和计算力" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "回忆能力" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "语言能力" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "结构能力" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "总分" ) ) ;
// MoCA
titleRow . add ( new PoiUtil . PoiUtilCell ( "连线测验" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "立方体" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "画钟" ) ) ;
// 命名 4-6
titleRow . add ( new PoiUtil . PoiUtilCell ( "命名" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "记忆1" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "记忆2" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "注意顺背" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "注意倒背" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "注意敲1" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "注意100-7" ) ) ;
// 语言重复 13-14
titleRow . add ( new PoiUtil . PoiUtilCell ( "语言重复" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "流畅性1min" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "抽象" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "延迟回忆" ) ) ;
// 20
titleRow . add ( new PoiUtil . PoiUtilCell ( "分类提示" ) ) ;
// 21
titleRow . add ( new PoiUtil . PoiUtilCell ( "多选提示" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "定向" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "总分" ) ) ;
// 其他量表总分
titleRow . add ( new PoiUtil . PoiUtilCell ( "ADL总分" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "HAMA总分" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "HAMD总分" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "NPI总分" ) ) ;
// 画钟
//38
titleRow . add ( new PoiUtil . PoiUtilCell ( "完成总时间" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "落笔时间" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "思考时间" ) ) ;
// 41-42 空字符
titleRow . add ( new PoiUtil . PoiUtilCell ( "钟面后延迟时间" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "第一指针延迟时间" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "第二指针延迟时间" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "总笔画数" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "每分钟笔画数" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "平均长度" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "最长笔画长度" ) ) ;
// 48 49 空字符串
titleRow . add ( new PoiUtil . PoiUtilCell ( "时针长度" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "分针长度" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "平均速度" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "最长笔画速度" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "最小外接圆面积" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "图形中心水平位置" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "图形中心垂直位置" ) ) ;
// 简单图形测验
// 55
fillSimplePicture ( titleRow ) ;
fillSimplePicture ( titleRow ) ;
fillSimplePicture ( titleRow ) ;
rows . add ( titleRow ) ;
}
private void fillSimplePicture ( List < PoiUtil . PoiUtilCell > titleRow ) {
titleRow . add ( new PoiUtil . PoiUtilCell ( "完成总时间" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "落笔时间" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "思考时间" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "总笔画数" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "每分钟笔画数" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "平均长度" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "最长笔画长度" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "平均速度" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "最长笔画速度" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "最小外接长方形面积" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "图形中心水平位置" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "图形中心垂直位置" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "图形顶边距离绘图区域中心的距离" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "图形底边距离绘图区域中心的距离" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "每条笔画的长度" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "长笔画数量" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "短笔画数量" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "所有短长笔画序列的过渡时间" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "5个早期长笔画的经过时间" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "前5笔长笔画率" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "相似系数" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "图形重心水平位置" ) ) ;
titleRow . add ( new PoiUtil . PoiUtilCell ( "图形重心垂直位置" ) ) ;
}
private List < PatientReportVo . ReportScore > getReportScores ( PatientReportDto . ExportCode param , List < PdfUtil . Row > content , List < PatientReportVo . ReportScore > reportScores , PatientReportVo . ReprotPatient reportPatient ) {
long reportId = param . getId ( ) ;
long reportId = param . getId ( ) ;
//重新封装报告单信息
//重新封装报告单信息
List < PatientReportVo . ReportScore > scores = getReportScores ( reportScores , reportId ) ;
List < PatientReportVo . ReportScore > scores = getReportScores ( reportScores , reportId ) ;
@ -663,8 +1030,8 @@ public class PatientReportService implements IPatientReportService {
int titleSpan = 2 ;
int titleSpan = 2 ;
PdfUtil . Cell initWordCell = addCell ( row , "初步印象" , titleSpan , 2 ) ;
PdfUtil . Cell initWordCell = addCell ( row , "初步印象" , titleSpan , 2 ) ;
initWordCell . setHeight ( PdfUtil . Cell . defaultHeight * 2 ) ;
initWordCell . setHeight ( PdfUtil . Cell . defaultHeight * 2 ) ;
String initialImpression = "" ;
String initialImpression = reportPatient . getInitialImpression ( ) ;
PdfUtil . Cell initImplCell = addCell ( row , initialImpression , colNum - titleSpan , 2 ) ;
PdfUtil . Cell initImplCell = addCell ( row , "" , colNum - titleSpan , 2 ) ;
initImplCell . setHeight ( PdfUtil . Cell . defaultHeight * 2 ) ;
initImplCell . setHeight ( PdfUtil . Cell . defaultHeight * 2 ) ;
initImplCell . setBorderRight ( 1 ) ;
initImplCell . setBorderRight ( 1 ) ;
initImplCell . setCenter ( false ) ;
initImplCell . setCenter ( false ) ;
@ -745,14 +1112,20 @@ public class PatientReportService implements IPatientReportService {
// 检查目的
// 检查目的
if ( StrUtil . isNotBlank ( title . checkPurpose ) ) {
if ( StrUtil . isNotBlank ( title . checkPurpose ) ) {
PdfUtil . Row row = new PdfUtil . Row ( ) ;
PdfUtil . Row row = new PdfUtil . Row ( ) ;
row . setHeight ( 100 ) ;
PdfUtil . Cell cell = addCell ( row , title . checkPurpose , ( title . optionList . size ( ) + questionSpan + 1 ) * cols , 1 ) ;
PdfUtil . Cell cell = addCell ( row , title . checkPurpose , ( title . optionList . size ( ) + questionSpan + 1 ) * cols , 1 ) ;
cell . setCenter ( false ) ;
cell . setCenter ( false ) ;
cell . setBorderRight ( 1 ) ;
cell . setBorderRight ( 1 ) ;
cell . setHeight ( 36 ) ;
questionTable . add ( row ) ;
questionTable . add ( row ) ;
}
}
// 设置表头
// 设置表头
PdfUtil . Row row1 = new PdfUtil . Row ( ) ;
PdfUtil . Row row1 = new PdfUtil . Row ( ) ;
PdfUtil . Row row2 = new PdfUtil . Row ( ) ;
PdfUtil . Row row2 = new PdfUtil . Row ( ) ;
if ( ! Constant . Ht . Report . HAMA . equals ( code ) ) {
row2 . setFontSize ( 10 ) ;
}
for ( int i = 0 ; i < cols ; i + + ) {
for ( int i = 0 ; i < cols ; i + + ) {
addCell ( row1 , "序号" , 1 , 2 ) ;
addCell ( row1 , "序号" , 1 , 2 ) ;
// addCell(row2, "", 1, 1);
// addCell(row2, "", 1, 1);