Browse Source

Merge branch 'pt' of dd.tall.wiki:ccsens_wiki/ccsenscloud into pt

recovery
wang1007152140 5 years ago
parent
commit
21910274bf
  1. 60
      tcm/src/main/java/com/ccsens/tcm/api/ImportController.java
  2. 12
      tcm/src/main/java/com/ccsens/tcm/bean/po/PatientInformation.java
  3. 40
      tcm/src/main/java/com/ccsens/tcm/bean/po/PatientInformationExample.java
  4. 12
      tcm/src/main/java/com/ccsens/tcm/bean/po/Question.java
  5. 58
      tcm/src/main/java/com/ccsens/tcm/bean/po/QuestionExample.java
  6. 19
      tcm/src/main/java/com/ccsens/tcm/persist/dao/QuestionDao.java
  7. 19
      tcm/src/main/java/com/ccsens/tcm/persist/dao/QuestionOptionDao.java
  8. 19
      tcm/src/main/java/com/ccsens/tcm/persist/dao/ReportCodeDao.java
  9. 21
      tcm/src/main/java/com/ccsens/tcm/service/IImportService.java
  10. 223
      tcm/src/main/java/com/ccsens/tcm/service/ImportService.java
  11. 56
      tcm/src/main/java/com/ccsens/tcm/uitl/Constant.java
  12. 4
      tcm/src/main/resources/application-dev.yml
  13. 31
      tcm/src/main/resources/mapper_dao/QuestionDao.xml
  14. 26
      tcm/src/main/resources/mapper_dao/QuestionOptionDao.xml
  15. 32
      tcm/src/main/resources/mapper_dao/ReportCodeDao.xml
  16. 28
      tcm/src/main/resources/mapper_raw/PatientInformationMapper.xml
  17. 28
      tcm/src/main/resources/mapper_raw/PatientRecordMapper.xml
  18. 28
      tcm/src/main/resources/mapper_raw/QuestionMapper.xml
  19. 32
      tcm/src/main/resources/mapper_raw/ReportCodeMapper.xml

60
tcm/src/main/java/com/ccsens/tcm/api/ImportController.java

@ -0,0 +1,60 @@
package com.ccsens.tcm.api;
import com.ccsens.tcm.service.IImportService;
import com.ccsens.tcm.uitl.Constant;
import com.ccsens.util.JsonResponse;
import com.ccsens.util.PropUtil;
import com.ccsens.util.UploadFileUtil_Servlet3;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.Part;
import java.io.File;
/**
* @author
*/
@Slf4j
@Api(tags = "试题相关接口")
@RestController
@RequestMapping("/import")
public class ImportController {
@Resource
private IImportService importService;
@ApiOperation(value = "导入试题类型",notes = "文件大小不能超过20M,支持后缀:.xls|.xlsx")
@ApiImplicitParams({})
@RequestMapping(value = "/code", method = RequestMethod.POST)
public JsonResponse importCode(@RequestParam(required = true) Part file) throws Exception{
//1.上传文件
String allowedExts = "xls,xlsx";
String dir = PropUtil.path;
String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir);
File excelFile = new File(dir+path);
importService.importReport(excelFile);
log.info("导入试题类型成功");
return JsonResponse.newInstance().ok();
}
@ApiOperation(value = "导入病史相关",notes = "文件大小不能超过20M,支持后缀:.xls|.xlsx")
@ApiImplicitParams({})
@RequestMapping(value = "/BSXG", method = RequestMethod.POST)
public JsonResponse importBsxg(@RequestParam(required = true) Part file) throws Exception{
//1.上传文件
String allowedExts = "xls,xlsx";
String dir = PropUtil.path;
String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir);
File excelFile = new File(dir+path);
importService.importBsxg(excelFile, Constant.Report.CODE_BSXG);
log.info("导入病史相关成功");
return JsonResponse.newInstance().ok();
}
}

12
tcm/src/main/java/com/ccsens/tcm/bean/po/PatientInformation.java

@ -8,11 +8,11 @@ public class PatientInformation implements Serializable {
private String hospitalization; private String hospitalization;
private Integer inpatientId; private Long inpatientId;
private Byte inputStatus; private Byte inputStatus;
private Integer hospitalId; private Long hospitalId;
private Long userId; private Long userId;
@ -40,11 +40,11 @@ public class PatientInformation implements Serializable {
this.hospitalization = hospitalization == null ? null : hospitalization.trim(); this.hospitalization = hospitalization == null ? null : hospitalization.trim();
} }
public Integer getInpatientId() { public Long getInpatientId() {
return inpatientId; return inpatientId;
} }
public void setInpatientId(Integer inpatientId) { public void setInpatientId(Long inpatientId) {
this.inpatientId = inpatientId; this.inpatientId = inpatientId;
} }
@ -56,11 +56,11 @@ public class PatientInformation implements Serializable {
this.inputStatus = inputStatus; this.inputStatus = inputStatus;
} }
public Integer getHospitalId() { public Long getHospitalId() {
return hospitalId; return hospitalId;
} }
public void setHospitalId(Integer hospitalId) { public void setHospitalId(Long hospitalId) {
this.hospitalId = hospitalId; this.hospitalId = hospitalId;
} }

40
tcm/src/main/java/com/ccsens/tcm/bean/po/PatientInformationExample.java

@ -245,52 +245,52 @@ public class PatientInformationExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andInpatientIdEqualTo(Integer value) { public Criteria andInpatientIdEqualTo(Long value) {
addCriterion("inpatient_id =", value, "inpatientId"); addCriterion("inpatient_id =", value, "inpatientId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andInpatientIdNotEqualTo(Integer value) { public Criteria andInpatientIdNotEqualTo(Long value) {
addCriterion("inpatient_id <>", value, "inpatientId"); addCriterion("inpatient_id <>", value, "inpatientId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andInpatientIdGreaterThan(Integer value) { public Criteria andInpatientIdGreaterThan(Long value) {
addCriterion("inpatient_id >", value, "inpatientId"); addCriterion("inpatient_id >", value, "inpatientId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andInpatientIdGreaterThanOrEqualTo(Integer value) { public Criteria andInpatientIdGreaterThanOrEqualTo(Long value) {
addCriterion("inpatient_id >=", value, "inpatientId"); addCriterion("inpatient_id >=", value, "inpatientId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andInpatientIdLessThan(Integer value) { public Criteria andInpatientIdLessThan(Long value) {
addCriterion("inpatient_id <", value, "inpatientId"); addCriterion("inpatient_id <", value, "inpatientId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andInpatientIdLessThanOrEqualTo(Integer value) { public Criteria andInpatientIdLessThanOrEqualTo(Long value) {
addCriterion("inpatient_id <=", value, "inpatientId"); addCriterion("inpatient_id <=", value, "inpatientId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andInpatientIdIn(List<Integer> values) { public Criteria andInpatientIdIn(List<Long> values) {
addCriterion("inpatient_id in", values, "inpatientId"); addCriterion("inpatient_id in", values, "inpatientId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andInpatientIdNotIn(List<Integer> values) { public Criteria andInpatientIdNotIn(List<Long> values) {
addCriterion("inpatient_id not in", values, "inpatientId"); addCriterion("inpatient_id not in", values, "inpatientId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andInpatientIdBetween(Integer value1, Integer value2) { public Criteria andInpatientIdBetween(Long value1, Long value2) {
addCriterion("inpatient_id between", value1, value2, "inpatientId"); addCriterion("inpatient_id between", value1, value2, "inpatientId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andInpatientIdNotBetween(Integer value1, Integer value2) { public Criteria andInpatientIdNotBetween(Long value1, Long value2) {
addCriterion("inpatient_id not between", value1, value2, "inpatientId"); addCriterion("inpatient_id not between", value1, value2, "inpatientId");
return (Criteria) this; return (Criteria) this;
} }
@ -365,52 +365,52 @@ public class PatientInformationExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andHospitalIdEqualTo(Integer value) { public Criteria andHospitalIdEqualTo(Long value) {
addCriterion("hospital_id =", value, "hospitalId"); addCriterion("hospital_id =", value, "hospitalId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andHospitalIdNotEqualTo(Integer value) { public Criteria andHospitalIdNotEqualTo(Long value) {
addCriterion("hospital_id <>", value, "hospitalId"); addCriterion("hospital_id <>", value, "hospitalId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andHospitalIdGreaterThan(Integer value) { public Criteria andHospitalIdGreaterThan(Long value) {
addCriterion("hospital_id >", value, "hospitalId"); addCriterion("hospital_id >", value, "hospitalId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andHospitalIdGreaterThanOrEqualTo(Integer value) { public Criteria andHospitalIdGreaterThanOrEqualTo(Long value) {
addCriterion("hospital_id >=", value, "hospitalId"); addCriterion("hospital_id >=", value, "hospitalId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andHospitalIdLessThan(Integer value) { public Criteria andHospitalIdLessThan(Long value) {
addCriterion("hospital_id <", value, "hospitalId"); addCriterion("hospital_id <", value, "hospitalId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andHospitalIdLessThanOrEqualTo(Integer value) { public Criteria andHospitalIdLessThanOrEqualTo(Long value) {
addCriterion("hospital_id <=", value, "hospitalId"); addCriterion("hospital_id <=", value, "hospitalId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andHospitalIdIn(List<Integer> values) { public Criteria andHospitalIdIn(List<Long> values) {
addCriterion("hospital_id in", values, "hospitalId"); addCriterion("hospital_id in", values, "hospitalId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andHospitalIdNotIn(List<Integer> values) { public Criteria andHospitalIdNotIn(List<Long> values) {
addCriterion("hospital_id not in", values, "hospitalId"); addCriterion("hospital_id not in", values, "hospitalId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andHospitalIdBetween(Integer value1, Integer value2) { public Criteria andHospitalIdBetween(Long value1, Long value2) {
addCriterion("hospital_id between", value1, value2, "hospitalId"); addCriterion("hospital_id between", value1, value2, "hospitalId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andHospitalIdNotBetween(Integer value1, Integer value2) { public Criteria andHospitalIdNotBetween(Long value1, Long value2) {
addCriterion("hospital_id not between", value1, value2, "hospitalId"); addCriterion("hospital_id not between", value1, value2, "hospitalId");
return (Criteria) this; return (Criteria) this;
} }

12
tcm/src/main/java/com/ccsens/tcm/bean/po/Question.java

@ -8,7 +8,7 @@ public class Question implements Serializable {
private String question; private String question;
private Long codeId; private String code;
private Integer sort; private Integer sort;
@ -48,12 +48,12 @@ public class Question implements Serializable {
this.question = question == null ? null : question.trim(); this.question = question == null ? null : question.trim();
} }
public Long getCodeId() { public String getCode() {
return codeId; return code;
} }
public void setCodeId(Long codeId) { public void setCode(String code) {
this.codeId = codeId; this.code = code == null ? null : code.trim();
} }
public Integer getSort() { public Integer getSort() {
@ -144,7 +144,7 @@ public class Question implements Serializable {
sb.append("Hash = ").append(hashCode()); sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id); sb.append(", id=").append(id);
sb.append(", question=").append(question); sb.append(", question=").append(question);
sb.append(", codeId=").append(codeId); sb.append(", code=").append(code);
sb.append(", sort=").append(sort); sb.append(", sort=").append(sort);
sb.append(", units=").append(units); sb.append(", units=").append(units);
sb.append(", type=").append(type); sb.append(", type=").append(type);

58
tcm/src/main/java/com/ccsens/tcm/bean/po/QuestionExample.java

@ -235,63 +235,73 @@ public class QuestionExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCodeIdIsNull() { public Criteria andCodeIsNull() {
addCriterion("code_id is null"); addCriterion("code is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCodeIdIsNotNull() { public Criteria andCodeIsNotNull() {
addCriterion("code_id is not null"); addCriterion("code is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCodeIdEqualTo(Long value) { public Criteria andCodeEqualTo(String value) {
addCriterion("code_id =", value, "codeId"); addCriterion("code =", value, "code");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCodeIdNotEqualTo(Long value) { public Criteria andCodeNotEqualTo(String value) {
addCriterion("code_id <>", value, "codeId"); addCriterion("code <>", value, "code");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCodeIdGreaterThan(Long value) { public Criteria andCodeGreaterThan(String value) {
addCriterion("code_id >", value, "codeId"); addCriterion("code >", value, "code");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCodeIdGreaterThanOrEqualTo(Long value) { public Criteria andCodeGreaterThanOrEqualTo(String value) {
addCriterion("code_id >=", value, "codeId"); addCriterion("code >=", value, "code");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCodeIdLessThan(Long value) { public Criteria andCodeLessThan(String value) {
addCriterion("code_id <", value, "codeId"); addCriterion("code <", value, "code");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCodeIdLessThanOrEqualTo(Long value) { public Criteria andCodeLessThanOrEqualTo(String value) {
addCriterion("code_id <=", value, "codeId"); addCriterion("code <=", value, "code");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCodeIdIn(List<Long> values) { public Criteria andCodeLike(String value) {
addCriterion("code_id in", values, "codeId"); addCriterion("code like", value, "code");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCodeIdNotIn(List<Long> values) { public Criteria andCodeNotLike(String value) {
addCriterion("code_id not in", values, "codeId"); addCriterion("code not like", value, "code");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCodeIdBetween(Long value1, Long value2) { public Criteria andCodeIn(List<String> values) {
addCriterion("code_id between", value1, value2, "codeId"); addCriterion("code in", values, "code");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCodeIdNotBetween(Long value1, Long value2) { public Criteria andCodeNotIn(List<String> values) {
addCriterion("code_id not between", value1, value2, "codeId"); addCriterion("code not in", values, "code");
return (Criteria) this;
}
public Criteria andCodeBetween(String value1, String value2) {
addCriterion("code between", value1, value2, "code");
return (Criteria) this;
}
public Criteria andCodeNotBetween(String value1, String value2) {
addCriterion("code not between", value1, value2, "code");
return (Criteria) this; return (Criteria) this;
} }

19
tcm/src/main/java/com/ccsens/tcm/persist/dao/QuestionDao.java

@ -0,0 +1,19 @@
package com.ccsens.tcm.persist.dao;
import com.ccsens.tcm.bean.po.Question;
import com.ccsens.tcm.persist.mapper.QuestionMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author
*/
@Repository
public interface QuestionDao extends QuestionMapper {
/**
* 批量添加题目
* @param questionList 读取的题目
*/
void insertBatch(List<Question> questionList);
}

19
tcm/src/main/java/com/ccsens/tcm/persist/dao/QuestionOptionDao.java

@ -0,0 +1,19 @@
package com.ccsens.tcm.persist.dao;
import com.ccsens.tcm.bean.po.QuestionOption;
import com.ccsens.tcm.persist.mapper.QuestionOptionMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author
*/
@Repository
public interface QuestionOptionDao extends QuestionOptionMapper {
/**
* 批量添加题目选项
* @param optionList 选项
*/
void insertBatch(List<QuestionOption> optionList);
}

19
tcm/src/main/java/com/ccsens/tcm/persist/dao/ReportCodeDao.java

@ -0,0 +1,19 @@
package com.ccsens.tcm.persist.dao;
import com.ccsens.tcm.bean.po.ReportCode;
import com.ccsens.tcm.persist.mapper.ReportCodeMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author
*/
@Repository
public interface ReportCodeDao extends ReportCodeMapper {
/**
* 批量添加测试类型
* @param reportList 从表里读取的类型对象数组
*/
void insertBatch(List<ReportCode> reportList);
}

21
tcm/src/main/java/com/ccsens/tcm/service/IImportService.java

@ -0,0 +1,21 @@
package com.ccsens.tcm.service;
import java.io.File;
/**
* @author
*/
public interface IImportService {
/**
* 导入测试的类型
* @param excelFile excel文件
*/
void importReport(File excelFile) throws Exception;
/**
* 导入病史相关试题
* @param excelFile excel文件
* @param codeBsxg sheet名
*/
void importBsxg(File excelFile, String codeBsxg) throws Exception;
}

223
tcm/src/main/java/com/ccsens/tcm/service/ImportService.java

@ -0,0 +1,223 @@
package com.ccsens.tcm.service;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.ccsens.tcm.bean.po.*;
import com.ccsens.tcm.persist.dao.QuestionDao;
import com.ccsens.tcm.persist.dao.QuestionOptionDao;
import com.ccsens.tcm.persist.dao.ReportCodeDao;
import com.ccsens.tcm.uitl.Constant;
import com.ccsens.util.PoiUtil;
import com.ccsens.util.PropUtil;
import com.ccsens.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.io.File;
import java.util.*;
/**
* @author
*/
@Slf4j
@Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class ImportService implements IImportService {
@Resource
private ReportCodeDao reportCodeDao;
@Resource
private Snowflake snowflake;
@Resource
private QuestionDao questionDao;
@Resource
private QuestionOptionDao questionOptionDao;
@Override
public void importReport(File excelFile) throws Exception {
List<Object[]> reports = PoiUtil.readExce(excelFile, 0, null,1, false);
log.info("读取数据完成");
List<ReportCode> reportList = new ArrayList<>();
for (Object[] objs: reports) {
if (!(objs != null && objs.length >= 2 && !StringUtils.isEmpty(objs[0]) && !StringUtils.isEmpty(objs[1]))) {
log.info("测评报告单数据不足,跳转下一行");
continue;
}
ReportCode report = initReport(objs);
reportList.add(report);
}
if (!reportList.isEmpty()) {
reportCodeDao.insertBatch(reportList);
}
}
@Override
public void importBsxg(File excelFile, String codeBsxg) throws Exception {
log.info("导入试题参数:{}, {}", excelFile, codeBsxg);
List<String> types = new ArrayList<>();
if (Constant.Question.ALL.equalsIgnoreCase(codeBsxg)) {
types.addAll(Constant.Question.QUESTION_TYPE);
} else {
types.add(codeBsxg);
}
log.info("导入试题类型:{}", types);
for (String sheetName: types) {
List<Object[]> questions = PoiUtil.readExce(excelFile, -1, sheetName,1, true);
saveQuestions(questions, sheetName);
}
}
/**
* 保存试题
* */
private void saveQuestions(List<Object[]> questions , String evaluationCode) throws Exception{
List<Question> questionList = new ArrayList<>();
List<QuestionOption> optionList = new ArrayList<>();
//关联的选项的id
Long optionId = null;
for(Object[] objs : questions) {
if (objs == null || objs.length < 4 || StringUtils.isEmpty(objs[2])) {
log.info("数据不足,跳转下一行");
continue;
}
int sort = StringUtil.checkNum(String.valueOf(objs[3]), false) ? Integer.parseInt(String.valueOf(objs[3])) : 1;
String code = StringUtils.isEmpty(objs[1]) ? Constant.STRING_DEFAULT : String.valueOf(objs[1]);
String type = String.valueOf(objs[0]);
switch (type) {
case "题目" :
Question question = initQuestion(objs, code, sort,null);
questionList.add(question);
break;
case "选项" :
if (questionList.isEmpty()) {
break;
}
QuestionOption option = initOption(objs, questionList.get(questionList.size()-1).getId(), sort);
optionList.add(option);
optionId = option.getId();
break;
case "关联题目" :
if (optionList.isEmpty()) {
break;
}
Question relevanceQuestion = initQuestion(objs, code, sort, optionId);
questionList.add(relevanceQuestion);
break;
case "关联题目的选项" :
if (questionList.isEmpty()) {
break;
}
QuestionOption relevanceOption = initOption(objs, questionList.get(questionList.size()-1).getId(), sort);
optionList.add(relevanceOption);
break;
default:
log.info("{}类型未知,不解析", type);
break;
}
}
if (!questionList.isEmpty()) {
questionDao.insertBatch(questionList);
}
if (!optionList.isEmpty()) {
questionOptionDao.insertBatch(optionList);
}
}
/**
* 初始化选项
* @param objs 表格内读取的数据
* @param questionId 试题id
* @param sort 排序
* @return 返回选项
*/
private QuestionOption initOption(Object[] objs, Long questionId, int sort) {
QuestionOptionExample example = new QuestionOptionExample();
example.createCriteria().andQuestionIdEqualTo(questionId).andSortEqualTo(sort);
List<QuestionOption> options = questionOptionDao.selectByExample(example);
//转化option
QuestionOption option;
if (CollectionUtils.isEmpty(options)) {
option = new QuestionOption();
option.setId(snowflake.nextId());
} else {
option = options.get(0);
}
option.setQuestionId(questionId);
option.setSort(sort);
String value = objs.length>2 && StringUtils.isEmpty(objs[2]) ? Constant.STRING_DEFAULT : String.valueOf(objs[2]);
option.setShowValue(value);
option.setSubmitValue(value);
option.setAfterOperation(objs.length>7 && StringUtil.checkNum(String.valueOf(objs[7]), false) ? Byte.parseByte(String.valueOf(objs[7])) : Constant.NUMBER_DEFAULT);
log.info("导入选项:{}", option);
return option;
}
/**
* 初始化报告单对象若该对象已存在则返回null
* @param objs 表格内读取的数据
* @return 返回测试类型
*/
private ReportCode initReport(Object[] objs) {
ReportCodeExample example = new ReportCodeExample();
example.createCriteria().andCodeEqualTo((String) objs[0]);
List<ReportCode> list = reportCodeDao.selectByExample(example);
ReportCode report;
if (!CollectionUtils.isEmpty(list)) {
report = list.get(0);
} else {
report = new ReportCode();
report.setId(snowflake.nextId());
}
report.setCode((String) objs[0]);
report.setName((String) objs[1]);
report.setParentCode(objs.length > 2 && !StringUtils.isEmpty(objs[2]) ? (String) objs[2] : Constant.STRING_DEFAULT);
report.setReportType(objs.length > 3 && StringUtil.checkNum(String.valueOf(objs[3]),false)? Byte.parseByte((String) objs[3]) : Constant.NUMBER_DEFAULT);
report.setMust(objs.length > 4 && StringUtil.checkNum(String.valueOf(objs[4]), false) ? Byte.parseByte((String) (objs[4])) : Constant.NUMBER_DEFAULT);
report.setSort(objs.length > 5 && StringUtil.checkNum(String.valueOf(objs[5]), false) ? Integer.parseInt((String) (objs[5])) : Constant.NUMBER_DEFAULT_SORT);
report.setLevel(objs.length > 6 && StringUtil.checkNum(String.valueOf(objs[6]), false) ? Byte.parseByte((String)(objs[6])) : Constant.NUMBER_DEFAULT_SORT);
report.setRemark(objs.length > 7 && !StringUtils.isEmpty(objs[7]) ? (String) objs[7] : Constant.STRING_DEFAULT);
return report;
}
/**
* 初始化试题
* @param objs 表格内读取的数据
* @param evaluationCode 试题类型
* @param sort 排序
* @return 返回试题
*/
private Question initQuestion(Object[] objs, String evaluationCode, int sort,Long optionId) {
QuestionExample example = new QuestionExample();
example.createCriteria().andCodeEqualTo(evaluationCode).andSortEqualTo(sort);
List<Question> questions = questionDao.selectByExample(example);
Question question;
if (CollectionUtils.isEmpty(questions)) {
question = new Question();
question.setId(snowflake.nextId());
} else {
question = questions.get(0);
}
question.setCode(StringUtils.isEmpty(objs[1]) ? Constant.STRING_DEFAULT : String.valueOf(objs[1]));
question.setQuestion(StringUtils.isEmpty(objs[2]) ? Constant.STRING_DEFAULT : String.valueOf(objs[2]));
question.setSort(sort);
question.setType(objs.length>4 && StringUtil.checkNum(String.valueOf(objs[4]), false) ? Byte.parseByte(String.valueOf(objs[4])) : Constant.Question.QUESTION_SHOW_TYPE);
question.setUnits(objs.length>5 && StringUtils.isEmpty(objs[5]) ? Constant.STRING_DEFAULT : String.valueOf(objs[5]));
question.setSearchCriteria(objs.length>6 && StringUtil.checkNum(String.valueOf(objs[6]), false) ? Byte.parseByte(String.valueOf(objs[6])) : Constant.Question.QUESTION_SHOW_TYPE);
question.setRemark(objs.length > 8 && !StringUtils.isEmpty(objs[8]) ? (String) objs[8] : Constant.STRING_DEFAULT);
question.setRelevanceOptionId(optionId == null ? 0 : optionId);
log.info("导入试题:{}", question);
return question;
}
}

56
tcm/src/main/java/com/ccsens/tcm/uitl/Constant.java

@ -0,0 +1,56 @@
package com.ccsens.tcm.uitl;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @description:
* @author: wuHuiJuan
* @create: 2019/11/29 17:21
*/
public class Constant {
/**逗号*/
public static final String COMMA = "[,,]";
/**图片*/
public static final String IMG = ".png,.jpg,.jpeg,.gif,.bmp";
/**视频音频*/
public static final String VIDEO = ".flv,swf,mkv,avi,rm,rmvb,mpeg,mpg,.ogg,ogv,mov,wmv,mp4,webm,mp3,wav,mid,.wma";
/**上传图片访问路径*/
public static final String UPLOAD_URL = "uploads/";
/**数字默认值*/
public final static byte NUMBER_DEFAULT = 0;
/**排序默认值*/
public final static byte NUMBER_DEFAULT_SORT = 1;
/**数字默认值*/
public final static BigDecimal NUMBER_DEFAULT_BIGDECIMAL = BigDecimal.valueOf(0);
/**字符串默认值*/
public final static String STRING_DEFAULT = "";
public final static byte SEX_MAN = 0;
public final static byte SEX_WOMAN = 1;
public static class Report{
public final static String PARENT_CODE = "TCM";
public final static String CODE_BSXG = "BSXG";
}
public static class Question {
public final static String ALL = "all";
/**默认题目类型*/
public final static byte QUESTION_SHOW_TYPE = 1;
/**默认选项类型*/
public final static byte RULE_TYPE_DEFAULT = 1;
/**测评分类*/
public final static List<String> QUESTION_TYPE = new ArrayList<>();
public final static Map<String, Byte> TYPE = new HashMap<>();
static {
QUESTION_TYPE.add("TCM");
QUESTION_TYPE.add("BSXG");
}
}
}

4
tcm/src/main/resources/application-dev.yml

@ -29,9 +29,9 @@ spring:
swagger: swagger:
enable: true enable: true
file: file:
path: /home/cloud/beneficiation/uploads/ path: /home/cloud/tcm/uploads/
domain: https://test.tall.wiki/gateway/mt/ domain: https://test.tall.wiki/gateway/mt/
imgDomain: https://test.tall.wiki/gateway/beneficiation/uploads/ imgDomain: https://test.tall.wiki/gateway/tcm/uploads/
#gameMqName: game_status_wisdom #gameMqName: game_status_wisdom
logging: logging:
path: path:

31
tcm/src/main/resources/mapper_dao/QuestionDao.xml

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.tcm.persist.dao.QuestionDao">
<resultMap id="BaseResultMap" type="com.ccsens.tcm.bean.po.Question">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="question" jdbcType="VARCHAR" property="question" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="units" jdbcType="VARCHAR" property="units" />
<result column="type" jdbcType="TINYINT" property="type" />
<result column="relevance_option_id" jdbcType="BIGINT" property="relevanceOptionId" />
<result column="search_criteria" jdbcType="TINYINT" property="searchCriteria" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="operator" jdbcType="BIGINT" property="operator" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
</resultMap>
<insert id="insertBatch">
replace into t_question (id, question, code,
sort, units, type,
relevance_option_id, search_criteria, remark)
values
<foreach collection="list" item="question" separator=",">
(#{question.id,jdbcType=BIGINT}, #{question.question,jdbcType=VARCHAR}, #{question.code,jdbcType=VARCHAR},
#{question.sort,jdbcType=INTEGER}, #{question.units,jdbcType=VARCHAR}, #{question.type,jdbcType=TINYINT},
#{question.relevanceOptionId,jdbcType=BIGINT}, #{question.searchCriteria,jdbcType=TINYINT}, #{question.remark,jdbcType=VARCHAR})
</foreach>
</insert>
</mapper>

26
tcm/src/main/resources/mapper_dao/QuestionOptionDao.xml

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.tcm.persist.dao.QuestionOptionDao">
<resultMap id="BaseResultMap" type="com.ccsens.tcm.bean.po.QuestionOption">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="question_id" jdbcType="BIGINT" property="questionId" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="show_value" jdbcType="VARCHAR" property="showValue" />
<result column="submit_value" jdbcType="VARCHAR" property="submitValue" />
<result column="after_operation" jdbcType="TINYINT" property="afterOperation" />
<result column="operator" jdbcType="BIGINT" property="operator" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
</resultMap>
<insert id="insertBatch">
replace into t_question_option (id, question_id, sort,
show_value, submit_value, after_operation)
values
<foreach collection="list" item="option" separator=",">
(#{option.id,jdbcType=BIGINT}, #{option.questionId,jdbcType=BIGINT}, #{option.sort,jdbcType=INTEGER},
#{option.showValue,jdbcType=VARCHAR}, #{option.submitValue,jdbcType=VARCHAR}, #{option.afterOperation,jdbcType=TINYINT})
</foreach>
</insert>
</mapper>

32
tcm/src/main/resources/mapper_dao/ReportCodeDao.xml

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.tcm.persist.dao.ReportCodeDao">
<resultMap id="BaseResultMap" type="com.ccsens.tcm.bean.po.ReportCode">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="parent_code" jdbcType="VARCHAR" property="parentCode" />
<result column="must" jdbcType="TINYINT" property="must" />
<result column="level" jdbcType="TINYINT" property="level" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="report_type" jdbcType="TINYINT" property="reportType" />
<result column="operator" jdbcType="BIGINT" property="operator" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
</resultMap>
<insert id="insertBatch">
replace into t_report_code (id, code, name,
parent_code, must, level,
sort, remark, report_type)
values
<foreach collection="list" item="report" separator=",">
(#{report.id,jdbcType=BIGINT}, #{report.code,jdbcType=VARCHAR}, #{report.name,jdbcType=VARCHAR},
#{report.parentCode,jdbcType=VARCHAR}, #{report.must,jdbcType=TINYINT}, #{report.level,jdbcType=TINYINT},
#{report.sort,jdbcType=INTEGER}, #{report.remark,jdbcType=VARCHAR}, #{report.reportType,jdbcType=TINYINT})
</foreach>
</insert>
</mapper>

28
tcm/src/main/resources/mapper_raw/PatientInformationMapper.xml

@ -4,9 +4,9 @@
<resultMap id="BaseResultMap" type="com.ccsens.tcm.bean.po.PatientInformation"> <resultMap id="BaseResultMap" type="com.ccsens.tcm.bean.po.PatientInformation">
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="hospitalization" jdbcType="VARCHAR" property="hospitalization" /> <result column="hospitalization" jdbcType="VARCHAR" property="hospitalization" />
<result column="inpatient_id" jdbcType="INTEGER" property="inpatientId" /> <result column="inpatient_id" jdbcType="BIGINT" property="inpatientId" />
<result column="input_status" jdbcType="TINYINT" property="inputStatus" /> <result column="input_status" jdbcType="TINYINT" property="inputStatus" />
<result column="hospital_id" jdbcType="INTEGER" property="hospitalId" /> <result column="hospital_id" jdbcType="BIGINT" property="hospitalId" />
<result column="user_id" jdbcType="BIGINT" property="userId" /> <result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" /> <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="update_at" jdbcType="TIMESTAMP" property="updateAt" /> <result column="update_at" jdbcType="TIMESTAMP" property="updateAt" />
@ -109,8 +109,8 @@
input_status, hospital_id, user_id, input_status, hospital_id, user_id,
created_at, update_at, rec_status created_at, update_at, rec_status
) )
values (#{id,jdbcType=BIGINT}, #{hospitalization,jdbcType=VARCHAR}, #{inpatientId,jdbcType=INTEGER}, values (#{id,jdbcType=BIGINT}, #{hospitalization,jdbcType=VARCHAR}, #{inpatientId,jdbcType=BIGINT},
#{inputStatus,jdbcType=TINYINT}, #{hospitalId,jdbcType=INTEGER}, #{userId,jdbcType=BIGINT}, #{inputStatus,jdbcType=TINYINT}, #{hospitalId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT},
#{createdAt,jdbcType=TIMESTAMP}, #{updateAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT} #{createdAt,jdbcType=TIMESTAMP}, #{updateAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}
) )
</insert> </insert>
@ -153,13 +153,13 @@
#{hospitalization,jdbcType=VARCHAR}, #{hospitalization,jdbcType=VARCHAR},
</if> </if>
<if test="inpatientId != null"> <if test="inpatientId != null">
#{inpatientId,jdbcType=INTEGER}, #{inpatientId,jdbcType=BIGINT},
</if> </if>
<if test="inputStatus != null"> <if test="inputStatus != null">
#{inputStatus,jdbcType=TINYINT}, #{inputStatus,jdbcType=TINYINT},
</if> </if>
<if test="hospitalId != null"> <if test="hospitalId != null">
#{hospitalId,jdbcType=INTEGER}, #{hospitalId,jdbcType=BIGINT},
</if> </if>
<if test="userId != null"> <if test="userId != null">
#{userId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT},
@ -191,13 +191,13 @@
hospitalization = #{record.hospitalization,jdbcType=VARCHAR}, hospitalization = #{record.hospitalization,jdbcType=VARCHAR},
</if> </if>
<if test="record.inpatientId != null"> <if test="record.inpatientId != null">
inpatient_id = #{record.inpatientId,jdbcType=INTEGER}, inpatient_id = #{record.inpatientId,jdbcType=BIGINT},
</if> </if>
<if test="record.inputStatus != null"> <if test="record.inputStatus != null">
input_status = #{record.inputStatus,jdbcType=TINYINT}, input_status = #{record.inputStatus,jdbcType=TINYINT},
</if> </if>
<if test="record.hospitalId != null"> <if test="record.hospitalId != null">
hospital_id = #{record.hospitalId,jdbcType=INTEGER}, hospital_id = #{record.hospitalId,jdbcType=BIGINT},
</if> </if>
<if test="record.userId != null"> <if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT}, user_id = #{record.userId,jdbcType=BIGINT},
@ -220,9 +220,9 @@
update t_patient_information update t_patient_information
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
hospitalization = #{record.hospitalization,jdbcType=VARCHAR}, hospitalization = #{record.hospitalization,jdbcType=VARCHAR},
inpatient_id = #{record.inpatientId,jdbcType=INTEGER}, inpatient_id = #{record.inpatientId,jdbcType=BIGINT},
input_status = #{record.inputStatus,jdbcType=TINYINT}, input_status = #{record.inputStatus,jdbcType=TINYINT},
hospital_id = #{record.hospitalId,jdbcType=INTEGER}, hospital_id = #{record.hospitalId,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT}, user_id = #{record.userId,jdbcType=BIGINT},
created_at = #{record.createdAt,jdbcType=TIMESTAMP}, created_at = #{record.createdAt,jdbcType=TIMESTAMP},
update_at = #{record.updateAt,jdbcType=TIMESTAMP}, update_at = #{record.updateAt,jdbcType=TIMESTAMP},
@ -238,13 +238,13 @@
hospitalization = #{hospitalization,jdbcType=VARCHAR}, hospitalization = #{hospitalization,jdbcType=VARCHAR},
</if> </if>
<if test="inpatientId != null"> <if test="inpatientId != null">
inpatient_id = #{inpatientId,jdbcType=INTEGER}, inpatient_id = #{inpatientId,jdbcType=BIGINT},
</if> </if>
<if test="inputStatus != null"> <if test="inputStatus != null">
input_status = #{inputStatus,jdbcType=TINYINT}, input_status = #{inputStatus,jdbcType=TINYINT},
</if> </if>
<if test="hospitalId != null"> <if test="hospitalId != null">
hospital_id = #{hospitalId,jdbcType=INTEGER}, hospital_id = #{hospitalId,jdbcType=BIGINT},
</if> </if>
<if test="userId != null"> <if test="userId != null">
user_id = #{userId,jdbcType=BIGINT}, user_id = #{userId,jdbcType=BIGINT},
@ -264,9 +264,9 @@
<update id="updateByPrimaryKey" parameterType="com.ccsens.tcm.bean.po.PatientInformation"> <update id="updateByPrimaryKey" parameterType="com.ccsens.tcm.bean.po.PatientInformation">
update t_patient_information update t_patient_information
set hospitalization = #{hospitalization,jdbcType=VARCHAR}, set hospitalization = #{hospitalization,jdbcType=VARCHAR},
inpatient_id = #{inpatientId,jdbcType=INTEGER}, inpatient_id = #{inpatientId,jdbcType=BIGINT},
input_status = #{inputStatus,jdbcType=TINYINT}, input_status = #{inputStatus,jdbcType=TINYINT},
hospital_id = #{hospitalId,jdbcType=INTEGER}, hospital_id = #{hospitalId,jdbcType=BIGINT},
user_id = #{userId,jdbcType=BIGINT}, user_id = #{userId,jdbcType=BIGINT},
created_at = #{createdAt,jdbcType=TIMESTAMP}, created_at = #{createdAt,jdbcType=TIMESTAMP},
update_at = #{updateAt,jdbcType=TIMESTAMP}, update_at = #{updateAt,jdbcType=TIMESTAMP},

28
tcm/src/main/resources/mapper_raw/PatientRecordMapper.xml

@ -106,24 +106,21 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="com.ccsens.tcm.bean.po.PatientRecord"> <insert id="insert" parameterType="com.ccsens.tcm.bean.po.PatientRecord">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long"> insert into t_patient_record (id, patient_id, test_questions_id,
SELECT LAST_INSERT_ID() contents, user_id, collect_time,
</selectKey> time_slot, created_at, update_at,
insert into t_patient_record (patient_id, test_questions_id, contents, rec_status)
user_id, collect_time, time_slot, values (#{id,jdbcType=BIGINT}, #{patientId,jdbcType=BIGINT}, #{testQuestionsId,jdbcType=BIGINT},
created_at, update_at, rec_status #{contents,jdbcType=VARCHAR}, #{userId,jdbcType=BIGINT}, #{collectTime,jdbcType=INTEGER},
) #{timeSlot,jdbcType=TIMESTAMP}, #{createdAt,jdbcType=TIMESTAMP}, #{updateAt,jdbcType=TIMESTAMP},
values (#{patientId,jdbcType=BIGINT}, #{testQuestionsId,jdbcType=BIGINT}, #{contents,jdbcType=VARCHAR}, #{recStatus,jdbcType=TINYINT})
#{userId,jdbcType=BIGINT}, #{collectTime,jdbcType=INTEGER}, #{timeSlot,jdbcType=TIMESTAMP},
#{createdAt,jdbcType=TIMESTAMP}, #{updateAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}
)
</insert> </insert>
<insert id="insertSelective" parameterType="com.ccsens.tcm.bean.po.PatientRecord"> <insert id="insertSelective" parameterType="com.ccsens.tcm.bean.po.PatientRecord">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into t_patient_record insert into t_patient_record
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="patientId != null"> <if test="patientId != null">
patient_id, patient_id,
</if> </if>
@ -153,6 +150,9 @@
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="patientId != null"> <if test="patientId != null">
#{patientId,jdbcType=BIGINT}, #{patientId,jdbcType=BIGINT},
</if> </if>

28
tcm/src/main/resources/mapper_raw/QuestionMapper.xml

@ -4,7 +4,7 @@
<resultMap id="BaseResultMap" type="com.ccsens.tcm.bean.po.Question"> <resultMap id="BaseResultMap" type="com.ccsens.tcm.bean.po.Question">
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="question" jdbcType="VARCHAR" property="question" /> <result column="question" jdbcType="VARCHAR" property="question" />
<result column="code_id" jdbcType="BIGINT" property="codeId" /> <result column="code" jdbcType="VARCHAR" property="code" />
<result column="sort" jdbcType="INTEGER" property="sort" /> <result column="sort" jdbcType="INTEGER" property="sort" />
<result column="units" jdbcType="VARCHAR" property="units" /> <result column="units" jdbcType="VARCHAR" property="units" />
<result column="type" jdbcType="TINYINT" property="type" /> <result column="type" jdbcType="TINYINT" property="type" />
@ -75,7 +75,7 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, question, code_id, sort, units, type, relevance_option_id, search_criteria, remark, id, question, code, sort, units, type, relevance_option_id, search_criteria, remark,
operator, created_at, updated_at, rec_status operator, created_at, updated_at, rec_status
</sql> </sql>
<select id="selectByExample" parameterType="com.ccsens.tcm.bean.po.QuestionExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.ccsens.tcm.bean.po.QuestionExample" resultMap="BaseResultMap">
@ -109,12 +109,12 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="com.ccsens.tcm.bean.po.Question"> <insert id="insert" parameterType="com.ccsens.tcm.bean.po.Question">
insert into t_question (id, question, code_id, insert into t_question (id, question, code,
sort, units, type, sort, units, type,
relevance_option_id, search_criteria, remark, relevance_option_id, search_criteria, remark,
operator, created_at, updated_at, operator, created_at, updated_at,
rec_status) rec_status)
values (#{id,jdbcType=BIGINT}, #{question,jdbcType=VARCHAR}, #{codeId,jdbcType=BIGINT}, values (#{id,jdbcType=BIGINT}, #{question,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR},
#{sort,jdbcType=INTEGER}, #{units,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT}, #{sort,jdbcType=INTEGER}, #{units,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT},
#{relevanceOptionId,jdbcType=BIGINT}, #{searchCriteria,jdbcType=TINYINT}, #{remark,jdbcType=VARCHAR}, #{relevanceOptionId,jdbcType=BIGINT}, #{searchCriteria,jdbcType=TINYINT}, #{remark,jdbcType=VARCHAR},
#{operator,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{operator,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP},
@ -129,8 +129,8 @@
<if test="question != null"> <if test="question != null">
question, question,
</if> </if>
<if test="codeId != null"> <if test="code != null">
code_id, code,
</if> </if>
<if test="sort != null"> <if test="sort != null">
sort, sort,
@ -170,8 +170,8 @@
<if test="question != null"> <if test="question != null">
#{question,jdbcType=VARCHAR}, #{question,jdbcType=VARCHAR},
</if> </if>
<if test="codeId != null"> <if test="code != null">
#{codeId,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR},
</if> </if>
<if test="sort != null"> <if test="sort != null">
#{sort,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER},
@ -220,8 +220,8 @@
<if test="record.question != null"> <if test="record.question != null">
question = #{record.question,jdbcType=VARCHAR}, question = #{record.question,jdbcType=VARCHAR},
</if> </if>
<if test="record.codeId != null"> <if test="record.code != null">
code_id = #{record.codeId,jdbcType=BIGINT}, code = #{record.code,jdbcType=VARCHAR},
</if> </if>
<if test="record.sort != null"> <if test="record.sort != null">
sort = #{record.sort,jdbcType=INTEGER}, sort = #{record.sort,jdbcType=INTEGER},
@ -262,7 +262,7 @@
update t_question update t_question
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
question = #{record.question,jdbcType=VARCHAR}, question = #{record.question,jdbcType=VARCHAR},
code_id = #{record.codeId,jdbcType=BIGINT}, code = #{record.code,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=INTEGER}, sort = #{record.sort,jdbcType=INTEGER},
units = #{record.units,jdbcType=VARCHAR}, units = #{record.units,jdbcType=VARCHAR},
type = #{record.type,jdbcType=TINYINT}, type = #{record.type,jdbcType=TINYINT},
@ -283,8 +283,8 @@
<if test="question != null"> <if test="question != null">
question = #{question,jdbcType=VARCHAR}, question = #{question,jdbcType=VARCHAR},
</if> </if>
<if test="codeId != null"> <if test="code != null">
code_id = #{codeId,jdbcType=BIGINT}, code = #{code,jdbcType=VARCHAR},
</if> </if>
<if test="sort != null"> <if test="sort != null">
sort = #{sort,jdbcType=INTEGER}, sort = #{sort,jdbcType=INTEGER},
@ -322,7 +322,7 @@
<update id="updateByPrimaryKey" parameterType="com.ccsens.tcm.bean.po.Question"> <update id="updateByPrimaryKey" parameterType="com.ccsens.tcm.bean.po.Question">
update t_question update t_question
set question = #{question,jdbcType=VARCHAR}, set question = #{question,jdbcType=VARCHAR},
code_id = #{codeId,jdbcType=BIGINT}, code = #{code,jdbcType=VARCHAR},
sort = #{sort,jdbcType=INTEGER}, sort = #{sort,jdbcType=INTEGER},
units = #{units,jdbcType=VARCHAR}, units = #{units,jdbcType=VARCHAR},
type = #{type,jdbcType=TINYINT}, type = #{type,jdbcType=TINYINT},

32
tcm/src/main/resources/mapper_raw/ReportCodeMapper.xml

@ -109,26 +109,23 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="com.ccsens.tcm.bean.po.ReportCode"> <insert id="insert" parameterType="com.ccsens.tcm.bean.po.ReportCode">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long"> insert into t_report_code (id, code, name,
SELECT LAST_INSERT_ID() parent_code, must, level,
</selectKey> sort, remark, report_type,
insert into t_report_code (code, name, parent_code, operator, created_at, updated_at,
must, level, sort, rec_status)
remark, report_type, operator, values (#{id,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
created_at, updated_at, rec_status #{parentCode,jdbcType=VARCHAR}, #{must,jdbcType=TINYINT}, #{level,jdbcType=TINYINT},
) #{sort,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, #{reportType,jdbcType=TINYINT},
values (#{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{parentCode,jdbcType=VARCHAR}, #{operator,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP},
#{must,jdbcType=TINYINT}, #{level,jdbcType=TINYINT}, #{sort,jdbcType=INTEGER}, #{recStatus,jdbcType=TINYINT})
#{remark,jdbcType=VARCHAR}, #{reportType,jdbcType=TINYINT}, #{operator,jdbcType=BIGINT},
#{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}
)
</insert> </insert>
<insert id="insertSelective" parameterType="com.ccsens.tcm.bean.po.ReportCode"> <insert id="insertSelective" parameterType="com.ccsens.tcm.bean.po.ReportCode">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into t_report_code insert into t_report_code
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="code != null"> <if test="code != null">
code, code,
</if> </if>
@ -167,6 +164,9 @@
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="code != null"> <if test="code != null">
#{code,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR},
</if> </if>

Loading…
Cancel
Save