Browse Source

医生和病人信息修改

master
6 years ago
parent
commit
662e0c2aa8
  1. 18
      ht/src/main/java/com/ccsens/ht/api/DoctorController.java
  2. 43
      ht/src/main/java/com/ccsens/ht/api/FileController.java
  3. 16
      ht/src/main/java/com/ccsens/ht/api/PatientController.java
  4. 24
      ht/src/main/java/com/ccsens/ht/bean/dto/FileDto.java
  5. 25
      ht/src/main/java/com/ccsens/ht/bean/dto/PatientDto.java
  6. 2
      ht/src/main/java/com/ccsens/ht/bean/dto/QuestionDto.java
  7. 16
      ht/src/main/java/com/ccsens/ht/bean/po/HtPatientFollowUp.java
  8. 60
      ht/src/main/java/com/ccsens/ht/bean/po/HtPatientFollowUpExample.java
  9. 2
      ht/src/main/java/com/ccsens/ht/bean/vo/DoctorVo.java
  10. 19
      ht/src/main/java/com/ccsens/ht/bean/vo/FileVo.java
  11. 7
      ht/src/main/java/com/ccsens/ht/persist/dao/HtDoctorAuditDao.java
  12. 3
      ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientReportDao.java
  13. 7
      ht/src/main/java/com/ccsens/ht/service/DoctorService.java
  14. 2
      ht/src/main/java/com/ccsens/ht/service/IDoctorService.java
  15. 11
      ht/src/main/java/com/ccsens/ht/service/IPatientService.java
  16. 20
      ht/src/main/java/com/ccsens/ht/service/ImportService.java
  17. 50
      ht/src/main/java/com/ccsens/ht/service/PatientReportService.java
  18. 14
      ht/src/main/java/com/ccsens/ht/service/PatientService.java
  19. 10
      ht/src/main/java/com/ccsens/ht/service/QuestionService.java
  20. 2
      ht/src/main/resources/application-dev.yml
  21. 2
      ht/src/main/resources/application-test.yml
  22. 10
      ht/src/main/resources/mapper_dao/HtDoctorAuditDao.xml
  23. 21
      ht/src/main/resources/mapper_dao/HtPatientReportDao.xml
  24. 26
      ht/src/main/resources/mapper_raw/HtPatientFollowUpMapper.xml
  25. 45
      util/src/main/java/com/ccsens/util/Base64FileUtil.java
  26. 3
      util/src/main/java/com/ccsens/util/CodeEnum.java
  27. 34
      util/src/test/java/com/ccsens/util/Base64Test.java

18
ht/src/main/java/com/ccsens/ht/api/DoctorController.java

@ -35,6 +35,9 @@ public class DoctorController {
@Autowired
private IDoctorService doctorService;
@MustLogin
@ApiOperation(value = "资格认证",notes = "医生提交基本信息进行资格认证")
@ApiImplicitParams({
@ -77,7 +80,20 @@ public class DoctorController {
return JsonResponse.newInstance().ok(codeEnum);
}
@MustLogin
@ApiOperation(value = "查询医生资格审核状态",notes = "查询医生资格审核状态")
@ApiImplicitParams({
@ApiImplicitParam(name = "json", value = "医生查询条件", required = true)
})
@RequestMapping(value = "/queryDoctorStatus", method = RequestMethod.POST)
public JsonResponse<DoctorVo.Query> queryDoctorStatus(@RequestBody @ApiParam QueryDto params) {
log.info("资格认证列表:{}", params);
DoctorVo.Query dtos = doctorService.queryDoctorStatus(params.getUserId());
if (dtos == null) {
JsonResponse.newInstance().ok(CodeEnum.DOCTOR_NOT_SUBMIT);
}
return JsonResponse.newInstance().ok(dtos);
}
}

43
ht/src/main/java/com/ccsens/ht/api/FileController.java

@ -0,0 +1,43 @@
package com.ccsens.ht.api;
import cn.hutool.core.date.DateUtil;
import com.ccsens.ht.annotation.MustLogin;
import com.ccsens.ht.bean.dto.FileDto;
import com.ccsens.ht.bean.dto.QueryDto;
import com.ccsens.ht.bean.dto.QuestionDto;
import com.ccsens.ht.bean.vo.FileVo;
import com.ccsens.ht.bean.vo.QuestionVo;
import com.ccsens.util.Base64FileUtil;
import com.ccsens.util.JsonResponse;
import com.ccsens.util.PropUtil;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
/**
* @description:
* @author: wuHuiJuan
* @create: 2019/12/17 18:03
*/
@Slf4j
@Api(tags = "文件上传",value = "文件上传")
@RestController
public class FileController {
@MustLogin
@ApiOperation(value = "测评试题查询",notes = "测评试题查询")
@ApiImplicitParams({
@ApiImplicitParam(name = "json", value = "测评试题查询信息", required = true)
})
@RequestMapping(value="/saveFile", method = RequestMethod.POST)
public JsonResponse<FileVo.Save> saveFile(@RequestBody @ApiParam @Valid QueryDto<FileDto.Save> queryDto) throws Exception {
String path = Base64FileUtil.base64ToFile(queryDto.getParam().getBase64(), PropUtil.path, "/file/" + DateUtil.today() + "/");
FileVo.Save save = new FileVo.Save();
save.setPath(PropUtil.imgDomain + path);
return JsonResponse.newInstance().ok(save);
}
}

16
ht/src/main/java/com/ccsens/ht/api/PatientController.java

@ -11,6 +11,7 @@ import com.ccsens.ht.service.IPatientService;
import com.ccsens.ht.uitl.Constant;
import com.ccsens.util.CodeEnum;
import com.ccsens.util.JsonResponse;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -37,6 +38,21 @@ public class PatientController {
@Autowired
private IPatientService patientService;
@MustLogin
@ApiOperation(value = "查询医生录入的病人信息",notes = "查询医生录入的病人信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "json", value = "分页条件", required = true)
})
@RequestMapping(value="/queryByRecordId", method = RequestMethod.POST)
public JsonResponse<PageInfo<PatientVo.Query>> queryByRecordId(@RequestBody @ApiParam @Valid QueryDto<PatientDto.Recorder> params){
log.info("查询医生记录的病人信息:{}", params);
PageInfo<PatientVo.Query> pageInfo = patientService.queryByRecorder(params.getParam(), params.getUserId());
log.info("查询医生记录的病人信息结果:{}", pageInfo);
return JsonResponse.newInstance().ok(pageInfo);
}
/**
*@Description:
* @param params

24
ht/src/main/java/com/ccsens/ht/bean/dto/FileDto.java

@ -0,0 +1,24 @@
package com.ccsens.ht.bean.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @description:
* @author: wuHuiJuan
* @create: 2019/12/17 18:05
*/
public class FileDto {
@ApiModel("FileDtoSave")
@Data
public static class Save{
@ApiModelProperty("文件base64字符串")
@NotNull(message = "文件内容不允许为空")
private String base64;
}
}

25
ht/src/main/java/com/ccsens/ht/bean/dto/PatientDto.java

@ -7,6 +7,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
@ -16,6 +18,19 @@ import javax.validation.constraints.NotNull;
* @create: 2019/10/31 09:28
*/
public class PatientDto {
@ApiModel("PatientDtoRecorder")
@Data
public static class Recorder{
@ApiModelProperty("第几页")
@Min(value = 1)
private int pageNum = 1;
@ApiModelProperty("每页多少条")
@Min(value = 1)
@Max(value=100)
private int pageSize = 10;
}
@ApiModel("PatientDtoQuery")
@Data
public static class Query{
@ -40,35 +55,45 @@ public class PatientDto {
private Long id;
@ApiModelProperty("病人用户id")
private Long userId;
@NotNull
@ApiModelProperty("病人名字")
private String name;
@ApiModelProperty("病人门诊号")
private String patientNumber;
@ApiModelProperty("病人住院号")
private String hospitalNumber;
@NotNull
@ApiModelProperty("病人身份证号")
@NotNull(message="身份证信息不能为空")
private String idcard;
@NotNull
@ApiModelProperty("性别(0:男 1:女)")
private Byte sex;
@NotNull
@ApiModelProperty("婚姻状况(1:未婚2:已婚 3:离异 4:分居 5:丧偶 6:同居 7:其他 )")
private Byte maritalStatus;
@NotNull
@ApiModelProperty("教育程度(1:文盲 2:小学 3:初中 4:高中 5:大学 6:大学以上 7:其他)")
private Byte educationalStatus;
@NotNull
@ApiModelProperty("受教育时间(年或月)")
private String educationalStatusUnit;
@ApiModelProperty("民族")
private String nation;
@ApiModelProperty("籍贯")
private String nativePlace;
@NotNull
@ApiModelProperty("职业(1:农林牧渔水利生产人员 2:教师 3:医务工作者 4:专业技术人员 5:生产、运输设备操作人员及有关人员6:商业、服务业人员7:国家机关、事业单位、企业负责人8:国家机关、事业单位、企业办事人员和有关人员9:军人 10:媒体、文体类工作人员 11:在校学生 12:未就业 13:家务 14:其他")
private Byte career;
@NotNull
@ApiModelProperty("生育数量")
private Integer birthNumber;
@ApiModelProperty("绝经年龄(女)")
private Integer menopauseAge;
@NotNull
@ApiModelProperty("联系人")
private String contact;
@NotNull
@ApiModelProperty("手机")
private String mobile;
@ApiModelProperty("电话")

2
ht/src/main/java/com/ccsens/ht/bean/dto/QuestionDto.java

@ -49,7 +49,7 @@ public class QuestionDto {
private Long id;
@NotNull(message = "病友画图或录音不能为空")
@ApiModelProperty("病友画图或录音")
private Part part;
private String path;
}

16
ht/src/main/java/com/ccsens/ht/bean/po/HtPatientFollowUp.java

@ -12,9 +12,9 @@ public class HtPatientFollowUp implements Serializable {
private Integer followUpTimes;
private String recorder;
private Long recorder;
private String diagnose;
private Long diagnose;
private String remark;
@ -58,20 +58,20 @@ public class HtPatientFollowUp implements Serializable {
this.followUpTimes = followUpTimes;
}
public String getRecorder() {
public Long getRecorder() {
return recorder;
}
public void setRecorder(String recorder) {
this.recorder = recorder == null ? null : recorder.trim();
public void setRecorder(Long recorder) {
this.recorder = recorder;
}
public String getDiagnose() {
public Long getDiagnose() {
return diagnose;
}
public void setDiagnose(String diagnose) {
this.diagnose = diagnose == null ? null : diagnose.trim();
public void setDiagnose(Long diagnose) {
this.diagnose = diagnose;
}
public String getRemark() {

60
ht/src/main/java/com/ccsens/ht/bean/po/HtPatientFollowUpExample.java

@ -355,62 +355,52 @@ public class HtPatientFollowUpExample {
return (Criteria) this;
}
public Criteria andRecorderEqualTo(String value) {
public Criteria andRecorderEqualTo(Long value) {
addCriterion("recorder =", value, "recorder");
return (Criteria) this;
}
public Criteria andRecorderNotEqualTo(String value) {
public Criteria andRecorderNotEqualTo(Long value) {
addCriterion("recorder <>", value, "recorder");
return (Criteria) this;
}
public Criteria andRecorderGreaterThan(String value) {
public Criteria andRecorderGreaterThan(Long value) {
addCriterion("recorder >", value, "recorder");
return (Criteria) this;
}
public Criteria andRecorderGreaterThanOrEqualTo(String value) {
public Criteria andRecorderGreaterThanOrEqualTo(Long value) {
addCriterion("recorder >=", value, "recorder");
return (Criteria) this;
}
public Criteria andRecorderLessThan(String value) {
public Criteria andRecorderLessThan(Long value) {
addCriterion("recorder <", value, "recorder");
return (Criteria) this;
}
public Criteria andRecorderLessThanOrEqualTo(String value) {
public Criteria andRecorderLessThanOrEqualTo(Long value) {
addCriterion("recorder <=", value, "recorder");
return (Criteria) this;
}
public Criteria andRecorderLike(String value) {
addCriterion("recorder like", value, "recorder");
return (Criteria) this;
}
public Criteria andRecorderNotLike(String value) {
addCriterion("recorder not like", value, "recorder");
return (Criteria) this;
}
public Criteria andRecorderIn(List<String> values) {
public Criteria andRecorderIn(List<Long> values) {
addCriterion("recorder in", values, "recorder");
return (Criteria) this;
}
public Criteria andRecorderNotIn(List<String> values) {
public Criteria andRecorderNotIn(List<Long> values) {
addCriterion("recorder not in", values, "recorder");
return (Criteria) this;
}
public Criteria andRecorderBetween(String value1, String value2) {
public Criteria andRecorderBetween(Long value1, Long value2) {
addCriterion("recorder between", value1, value2, "recorder");
return (Criteria) this;
}
public Criteria andRecorderNotBetween(String value1, String value2) {
public Criteria andRecorderNotBetween(Long value1, Long value2) {
addCriterion("recorder not between", value1, value2, "recorder");
return (Criteria) this;
}
@ -425,62 +415,52 @@ public class HtPatientFollowUpExample {
return (Criteria) this;
}
public Criteria andDiagnoseEqualTo(String value) {
public Criteria andDiagnoseEqualTo(Long value) {
addCriterion("diagnose =", value, "diagnose");
return (Criteria) this;
}
public Criteria andDiagnoseNotEqualTo(String value) {
public Criteria andDiagnoseNotEqualTo(Long value) {
addCriterion("diagnose <>", value, "diagnose");
return (Criteria) this;
}
public Criteria andDiagnoseGreaterThan(String value) {
public Criteria andDiagnoseGreaterThan(Long value) {
addCriterion("diagnose >", value, "diagnose");
return (Criteria) this;
}
public Criteria andDiagnoseGreaterThanOrEqualTo(String value) {
public Criteria andDiagnoseGreaterThanOrEqualTo(Long value) {
addCriterion("diagnose >=", value, "diagnose");
return (Criteria) this;
}
public Criteria andDiagnoseLessThan(String value) {
public Criteria andDiagnoseLessThan(Long value) {
addCriterion("diagnose <", value, "diagnose");
return (Criteria) this;
}
public Criteria andDiagnoseLessThanOrEqualTo(String value) {
public Criteria andDiagnoseLessThanOrEqualTo(Long value) {
addCriterion("diagnose <=", value, "diagnose");
return (Criteria) this;
}
public Criteria andDiagnoseLike(String value) {
addCriterion("diagnose like", value, "diagnose");
return (Criteria) this;
}
public Criteria andDiagnoseNotLike(String value) {
addCriterion("diagnose not like", value, "diagnose");
return (Criteria) this;
}
public Criteria andDiagnoseIn(List<String> values) {
public Criteria andDiagnoseIn(List<Long> values) {
addCriterion("diagnose in", values, "diagnose");
return (Criteria) this;
}
public Criteria andDiagnoseNotIn(List<String> values) {
public Criteria andDiagnoseNotIn(List<Long> values) {
addCriterion("diagnose not in", values, "diagnose");
return (Criteria) this;
}
public Criteria andDiagnoseBetween(String value1, String value2) {
public Criteria andDiagnoseBetween(Long value1, Long value2) {
addCriterion("diagnose between", value1, value2, "diagnose");
return (Criteria) this;
}
public Criteria andDiagnoseNotBetween(String value1, String value2) {
public Criteria andDiagnoseNotBetween(Long value1, Long value2) {
addCriterion("diagnose not between", value1, value2, "diagnose");
return (Criteria) this;
}

2
ht/src/main/java/com/ccsens/ht/bean/vo/DoctorVo.java

@ -33,7 +33,7 @@ public class DoctorVo {
private Integer age;
@ApiModelProperty("审核人ID")
private Long auditorId;
@ApiModelProperty("审核")
@ApiModelProperty("审核 0:待审核 1:审核通过 2:审核失败")
private Byte auditState;
@ApiModelProperty("备注")
private String remark;

19
ht/src/main/java/com/ccsens/ht/bean/vo/FileVo.java

@ -0,0 +1,19 @@
package com.ccsens.ht.bean.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @description:
* @author: wuHuiJuan
* @create: 2019/12/17 18:04
*/
public class FileVo {
@ApiModel("FileVoSave")
@Data
public static class Save{
@ApiModelProperty("文件访问路径")
private String path;
}
}

7
ht/src/main/java/com/ccsens/ht/persist/dao/HtDoctorAuditDao.java

@ -36,4 +36,11 @@ public interface HtDoctorAuditDao extends HtDoctorAuditMapper {
*/
List<DoctorVo.Query> queryDoctor(@Param(value = "auditorId") Long auditorId, @Param(value = "titleId") Long titleId, @Param(value = "jobId") Long jobId, @Param(value = "recursionId")Long recursionId, @Param(value = "name")String name);
/**
* 根据userId查询医生提交的资格认证信息
* @param userId
* @return
*/
DoctorVo.Query queryDoctorStatus(@Param(value = "userId") Long userId);
}

3
ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientReportDao.java

@ -5,6 +5,7 @@ import com.ccsens.ht.persist.mapper.HtPatientReportMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 病人报告单信息查询
@ -34,6 +35,6 @@ public interface HtPatientReportDao extends HtPatientReportMapper {
* @param id
* @return
*/
List<PatientReportVo.ReportScore> queryNPIScore(@Param("id") Long id);
Map<String, Object> queryNPIScore(@Param("id") Long id);
}

7
ht/src/main/java/com/ccsens/ht/service/DoctorService.java

@ -16,6 +16,7 @@ import com.ccsens.util.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
@ -269,4 +270,10 @@ public class DoctorService implements IDoctorService {
public List<HtDoctor> selectByExample(HtDoctorExample doctorExample) {
return htDoctorMapper.selectByExample(doctorExample);
}
@Override
public DoctorVo.Query queryDoctorStatus(Long userId) {
DoctorVo.Query query = htDoctorAuditDao.queryDoctorStatus(userId);
return query;
}
}

2
ht/src/main/java/com/ccsens/ht/service/IDoctorService.java

@ -56,4 +56,6 @@ public interface IDoctorService {
*/
List<HtDoctor> selectByExample(HtDoctorExample doctorExample);
/**查询医生审核状态*/
DoctorVo.Query queryDoctorStatus(Long userId);
}

11
ht/src/main/java/com/ccsens/ht/service/IPatientService.java

@ -3,7 +3,10 @@ package com.ccsens.ht.service;
import com.ccsens.ht.bean.dto.PatientDto;
import com.ccsens.ht.bean.po.HtPatient;
import com.ccsens.ht.bean.vo.PatientVo;
import com.ccsens.util.CodeEnum;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -44,5 +47,13 @@ public interface IPatientService {
*/
CodeEnum editPatientOtherMsg(PatientDto.EditOtherMsg edit, Long userId);
/**
* 根据记录人查询病人信息
* @param recorder
* @param userId
* @return
*/
PageInfo<PatientVo.Query> queryByRecorder(PatientDto.Recorder recorder, Long userId);
}

20
ht/src/main/java/com/ccsens/ht/service/ImportService.java

@ -231,6 +231,8 @@ public class ImportService implements IImportService {
List<HtQuestionOption> optionList = new ArrayList<>();
List<HtQuestionIntroducer> introduceList = new ArrayList<>();
List<HtQuestionScoringRule> ruleList = new ArrayList<>();
//记录那类型题是关联试题
Map<String, String> parentCode = new HashMap<>();
for(Object[] objs : questions) {
if (objs == null || objs.length < 4 || StringUtils.isEmpty(objs[2])) {
log.info("数据不足,跳转下一行");
@ -242,6 +244,15 @@ public class ImportService implements IImportService {
switch (type) {
case "题目" :
HtQuestion question = initQuestion(objs, evaluationCode, sort);
if (StrUtil.isNotEmpty(question.getRelationCode())) {
String[] split = question.getRelationCode().split("[,,]");
for (String code: split) {
parentCode.put(code, question.getParentCode());
}
}
if (parentCode.containsKey(question.getParentCode())) {
question.setEvaluationCode(parentCode.get(question.getParentCode()));
}
questionList.add(question);
break;
case "选项" :
@ -300,10 +311,12 @@ public class ImportService implements IImportService {
rule = new HtQuestionScoringRule();
rule.setQuestionId(questionId);
rule.setId(snowflake.nextId());
rule.setType(type);
rule.setCreateTime(new Date());
} else {
rule = rules.get(0);
}
rule.setDetail(StringUtils.isEmpty(objs[2]) ? Constant.Ht.STRING_DEFAULT : String.valueOf(objs[2]));
return rule;
}
@ -382,8 +395,11 @@ public class ImportService implements IImportService {
question.setSort(sort);
question.setType(objs.length>4 && StringUtil.checkNum(String.valueOf(objs[4]), false) ? Byte.parseByte(String.valueOf(objs[4])) : Constant.Ht.Question.QUESTION_SHOW_TYPE);
String questionStr = StringUtils.isEmpty(objs[2]) ? Constant.Ht.STRING_DEFAULT : String.valueOf(objs[2]);
byte imgType = 2;
questionStr = question.getType().byteValue() == imgType && StrUtil.isNotEmpty(questionStr) ? PropUtil.imgDomain + questionStr : questionStr;
Set<Byte> imgType = new HashSet<>();
imgType.add((byte)2);
imgType.add((byte)7);
imgType.add((byte)8);
questionStr = imgType.contains(question.getType()) && StrUtil.isNotEmpty(questionStr) ? PropUtil.imgDomain + questionStr : questionStr;
question.setQuestion(questionStr);
question.setRecordType(objs.length > 5 && !StringUtils.isEmpty(objs[5]) ? String.valueOf(objs[5]) : Constant.Ht.STRING_DEFAULT);
question.setRecordContent(objs.length > 6 && !StringUtils.isEmpty(objs[6]) ? String.valueOf(objs[6]) : Constant.Ht.STRING_DEFAULT);

50
ht/src/main/java/com/ccsens/ht/service/PatientReportService.java

@ -3,13 +3,14 @@ package com.ccsens.ht.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.StrUtil;
import com.ccsens.ht.bean.dto.PatientReportDto;
import com.ccsens.ht.bean.po.*;
import com.ccsens.ht.bean.vo.PatientReportVo;
import com.ccsens.ht.persist.dao.HtPatientReportDao;
import com.ccsens.ht.persist.dao.HtPositionDao;
import com.ccsens.ht.persist.dao.HtReportDao;
import com.ccsens.ht.persist.mapper.HtDoctorMapper;
import com.ccsens.ht.persist.mapper.HtPatientFollowUpMapper;
import com.ccsens.ht.persist.mapper.HtPatientMapper;
import com.ccsens.ht.persist.mapper.HtPatientReportRecordMapper;
import com.ccsens.ht.uitl.Constant;
@ -52,9 +53,9 @@ public class PatientReportService implements IPatientReportService {
@Autowired
private HtPositionDao htPositionDao;
@Autowired
private HtReportDao htReportDao;
@Autowired
private HtPatientReportRecordMapper htPatientReportRecordMapper;
@Autowired
private HtPatientFollowUpMapper htPatientFollowUpMapper;
@Override
public JsonResponse<PatientReportVo.Generate> generatePatientReport(PatientReportDto.Generate generate, Long userId) {
@ -118,6 +119,22 @@ public class PatientReportService implements IPatientReportService {
log.info("不具备修改权限");
return CodeEnum.REPORT_DOCTOR_ERROR;
}
//记录病人的随访记录
if (StrUtil.isEmpty(htPatientReport.getInitialImpression())) {
//1.统计病人的报告单的总数
HtPatientReportExample patientReportExample = new HtPatientReportExample();
patientReportExample.createCriteria().andPatientIdEqualTo(htPatientReport.getPatientId()).andInitialImpressionIsNotNull();
long count = htPatientReportDao.countByExample(patientReportExample);
HtPatientFollowUp followUp = new HtPatientFollowUp();
followUp.setId(snowflake.nextId());
followUp.setPatientId(htPatientReport.getPatientId());
followUp.setFollowUpDatetime(new Date());
followUp.setFollowUpTimes((int)count+1);
followUp.setRecorder(htPatientReport.getDoctorId());
followUp.setDiagnose(doctor.getId());
htPatientFollowUpMapper.insertSelective(followUp);
}
//修改报告单
htPatientReportDao.updateByPrimaryKeySelective(patientReport.copy());
log.info("成功编辑报告单信息");
@ -128,6 +145,7 @@ public class PatientReportService implements IPatientReportService {
record.setContent(patientReport.toString());
htPatientReportRecordMapper.insertSelective(record);
log.info("记录编辑日志");
return CodeEnum.SUCCESS;
}
@ -204,10 +222,7 @@ public class PatientReportService implements IPatientReportService {
if (Constant.Ht.Report.TYPE_EVALUATION.equals(score.getType())) {
String specialCode = "NPI";
if (specialCode.equalsIgnoreCase(score.getCode())) {
List<PatientReportVo.ReportScore> reportScores = htPatientReportDao.queryNPIScore(queryDetail.getId());
score.setSubReport(reportScores);
score.setScore(null);
initNPI(queryDetail, score);
}
scores.add(score);
} else {
@ -225,6 +240,27 @@ public class PatientReportService implements IPatientReportService {
return detail;
}
private void initNPI(PatientReportDto.QueryDetail queryDetail, PatientReportVo.ReportScore score) {
Map<String, Object> npiScore = htPatientReportDao.queryNPIScore(queryDetail.getId());
PatientReportVo.ReportScore carer = new PatientReportVo.ReportScore();
carer.setCode("carer");
carer.setName("照顾者");
carer.setTotalScore(-1);
carer.setScore(npiScore == null || npiScore.get("carer") == null ? null : (Integer)npiScore.get("carer"));
carer.setType((byte)3);
carer.setParentCode("NPI");
score.addSub(carer);
PatientReportVo.ReportScore patient = new PatientReportVo.ReportScore();
patient.setCode("result");
patient.setName("患者");
patient.setTotalScore(-1);
patient.setScore(npiScore == null || npiScore.get("result") == null ? null : (Integer)npiScore.get("result"));
patient.setType((byte)3);
patient.setParentCode("NPI");
score.addSub(patient);
score.setScore(null);
}
@Override
public PatientReportVo.Authority queryReportAuthority(PatientReportDto.Authority authority, Long userId) {
PatientReportVo.Authority authorityVo = new PatientReportVo.Authority();

14
ht/src/main/java/com/ccsens/ht/service/PatientService.java

@ -10,11 +10,14 @@ import com.ccsens.ht.bean.dto.PatientDto;
import com.ccsens.ht.bean.po.HtPatient;
import com.ccsens.ht.bean.po.HtPatientExample;
import com.ccsens.ht.bean.po.HtPatientReport;
import com.ccsens.ht.bean.vo.PatientVo;
import com.ccsens.ht.persist.mapper.HtPatientMapper;
import com.ccsens.ht.persist.mapper.HtPatientReportMapper;
import com.ccsens.ht.uitl.Constant;
import com.ccsens.util.*;
import com.ccsens.util.exception.BaseException;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -48,6 +51,17 @@ public class PatientService implements IPatientService {
@Autowired
private TallFeignClient tallFeignClient;
@Override
public PageInfo<PatientVo.Query> queryByRecorder(PatientDto.Recorder recorder, Long userId) {
PageHelper.startPage(recorder.getPageNum(), recorder.getPageSize());
HtPatientExample example = new HtPatientExample();
example.createCriteria().andRecorderEqualTo(userId);
example.setOrderByClause("create_time desc");
List<HtPatient> htPatients = htPatientMapper.selectByExample(example);
List<PatientVo.Query> copy = PatientVo.Query.copy(htPatients);
return new PageInfo<>(copy);
}
@Override
public List<HtPatient> selectPatient(PatientDto.Query patient) {

10
ht/src/main/java/com/ccsens/ht/service/QuestionService.java

@ -1,6 +1,8 @@
package com.ccsens.ht.service;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
@ -182,7 +184,7 @@ public class QuestionService implements IQuestionService {
if (!CollectionUtils.isEmpty(ruleList)) {
HtQuestionScoringRule rule = ruleList.get(0);
if (rule.getType() == Constant.Ht.Rule.SMALL) {
if (rule.getType() == null || rule.getType() == Constant.Ht.Rule.SMALL) {
JSONArray ruleDetails = JSON.parseArray(rule.getDetail());
AtomicInteger patientScore = new AtomicInteger();
for (int i = 0; i < ruleDetails.size() - 2 ; i++) {
@ -240,11 +242,7 @@ public class QuestionService implements IQuestionService {
List<HtPatientScore> scores = new ArrayList<>();
for(QuestionDto.Option option : score.getOptions()) {
HtQuestionOption questionOption = idOption.get(option.getId());
String path = null;
if (option.getPart() != null) {
path = PropUtil.imgDomain + UploadFileUtil_Servlet3.uploadFile(option.getPart(), Constant.IMG + "," + Constant.VIDEO, PropUtil.path);
}
assembleScore(score, question, report, ruleList, nameOption, scores, questionOption, path);
assembleScore(score, question, report, ruleList, nameOption, scores, questionOption, option.getPath());
}
String special = "NPI";
if (special.equalsIgnoreCase(question.getEvaluationCode())) {

2
ht/src/main/resources/application-dev.yml

@ -31,7 +31,7 @@ file:
path: /home/cloud/ht/uploads/
#domain: https://api.ccsens.com/test/
domain: http://localhost:7040/
imgDomain: http://localhost:7040/uploads/
imgDomain: http://localhost:7040/uploads
ht:
project:
name: 阿尔兹海默症评估系统

2
ht/src/main/resources/application-test.yml

@ -32,7 +32,7 @@ file:
path: /home/cloud/ht/uploads/
#domain: https://api.ccsens.com/test/
domain: https://test.tall.wiki/gateway/ht/
imgDomain: https://test.tall.wiki/gateway/ht/uploads/
imgDomain: https://test.tall.wiki/gateway/ht/uploads
ht:
project:
name: 阿尔兹海默症评估系统

10
ht/src/main/resources/mapper_dao/HtDoctorAuditDao.xml

@ -64,4 +64,14 @@
order by d.audit_state, d.create_time desc
</select>
<select id="queryDoctorStatus" resultMap="DoctorDtoResultMap">
select d.*, t.title as title_name, p.`name` as position_name, pt.name as department
from t_ht_doctor d, t_ht_title t, t_ht_position p, t_ht_position pt
where d.title_id = t.id and d.position_id = p.id and p.superior_department_id = pt.id
and d.is_del = 0 and t.is_del = 0 and p.is_del = 0 and pt.is_del = 0
and d.user_id = #{userId, jdbcType=BIGINT}
order by d.create_time desc
limit 1
</select>
</mapper>

21
ht/src/main/resources/mapper_dao/HtPatientReportDao.xml

@ -48,21 +48,18 @@
from
(select code,name, description, total_score, remark, type, parent_code, sort from t_ht_report where is_show = 1 and is_del = 0) t1
left join t_ht_patient_score t2
on t1.code = t2.question_parent_code
where (t2.patient_report_id = #{id, jdbcType=BIGINT} and t2.type in (0,2) and t2.is_del = 0) or t2.id is null
on t1.code = t2.question_parent_code and
(
(t2.patient_report_id = #{id, jdbcType=BIGINT} and t2.type in (0,2) and t2.is_del = 0) or t2.id is null
)
GROUP BY t1.code
order by t1.type,t1.sort
</select>
<select id="queryNPIScore" resultMap="ScoreMap">
select if(t2.option_name = 'carer', 'ZGZ','HZ' ) as code,if(t2.option_name = 'carer', '照顾者','患者' ) as name, '' as description,
t1.total_score, t2.option_name, t1.remark,t1.type,'NPI' as parent_code, sum(t2.score) as score
from
(select code,name, description, total_score, remark, type, parent_code, sort from t_ht_report where is_show = 1 and is_del = 0) t1
left join t_ht_patient_score t2 on t1.code = t2.question_parent_code and t2.option_name in ('carer','result')
where (t2.patient_report_id =#{id, jdbcType=BIGINT} and t2.question_parent_code = 'NPI' and t2.type in (0,2) and t2.is_del = 0)
or (t2.id is null and t2.is_del = 0)
GROUP BY t1.code,t2.option_name
order by t1.type,t1.sort
<select id="queryNPIScore" resultType="Map">
select option_name as optionName, sum(score) as score
from t_ht_patient_score
where patient_report_id = #{id, jdbcType=BIGINT} and question_parent_code = 'NPI'
and option_name in ('carer','result') and is_del = 0 group by option_name;
</select>

26
ht/src/main/resources/mapper_raw/HtPatientFollowUpMapper.xml

@ -6,8 +6,8 @@
<result column="patient_id" jdbcType="BIGINT" property="patientId" />
<result column="follow_up_datetime" jdbcType="TIMESTAMP" property="followUpDatetime" />
<result column="follow_up_times" jdbcType="INTEGER" property="followUpTimes" />
<result column="recorder" jdbcType="VARCHAR" property="recorder" />
<result column="diagnose" jdbcType="VARCHAR" property="diagnose" />
<result column="recorder" jdbcType="BIGINT" property="recorder" />
<result column="diagnose" jdbcType="BIGINT" property="diagnose" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
@ -111,7 +111,7 @@
remark, create_time, update_time,
is_del)
values (#{id,jdbcType=BIGINT}, #{patientId,jdbcType=BIGINT}, #{followUpDatetime,jdbcType=TIMESTAMP},
#{followUpTimes,jdbcType=INTEGER}, #{recorder,jdbcType=VARCHAR}, #{diagnose,jdbcType=VARCHAR},
#{followUpTimes,jdbcType=INTEGER}, #{recorder,jdbcType=BIGINT}, #{diagnose,jdbcType=BIGINT},
#{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{isDel,jdbcType=TINYINT})
</insert>
@ -163,10 +163,10 @@
#{followUpTimes,jdbcType=INTEGER},
</if>
<if test="recorder != null">
#{recorder,jdbcType=VARCHAR},
#{recorder,jdbcType=BIGINT},
</if>
<if test="diagnose != null">
#{diagnose,jdbcType=VARCHAR},
#{diagnose,jdbcType=BIGINT},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
@ -204,10 +204,10 @@
follow_up_times = #{record.followUpTimes,jdbcType=INTEGER},
</if>
<if test="record.recorder != null">
recorder = #{record.recorder,jdbcType=VARCHAR},
recorder = #{record.recorder,jdbcType=BIGINT},
</if>
<if test="record.diagnose != null">
diagnose = #{record.diagnose,jdbcType=VARCHAR},
diagnose = #{record.diagnose,jdbcType=BIGINT},
</if>
<if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR},
@ -232,8 +232,8 @@
patient_id = #{record.patientId,jdbcType=BIGINT},
follow_up_datetime = #{record.followUpDatetime,jdbcType=TIMESTAMP},
follow_up_times = #{record.followUpTimes,jdbcType=INTEGER},
recorder = #{record.recorder,jdbcType=VARCHAR},
diagnose = #{record.diagnose,jdbcType=VARCHAR},
recorder = #{record.recorder,jdbcType=BIGINT},
diagnose = #{record.diagnose,jdbcType=BIGINT},
remark = #{record.remark,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
@ -255,10 +255,10 @@
follow_up_times = #{followUpTimes,jdbcType=INTEGER},
</if>
<if test="recorder != null">
recorder = #{recorder,jdbcType=VARCHAR},
recorder = #{recorder,jdbcType=BIGINT},
</if>
<if test="diagnose != null">
diagnose = #{diagnose,jdbcType=VARCHAR},
diagnose = #{diagnose,jdbcType=BIGINT},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
@ -280,8 +280,8 @@
set patient_id = #{patientId,jdbcType=BIGINT},
follow_up_datetime = #{followUpDatetime,jdbcType=TIMESTAMP},
follow_up_times = #{followUpTimes,jdbcType=INTEGER},
recorder = #{recorder,jdbcType=VARCHAR},
diagnose = #{diagnose,jdbcType=VARCHAR},
recorder = #{recorder,jdbcType=BIGINT},
diagnose = #{diagnose,jdbcType=BIGINT},
remark = #{remark,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},

45
util/src/main/java/com/ccsens/util/Base64FileUtil.java

@ -0,0 +1,45 @@
package com.ccsens.util;
import cn.hutool.core.codec.Base64;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.Random;
/**
* @description:
* @author: wuHuiJuan
* @create: 2019/12/17 17:48
*/
public class Base64FileUtil {
/**
* 将base64字符串转换成文件
* @param base64
* @param path
* @param visitPath 访问路径无文件名
* @return 返回文件访问路径无域名
* @throws Exception
*/
public static String base64ToFile(String base64, String path, String visitPath) throws Exception {
//获取后缀 data:image/png;base64,xxxxxx
String suffix = base64.substring(base64.indexOf("/")+1, base64.indexOf(";"));
Random random = new Random();
String randomStr = String.valueOf(System.currentTimeMillis()) + random.nextInt(100) + "." + suffix;
String fileName = visitPath + randomStr;
File file = new File(path + fileName);
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
// 截取base64,后面的字符串
String base64flag = "base64,";
int index = base64.indexOf(base64flag);
String str = index < 0 ? base64 : base64.substring(index + base64flag.length());
byte[] decode = Base64.decode(str);
FileOutputStream out = new FileOutputStream(file);
out.write(decode);
out.close();
return fileName;
}
}

3
util/src/main/java/com/ccsens/util/CodeEnum.java

@ -66,7 +66,8 @@ public enum CodeEnum {
REPEAT_PROJECT_NAME(51,"项目名不能重复,请修改后重试",true),
TIME_ERROR_BEGIN(52,"时间异常,开始时间不能大于结束时间",true),
TIME_ERROR_PROJECT(53,"时间异常,任务的时间不能超出项目的时间",true),
HAS_GROUP_TIME_CHANGE(54,"分组任务不能直接修改时间,请修改其子任务时间",true)
HAS_GROUP_TIME_CHANGE(54,"分组任务不能直接修改时间,请修改其子任务时间",true),
DOCTOR_NOT_SUBMIT(55,"尚未进行资格认证",true),
;
public CodeEnum addMsg(String msg){

34
util/src/test/java/com/ccsens/util/Base64Test.java

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save