diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java index e26940dd..8e540b45 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java @@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONObject; import com.acupuncture.common.annotation.Anonymous; import com.acupuncture.common.annotation.DataSource; import com.acupuncture.common.config.RuoYiConfig; @@ -191,4 +192,60 @@ public class ExternalController { public JsonResponse selectReportByMemberId(@RequestBody @Validated ExternalDto.MemberDto dto){ return JsonResponse.ok(externalService.selectReportByMemberId(dto.getId())); } + + @Anonymous + @ApiOperation("2人员信息查询接口") + @GetMapping("/http/getPersonInfo") + @DataSource(DataSourceType.MASTER) + public Object getPersonInfo( @RequestParam("uid") String uid) { + log.info("获取人员信息:{}", uid); + ExternalVo.UserInfo query = externalService.motionQueryMember(uid); + if (query == null) { + return "no person"; + } + return query; + } + + @Anonymous + @ApiOperation("3.1体质测试类数据的实时传输") + @PostMapping("/http/motionUploadMemberInfo") + public Object motionAdd(@RequestBody String str){ + log.info("str:{}", str); + ExternalDto.RtcfInfo rtcfInfo = BeanUtil.copyProperties(new JSONObject(str), ExternalDto.RtcfInfo.class); + checkoutData(rtcfInfo.getUUID()); + log.info("上传运动数据dto123:{}",rtcfInfo); + if (externalService.motionAdd(rtcfInfo) == 0) { + return "upload fail"; + }else { + return "Fitness data upload ok"; + } + } + + @Anonymous + @ApiOperation("3.2体成分数据的上传") + @PostMapping("/http/motionUploadMemberTcfInfo") + public Object motionAddTcf(@RequestBody String str){ + log.info("str:{}", str); + ExternalDto.BcaData rtcfInfo = BeanUtil.copyProperties(new JSONObject(str), ExternalDto.BcaData.class); + checkoutData(rtcfInfo.getUUID()); + log.info("上传运动数据dto123:{}",rtcfInfo); + if (externalService.motionAddTcf(rtcfInfo) == 0) { + return "upload fail"; + }else { + return "BCA data upload ok"; + } + } + + + @ApiOperation("查询运动3.1信息") + @PostMapping("/http/queryMotionInfo") + public JsonResponse queryMotionInfo(@RequestBody @Validated ExternalDto.MemberDto dto){ + return JsonResponse.ok(externalService.queryMotionInfo(dto.getMemberId())); + } + + @ApiOperation("查询运动3.2信息") + @PostMapping("/http/queryMotionTcfInfo") + public JsonResponse queryMotionTcfInfo(@RequestBody @Validated ExternalDto.MemberDto dto){ + return JsonResponse.ok(externalService.queryMotionTcfInfo(dto.getMemberId())); + } } diff --git a/acupuncture-admin/src/main/resources/application-dev.yml b/acupuncture-admin/src/main/resources/application-dev.yml index 1b9c6176..958a7336 100644 --- a/acupuncture-admin/src/main/resources/application-dev.yml +++ b/acupuncture-admin/src/main/resources/application-dev.yml @@ -6,7 +6,7 @@ spring: druid: # 主库数据源 master: - url: jdbc:mysql://localhost:3306/acupuncture?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://localhost:3306/acupuncture_ays?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root password: q7510327 # 从库数据源 diff --git a/acupuncture-admin/src/main/resources/application-prod.yml b/acupuncture-admin/src/main/resources/application-prod.yml index aaa2e7af..41d2c6ca 100644 --- a/acupuncture-admin/src/main/resources/application-prod.yml +++ b/acupuncture-admin/src/main/resources/application-prod.yml @@ -66,7 +66,7 @@ spring: # 端口,默认为6379 port: 6379 # 数据库索引 - database: 0 + database: 1 # 密码 password: 123456 # 连接超时时间 diff --git a/acupuncture-admin/src/main/resources/application.yml b/acupuncture-admin/src/main/resources/application.yml index edbc6b6d..1e78a74d 100644 --- a/acupuncture-admin/src/main/resources/application.yml +++ b/acupuncture-admin/src/main/resources/application.yml @@ -101,7 +101,7 @@ token: # 令牌密钥 secret: abcdefghijklmnopqrstuvwxyz # 令牌有效期(默认30分钟) - expireTime: 1800 + expireTime: 18000 # MyBatis配置 mybatis: diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java index bc30b81b..d251f248 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java @@ -2,8 +2,10 @@ package com.acupuncture.system.domain.dto; import com.acupuncture.system.domain.po.UplReportImage; import com.acupuncture.system.domain.po.UplRtcfInfo; +import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotNull; @@ -215,4 +217,933 @@ public class ExternalDto { private String from; private String memberid; } + + + /** + * 3.1体质测试类数据的实时传输 + */ + public static class RtcfInfo { + @ApiModelProperty("当前测得体质测试类数据标题") + @JsonProperty("Title") + private String Title; + @ApiModelProperty("单位代码(或科室代码、项目代码)") + @JsonProperty("UUID") + private String UUID; + @ApiModelProperty("人员编号") + @JsonProperty("UID") + @NotNull(message = "人员编号不能为空") + private String UID; + @ApiModelProperty("测试序号(时间戳)") + @JsonProperty("TestID") + private String TestID; + @ApiModelProperty("测试日期") + @JsonProperty("TestDate") + @NotNull(message = "测试日期不能为空") + private String TestDate; + @ApiModelProperty("测试者姓名") + @JsonProperty("Name") + private String Name; + @ApiModelProperty("测试者性别,男1女2") + @JsonProperty("Sex") + private String Sex; + @ApiModelProperty("测试者出生年份") + @JsonProperty("BirthYear") + @JsonFormat(pattern = "yyyy") + private String BirthYear; + + private List data; + private Advice advice; + + //体测结果数据* + + public String getTitle() { + return Title; + } + + public void setTitle(String title) { + Title = title; + } + @JsonProperty("") + public String getUUID() { + return UUID; + } + + public void setUUID(String UUID) { + this.UUID = UUID; + } + @JsonProperty("") + public String getUID() { + return UID; + } + + public void setUID(String UID) { + this.UID = UID; + } + @JsonProperty("") + public String getTestID() { + return TestID; + } + + public void setTestID(String testID) { + TestID = testID; + } + @JsonProperty("") + public String getTestDate() { + return TestDate; + } + + public void setTestDate(String testDate) { + TestDate = testDate; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getSex() { + return Sex; + } + + public void setSex(String sex) { + Sex = sex; + } + @JsonFormat(pattern = "yyyy") + public String getBirthYear() { + return BirthYear; + } + @JsonFormat(pattern = "yyyy") + public void setBirthYear(String birthYear) { + BirthYear = birthYear; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public Advice getAdvice() { + return advice; + } + + public void setAdvice(Advice advice) { + this.advice = advice; + } + + public static class Detail { + private String TestID; + @JsonProperty("Item") + private String Item; + @JsonProperty("Value") + private String Value; + @JsonProperty("Score") + private String Score; + + @JsonProperty("Item") + public String getItem() { + return Item; + } + + public void setItem(String item) { + Item = item; + } + + @JsonProperty("Value") + public String getValue() { + return Value; + } + + public void setValue(String value) { + Value = value; + } + + @JsonProperty("Score") + public String getScore() { + return Score; + } + + public void setScore(String score) { + Score = score; + } + + public String getTestID() { + return TestID; + } + + public void setTestID(String testID) { + TestID = testID; + } + } + + public static class Advice { + @JsonProperty("SportPrinciple") + private String SportPrinciple; //运动原则 + @JsonProperty("Aerobic") + private String Aerobic; //有氧运动内容 + @JsonProperty("Strength") + private String Strength; //力量运动内容 + @JsonProperty("Flexibility") + private String Flexibility; //柔韧运动内容 + @JsonProperty("FunctionExcercise") + private String FunctionExcercise; //功能性练习内容 + @JsonProperty("Caution") + private String Caution; //注意事项 + private String TestID; + @JsonProperty("SportPrinciple") + public String getSportPrinciple() { + return SportPrinciple; + } + + public void setSportPrinciple(String sportPrinciple) { + SportPrinciple = sportPrinciple; + } + + @JsonProperty("Aerobic") + public String getAerobic() { + return Aerobic; + } + + public void setAerobic(String aerobic) { + Aerobic = aerobic; + } + + @JsonProperty("Strength") + public String getStrength() { + return Strength; + } + + public void setStrength(String strength) { + Strength = strength; + } + + @JsonProperty("Flexibility") + public String getFlexibility() { + return Flexibility; + } + + public void setFlexibility(String flexibility) { + Flexibility = flexibility; + } + + @JsonProperty("FunctionExcercise") + public String getFunctionExcercise() { + return FunctionExcercise; + } + + public void setFunctionExcercise(String functionExcercise) { + FunctionExcercise = functionExcercise; + } + + @JsonProperty("Caution") + public String getCaution() { + return Caution; + } + + public void setCaution(String caution) { + Caution = caution; + } + + public String getTestID() { + return TestID; + } + + public void setTestID(String testID) { + TestID = testID; + } + } + } + + public static class BcaData { + @ApiModelProperty("当前测得体质测试类数据标题") + @JsonProperty("Title") + private String Title; + @ApiModelProperty("单位代码(或科室代码、项目代码)") + @JsonProperty("UUID") + private String UUID; + @ApiModelProperty("人员编号") + @JsonProperty("UID") + private String UID; + @ApiModelProperty("测试序号(时间戳)") + @JsonProperty("TestID") + private String TestID; + @ApiModelProperty("测试日期") + @JsonProperty("TestDate") + private String TestDate; + @ApiModelProperty("测试者姓名") + @JsonProperty("Name") + private String Name; + @ApiModelProperty("测试者性别,男1女2") + @JsonProperty("Sex") + private String Sex; + private Data data; + private Advice advice; + + public String getTitle() { + return Title; + } + + public void setTitle(String title) { + Title = title; + } + + public String getUUID() { + return UUID; + } + + public void setUUID(String UUID) { + this.UUID = UUID; + } + + public String getUID() { + return UID; + } + + public void setUID(String UID) { + this.UID = UID; + } + + public String getTestID() { + return TestID; + } + + public void setTestID(String testID) { + TestID = testID; + } + + public String getTestDate() { + return TestDate; + } + + public void setTestDate(String testDate) { + TestDate = testDate; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getSex() { + return Sex; + } + + public void setSex(String sex) { + Sex = sex; + } + + public Data getData() { + return data; + } + + public void setData(Data data) { + this.data = data; + } + + public Advice getAdvice() { + return advice; + } + + public void setAdvice(Advice advice) { + this.advice = advice; + } + + public static class Data { + @JsonProperty("TestID") + private String TestID; + @JsonProperty("UID") + private String UID; + @JsonProperty("UUID") + private String UUID; + @JsonProperty("Name") + private String Name; + @JsonProperty("TestDate") + private String TestDate; + @JsonProperty("Sex") + private String Sex; + @JsonProperty("Weight") + private String Weight; //体重 + @JsonProperty("Fat") + private String Fat; //脂肪 + @JsonProperty("Bone") + private String Bone; //骨质 + @JsonProperty("Protein") + private String Protein; //蛋白质 + @JsonProperty("Water") + private String Water; //水分 + @JsonProperty("Muscle") + private String Muscle; //肌肉 + @JsonProperty("SMM") + private String SMM; //骨骼肌 + @JsonProperty("PBF") + private String PBF; //体脂百分比 + @JsonProperty("BMI") + private String BMI; //体质指数 + @JsonProperty("BMR") + private String BMR; //基础代谢 + @JsonProperty("Edema") + private String Edema; //水肿系数(2位小数) + @JsonProperty("VFI") + private String VFI; //内脏脂肪指数 + @JsonProperty("BodyAge") + private String BodyAge; //身体年龄 + @JsonProperty("Score") + private String Score; //健康评分 + @JsonProperty("BodyType") + private String BodyType; //体型判定 + @JsonProperty("Standard_weight") + private String Standard_weight; //目标体重 + @JsonProperty("Weight_control") + private String Weight_control; //体重控制 + @JsonProperty("Fat_control") + private String Fat_control; //脂肪控制量 + @JsonProperty("Muscle_control") + private String Muscle_control;//肌肉控制量 + @JsonProperty("ASMI") + private String ASMI; //四肢骨骼肌指数 + @JsonProperty("WeightMax") + private String WeightMax; //体重正常范围的高值 + @JsonProperty("WeightMin") + private String WeightMin; //体重正常范围的低值 + @JsonProperty("FatMax") + private String FatMax;//体重正常范围的高值 + @JsonProperty("FatMin") + private String FatMin; //体重正常范围的低值 + @JsonProperty("BoneMax") + private String BoneMax; //骨质正常范围的高值 + @JsonProperty("BoneMin") + private String BoneMin; //骨质正常范围的低值 + @JsonProperty("ProteinMax") + private String ProteinMax; //蛋白质正常范围的高值 + @JsonProperty("ProteinMin") + private String ProteinMin; //蛋白质正常范围的低值 + @JsonProperty("WaterMax") + private String WaterMax;//水分正常范围的高值 + @JsonProperty("WaterMin") + private String WaterMin; //水分正常范围的低值 + @JsonProperty("MuscleMax") + private String MuscleMax; //肌肉正常范围的高值 + @JsonProperty("MuscleMin") + private String MuscleMin; //肌肉正常范围的低值 + @JsonProperty("SMMMax") + private String SMMMax;//骨骼肌正常范围的高值 + @JsonProperty("SMMMin") + private String SMMMin;//骨骼肌正常范围的低值 + @JsonProperty("PBFMax") + private String PBFMax; //体脂率正常范围的高值 + @JsonProperty("PBFMin") + private String PBFMin; //体脂率正常范围的低值 + @JsonProperty("BMIMax") + private String BMIMax; //体质指数正常范围的高值 + @JsonProperty("BMIMin") + private String BMIMin; //体质指数正常范围的低值 + @JsonProperty("WHRMax") + private String WHRMax;//腰臀比正常范围的高值 + @JsonProperty("WHRMin") + private String WHRMin;//腰臀比正常范围的低值 + @JsonProperty("EdemaMax") + private String EdemaMax; //水肿系数正常范围的高值 + @JsonProperty("EdemaMin") + private String EdemaMin; //水肿系数正常范围的低值 + @JsonProperty("VFIMax") + private String VFIMax; //内脏脂肪指数正常范围的高值 + @JsonProperty("VFIMin") + private String VFIMin; //内脏脂肪指数正常范围的低值 + @JsonProperty("Diagnosis") + private String Diagnosis; //诊断结论(UTF-8编码) + + public String getTestID() { + return TestID; + } + + public void setTestID(String testID) { + TestID = testID; + } + + public String getUID() { + return UID; + } + + public void setUID(String UID) { + this.UID = UID; + } + + public String getUUID() { + return UUID; + } + + public void setUUID(String UUID) { + this.UUID = UUID; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getTestDate() { + return TestDate; + } + + public void setTestDate(String testDate) { + TestDate = testDate; + } + + public String getSex() { + return Sex; + } + + public void setSex(String sex) { + Sex = sex; + } + + public String getWeight() { + return Weight; + } + + public void setWeight(String weight) { + Weight = weight; + } + + public String getFat() { + return Fat; + } + + public void setFat(String fat) { + Fat = fat; + } + + public String getBone() { + return Bone; + } + + public void setBone(String bone) { + Bone = bone; + } + + public String getProtein() { + return Protein; + } + + public void setProtein(String protein) { + Protein = protein; + } + + public String getWater() { + return Water; + } + + public void setWater(String waterx) { + Water = waterx; + } + + public String getMuscle() { + return Muscle; + } + + public void setMuscle(String muscle) { + Muscle = muscle; + } + + public String getSMM() { + return SMM; + } + + public void setSMM(String SMM) { + this.SMM = SMM; + } + + public String getPBF() { + return PBF; + } + + public void setPBF(String PBF) { + this.PBF = PBF; + } + + public String getBMI() { + return BMI; + } + + public void setBMI(String BMI) { + this.BMI = BMI; + } + + public String getBMR() { + return BMR; + } + + public void setBMR(String BMR) { + this.BMR = BMR; + } + + public String getEdema() { + return Edema; + } + + public void setEdema(String edema) { + Edema = edema; + } + + public String getVFI() { + return VFI; + } + + public void setVFI(String VFI) { + this.VFI = VFI; + } + + public String getBodyAge() { + return BodyAge; + } + + public void setBodyAge(String bodyAge) { + BodyAge = bodyAge; + } + + public String getScore() { + return Score; + } + + public void setScore(String score) { + Score = score; + } + + public String getBodyType() { + return BodyType; + } + + public void setBodyType(String bodyType) { + BodyType = bodyType; + } + + public String getStandard_weight() { + return Standard_weight; + } + + public void setStandard_weight(String standard_weight) { + Standard_weight = standard_weight; + } + + public String getWeight_control() { + return Weight_control; + } + + public void setWeight_control(String weight_control) { + Weight_control = weight_control; + } + + public String getFat_control() { + return Fat_control; + } + + public void setFat_control(String fat_control) { + Fat_control = fat_control; + } + + public String getMuscle_control() { + return Muscle_control; + } + + public void setMuscle_control(String muscle_control) { + Muscle_control = muscle_control; + } + + public String getASMI() { + return ASMI; + } + + public void setASMI(String ASMI) { + this.ASMI = ASMI; + } + + public String getWeightMax() { + return WeightMax; + } + + public void setWeightMax(String weightMax) { + WeightMax = weightMax; + } + + public String getWeightMin() { + return WeightMin; + } + + public void setWeightMin(String weightMin) { + WeightMin = weightMin; + } + + public String getFatMax() { + return FatMax; + } + + public void setFatMax(String fatMax) { + FatMax = fatMax; + } + + public String getFatMin() { + return FatMin; + } + + public void setFatMin(String fatMin) { + FatMin = fatMin; + } + + public String getBoneMax() { + return BoneMax; + } + + public void setBoneMax(String boneMax) { + BoneMax = boneMax; + } + + public String getBoneMin() { + return BoneMin; + } + + public void setBoneMin(String boneMin) { + BoneMin = boneMin; + } + + public String getProteinMax() { + return ProteinMax; + } + + public void setProteinMax(String proteinMax) { + ProteinMax = proteinMax; + } + + public String getProteinMin() { + return ProteinMin; + } + + public void setProteinMin(String proteinMin) { + ProteinMin = proteinMin; + } + + public String getWaterMax() { + return WaterMax; + } + + public void setWaterMax(String waterMax) { + WaterMax = waterMax; + } + + public String getWaterMin() { + return WaterMin; + } + + public void setWaterMin(String waterMin) { + WaterMin = waterMin; + } + + public String getMuscleMax() { + return MuscleMax; + } + + public void setMuscleMax(String muscleMax) { + MuscleMax = muscleMax; + } + + public String getMuscleMin() { + return MuscleMin; + } + + public void setMuscleMin(String muscleMin) { + MuscleMin = muscleMin; + } + + public String getSMMMax() { + return SMMMax; + } + + public void setSMMMax(String SMMMax) { + this.SMMMax = SMMMax; + } + + public String getSMMMin() { + return SMMMin; + } + + public void setSMMMin(String SMMMin) { + this.SMMMin = SMMMin; + } + + public String getPBFMax() { + return PBFMax; + } + + public void setPBFMax(String PBFMax) { + this.PBFMax = PBFMax; + } + + public String getPBFMin() { + return PBFMin; + } + + public void setPBFMin(String PBFMin) { + this.PBFMin = PBFMin; + } + + public String getBMIMax() { + return BMIMax; + } + + public void setBMIMax(String BMIMax) { + this.BMIMax = BMIMax; + } + + public String getBMIMin() { + return BMIMin; + } + + public void setBMIMin(String BMIMin) { + this.BMIMin = BMIMin; + } + + public String getWHRMax() { + return WHRMax; + } + + public void setWHRMax(String WHRMax) { + this.WHRMax = WHRMax; + } + + public String getWHRMin() { + return WHRMin; + } + + public void setWHRMin(String WHRMin) { + this.WHRMin = WHRMin; + } + + public String getEdemaMax() { + return EdemaMax; + } + + public void setEdemaMax(String edemaMax) { + EdemaMax = edemaMax; + } + + public String getEdemaMin() { + return EdemaMin; + } + + public void setEdemaMin(String edemaMin) { + EdemaMin = edemaMin; + } + + public String getVFIMax() { + return VFIMax; + } + + public void setVFIMax(String VFIMax) { + this.VFIMax = VFIMax; + } + + public String getVFIMin() { + return VFIMin; + } + + public void setVFIMin(String VFIMin) { + this.VFIMin = VFIMin; + } + + public String getDiagnosis() { + return Diagnosis; + } + + public void setDiagnosis(String diagnosis) { + Diagnosis = diagnosis; + } + } + + + public static class Advice { + @JsonProperty("TestID") + private String TestID; + private String PersonType; //*人员类型 + private String DailyEnergy; //日能量需求(单位:kcal) + private String DietPrinciple; //膳食原则 + private String StandardBreakfast; //示范食谱-早餐(使用\n换行,下同) + private String StandardLunch; //示范食谱-午餐 + private String StandardDinner; //示范食谱-晚餐 + private String StandardNutrition; //示范食谱-营养素 + + public String getTestID() { + return TestID; + } + + public void setTestID(String testID) { + TestID = testID; + } + + public String getPersonType() { + return PersonType; + } + + public void setPersonType(String personType) { + PersonType = personType; + } + + public String getDailyEnergy() { + return DailyEnergy; + } + + public void setDailyEnergy(String dailyEnergy) { + DailyEnergy = dailyEnergy; + } + + public String getDietPrinciple() { + return DietPrinciple; + } + + public void setDietPrinciple(String dietPrinciple) { + DietPrinciple = dietPrinciple; + } + + public String getStandardBreakfast() { + return StandardBreakfast; + } + + public void setStandardBreakfast(String standardBreakfast) { + StandardBreakfast = standardBreakfast; + } + + public String getStandardLunch() { + return StandardLunch; + } + + public void setStandardLunch(String standardLunch) { + StandardLunch = standardLunch; + } + + public String getStandardDinner() { + return StandardDinner; + } + + public void setStandardDinner(String standardDinner) { + StandardDinner = standardDinner; + } + + public String getStandardNutrition() { + return StandardNutrition; + } + + public void setStandardNutrition(String standardNutrition) { + StandardNutrition = standardNutrition; + } + } + } } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/ExternalVo.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/ExternalVo.java index 2eb43efb..19a7eac0 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/ExternalVo.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/ExternalVo.java @@ -1,8 +1,17 @@ package com.acupuncture.system.domain.vo; +import cn.hutool.core.date.DateUtil; +import com.acupuncture.system.domain.dto.ExternalDto; +import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiParam; import lombok.Data; +import javax.validation.constraints.NotNull; +import java.util.Date; +import java.util.List; + /** * @Author zzc * @Package com.acupuncture.system.domain.dto @@ -12,16 +21,16 @@ import lombok.Data; public class ExternalVo { @Data - public static class Result{ - private String message; + public static class Result { + private String message = "bcaUser"; private String gid; private String memberid; - private String testId; +// private String testId; - private String testDate; +// private String testDate; private String name; @@ -31,7 +40,7 @@ public class ExternalVo { private String birthYear; - private String weight; + // private String weight; private String phone; public String getSex() { @@ -47,7 +56,7 @@ public class ExternalVo { @Data @ApiModel("人体成分数据上传") - public static class RtcfInfoVo{ + public static class RtcfInfoVo { private Long id; private String message; @@ -216,7 +225,7 @@ public class ExternalVo { @Data @ApiModel("报告图片") - public static class ReportImagVo{ + public static class ReportImagVo { private Long id; private String patientId; @@ -225,4 +234,1019 @@ public class ExternalVo { private String filePath; } -} + + + /* + 运动功能测评数据 + */ + + public static class UserInfo { + @JsonProperty("Title") + @ApiModelProperty(value = "标题") + private String Title; + @ApiModelProperty(value = "组别代码(可为空)") + @JsonProperty("GID") + private String GID; + @ApiModelProperty(value = "人员编号") + @JsonProperty("UID") + private String UID; + @ApiModelProperty(value = "姓名") + @JsonProperty("Name") + private String Name; + @ApiModelProperty(value = "性别 (男1,女2)") + @JsonProperty("Sex") + private String Sex; + @ApiModelProperty(value = "身高(cm)") + @JsonProperty("Height") + private String Height; + @ApiModelProperty(value = "出生年") + @JsonProperty("BirthYear") + private Date BirthYear; + @ApiModelProperty(value = "电话(可为空)") + @JsonProperty("Phone") + private String Phone; + @JsonProperty("TestID") + private String TestID; + @JsonProperty("TestID") + public String getTestID() { + return TestID; + } + + @JsonProperty("Title") + public String getTitle() { + return Title; + } + + @JsonProperty("GID") + public String getGID() { + return GID; + } + + @JsonProperty("UID") + public String getUID() { + return UID; + } + + @JsonProperty("Name") + public String getName() { + return Name; + } + + @JsonProperty("Sex") + public String getSex() { + if ("0".equals(Sex)) { + return "1"; + } + if ("1".equals(Sex)) { + return "2"; + } + return Sex; + } + + @JsonProperty("Height") + public String getHeight() { + return Height; + } + + @JsonProperty("BirthYear") + public String getBirthYear() { + if (BirthYear != null) { + return DateUtil.format(BirthYear, "yyyy"); + } + return null; + } + + @JsonProperty("Phone") + public String getPhone() { + return Phone; + } + } + + + /** + * 3.1体质测试类数据的实时传输 + */ + public static class RtcfInfo { + @ApiModelProperty("当前测得体质测试类数据标题") + @JsonProperty("Title") + private String Title; + @ApiModelProperty("单位代码(或科室代码、项目代码)") + @JsonProperty("UUID") + private String UUID; + @ApiModelProperty("人员编号") + @JsonProperty("UID") + @NotNull(message = "人员编号不能为空") + private String UID; + @ApiModelProperty("测试序号(时间戳)") + @JsonProperty("TestID") + private String TestID; + @ApiModelProperty("测试日期") + @JsonProperty("TestDate") + @NotNull(message = "测试日期不能为空") + private String TestDate; + @ApiModelProperty("测试者姓名") + @JsonProperty("Name") + private String Name; + @ApiModelProperty("测试者性别,男1女2") + @JsonProperty("Sex") + private String Sex; + @ApiModelProperty("测试者出生年份") + @JsonProperty("BirthYear") + private String BirthYear; + + private List data; + private Advice advice; + + //体测结果数据* + + public String getTitle() { + return Title; + } + + public void setTitle(String title) { + Title = title; + } + @JsonProperty("") + public String getUUID() { + return UUID; + } + + public void setUUID(String UUID) { + this.UUID = UUID; + } + @JsonProperty("") + public String getUID() { + return UID; + } + + public void setUID(String UID) { + this.UID = UID; + } + @JsonProperty("") + public String getTestID() { + return TestID; + } + + public void setTestID(String testID) { + TestID = testID; + } + @JsonProperty("") + public String getTestDate() { + return TestDate; + } + + public void setTestDate(String testDate) { + TestDate = testDate; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getSex() { + return Sex; + } + + public void setSex(String sex) { + Sex = sex; + } + + public String getBirthYear() { + return BirthYear; + } + + public void setBirthYear(String birthYear) { + BirthYear = birthYear; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public Advice getAdvice() { + return advice; + } + + public void setAdvice(Advice advice) { + this.advice = advice; + } + + public static class Detail { + private String TestID; + @JsonProperty("Item") + private String Item; + @JsonProperty("Value") + private String Value; + @JsonProperty("Score") + private String Score; + + @JsonProperty("Item") + public String getItem() { + return Item; + } + + public void setItem(String item) { + Item = item; + } + + @JsonProperty("Value") + public String getValue() { + return Value; + } + + public void setValue(String value) { + Value = value; + } + + @JsonProperty("Score") + public String getScore() { + return Score; + } + + public void setScore(String score) { + Score = score; + } + + public String getTestID() { + return TestID; + } + + public void setTestID(String testID) { + TestID = testID; + } + } + + public static class Advice { + @JsonProperty("SportPrinciple") + private String SportPrinciple; //运动原则 + @JsonProperty("Aerobic") + private String Aerobic; //有氧运动内容 + @JsonProperty("Strength") + private String Strength; //力量运动内容 + @JsonProperty("Flexibility") + private String Flexibility; //柔韧运动内容 + @JsonProperty("FunctionExcercise") + private String FunctionExcercise; //功能性练习内容 + @JsonProperty("Caution") + private String Caution; //注意事项 + private String TestID; + @JsonProperty("SportPrinciple") + public String getSportPrinciple() { + return SportPrinciple; + } + + public void setSportPrinciple(String sportPrinciple) { + SportPrinciple = sportPrinciple; + } + + @JsonProperty("Aerobic") + public String getAerobic() { + return Aerobic; + } + + public void setAerobic(String aerobic) { + Aerobic = aerobic; + } + + @JsonProperty("Strength") + public String getStrength() { + return Strength; + } + + public void setStrength(String strength) { + Strength = strength; + } + + @JsonProperty("Flexibility") + public String getFlexibility() { + return Flexibility; + } + + public void setFlexibility(String flexibility) { + Flexibility = flexibility; + } + + @JsonProperty("FunctionExcercise") + public String getFunctionExcercise() { + return FunctionExcercise; + } + + public void setFunctionExcercise(String functionExcercise) { + FunctionExcercise = functionExcercise; + } + + @JsonProperty("Caution") + public String getCaution() { + return Caution; + } + + public void setCaution(String caution) { + Caution = caution; + } + + public String getTestID() { + return TestID; + } + + public void setTestID(String testID) { + TestID = testID; + } + } + } + + public static class BcaData { + @ApiModelProperty("当前测得体质测试类数据标题") + @JsonProperty("Title") + private String Title; + @ApiModelProperty("单位代码(或科室代码、项目代码)") + @JsonProperty("UUID") + private String UUID; + @ApiModelProperty("人员编号") + @JsonProperty("UID") + private String UID; + @ApiModelProperty("测试序号(时间戳)") + @JsonProperty("TestID") + private String TestID; + @ApiModelProperty("测试日期") + @JsonProperty("TestDate") + private String TestDate; + @ApiModelProperty("测试者姓名") + @JsonProperty("Name") + private String Name; + @ApiModelProperty("测试者性别,男1女2") + @JsonProperty("Sex") + private String Sex; + private Data data; + private Advice advice; + + public String getTitle() { + return Title; + } + + public void setTitle(String title) { + Title = title; + } + + public String getUUID() { + return UUID; + } + + public void setUUID(String UUID) { + this.UUID = UUID; + } + + public String getUID() { + return UID; + } + + public void setUID(String UID) { + this.UID = UID; + } + + public String getTestID() { + return TestID; + } + + public void setTestID(String testID) { + TestID = testID; + } + + public String getTestDate() { + return TestDate; + } + + public void setTestDate(String testDate) { + TestDate = testDate; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getSex() { + return Sex; + } + + public void setSex(String sex) { + Sex = sex; + } + + public Data getData() { + return data; + } + + public void setData(Data data) { + this.data = data; + } + + public Advice getAdvice() { + return advice; + } + + public void setAdvice(Advice advice) { + this.advice = advice; + } + + public static class Data { + @JsonProperty("TestID") + private String TestID; + @JsonProperty("UID") + private String UID; + @JsonProperty("UUID") + private String UUID; + @JsonProperty("Name") + private String Name; + @JsonProperty("TestDate") + private String TestDate; + @JsonProperty("Sex") + private String Sex; + @JsonProperty("Weight") + private String Weight; //体重 + @JsonProperty("Fat") + private String Fat; //脂肪 + @JsonProperty("Bone") + private String Bone; //骨质 + @JsonProperty("Protein") + private String Protein; //蛋白质 + @JsonProperty("Water") + private String Water; //水分 + @JsonProperty("Muscle") + private String Muscle; //肌肉 + @JsonProperty("SMM") + private String SMM; //骨骼肌 + @JsonProperty("PBF") + private String PBF; //体脂百分比 + @JsonProperty("BMI") + private String BMI; //体质指数 + @JsonProperty("BMR") + private String BMR; //基础代谢 + @JsonProperty("Edema") + private String Edema; //水肿系数(2位小数) + @JsonProperty("VFI") + private String VFI; //内脏脂肪指数 + @JsonProperty("BodyAge") + private String BodyAge; //身体年龄 + @JsonProperty("Score") + private String Score; //健康评分 + @JsonProperty("BodyType") + private String BodyType; //体型判定 + @JsonProperty("Standard_weight") + private String Standard_weight; //目标体重 + @JsonProperty("Weight_control") + private String Weight_control; //体重控制 + @JsonProperty("Fat_control") + private String Fat_control; //脂肪控制量 + @JsonProperty("Muscle_control") + private String Muscle_control;//肌肉控制量 + @JsonProperty("ASMI") + private String ASMI; //四肢骨骼肌指数 + @JsonProperty("WeightMax") + private String WeightMax; //体重正常范围的高值 + @JsonProperty("WeightMin") + private String WeightMin; //体重正常范围的低值 + @JsonProperty("FatMax") + private String FatMax;//体重正常范围的高值 + @JsonProperty("FatMin") + private String FatMin; //体重正常范围的低值 + @JsonProperty("BoneMax") + private String BoneMax; //骨质正常范围的高值 + @JsonProperty("BoneMin") + private String BoneMin; //骨质正常范围的低值 + @JsonProperty("ProteinMax") + private String ProteinMax; //蛋白质正常范围的高值 + @JsonProperty("ProteinMin") + private String ProteinMin; //蛋白质正常范围的低值 + @JsonProperty("WaterMax") + private String WaterMax;//水分正常范围的高值 + @JsonProperty("WaterMin") + private String WaterMin; //水分正常范围的低值 + @JsonProperty("MuscleMax") + private String MuscleMax; //肌肉正常范围的高值 + @JsonProperty("MuscleMin") + private String MuscleMin; //肌肉正常范围的低值 + @JsonProperty("SMMMax") + private String SMMMax;//骨骼肌正常范围的高值 + @JsonProperty("SMMMin") + private String SMMMin;//骨骼肌正常范围的低值 + @JsonProperty("PBFMax") + private String PBFMax; //体脂率正常范围的高值 + @JsonProperty("PBFMin") + private String PBFMin; //体脂率正常范围的低值 + @JsonProperty("BMIMax") + private String BMIMax; //体质指数正常范围的高值 + @JsonProperty("BMIMin") + private String BMIMin; //体质指数正常范围的低值 + @JsonProperty("WHRMax") + private String WHRMax;//腰臀比正常范围的高值 + @JsonProperty("WHRMin") + private String WHRMin;//腰臀比正常范围的低值 + @JsonProperty("EdemaMax") + private String EdemaMax; //水肿系数正常范围的高值 + @JsonProperty("EdemaMin") + private String EdemaMin; //水肿系数正常范围的低值 + @JsonProperty("VFIMax") + private String VFIMax; //内脏脂肪指数正常范围的高值 + @JsonProperty("VFIMin") + private String VFIMin; //内脏脂肪指数正常范围的低值 + @JsonProperty("Diagnosis") + private String Diagnosis; //诊断结论(UTF-8编码) + + public String getTestID() { + return TestID; + } + + public void setTestID(String testID) { + TestID = testID; + } + + public String getUID() { + return UID; + } + + public void setUID(String UID) { + this.UID = UID; + } + + public String getUUID() { + return UUID; + } + + public void setUUID(String UUID) { + this.UUID = UUID; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getTestDate() { + return TestDate; + } + + public void setTestDate(String testDate) { + TestDate = testDate; + } + + public String getSex() { + return Sex; + } + + public void setSex(String sex) { + Sex = sex; + } + + public String getWeight() { + return Weight; + } + + public void setWeight(String weight) { + Weight = weight; + } + + public String getFat() { + return Fat; + } + + public void setFat(String fat) { + Fat = fat; + } + + public String getBone() { + return Bone; + } + + public void setBone(String bone) { + Bone = bone; + } + + public String getProtein() { + return Protein; + } + + public void setProtein(String protein) { + Protein = protein; + } + + public String getWater() { + return Water; + } + + public void setWater(String waterx) { + Water = waterx; + } + + public String getMuscle() { + return Muscle; + } + + public void setMuscle(String muscle) { + Muscle = muscle; + } + + public String getSMM() { + return SMM; + } + + public void setSMM(String SMM) { + this.SMM = SMM; + } + + public String getPBF() { + return PBF; + } + + public void setPBF(String PBF) { + this.PBF = PBF; + } + + public String getBMI() { + return BMI; + } + + public void setBMI(String BMI) { + this.BMI = BMI; + } + + public String getBMR() { + return BMR; + } + + public void setBMR(String BMR) { + this.BMR = BMR; + } + + public String getEdema() { + return Edema; + } + + public void setEdema(String edema) { + Edema = edema; + } + + public String getVFI() { + return VFI; + } + + public void setVFI(String VFI) { + this.VFI = VFI; + } + + public String getBodyAge() { + return BodyAge; + } + + public void setBodyAge(String bodyAge) { + BodyAge = bodyAge; + } + + public String getScore() { + return Score; + } + + public void setScore(String score) { + Score = score; + } + + public String getBodyType() { + return BodyType; + } + + public void setBodyType(String bodyType) { + BodyType = bodyType; + } + + public String getStandard_weight() { + return Standard_weight; + } + + public void setStandard_weight(String standard_weight) { + Standard_weight = standard_weight; + } + + public String getWeight_control() { + return Weight_control; + } + + public void setWeight_control(String weight_control) { + Weight_control = weight_control; + } + + public String getFat_control() { + return Fat_control; + } + + public void setFat_control(String fat_control) { + Fat_control = fat_control; + } + + public String getMuscle_control() { + return Muscle_control; + } + + public void setMuscle_control(String muscle_control) { + Muscle_control = muscle_control; + } + + public String getASMI() { + return ASMI; + } + + public void setASMI(String ASMI) { + this.ASMI = ASMI; + } + + public String getWeightMax() { + return WeightMax; + } + + public void setWeightMax(String weightMax) { + WeightMax = weightMax; + } + + public String getWeightMin() { + return WeightMin; + } + + public void setWeightMin(String weightMin) { + WeightMin = weightMin; + } + + public String getFatMax() { + return FatMax; + } + + public void setFatMax(String fatMax) { + FatMax = fatMax; + } + + public String getFatMin() { + return FatMin; + } + + public void setFatMin(String fatMin) { + FatMin = fatMin; + } + + public String getBoneMax() { + return BoneMax; + } + + public void setBoneMax(String boneMax) { + BoneMax = boneMax; + } + + public String getBoneMin() { + return BoneMin; + } + + public void setBoneMin(String boneMin) { + BoneMin = boneMin; + } + + public String getProteinMax() { + return ProteinMax; + } + + public void setProteinMax(String proteinMax) { + ProteinMax = proteinMax; + } + + public String getProteinMin() { + return ProteinMin; + } + + public void setProteinMin(String proteinMin) { + ProteinMin = proteinMin; + } + + public String getWaterMax() { + return WaterMax; + } + + public void setWaterMax(String waterMax) { + WaterMax = waterMax; + } + + public String getWaterMin() { + return WaterMin; + } + + public void setWaterMin(String waterMin) { + WaterMin = waterMin; + } + + public String getMuscleMax() { + return MuscleMax; + } + + public void setMuscleMax(String muscleMax) { + MuscleMax = muscleMax; + } + + public String getMuscleMin() { + return MuscleMin; + } + + public void setMuscleMin(String muscleMin) { + MuscleMin = muscleMin; + } + + public String getSMMMax() { + return SMMMax; + } + + public void setSMMMax(String SMMMax) { + this.SMMMax = SMMMax; + } + + public String getSMMMin() { + return SMMMin; + } + + public void setSMMMin(String SMMMin) { + this.SMMMin = SMMMin; + } + + public String getPBFMax() { + return PBFMax; + } + + public void setPBFMax(String PBFMax) { + this.PBFMax = PBFMax; + } + + public String getPBFMin() { + return PBFMin; + } + + public void setPBFMin(String PBFMin) { + this.PBFMin = PBFMin; + } + + public String getBMIMax() { + return BMIMax; + } + + public void setBMIMax(String BMIMax) { + this.BMIMax = BMIMax; + } + + public String getBMIMin() { + return BMIMin; + } + + public void setBMIMin(String BMIMin) { + this.BMIMin = BMIMin; + } + + public String getWHRMax() { + return WHRMax; + } + + public void setWHRMax(String WHRMax) { + this.WHRMax = WHRMax; + } + + public String getWHRMin() { + return WHRMin; + } + + public void setWHRMin(String WHRMin) { + this.WHRMin = WHRMin; + } + + public String getEdemaMax() { + return EdemaMax; + } + + public void setEdemaMax(String edemaMax) { + EdemaMax = edemaMax; + } + + public String getEdemaMin() { + return EdemaMin; + } + + public void setEdemaMin(String edemaMin) { + EdemaMin = edemaMin; + } + + public String getVFIMax() { + return VFIMax; + } + + public void setVFIMax(String VFIMax) { + this.VFIMax = VFIMax; + } + + public String getVFIMin() { + return VFIMin; + } + + public void setVFIMin(String VFIMin) { + this.VFIMin = VFIMin; + } + + public String getDiagnosis() { + return Diagnosis; + } + + public void setDiagnosis(String diagnosis) { + Diagnosis = diagnosis; + } + } + + + public static class Advice { + @JsonProperty("TestID") + private String TestID; + private String PersonType; //*人员类型 + private String DailyEnergy; //日能量需求(单位:kcal) + private String DietPrinciple; //膳食原则 + private String StandardBreakfast; //示范食谱-早餐(使用\n换行,下同) + private String StandardLunch; //示范食谱-午餐 + private String StandardDinner; //示范食谱-晚餐 + private String StandardNutrition; //示范食谱-营养素 + + public String getTestID() { + return TestID; + } + + public void setTestID(String testID) { + TestID = testID; + } + + public String getPersonType() { + return PersonType; + } + + public void setPersonType(String personType) { + PersonType = personType; + } + + public String getDailyEnergy() { + return DailyEnergy; + } + + public void setDailyEnergy(String dailyEnergy) { + DailyEnergy = dailyEnergy; + } + + public String getDietPrinciple() { + return DietPrinciple; + } + + public void setDietPrinciple(String dietPrinciple) { + DietPrinciple = dietPrinciple; + } + + public String getStandardBreakfast() { + return StandardBreakfast; + } + + public void setStandardBreakfast(String standardBreakfast) { + StandardBreakfast = standardBreakfast; + } + + public String getStandardLunch() { + return StandardLunch; + } + + public void setStandardLunch(String standardLunch) { + StandardLunch = standardLunch; + } + + public String getStandardDinner() { + return StandardDinner; + } + + public void setStandardDinner(String standardDinner) { + StandardDinner = standardDinner; + } + + public String getStandardNutrition() { + return StandardNutrition; + } + + public void setStandardNutrition(String standardNutrition) { + StandardNutrition = standardNutrition; + } + } + } +} \ No newline at end of file diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/ExternalDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/ExternalDao.java index 68959709..4cf74ab4 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/ExternalDao.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/ExternalDao.java @@ -5,6 +5,7 @@ import com.acupuncture.system.domain.vo.DmsLoginUserVo; import com.acupuncture.system.domain.vo.ExternalVo; import org.apache.ibatis.annotations.Param; +import java.util.Date; import java.util.List; /** @@ -18,4 +19,70 @@ public interface ExternalDao { List select(@Param("query") ExternalDto.Query query); List selectByMemberId(@Param("query") ExternalDto.Query query); + + /** + * 运动功能测评获取人员信息 + * @param memberid 门诊号/住院号 + * @return + */ + ExternalVo.UserInfo motionQueryMember(@Param("memberid") String memberid); + + int motionAdd(@Param("rtcfInfoDto") ExternalDto.RtcfInfo rtcfInfoDto); + + /** + * 查询是否已有主测试记录 + */ + ExternalVo.UserInfo motionQueryMemberInfo(@Param("memberid") String memberid, + @Param("testData")Date testData, + @Param("Title") String Title); + + /** + * 体质测试类数据的实时传输 体测结果数据 + * @param dto + * @return + */ + int motionAddDetail(@Param("list") List dto); + + int motionAddAdvice(@Param("dto") ExternalDto.RtcfInfo.Advice dto); + + + /** + * 3.2 添加体成分数据 + * @param dto + * @return + */ + int motionAddTcf(@Param("dto") ExternalDto.BcaData.Data dto); + + int motionAddTcfMain(@Param("dto") ExternalDto.BcaData dto); + + int motionAddTcfAdvice(@Param("dto") ExternalDto.BcaData.Advice dto); + + int delMain(@Param("uId") String uId, + @Param("Title") String Title); + + int delData(@Param("TestID") String TestID); + + int delAdvice(@Param("TestID") String TestID); + + int delRecord(@Param("TestID") String TestID); + + int delBcaAdvice(@Param("TestID") String TestID); + + //前台同步查询运动数据 + + ExternalVo.RtcfInfo queryMotionInfo(@Param("memberid")String memberid, + @Param("Title") String Title); + + List queryMotionDetail(@Param("TestID")String TestID); + + ExternalVo.RtcfInfo.Advice queryMotionAdvice(@Param("TestID")String TestID); + + + ExternalVo.BcaData queryMotionTcfInfo(@Param("memberid")String memberid, + @Param("Title") String Title); + + ExternalVo.BcaData.Data queryMotionTcfData(@Param("TestID")String TestID); + + ExternalVo.BcaData.Advice queryMotionTcfAdvice(@Param("TestID")String TestID); + } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/ExternalService.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/ExternalService.java index 57f13367..cccce6c3 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/ExternalService.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/ExternalService.java @@ -54,4 +54,28 @@ public interface ExternalService { */ UplReportImage selectReportByMemberId(Long id); + + /** + * 运动功能测评获取人员信息 + * @param memberid 门诊号/住院号 + * @return + */ + ExternalVo.UserInfo motionQueryMember(String memberid); + + /** + * 上传数据 + * @return + */ + int motionAdd(ExternalDto.RtcfInfo rtcfInfoDto); + + /** + * 上传数据 + * @return + */ + int motionAddTcf(ExternalDto.BcaData bcaData); + + + ExternalVo.RtcfInfo queryMotionInfo(String memberid); + + ExternalVo.BcaData queryMotionTcfInfo(String memberid); } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java index 2e6478f1..da162796 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java @@ -2,6 +2,7 @@ package com.acupuncture.system.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; import com.acupuncture.common.core.redis.RedisCache; @@ -15,6 +16,8 @@ import com.acupuncture.system.persist.mapper.UplReportImageMapper; import com.acupuncture.system.persist.mapper.UplRtcfInfoMapper; import com.acupuncture.system.service.ExternalService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.Date; @@ -27,6 +30,7 @@ import java.util.List; * @description: */ @Service +@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public class ExternalServiceImpl implements ExternalService { @Resource @@ -220,4 +224,82 @@ public class ExternalServiceImpl implements ExternalService { } return new UplReportImage(); } + + @Override + public ExternalVo.UserInfo motionQueryMember(String memberid) { + return externalDao.motionQueryMember(memberid); + } + + @Override + public int motionAdd(ExternalDto.RtcfInfo rtcfInfoDto) { + //查询今日是否已有测试数据, 如有则删除后新增 + ExternalVo.UserInfo userInfo = externalDao.motionQueryMemberInfo(rtcfInfoDto.getUID(), DateUtil.parse(rtcfInfoDto.getTestDate(), "yyyy-MM-dd"), rtcfInfoDto.getTitle()); + if (userInfo != null) { + //删除数据 + externalDao.delMain(userInfo.getUID(), "CURRENT_FIT_DATA"); + externalDao.delData(userInfo.getTestID()); + externalDao.delAdvice(userInfo.getTestID()); + } + + ExternalDto.RtcfInfo.Advice advice = rtcfInfoDto.getAdvice(); + List data = rtcfInfoDto.getData(); + if (advice != null) { + advice.setTestID(rtcfInfoDto.getTestID()); + externalDao.motionAddAdvice(advice); + } + if (CollectionUtil.isNotEmpty(data)) { + for (ExternalDto.RtcfInfo.Detail datum : data) { + datum.setTestID(rtcfInfoDto.getTestID()); + } + externalDao.motionAddDetail(data); + } + return externalDao.motionAdd(rtcfInfoDto); + } + + @Override + public int motionAddTcf(ExternalDto.BcaData bcaData) { + //查询今日是否已有测试数据, 如有则删除后新增 + ExternalVo.UserInfo userInfo = externalDao.motionQueryMemberInfo(bcaData.getUID(), DateUtil.parse(bcaData.getTestDate(), "yyyy-MM-dd"), bcaData.getTitle()); + if (userInfo != null) { + //删除数据 + externalDao.delMain(userInfo.getUID(), "CURRENT_BCA_DATA"); + externalDao.delRecord(userInfo.getUID()); + externalDao.delBcaAdvice(userInfo.getUID()); + } + + if (bcaData.getData() != null) { + bcaData.getData().setName(bcaData.getName()); + bcaData.getData().setTestID(bcaData.getTestID()); + bcaData.getData().setUUID(bcaData.getUUID()); + bcaData.getData().setSex(bcaData.getSex()); + bcaData.getData().setUID(bcaData.getUID()); + bcaData.getData().setTestDate(bcaData.getTestDate()); + externalDao.motionAddTcf(bcaData.getData()); + } + if (bcaData.getAdvice() != null) { + bcaData.getAdvice().setTestID(bcaData.getTestID()); + externalDao.motionAddTcfAdvice(bcaData.getAdvice()); + } + return externalDao.motionAddTcfMain(bcaData); + } + + @Override + public ExternalVo.RtcfInfo queryMotionInfo(String memberid) { + ExternalVo.RtcfInfo currentFitData = externalDao.queryMotionInfo(memberid, "CURRENT_FIT_DATA"); + if (currentFitData != null) { + currentFitData.setData(externalDao.queryMotionDetail(currentFitData.getTestID())); + currentFitData.setAdvice(externalDao.queryMotionAdvice(currentFitData.getTestID())); + } + return currentFitData; + } + + @Override + public ExternalVo.BcaData queryMotionTcfInfo(String memberid) { + ExternalVo.BcaData bcaData = externalDao.queryMotionTcfInfo(memberid, "CURRENT_BCA_DATA"); + if (bcaData != null) { + bcaData.setData(externalDao.queryMotionTcfData(bcaData.getTestID())); + bcaData.setAdvice(externalDao.queryMotionTcfAdvice(bcaData.getTestID())); + } + return bcaData; + } } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java index 6fc267f9..2ec6ff97 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java @@ -6,9 +6,7 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.IoUtil; import cn.hutool.core.map.MapUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.IdcardUtil; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.util.*; import cn.hutool.extra.pinyin.PinyinUtil; import cn.hutool.poi.excel.BigExcelWriter; import cn.hutool.poi.excel.ExcelUtil; @@ -42,6 +40,7 @@ import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; +import java.math.BigDecimal; import java.nio.file.Files; import java.nio.file.Paths; import java.util.*; @@ -83,7 +82,8 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { private String profilePath; @Value("${acupuncture.profileUrl}") private String profileUrl; - + //诊疗档案编码默认生成规则 + private static final String MEMBER_ID_PREFIX = "UID"; @Override public void addTreatment(PmsTreatmentDto.TreatmentAdd dto) { @@ -150,22 +150,39 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { } } + /** + * 用户编号递增,保证所有库中用户编号唯一 + * 将每天生成的用户编号存到redis + * 如有则+1,放入缓存 + * 没有则创建第一条,放入缓存 + * @return + */ @Override @Synchronized public Long getMemberId() { //编码生成规则: 年+月+日+每天该租户的最大编码+1 //生成最小的编码 Date now = new Date(); - String date = DateUtil.format(now, "yyMMdd") + "0000"; - Long minMemberId = Long.parseLong(date); - PmsTreatmentExample pmsTreatmentExample = new PmsTreatmentExample(); - pmsTreatmentExample.createCriteria().andDelFlagEqualTo((byte) 0).andTenantIdEqualTo(SecurityUtils.getTenantId()).andMemberIdGreaterThan(minMemberId); - pmsTreatmentExample.setOrderByClause("create_time desc"); - List pmsTreatments = treatmentMapper.selectByExample(pmsTreatmentExample); - if (CollectionUtil.isEmpty(pmsTreatments)) { - return minMemberId + 1; + String date = DateUtil.format(now, "yyMMdd"); + Long minMemberId = Long.parseLong(date + "0000"); + + Object o = redisCache.get(MEMBER_ID_PREFIX + "_" + date); + if (ObjectUtil.isEmpty(o)) { + redisCache.set(MEMBER_ID_PREFIX + "_" + date, minMemberId + 1); + return minMemberId; + }else { + long l = NumberUtil.add(o.toString(), "1").longValue(); + redisCache.set(MEMBER_ID_PREFIX + "_" + date, l); + return l; } - return pmsTreatments.get(0).getMemberId() + 1; +// PmsTreatmentExample pmsTreatmentExample = new PmsTreatmentExample(); +// pmsTreatmentExample.createCriteria().andDelFlagEqualTo((byte) 0).andTenantIdEqualTo(SecurityUtils.getTenantId()).andMemberIdGreaterThan(minMemberId); +// pmsTreatmentExample.setOrderByClause("create_time desc"); +// List pmsTreatments = treatmentMapper.selectByExample(pmsTreatmentExample); +// if (CollectionUtil.isEmpty(pmsTreatments)) { +// return minMemberId + 1; +// } +// return pmsTreatments.get(0).getMemberId() + 1; } @Override diff --git a/acupuncture-system/src/main/resources/mapper/dao/ExternalDao.xml b/acupuncture-system/src/main/resources/mapper/dao/ExternalDao.xml index 9880a7b7..0c2bfc6d 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/ExternalDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/ExternalDao.xml @@ -49,4 +49,390 @@ + + + + insert into + fit_test_main + ( + TestID, + Title, + UUID, + UID, + TestDate, + Name, + Sex, + BirthYear + ) + values + ( + #{rtcfInfoDto.TestID}, + #{rtcfInfoDto.title}, + #{rtcfInfoDto.UUID}, + #{rtcfInfoDto.UID}, + #{rtcfInfoDto.testDate}, + #{rtcfInfoDto.Name}, + #{rtcfInfoDto.Sex}, + #{rtcfInfoDto.BirthYear} + ) + + + + + + INSERT INTO fit_test_data (TestID, ItemCode, TestValue, Score) + VALUES + + (#{item.TestID}, #{item.Item}, #{item.Value}, #{item.Score}) + + + + + insert into + fit_test_advice + ( + TestID, + SportPrinciple, + Aerobic, + Strength, + Flexibility, + FunctionExcercise, + Caution + ) + values + ( + #{dto.TestID}, + #{dto.SportPrinciple}, + #{dto.Aerobic}, + #{dto.Strength}, + #{dto.Flexibility}, + #{dto.FunctionExcercise}, + #{dto.Caution} + ) + + + + insert into fit_test_records + ( + TestID, + UUID, + UID, + TestDate, + Name, + Sex, + Weight, + Fat, + Bone, + Protein, + Water, + Muscle, + SMM, + PBF, + BMI, + BMR, + Edema, + VFI, + BodyAge, + Score, + BodyType, + Standard_weight, + Weight_control, + Fat_control, + Muscle_control, + ASMI, + WeightMax, + WeightMin, + FatMax, + FatMin, + BoneMax, + BoneMin, + ProteinMax, + ProteinMin, + WaterMax, + WaterMin, + MuscleMax, + MuscleMin, + SMMMax, + SMMMin, + PBFMax, + PBFMin, + BMIMax, + BMIMin, + WHRMax, + WHRMin, + EdemaMax, + EdemaMin, + VFIMax, + VFIMin, + Diagnosis) + values ( + #{dto.TestID}, + #{dto.UUID}, + #{dto.UID}, + #{dto.TestDate}, + #{dto.Name}, + #{dto.Sex}, + #{dto.Weight}, + #{dto.Fat}, + #{dto.Bone}, + #{dto.Protein}, + #{dto.Water}, + #{dto.Muscle}, + #{dto.SMM}, + #{dto.PBF}, + #{dto.BMI}, + #{dto.BMR}, + #{dto.Edema}, + #{dto.VFI}, + #{dto.BodyAge}, + #{dto.Score}, + #{dto.BodyType}, + #{dto.Standard_weight}, + #{dto.Weight_control}, + #{dto.Fat_control}, + #{dto.Muscle_control}, + #{dto.ASMI}, + #{dto.WeightMax}, + #{dto.WeightMin}, + #{dto.FatMax}, + #{dto.FatMin}, + #{dto.BoneMax}, + #{dto.BoneMin}, + #{dto.ProteinMax}, + #{dto.ProteinMin}, + #{dto.WaterMax}, + #{dto.WaterMin}, + #{dto.MuscleMax}, + #{dto.MuscleMin}, + #{dto.SMMMax}, + #{dto.SMMMin}, + #{dto.PBFMax}, + #{dto.PBFMin}, + #{dto.BMIMax}, + #{dto.BMIMin}, + #{dto.WHRMax}, + #{dto.WHRMin}, + #{dto.EdemaMax}, + #{dto.EdemaMin}, + #{dto.VFIMax}, + #{dto.VFIMin}, + #{dto.Diagnosis} + ) + + + + insert into + fit_test_main + ( + TestID, + Title, + UUID, + UID, + TestDate, + Name, + Sex + ) + values + ( + #{dto.TestID}, + #{dto.title}, + #{dto.UUID}, + #{dto.UID}, + #{dto.testDate}, + #{dto.Name}, + #{dto.Sex} + ) + + + + insert into fit_bca_advice(TestID, + PersonType, + DailyEnergy, + DietPrinciple, + StandardBreakfast, + StandardLunch, + StandardDinner, + StandardNutrition) + values ( #{dto.TestID}, + #{dto.PersonType}, + #{dto.DailyEnergy}, + #{dto.DietPrinciple}, + #{dto.StandardBreakfast}, + #{dto.StandardLunch}, + #{dto.StandardDinner}, + #{dto.StandardNutrition}) + + + + delete from fit_test_main where UID = #{uId} and Title = #{Title} + + + + delete from fit_test_advice where TestID = #{TestID} + + + + delete from fit_test_data where TestID = #{TestID} + + + + delete from fit_test_records where TestID = #{TestID} + + + + delete from fit_bca_advice where TestID = #{TestID} + + + + + + + + + + + + + + diff --git a/acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml b/acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml index 84f1c1f4..ffd907e4 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml @@ -62,7 +62,7 @@ group by p.id - order by p.create_time desc + order by p.update_time desc