From 37a525a869413429177c23819f50b62f455f3273 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Tue, 13 Apr 2021 19:11:35 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ccsens/tcm/service/ImportService.java | 13 ++++++------- .../main/resources/mapper_dao/QuestionDao.xml | 17 ++++++++++------- .../main/resources/mapper_dao/ReportCodeDao.xml | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/tcm/src/main/java/com/ccsens/tcm/service/ImportService.java b/tcm/src/main/java/com/ccsens/tcm/service/ImportService.java index 4fc45e74..7ac5069b 100644 --- a/tcm/src/main/java/com/ccsens/tcm/service/ImportService.java +++ b/tcm/src/main/java/com/ccsens/tcm/service/ImportService.java @@ -283,18 +283,17 @@ public class ImportService implements IImportService { } question.setRelevanceOptionId(optionId == null ? 0 : optionId); // 设置关联那个医院 - List hospitalIds = null; + List hospitalIds = new ArrayList<>(); int hospitalIndex = 10; if (objs.length > hospitalIndex && !StringUtils.isEmpty(objs[hospitalIndex])) { - hospitalMap.forEach((key, value)->{ - hospitalIds.add(value); - - }); - } else { String[] codes = ((String) objs[hospitalIndex]).split("[,,]"); for (String code:codes) { hospitalIds.add(hospitalMap.get(code)); } + } else { + hospitalMap.forEach((key, value)->{ + hospitalIds.add(value); + }); } hospitalIds.forEach(id->{ @@ -302,7 +301,7 @@ public class ImportService implements IImportService { questionHospital.setId(snowflake.nextId()); questionHospital.setQuestionId(question.getId()); questionHospital.setHospitalId(id); - questionHospitalDao.insert(questionHospital); + questionHospitalDao.insertSelective(questionHospital); }); log.info("导入试题:{}", question); diff --git a/tcm/src/main/resources/mapper_dao/QuestionDao.xml b/tcm/src/main/resources/mapper_dao/QuestionDao.xml index 28a2a991..2d17545c 100644 --- a/tcm/src/main/resources/mapper_dao/QuestionDao.xml +++ b/tcm/src/main/resources/mapper_dao/QuestionDao.xml @@ -173,8 +173,11 @@ from t_question q, t_question_hospital h WHERE q.id = h.question_id - q.`code` = #{code} - h.hospital_id = #{hospitalId} + + and q.`code` = #{code} + + + and h.hospital_id = #{hospitalId} and q.relevance_option_id = 0 and q.rec_status = 0 and h.rec_status = 0 @@ -262,15 +265,15 @@ )a ORDER BY a.qsort,a.osort,a.choose DESC,-a.otherInformation DESC - + - + - + @@ -298,11 +301,11 @@ AND trc.rec_status =0 order by trc.sort,trc1.sort,tq.sort - + - + diff --git a/tcm/src/main/resources/mapper_dao/ReportCodeDao.xml b/tcm/src/main/resources/mapper_dao/ReportCodeDao.xml index 0283429c..bc304f6f 100644 --- a/tcm/src/main/resources/mapper_dao/ReportCodeDao.xml +++ b/tcm/src/main/resources/mapper_dao/ReportCodeDao.xml @@ -149,7 +149,7 @@ c.code = t.code and t.recode_time = #{nums} and c.`level` = 2 - and crec_status = 0 + and c.rec_status = 0 and t.rec_status = 0 ) c2 on c1.`code` = c2.parent_code From 69f3fefa78219f08a59103b48903101aaa121c8a Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Wed, 14 Apr 2021 14:39:12 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tall/src/main/resources/application.yml | 4 ++-- .../com/ccsens/tcm/bean/dto/PatientDto.java | 4 ++-- .../ccsens/tcm/service/PatientService.java | 20 ++++++++++++------- tcm/src/main/resources/application.yml | 4 ++-- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/tall/src/main/resources/application.yml b/tall/src/main/resources/application.yml index ebc544af..b5408a3a 100644 --- a/tall/src/main/resources/application.yml +++ b/tall/src/main/resources/application.yml @@ -1,5 +1,5 @@ spring: profiles: - active: test - include: util-test,common + active: dev + include: util-dev,common diff --git a/tcm/src/main/java/com/ccsens/tcm/bean/dto/PatientDto.java b/tcm/src/main/java/com/ccsens/tcm/bean/dto/PatientDto.java index e530909d..2e67898d 100644 --- a/tcm/src/main/java/com/ccsens/tcm/bean/dto/PatientDto.java +++ b/tcm/src/main/java/com/ccsens/tcm/bean/dto/PatientDto.java @@ -20,8 +20,8 @@ public class PatientDto { @Data @ApiModel("保存患者基本信息") public static class SavePatient { - @ApiModelProperty("住院号") - private String hospitalization; +// @ApiModelProperty("住院号") +// private String hospitalization; @ApiModelProperty("对照组id") private Long inpatientId; @ApiModelProperty("录入状态:0:新建 1:数据搜集中 2数据搜集完成 3数据搜集超时 4:废弃") diff --git a/tcm/src/main/java/com/ccsens/tcm/service/PatientService.java b/tcm/src/main/java/com/ccsens/tcm/service/PatientService.java index 12e990f1..f435e2a9 100644 --- a/tcm/src/main/java/com/ccsens/tcm/service/PatientService.java +++ b/tcm/src/main/java/com/ccsens/tcm/service/PatientService.java @@ -73,16 +73,22 @@ public class PatientService implements IPatientService { @Override public void savePatient(PatientDto.SavePatient param, Long userId) { - PatientInformationExample patientInformationExample=new PatientInformationExample(); - patientInformationExample.createCriteria().andHospitalizationEqualTo(param.getHospitalization()).andRecStatusEqualTo((byte)0); - long l = patientInformationMapper.countByExample(patientInformationExample); - if(l>0){ - throw new BaseException(CodeEnum.ZHUYUANIDCHONGFU); - } - param.setHospitalId(selUserIdToHosId(userId).getId()); +// PatientInformationExample patientInformationExample=new PatientInformationExample(); +// patientInformationExample.createCriteria().andHospitalizationEqualTo(param.getHospitalization()).andRecStatusEqualTo((byte)0); +// long l = patientInformationMapper.countByExample(patientInformationExample); +// if(l>0){ +// throw new BaseException(CodeEnum.ZHUYUANIDCHONGFU); +// } + Hospital hospital = selUserIdToHosId(userId); + + + param.setHospitalId(hospital.getId()); PatientInformation patientInformation=new PatientInformation(); BeanUtils.copyProperties(param,patientInformation); patientInformation.setId(snowflake.nextId()); + // 生成编号 + String num = hospital.getCode() + ""; + patientInformation.setHospitalization(num); patientInformationMapper.insertSelective(patientInformation); } diff --git a/tcm/src/main/resources/application.yml b/tcm/src/main/resources/application.yml index 33b76558..4ecd13fd 100644 --- a/tcm/src/main/resources/application.yml +++ b/tcm/src/main/resources/application.yml @@ -1,5 +1,5 @@ spring: profiles: - active: green - include: common, util-green + active: dev + include: common, util-dev From a6ae493a99e07cc8a48d5044c510931082b312a2 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Thu, 15 Apr 2021 09:49:10 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=82=A3=E8=80=85=E5=92=8C=E7=94=9F?= =?UTF-8?q?=E7=89=A9=E6=A0=B7=E6=9C=AC=E7=BC=96=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ccsens/tcm/bean/po/BiologicalSamples.java | 11 +++ .../tcm/bean/po/BiologicalSamplesExample.java | 70 +++++++++++++++++++ .../tcm/bean/vo/BiologicalSamplesVo.java | 4 +- .../ccsens/tcm/service/PatientService.java | 46 +++++++----- .../java/com/ccsens/tcm/uitl/Constant.java | 41 +++++++++++ tcm/src/main/resources/application.yml | 4 +- .../main/resources/mapper_dao/PatientDao.xml | 2 +- .../mapper_raw/BiologicalSamplesMapper.xml | 35 +++++++--- .../main/java/com/ccsens/util/CodeEnum.java | 2 +- 9 files changed, 182 insertions(+), 33 deletions(-) diff --git a/tcm/src/main/java/com/ccsens/tcm/bean/po/BiologicalSamples.java b/tcm/src/main/java/com/ccsens/tcm/bean/po/BiologicalSamples.java index 1e36ad0d..7b16a3fd 100644 --- a/tcm/src/main/java/com/ccsens/tcm/bean/po/BiologicalSamples.java +++ b/tcm/src/main/java/com/ccsens/tcm/bean/po/BiologicalSamples.java @@ -6,6 +6,8 @@ import java.util.Date; public class BiologicalSamples implements Serializable { private Long id; + private String code; + private Byte sampleType; private Long patientInformationId; @@ -30,6 +32,14 @@ public class BiologicalSamples implements Serializable { this.id = id; } + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code == null ? null : code.trim(); + } + public Byte getSampleType() { return sampleType; } @@ -93,6 +103,7 @@ public class BiologicalSamples implements Serializable { sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); + sb.append(", code=").append(code); sb.append(", sampleType=").append(sampleType); sb.append(", patientInformationId=").append(patientInformationId); sb.append(", collectTime=").append(collectTime); diff --git a/tcm/src/main/java/com/ccsens/tcm/bean/po/BiologicalSamplesExample.java b/tcm/src/main/java/com/ccsens/tcm/bean/po/BiologicalSamplesExample.java index 591f2da5..5068090e 100644 --- a/tcm/src/main/java/com/ccsens/tcm/bean/po/BiologicalSamplesExample.java +++ b/tcm/src/main/java/com/ccsens/tcm/bean/po/BiologicalSamplesExample.java @@ -165,6 +165,76 @@ public class BiologicalSamplesExample { return (Criteria) this; } + public Criteria andCodeIsNull() { + addCriterion("code is null"); + return (Criteria) this; + } + + public Criteria andCodeIsNotNull() { + addCriterion("code is not null"); + return (Criteria) this; + } + + public Criteria andCodeEqualTo(String value) { + addCriterion("code =", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeNotEqualTo(String value) { + addCriterion("code <>", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeGreaterThan(String value) { + addCriterion("code >", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeGreaterThanOrEqualTo(String value) { + addCriterion("code >=", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeLessThan(String value) { + addCriterion("code <", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeLessThanOrEqualTo(String value) { + addCriterion("code <=", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeLike(String value) { + addCriterion("code like", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeNotLike(String value) { + addCriterion("code not like", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeIn(List values) { + addCriterion("code in", values, "code"); + return (Criteria) this; + } + + public Criteria andCodeNotIn(List values) { + 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; + } + public Criteria andSampleTypeIsNull() { addCriterion("sample_type is null"); return (Criteria) this; diff --git a/tcm/src/main/java/com/ccsens/tcm/bean/vo/BiologicalSamplesVo.java b/tcm/src/main/java/com/ccsens/tcm/bean/vo/BiologicalSamplesVo.java index 9e913781..41d383e9 100644 --- a/tcm/src/main/java/com/ccsens/tcm/bean/vo/BiologicalSamplesVo.java +++ b/tcm/src/main/java/com/ccsens/tcm/bean/vo/BiologicalSamplesVo.java @@ -14,8 +14,10 @@ public class BiologicalSamplesVo { public static class selBiolog { @ApiModelProperty("医院名称") private String name; - @ApiModelProperty("患者住院号") + @ApiModelProperty("患者编号") private String hospitalization; + @ApiModelProperty("生物样本编号") + private String code; @ApiModelProperty("样本类型 0:抗血凝10ml 1:促凝血5ml 2:晨尿10ml 3:24小时尿10ml") private Byte sampleType; @ApiModelProperty("采集时间") diff --git a/tcm/src/main/java/com/ccsens/tcm/service/PatientService.java b/tcm/src/main/java/com/ccsens/tcm/service/PatientService.java index f435e2a9..e15086c2 100644 --- a/tcm/src/main/java/com/ccsens/tcm/service/PatientService.java +++ b/tcm/src/main/java/com/ccsens/tcm/service/PatientService.java @@ -26,6 +26,7 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.text.DecimalFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; @@ -54,22 +55,22 @@ public class PatientService implements IPatientService { private HospitalMapper hospitalMapper; @Resource private DoctorMapper doctorMapper; - @Value("${day.one}") - public int one; - @Value("${day.two}") - public int two; - @Value("${day.oneFront}") - public int oneFront; - @Value("${day.oneAfter}") - public int oneAfter; - @Value("${day.twoAfter}") - public int twoAfter; - @Value("${day.three}") - public int three; - @Value("${day.threeFront}") - public int threeFront; - @Value("${day.threeAfter}") - public int threeAfter; +// @Value("${day.one}") +// public int one; +// @Value("${day.two}") +// public int two; +// @Value("${day.oneFront}") +// public int oneFront; +// @Value("${day.oneAfter}") +// public int oneAfter; +// @Value("${day.twoAfter}") +// public int twoAfter; +// @Value("${day.three}") +// public int three; +// @Value("${day.threeFront}") +// public int threeFront; +// @Value("${day.threeAfter}") +// public int threeAfter; @Override public void savePatient(PatientDto.SavePatient param, Long userId) { @@ -80,14 +81,20 @@ public class PatientService implements IPatientService { // throw new BaseException(CodeEnum.ZHUYUANIDCHONGFU); // } Hospital hospital = selUserIdToHosId(userId); - - + Inpatient inpatient = inpatientMapper.selectByPrimaryKey(param.getInpatientId()); + if (inpatient == null) { + throw new BaseException(CodeEnum.PARAM_ERROR); + } + log.info("医院:{},对照组:{}", hospital, inpatient); param.setHospitalId(hospital.getId()); PatientInformation patientInformation=new PatientInformation(); BeanUtils.copyProperties(param,patientInformation); patientInformation.setId(snowflake.nextId()); // 生成编号 - String num = hospital.getCode() + ""; + long incr = redisUtil.incr(Constant.Redis.HOSPITAL_NUM + hospital.getCode(), 1) + 1; + DecimalFormat df=new DecimalFormat("000"); + String num = hospital.getCode() + "" + inpatient.getCode() + df.format(incr); + log.info("编号:{}", num); patientInformation.setHospitalization(num); patientInformationMapper.insertSelective(patientInformation); } @@ -348,6 +355,7 @@ public class PatientService implements IPatientService { biologicalSamples.setId(snowflake.nextId()); biologicalSamples.setPatientInformationId(patientInformations.get(0).getId()); BeanUtils.copyProperties(param,biologicalSamples); + biologicalSamples.setCode(param.getHospitalization() + Constant.SPLIT_STRIKE + Constant.Biological.getByType(param.getSampleType()).getCode() + Constant.SPLIT_STRIKE + param.getCollectTime()); biologicalSamplesMapper.insertSelective(biologicalSamples); } diff --git a/tcm/src/main/java/com/ccsens/tcm/uitl/Constant.java b/tcm/src/main/java/com/ccsens/tcm/uitl/Constant.java index 9a7efbff..93effda2 100644 --- a/tcm/src/main/java/com/ccsens/tcm/uitl/Constant.java +++ b/tcm/src/main/java/com/ccsens/tcm/uitl/Constant.java @@ -20,6 +20,8 @@ public class Constant { 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 static final String SPLIT_STRIKE = "-"; /**选择选项后关联其他题目*/ @@ -35,6 +37,43 @@ public class Constant { public final static byte SEX_MAN = 0; public final static byte SEX_WOMAN = 1; + public enum Biological { + /**抗血凝*/ + ANTICOAGULATION((byte)0, "X-1", "血标本上清液"), + THROMBOPLASTIN((byte)1, "X-2", "血标本细胞"), + MORNING_URINE((byte)2, "N-3", "尿标本"), + ; + private byte type; + private String code; + private String name; + + Biological(byte type, String code, String name) { + this.type = type; + this.code = code; + this.name = name; + } + public static Biological getByType(byte type){ + for (Biological cal: Biological.values()) { + if (cal.type == type) { + return cal; + } + } + return null; + } + + public byte getType() { + return type; + } + + public String getCode() { + return code; + } + + public String getName() { + return name; + } + } + public static class Report{ public final static String PARENT_CODE = "TCM"; public final static String CODE_BSXG = "BSXG"; @@ -63,6 +102,8 @@ public class Constant { public final static String DISEASE_TIME = "disease_time"; /**所有题目按code分类*/ public final static String CODE_QUESTION = "code_question"; + /**医院排序*/ + public final static String HOSPITAL_NUM = "hospital_num_"; } public static class File{ diff --git a/tcm/src/main/resources/application.yml b/tcm/src/main/resources/application.yml index 4ecd13fd..33b76558 100644 --- a/tcm/src/main/resources/application.yml +++ b/tcm/src/main/resources/application.yml @@ -1,5 +1,5 @@ spring: profiles: - active: dev - include: common, util-dev + active: green + include: common, util-green diff --git a/tcm/src/main/resources/mapper_dao/PatientDao.xml b/tcm/src/main/resources/mapper_dao/PatientDao.xml index 26999425..149a59d8 100644 --- a/tcm/src/main/resources/mapper_dao/PatientDao.xml +++ b/tcm/src/main/resources/mapper_dao/PatientDao.xml @@ -391,7 +391,7 @@ t.user_id select @@ -104,12 +105,14 @@ - insert into t_biological_samples (id, sample_type, patient_information_id, - collect_time, user_id, created_at, - update_at, rec_status) - values (#{id,jdbcType=BIGINT}, #{sampleType,jdbcType=TINYINT}, #{patientInformationId,jdbcType=BIGINT}, - #{collectTime,jdbcType=INTEGER}, #{userId,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, - #{updateAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}) + insert into t_biological_samples (id, code, sample_type, + patient_information_id, collect_time, user_id, + created_at, update_at, rec_status + ) + values (#{id,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{sampleType,jdbcType=TINYINT}, + #{patientInformationId,jdbcType=BIGINT}, #{collectTime,jdbcType=INTEGER}, #{userId,jdbcType=BIGINT}, + #{createdAt,jdbcType=TIMESTAMP}, #{updateAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT} + ) insert into t_biological_samples @@ -117,6 +120,9 @@ id, + + code, + sample_type, @@ -143,6 +149,9 @@ #{id,jdbcType=BIGINT}, + + #{code,jdbcType=VARCHAR}, + #{sampleType,jdbcType=TINYINT}, @@ -178,6 +187,9 @@ id = #{record.id,jdbcType=BIGINT}, + + code = #{record.code,jdbcType=VARCHAR}, + sample_type = #{record.sampleType,jdbcType=TINYINT}, @@ -207,6 +219,7 @@ update t_biological_samples set id = #{record.id,jdbcType=BIGINT}, + code = #{record.code,jdbcType=VARCHAR}, sample_type = #{record.sampleType,jdbcType=TINYINT}, patient_information_id = #{record.patientInformationId,jdbcType=BIGINT}, collect_time = #{record.collectTime,jdbcType=INTEGER}, @@ -221,6 +234,9 @@ update t_biological_samples + + code = #{code,jdbcType=VARCHAR}, + sample_type = #{sampleType,jdbcType=TINYINT}, @@ -247,7 +263,8 @@ update t_biological_samples - set sample_type = #{sampleType,jdbcType=TINYINT}, + set code = #{code,jdbcType=VARCHAR}, + sample_type = #{sampleType,jdbcType=TINYINT}, patient_information_id = #{patientInformationId,jdbcType=BIGINT}, collect_time = #{collectTime,jdbcType=INTEGER}, user_id = #{userId,jdbcType=BIGINT}, diff --git a/util/src/main/java/com/ccsens/util/CodeEnum.java b/util/src/main/java/com/ccsens/util/CodeEnum.java index 437c10d7..ce588315 100644 --- a/util/src/main/java/com/ccsens/util/CodeEnum.java +++ b/util/src/main/java/com/ccsens/util/CodeEnum.java @@ -183,7 +183,7 @@ public enum CodeEnum { ALREADY_UPLOAD_VIDEO(150,"您已经上传了视频,请勿重复提交",true), ALREADY_UPLOAD_FORM(151,"请勿重复提交信息",true), MESSAGEISNULL(152,"数据为空",true), - QUANTITYERROR(153,"住院号和患者id不对应",true), + QUANTITYERROR(153,"住院号不正确",true), NOT_HOSPITAL(154,"未找到医院信息",true), ZHUYUANIDCHONGFU(155,"住院号重复",true), MEIYOUGAIYISHENG(156,"该医生信息查询不正确",true),