From d2a1957ec40c70c696ab3260d7f7df90c4539589 Mon Sep 17 00:00:00 2001 From: whywhyo <1511349576@qq.com> Date: 星期五, 21 七月 2023 15:33:31 +0800 Subject: [PATCH] 1254 --- zhang-content/src/main/java/com/ruoyi/domain/dto/ZHealthInfoDto.java | 43 ++ zhang-content/src/main/java/com/ruoyi/domain/health/StoolStatus.java | 22 + zhang-content/src/main/java/com/ruoyi/service/ZHealthNoteService.java | 5 zhang-content/src/main/java/com/ruoyi/domain/health/VascularDisease.java | 17 + zhang-content/src/main/java/com/ruoyi/domain/health/OtherDisease.java | 22 + zhang-content/src/main/java/com/ruoyi/domain/health/Sleep.java | 22 + zhang-content/src/main/java/com/ruoyi/domain/ZHealthNow.java | 2 zhang-content/src/main/java/com/ruoyi/domain/health/UrineStatus.java | 19 + zhang-content/src/main/java/com/ruoyi/domain/dto/ZHealthNowDto.java | 23 + zhang-content/src/main/java/com/ruoyi/domain/health/SkinType.java | 24 + zhang-content/src/main/java/com/ruoyi/service/impl/ZHealthHabitServiceImpl.java | 79 +++++ zhang-content/src/main/java/com/ruoyi/domain/health/NutritionType.java | 21 + zhang-content/src/main/java/com/ruoyi/service/ZHealthInfoService.java | 5 zhang-content/src/main/java/com/ruoyi/domain/health/BrainDisease.java | 19 + zhang-content/src/main/java/com/ruoyi/domain/health/HeartDisease.java | 20 + zhang-content/src/main/java/com/ruoyi/domain/health/DigestiveSystemDisease.java | 25 + zhang-content/src/main/java/com/ruoyi/domain/health/RespiratorySystemDisease.java | 21 + zhang-content/src/main/java/com/ruoyi/domain/ZHealthHabit.java | 8 ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHealthNoteController.java | 26 + ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHealthNowController.java | 31 ++ zhang-content/src/main/java/com/ruoyi/domain/health/AttitudeType.java | 20 + zhang-content/src/main/java/com/ruoyi/service/impl/ZHealthNowServiceImpl.java | 88 +++++ zhang-content/src/main/java/com/ruoyi/domain/dto/ZHealthHabitDto.java | 49 +++ zhang-content/src/main/java/com/ruoyi/domain/health/PsychologyType.java | 21 + ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHealthInfoController.java | 31 + zhang-content/src/main/java/com/ruoyi/service/impl/ZHealthNoteServiceImpl.java | 40 ++ zhang-content/src/main/java/com/ruoyi/domain/health/KidneyDisease.java | 21 + zhang-content/src/main/java/com/ruoyi/domain/health/LifeEvent.java | 19 + zhang-content/src/main/java/com/ruoyi/service/ZHealthHabitService.java | 5 zhang-content/src/main/java/com/ruoyi/service/ZHealthNowService.java | 6 zhang-content/src/main/java/com/ruoyi/domain/health/EatingHabits.java | 21 + zhang-content/src/main/java/com/ruoyi/service/impl/ZHealthInfoServiceImpl.java | 78 +++++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHealthHabitController.java | 36 ++ 33 files changed, 877 insertions(+), 12 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHealthHabitController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHealthHabitController.java index 23e6eb3..9f8dc65 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHealthHabitController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHealthHabitController.java @@ -1,9 +1,16 @@ package com.ruoyi.web.controller.zhang; -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.domain.ZHealthHabit; +import com.ruoyi.domain.dto.ZHealthBaseDto; +import com.ruoyi.domain.dto.ZHealthHabitDto; +import com.ruoyi.service.ZHealthHabitService; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; /** * <p> @@ -17,5 +24,28 @@ @RequestMapping("/zHealthHabit") public class ZHealthHabitController { + @Autowired + ZHealthHabitService zHealthHabitService; + + /** + * 鏌ヨ鏁版嵁 + */ + @GetMapping("/all") + public AjaxResult listAll(){ + return zHealthHabitService.selectData(); + } + + /** + * 鏂板鎴栦慨鏀硅褰� + */ +// @PreAuthorize("@ss.hasPermi('system:property:edit')") + @Log(title = "鍋ュ悍璁板綍", businessType = BusinessType.UPDATE) + @PostMapping + public AjaxResult edit(@RequestBody ZHealthHabitDto zHealthHabitDto) + { + return zHealthHabitService.saveOrUpdateData(zHealthHabitDto); + } + + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHealthInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHealthInfoController.java index f0a77a4..cfa0a3f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHealthInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHealthInfoController.java @@ -1,9 +1,13 @@ package com.ruoyi.web.controller.zhang; -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.domain.dto.ZHealthInfoDto; +import com.ruoyi.service.ZHealthInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; /** * <p> @@ -16,6 +20,27 @@ @RestController @RequestMapping("/zHealthInfo") public class ZHealthInfoController { + @Autowired + ZHealthInfoService zHealthInfoService; + + /** + * 鏌ヨ鏁版嵁 + */ + @GetMapping("/all") + public AjaxResult listAll(){ + return zHealthInfoService.selectData(); + } + + /** + * 鏂板鎴栦慨鏀硅褰� + */ +// @PreAuthorize("@ss.hasPermi('system:property:edit')") + @Log(title = "鍋ュ悍璁板綍", businessType = BusinessType.UPDATE) + @PostMapping + public AjaxResult edit(@RequestBody ZHealthInfoDto zHealthInfoDto) + { + return zHealthInfoService.saveOrUpdateData(zHealthInfoDto); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHealthNoteController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHealthNoteController.java index d5cf1b5..94fa528 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHealthNoteController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHealthNoteController.java @@ -1,10 +1,36 @@ package com.ruoyi.web.controller.zhang; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.domain.ZHealthNote; +import com.ruoyi.domain.dto.ZHealthNowDto; +import com.ruoyi.service.ZHealthNoteService; +import com.ruoyi.service.ZHealthNowService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + /** * @Author Jinquan_Ou * @Description * @Date 2023-07-17 13:30 * @Version 1.0.0 **/ +@RestController +@RequestMapping("/zHealthNote") public class ZHealthNoteController { + @Autowired + private ZHealthNoteService zHealthNoteService; + + @GetMapping() + public AjaxResult listAll(){ + return zHealthNoteService.listAll(); + } + + @PostMapping + public AjaxResult saveOrUpdate(@RequestBody ZHealthNote zHealthNote){ + return zHealthNoteService.saveData(zHealthNote); + } + + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHealthNowController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHealthNowController.java index bf94964..a9d161a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHealthNowController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHealthNowController.java @@ -1,10 +1,41 @@ package com.ruoyi.web.controller.zhang; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.domain.dto.ZHealthNowDto; +import com.ruoyi.service.ZHealthNowService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + /** * @Author Jinquan_Ou * @Description * @Date 2023-07-17 13:30 * @Version 1.0.0 **/ +@RestController +@RequestMapping("/zHealthNow") public class ZHealthNowController { + @Autowired + ZHealthNowService zHealthNowService; + + /** + * 鏌ヨ鏁版嵁 + */ + @GetMapping("/all") + public AjaxResult listAll(){ + return zHealthNowService.selectData(); + } + + /** + * 鏂板鎴栦慨鏀硅褰� + */ +// @PreAuthorize("@ss.hasPermi('system:property:edit')") + @Log(title = "鍋ュ悍璁板綍", businessType = BusinessType.UPDATE) + @PostMapping + public AjaxResult edit(@RequestBody ZHealthNowDto zHealthNowDto) + { + return zHealthNowService.saveOrUpdateData(zHealthNowDto); + } } diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZHealthHabit.java b/zhang-content/src/main/java/com/ruoyi/domain/ZHealthHabit.java index db8525a..74bb025 100644 --- a/zhang-content/src/main/java/com/ruoyi/domain/ZHealthHabit.java +++ b/zhang-content/src/main/java/com/ruoyi/domain/ZHealthHabit.java @@ -36,13 +36,13 @@ private String sleep; // 鐫$湢鐘舵��(json) - private String bigEgestionStatus; // 澶т究瑙勫緥(json) + private String stoolStatus; // 澶т究瑙勫緥(json) - private String smallEgestionStatus; // 灏忎究瑙勫緥(json) + private String urineStatus; // 灏忎究瑙勫緥(json) - private String bigEgestion; // 澶т究 + private String stool; // 澶т究 - private String smallEgestion; // 灏忎究 + private String urine; // 灏忎究 private String eatType; // 楗涔犳儻(json) diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZHealthNow.java b/zhang-content/src/main/java/com/ruoyi/domain/ZHealthNow.java index 76e68a5..d1c004d 100644 --- a/zhang-content/src/main/java/com/ruoyi/domain/ZHealthNow.java +++ b/zhang-content/src/main/java/com/ruoyi/domain/ZHealthNow.java @@ -28,9 +28,7 @@ private String blood; // 琛�绠$柧鐥� - private String digestiveSystem; // 娑堝寲绯荤粺鐤剧梾 - private String breathSystem; // 鍛煎惛绯荤粺鐤剧梾 diff --git a/zhang-content/src/main/java/com/ruoyi/domain/dto/ZHealthHabitDto.java b/zhang-content/src/main/java/com/ruoyi/domain/dto/ZHealthHabitDto.java new file mode 100644 index 0000000..f590ef4 --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/dto/ZHealthHabitDto.java @@ -0,0 +1,49 @@ +package com.ruoyi.domain.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.ruoyi.domain.health.*; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-19 20:52 + * @Version 1.0.0 + **/ +@Data +public class ZHealthHabitDto implements Serializable { + private static final long serialVersionUID = 1L; + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private Long uid; // 鎵�灞炵敤鎴穒d + + private String eatGood; // 楗(鍠�) + + private String eatBad; // 楗(蹇�) + + private String hobby; // 鐖卞ソ + + private String addition; // 鍡滃ソ + + private String stool; // 澶т究 + + private String urine; // 灏忎究 + + private Sleep sleepClass; //鐫$湢鎯呭喌 + + private StoolStatus stoolStatusClass; //澶т究鎯呭喌 + + private UrineStatus urineStatusClass; //灏忎究鎯呭喌 + + private EatingHabits eatingHabitsClass; //楗涔犳儻 + + private LifeEvent lifeEventClass; //鐢熸椿浜嬩欢 + + + + +} diff --git a/zhang-content/src/main/java/com/ruoyi/domain/dto/ZHealthInfoDto.java b/zhang-content/src/main/java/com/ruoyi/domain/dto/ZHealthInfoDto.java new file mode 100644 index 0000000..f5a6543 --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/dto/ZHealthInfoDto.java @@ -0,0 +1,43 @@ +package com.ruoyi.domain.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.ruoyi.domain.health.AttitudeType; +import com.ruoyi.domain.health.NutritionType; +import com.ruoyi.domain.health.PsychologyType; +import com.ruoyi.domain.health.SkinType; +import lombok.Data; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-20 11:20 + * @Version 1.0.0 + **/ +@Data +public class ZHealthInfoDto { + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private Long uid; // 鍋ュ悍琛ㄦ墍灞炶�卛d + + private String temperature; // 浣撴俯 + + private String pulse; // 鑴夋悘 + + private String breathe; // 鍛煎惛 + + private String bloodPressure; // 琛�鍘� + + private String weight; // 浣撻噸kg + + private String movement; // 鍥涜偄娲诲姩鎯呭喌 + + private SkinType skinTypeClass; // 鐨偆鎯呭喌 + + private PsychologyType psychologyTypeClass; // 蹇冪悊鐘舵�� + + private AttitudeType attitudeClass; // 闈㈠鐤剧梾鐨勬�佸害 + + private NutritionType nutritionClass; // 鍏ㄨ韩钀ュ吇鐘跺喌 +} diff --git a/zhang-content/src/main/java/com/ruoyi/domain/dto/ZHealthNowDto.java b/zhang-content/src/main/java/com/ruoyi/domain/dto/ZHealthNowDto.java new file mode 100644 index 0000000..82eecc2 --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/dto/ZHealthNowDto.java @@ -0,0 +1,23 @@ +package com.ruoyi.domain.dto; + +import com.ruoyi.domain.health.*; +import lombok.Data; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-21 8:52 + * @Version 1.0.0 + **/ +@Data +public class ZHealthNowDto { + private BrainDisease brainDiseaseClass; + private HeartDisease heartDiseaseClass; + private VascularDisease vascularDiseaseClass; + private DigestiveSystemDisease digestiveSystemDiseaseClass; + private RespiratorySystemDisease respiratorySystemDiseaseClass; + private KidneyDisease kidneyDiseaseClass; + private OtherDisease otherDiseaseClass; + + +} diff --git a/zhang-content/src/main/java/com/ruoyi/domain/health/AttitudeType.java b/zhang-content/src/main/java/com/ruoyi/domain/health/AttitudeType.java new file mode 100644 index 0000000..4b0197f --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/health/AttitudeType.java @@ -0,0 +1,20 @@ +package com.ruoyi.domain.health; + +import lombok.Data; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-20 11:22 + * @Version 1.0.0 + **/ +@Data +//鐥呯悊鎬佸害 +public class AttitudeType { + private Integer lucidity = 0; //鏄庢湕 + private Integer unknown = 0; //涓嶄簡瑙� + private Integer normal = 0; //姝e父 + private Integer abnormal = 0; //涓嶆甯� + private Integer other = 0;//鍏朵粬 + private String otherText = ""; +} diff --git a/zhang-content/src/main/java/com/ruoyi/domain/health/BrainDisease.java b/zhang-content/src/main/java/com/ruoyi/domain/health/BrainDisease.java new file mode 100644 index 0000000..3fffa73 --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/health/BrainDisease.java @@ -0,0 +1,19 @@ +package com.ruoyi.domain.health; + +import lombok.Data; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-21 8:53 + * @Version 1.0.0 + **/ +@Data +public class BrainDisease { + private Integer ischemicStroke = 0;//缂鸿鎬у崚涓� + private Integer cerebralHemorrhage = 0;//鑴戝嚭琛� + private Integer subarachnoidHemorrhage = 0;//铔涚綉鑶滀笅鑵斿嚭琛� + private Integer TIA = 0;//鐭殏鎬ц剳缂鸿鍙戜綔 + private Integer other = 0; + private String otherText = ""; +} diff --git a/zhang-content/src/main/java/com/ruoyi/domain/health/DigestiveSystemDisease.java b/zhang-content/src/main/java/com/ruoyi/domain/health/DigestiveSystemDisease.java new file mode 100644 index 0000000..19921f9 --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/health/DigestiveSystemDisease.java @@ -0,0 +1,25 @@ +package com.ruoyi.domain.health; + +import lombok.Data; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-21 9:14 + * @Version 1.0.0 + **/ +@Data +public class DigestiveSystemDisease { + private Integer gastroduodenalUlcer = 0;//鑳冨崄浜屾寚鑲犳簝鐤� + private Integer esophagitis = 0;//杩旀祦鎬ч绠$値 + private Integer gastritis = 0;//鎱㈡�ц儍鐐� + private Integer colitis = 0;//婧冪枴鎬х粨鑲犵値 + private Integer hepatitis = 0;//鑲濈値 + private Integer cholecystitis = 0;//鑳嗗泭鐐� + private Integer cholelithiasis = 0;//鑳嗙煶鐥� + private Integer fattyLiver = 0;//鑴傝偑鑲� + private Integer hyperlipidemia = 0;//楂樿剛琛�鐥� + private Integer haemorrhoids = 0;//鐥旂柈 + private Integer other = 0; + private String otherText = ""; +} diff --git a/zhang-content/src/main/java/com/ruoyi/domain/health/EatingHabits.java b/zhang-content/src/main/java/com/ruoyi/domain/health/EatingHabits.java new file mode 100644 index 0000000..9816b26 --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/health/EatingHabits.java @@ -0,0 +1,21 @@ +package com.ruoyi.domain.health; + +import lombok.Data; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-19 21:20 + * @Version 1.0.0 + **/ +@Data +public class EatingHabits { + private Integer uniformityOfMeatAndVegetables = 0; + private Integer meat = 0; + private Integer vegetable = 0; + private Integer salt = 0; + private Integer oil = 0; + private Integer sugar = 0; + private Integer other = 0; + private String otherText = ""; +} diff --git a/zhang-content/src/main/java/com/ruoyi/domain/health/HeartDisease.java b/zhang-content/src/main/java/com/ruoyi/domain/health/HeartDisease.java new file mode 100644 index 0000000..49a1dc4 --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/health/HeartDisease.java @@ -0,0 +1,20 @@ +package com.ruoyi.domain.health; + +import lombok.Data; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-21 8:56 + * @Version 1.0.0 + **/ +@Data +public class HeartDisease { + private Integer myocardialInfarct = 0; //蹇冭倢姊楀 + private Integer anginaPectoris = 0; //蹇冪粸鐥� + private Integer coronaryRevascularization = 0; //鍐犵姸鍔ㄨ剦琛�杩愰噸寤� + private Integer congestiveHeartFailure = 0; //鍏呰鎬у績鍔涜“绔厖琛�鎬у績鍔涜“绔� + private Integer precordialPain = 0; //蹇冨墠鍖虹柤鐥� + private Integer other = 0; + private String otherText = ""; +} diff --git a/zhang-content/src/main/java/com/ruoyi/domain/health/KidneyDisease.java b/zhang-content/src/main/java/com/ruoyi/domain/health/KidneyDisease.java new file mode 100644 index 0000000..cd5e354 --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/health/KidneyDisease.java @@ -0,0 +1,21 @@ +package com.ruoyi.domain.health; + +import lombok.Data; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-21 9:21 + * @Version 1.0.0 + **/ +@Data +public class KidneyDisease { + private Integer diabetes = 0;//绯栧翱鐥� + private Integer renalFailure = 0;//绯栧翱鐥� + private Integer acuteNephritis = 0;//鎬ユ�ц偩鐐� + private Integer chronicNephritis = 0;//鎱㈡�ц偩鐐� + private Integer urinaryCalculus = 0;//娉屽翱绯荤粺缁撶煶 + private Integer urinaryTractInfection = 0;//娉屽翱绯荤粺鎰熸煋 + private Integer other = 0; + private String otherText = ""; +} diff --git a/zhang-content/src/main/java/com/ruoyi/domain/health/LifeEvent.java b/zhang-content/src/main/java/com/ruoyi/domain/health/LifeEvent.java new file mode 100644 index 0000000..d370741 --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/health/LifeEvent.java @@ -0,0 +1,19 @@ +package com.ruoyi.domain.health; + +import lombok.Data; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-19 21:24 + * @Version 1.0.0 + **/ +@Data +public class LifeEvent { + private Integer bereave = 0; + private Integer liveAlone = 0; + private Integer inHospital = 0; + private Integer divide = 0; + private Integer other = 0;//鍏跺畠 + private String otherText = ""; +} diff --git a/zhang-content/src/main/java/com/ruoyi/domain/health/NutritionType.java b/zhang-content/src/main/java/com/ruoyi/domain/health/NutritionType.java new file mode 100644 index 0000000..1c71f94 --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/health/NutritionType.java @@ -0,0 +1,21 @@ +package com.ruoyi.domain.health; + +import lombok.Data; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-20 11:22 + * @Version 1.0.0 + **/ +@Data +public class NutritionType { + private Integer good = 0; //鑹ソ + private Integer medium = 0; //涓瓑 + private Integer poor = 0; //娆犱匠 + private Integer obesity = 0; //鑲ヨ儢 + private Integer thin = 0; //娑堢槮 + private Integer fluid = 0; //鎭舵恫璐� + private Integer other = 0;//鍏跺畠 + private String otherText = ""; +} diff --git a/zhang-content/src/main/java/com/ruoyi/domain/health/OtherDisease.java b/zhang-content/src/main/java/com/ruoyi/domain/health/OtherDisease.java new file mode 100644 index 0000000..c7b9a11 --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/health/OtherDisease.java @@ -0,0 +1,22 @@ +package com.ruoyi.domain.health; + +import lombok.Data; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-21 9:24 + * @Version 1.0.0 + **/ +@Data +public class OtherDisease { + private Integer pregnant = 0;//瀛曟湡涓変釜鏈堜互鍐呯殑瀛曞 + private Integer cold = 0;//鐥呮瘨鎬ч噸鎰熷啋 + private Integer infectious = 0;//浼犳煋鎬х柧鐥� + private Integer pulmonaryBulla = 0;//鑲哄ぇ鐤� + private Integer hemoptysis = 0;//缁撴牳鎬х┖娲炲舰鎴愮殑鍜 + private Integer pneumothorax = 0;//鏈粡澶勭悊鐨勬皵鑳� + private Integer activeBleeding = 0;//娲诲姩鎬у嚭琛� + private Integer other = 0;//鍏跺畠 + private String otherText = ""; +} diff --git a/zhang-content/src/main/java/com/ruoyi/domain/health/PsychologyType.java b/zhang-content/src/main/java/com/ruoyi/domain/health/PsychologyType.java new file mode 100644 index 0000000..6e6816b --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/health/PsychologyType.java @@ -0,0 +1,21 @@ +package com.ruoyi.domain.health; + +import lombok.Data; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-20 11:22 + * @Version 1.0.0 + **/ +@Data +public class PsychologyType { + private Integer optimistic = 0; //寮�鏈� + private Integer worry = 0; //鐒﹁檻 + private Integer fear = 0; //蹇ф剚鎭愭儳 + private Integer suspicion = 0; //鐚滅枒 + private Integer constrain = 0; //鍘嬫姂 + private Integer miss = 0; //鎬濆康 + private Integer other = 0;//鍏跺畠 + private String otherText = ""; +} diff --git a/zhang-content/src/main/java/com/ruoyi/domain/health/RespiratorySystemDisease.java b/zhang-content/src/main/java/com/ruoyi/domain/health/RespiratorySystemDisease.java new file mode 100644 index 0000000..9279c2b --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/health/RespiratorySystemDisease.java @@ -0,0 +1,21 @@ +package com.ruoyi.domain.health; + +import lombok.Data; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-21 9:08 + * @Version 1.0.0 + **/ +@Data +public class RespiratorySystemDisease { + private Integer COPD = 0; //COPD + private Integer pneumonia = 0; //鑲虹値 + private Integer bronchitis = 0; //鏀皵绠$値 + private Integer bronchialAsthma = 0; //鏀皵绠″摦鍠� + private Integer pulmonaryTuberculosis = 0; //鑲虹粨鏍� + private Integer upperRespiratoryTractInfection = 0; //涓婂懠鍚搁亾鎰熸煋 + private Integer other = 0;//鍏跺畠 + private String otherText = ""; +} diff --git a/zhang-content/src/main/java/com/ruoyi/domain/health/SkinType.java b/zhang-content/src/main/java/com/ruoyi/domain/health/SkinType.java new file mode 100644 index 0000000..f51bc52 --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/health/SkinType.java @@ -0,0 +1,24 @@ +package com.ruoyi.domain.health; + +import lombok.Data; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-20 11:22 + * @Version 1.0.0 + **/ +@Data +public class SkinType { + private Integer acne = 0; //闈掓槬鐥� + private Integer psoriasis = 0; //鐗涚毊钘� + private Integer color = 0; //鑹茬礌娌夌潃 + private Integer edema = 0; //姘磋偪 + private Integer rash = 0;//鐨柟 + private Integer bloodStasis = 0;//鐦�鐐圭榾鏂� + private Integer snom = 0;//鐨笅缁撹妭鎴栬偪鍧� + private Integer nevus = 0;//铚樿洓鐥� + private Integer ulcer = 0;//婧冪枴鎴栫槩鐥� + private Integer other = 0;//鍏跺畠 + private String otherText = ""; +} diff --git a/zhang-content/src/main/java/com/ruoyi/domain/health/Sleep.java b/zhang-content/src/main/java/com/ruoyi/domain/health/Sleep.java new file mode 100644 index 0000000..849e322 --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/health/Sleep.java @@ -0,0 +1,22 @@ +package com.ruoyi.domain.health; + +import lombok.Data; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-19 21:05 + * @Version 1.0.0 + **/ +@Data +public class Sleep { + private Integer good = 0;//鑹ソ + private Integer general = 0;//鑹ソ + private Integer easyWake = 0;//鏄撻啋 + private Integer dreaminess = 0;//澶氭ⅵ + private Integer sleepless = 0;//澶辩湢 + private Integer snore = 0;//鎵撻季 + private Integer wakefulness = 0;//鐫′笉鐔� + private Integer other = 0;//鍏跺畠 + private String otherText = ""; +} diff --git a/zhang-content/src/main/java/com/ruoyi/domain/health/StoolStatus.java b/zhang-content/src/main/java/com/ruoyi/domain/health/StoolStatus.java new file mode 100644 index 0000000..f6599f6 --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/health/StoolStatus.java @@ -0,0 +1,22 @@ +package com.ruoyi.domain.health; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-19 21:12 + * @Version 1.0.0 + **/ +@Data +public class StoolStatus{ + private Integer normal = 0;//姝e父 + private Integer constipation = 0;//渚跨 + private Integer diarrhea = 0;//鑵规郴 + private Integer incontinence = 0;//澶辩 + private Integer other = 0;//鍏跺畠 + private String otherText = ""; + +} diff --git a/zhang-content/src/main/java/com/ruoyi/domain/health/UrineStatus.java b/zhang-content/src/main/java/com/ruoyi/domain/health/UrineStatus.java new file mode 100644 index 0000000..7d6cd1b --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/health/UrineStatus.java @@ -0,0 +1,19 @@ +package com.ruoyi.domain.health; + +import lombok.Data; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-19 21:15 + * @Version 1.0.0 + **/ +@Data +public class UrineStatus { + private Integer normal = 0;//姝e父 + private Integer nightUrinaryRetention = 0;//澶滃翱娼寸暀 + private Integer incontinence = 0;//澶辩 + private Integer enuresis = 0;//閬楀翱 + private Integer other = 0;//鍏跺畠 + private String otherText = ""; +} diff --git a/zhang-content/src/main/java/com/ruoyi/domain/health/VascularDisease.java b/zhang-content/src/main/java/com/ruoyi/domain/health/VascularDisease.java new file mode 100644 index 0000000..3d3d0cb --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/health/VascularDisease.java @@ -0,0 +1,17 @@ +package com.ruoyi.domain.health; + +import lombok.Data; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-07-21 9:11 + * @Version 1.0.0 + **/ +@Data +public class VascularDisease { + private Integer dissectingAneurysm = 0; //澶瑰眰鍔ㄨ剦鐦� + private Integer arterialOcclusiveDiseases = 0; //鍔ㄨ剦闂鎬х柧鐥� + private Integer other = 0;//鍏跺畠 + private String otherText = ""; +} diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZHealthHabitService.java b/zhang-content/src/main/java/com/ruoyi/service/ZHealthHabitService.java index c46e4be..a9f14d9 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZHealthHabitService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZHealthHabitService.java @@ -2,7 +2,9 @@ import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.domain.ZHealthHabit; +import com.ruoyi.domain.dto.ZHealthHabitDto; /** * <p> @@ -14,4 +16,7 @@ */ public interface ZHealthHabitService extends IService<ZHealthHabit> { + AjaxResult selectData(); + + AjaxResult saveOrUpdateData(ZHealthHabitDto zHealthHabitDto); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZHealthInfoService.java b/zhang-content/src/main/java/com/ruoyi/service/ZHealthInfoService.java index 13cd87f..99d32bc 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZHealthInfoService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZHealthInfoService.java @@ -2,7 +2,9 @@ import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.domain.ZHealthInfo; +import com.ruoyi.domain.dto.ZHealthInfoDto; /** * <p> @@ -14,4 +16,7 @@ */ public interface ZHealthInfoService extends IService<ZHealthInfo> { + AjaxResult selectData(); + + AjaxResult saveOrUpdateData(ZHealthInfoDto zHealthInfoDto); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZHealthNoteService.java b/zhang-content/src/main/java/com/ruoyi/service/ZHealthNoteService.java index 5e28eb4..86feb19 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZHealthNoteService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZHealthNoteService.java @@ -1,6 +1,7 @@ package com.ruoyi.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.domain.ZHealthNote; /** @@ -10,4 +11,8 @@ * @Version 1.0.0 **/ public interface ZHealthNoteService extends IService<ZHealthNote> { + AjaxResult listAll(); + + AjaxResult saveData(ZHealthNote zHealthNote); + } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZHealthNowService.java b/zhang-content/src/main/java/com/ruoyi/service/ZHealthNowService.java index 06f6440..2046661 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZHealthNowService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZHealthNowService.java @@ -1,7 +1,9 @@ package com.ruoyi.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.domain.ZHealthNow; +import com.ruoyi.domain.dto.ZHealthNowDto; /** * @Author Jinquan_Ou @@ -10,4 +12,8 @@ * @Version 1.0.0 **/ public interface ZHealthNowService extends IService<ZHealthNow> { + AjaxResult selectData(); + + + AjaxResult saveOrUpdateData(ZHealthNowDto zHealthNowDto); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZHealthHabitServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZHealthHabitServiceImpl.java index 829c63d..d13dbb7 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZHealthHabitServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZHealthHabitServiceImpl.java @@ -1,8 +1,18 @@ package com.ruoyi.service.impl; +import com.alibaba.fastjson2.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.domain.ZHealthHabit; +import com.ruoyi.domain.ZHealthHabit; +import com.ruoyi.domain.dto.ZHealthHabitDto; +import com.ruoyi.domain.dto.ZHealthHabitDto; +import com.ruoyi.domain.health.*; import com.ruoyi.mapper.ZHealthHabitMapper; import com.ruoyi.service.ZHealthHabitService; import org.springframework.stereotype.Service; @@ -18,4 +28,73 @@ @Service public class ZHealthHabitServiceImpl extends ServiceImpl<ZHealthHabitMapper, ZHealthHabit> implements ZHealthHabitService { + @Override + public AjaxResult selectData() { + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + + LambdaQueryWrapper<ZHealthHabit> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZHealthHabit::getUid,userId); + ZHealthHabit zHealthHabit = getOne(lqw); + + //濡傛灉鏄涓�娆¤繘鏉ワ紝涔嬪墠娌℃湁杩欎釜鐢ㄦ埛鐨勬暟鎹紝鎶涘紓甯歌鐢ㄦ埛鍏堟彃鍏ユ暟鎹� + if(zHealthHabit == null){ + throw new RuntimeException("绗竴娆¤繘鏉�,璇峰厛濉啓濂芥暟鎹�"); + } + + //灏佽瑕佽繑鍥炵殑鏁版嵁 + ZHealthHabitDto returnData = new ZHealthHabitDto(); + BeanUtils.copyProperties(zHealthHabit,returnData); + +// returnData.setName(zHealthHabit.getName()); +// returnData.setSex(zHealthHabit.getSex()); +// returnData.setEducationLevel(zHealthHabit.getEducationLevel()); +// returnData.setWork(zHealthHabit.getWork()); +// returnData.setPhone(zHealthHabit.getPhone()); +// returnData.setEmail(zHealthHabit.getEmail()); +// returnData.setMedicine(zHealthHabit.getMedicine()); +// returnData.setBaseDisease(zHealthHabit.getBaseDisease()); + + //灏唈son鏁扮粍杞崲鎴愬璞� + returnData.setSleepClass(JSON.parseObject(zHealthHabit.getSleep(), Sleep.class)); + returnData.setStoolStatusClass(JSON.parseObject(zHealthHabit.getStoolStatus(), StoolStatus.class)); + returnData.setUrineStatusClass(JSON.parseObject(zHealthHabit.getUrineStatus(), UrineStatus.class)); + returnData.setEatingHabitsClass(JSON.parseObject(zHealthHabit.getEatType(), EatingHabits.class)); + returnData.setLifeEventClass(JSON.parseObject(zHealthHabit.getLifeType(), LifeEvent.class)); + + return AjaxResult.success(returnData); + + } + + @Override + public AjaxResult saveOrUpdateData(ZHealthHabitDto zHealthHabitDto) { + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + + LambdaQueryWrapper<ZHealthHabit> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZHealthHabit::getUid,userId); + ZHealthHabit getResult = getOne(lqw); + + ZHealthHabit zHealthHabit = new ZHealthHabit(); + + BeanUtils.copyProperties(zHealthHabitDto,zHealthHabit); + zHealthHabit.setUid(userId); + zHealthHabit.setSleep(JSON.toJSONString(zHealthHabitDto.getSleepClass())); + zHealthHabit.setStoolStatus(JSON.toJSONString(zHealthHabitDto.getStoolStatusClass())); + zHealthHabit.setUrineStatus(JSON.toJSONString(zHealthHabitDto.getUrineStatusClass())); + zHealthHabit.setEatType(JSON.toJSONString(zHealthHabitDto.getEatingHabitsClass())); + zHealthHabit.setLifeType(JSON.toJSONString(zHealthHabitDto.getLifeEventClass())); + + if(getResult == null){ + //濡傛灉鏄涓�娆¤繘鏉ワ紝閭d箞鏄柊澧炴暟鎹� + save(zHealthHabit); + }else { + //濡傛灉涓嶆槸绗竴娆★紝閭e氨鏄慨鏀规暟鎹簡 + zHealthHabit.setId(getResult.getId()); + updateById(zHealthHabit); + } + + return AjaxResult.success(); + + } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZHealthInfoServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZHealthInfoServiceImpl.java index 946f4aa..11046e7 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZHealthInfoServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZHealthInfoServiceImpl.java @@ -1,8 +1,19 @@ package com.ruoyi.service.impl; +import com.alibaba.fastjson2.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.domain.ZHealthInfo; +import com.ruoyi.domain.ZHealthInfo; +import com.ruoyi.domain.ZHealthInfo; +import com.ruoyi.domain.dto.ZHealthInfoDto; +import com.ruoyi.domain.dto.ZHealthInfoDto; +import com.ruoyi.domain.health.*; import com.ruoyi.mapper.ZHealthInfoMapper; import com.ruoyi.service.ZHealthInfoService; import org.springframework.stereotype.Service; @@ -18,4 +29,71 @@ @Service public class ZHealthInfoServiceImpl extends ServiceImpl<ZHealthInfoMapper, ZHealthInfo> implements ZHealthInfoService { + @Override + public AjaxResult selectData() { + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + + LambdaQueryWrapper<ZHealthInfo> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZHealthInfo::getUid,userId); + ZHealthInfo zHealthInfo = getOne(lqw); + + //濡傛灉鏄涓�娆¤繘鏉ワ紝涔嬪墠娌℃湁杩欎釜鐢ㄦ埛鐨勬暟鎹紝鎶涘紓甯歌鐢ㄦ埛鍏堟彃鍏ユ暟鎹� + if(zHealthInfo == null){ + throw new RuntimeException("绗竴娆¤繘鏉�,璇峰厛濉啓濂芥暟鎹�"); + } + + //灏佽瑕佽繑鍥炵殑鏁版嵁 + ZHealthInfoDto returnData = new ZHealthInfoDto(); + BeanUtils.copyProperties(zHealthInfo,returnData); + +// returnData.setName(zHealthInfo.getName()); +// returnData.setSex(zHealthInfo.getSex()); +// returnData.setEducationLevel(zHealthInfo.getEducationLevel()); +// returnData.setWork(zHealthInfo.getWork()); +// returnData.setPhone(zHealthInfo.getPhone()); +// returnData.setEmail(zHealthInfo.getEmail()); +// returnData.setMedicine(zHealthInfo.getMedicine()); +// returnData.setBaseDisease(zHealthInfo.getBaseDisease()); + + //灏唈son鏁扮粍杞崲鎴愬璞� + returnData.setSkinTypeClass(JSON.parseObject(zHealthInfo.getSkinType(), SkinType.class)); + returnData.setPsychologyTypeClass(JSON.parseObject(zHealthInfo.getPsychologyType(), PsychologyType.class)); + returnData.setAttitudeClass(JSON.parseObject(zHealthInfo.getAttitude(), AttitudeType.class)); + returnData.setNutritionClass(JSON.parseObject(zHealthInfo.getNutrition(), NutritionType.class)); + + return AjaxResult.success(returnData); + + } + + @Override + public AjaxResult saveOrUpdateData(ZHealthInfoDto zHealthInfoDto) { + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + + LambdaQueryWrapper<ZHealthInfo> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZHealthInfo::getUid,userId); + ZHealthInfo getResult = getOne(lqw); + + ZHealthInfo zHealthInfo = new ZHealthInfo(); + + BeanUtils.copyProperties(zHealthInfoDto,zHealthInfo); + zHealthInfo.setUid(userId); + zHealthInfo.setSkinType(JSON.toJSONString(zHealthInfoDto.getSkinTypeClass())); + zHealthInfo.setPsychologyType(JSON.toJSONString(zHealthInfoDto.getPsychologyTypeClass())); + zHealthInfo.setAttitude(JSON.toJSONString(zHealthInfoDto.getAttitudeClass())); + zHealthInfo.setNutrition(JSON.toJSONString(zHealthInfoDto.getNutritionClass())); + + + if(getResult == null){ + //濡傛灉鏄涓�娆¤繘鏉ワ紝閭d箞鏄柊澧炴暟鎹� + save(zHealthInfo); + }else { + //濡傛灉涓嶆槸绗竴娆★紝閭e氨鏄慨鏀规暟鎹簡 + zHealthInfo.setId(getResult.getId()); + updateById(zHealthInfo); + } + + return AjaxResult.success(); + } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZHealthNoteServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZHealthNoteServiceImpl.java index 8947d37..04a02f2 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZHealthNoteServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZHealthNoteServiceImpl.java @@ -1,6 +1,10 @@ package com.ruoyi.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.domain.ZHealthNote; import com.ruoyi.mapper.ZHealthNoteMapper; import com.ruoyi.service.ZHealthNoteService; @@ -14,4 +18,40 @@ **/ @Service public class ZHealthNoteServiceImpl extends ServiceImpl<ZHealthNoteMapper, ZHealthNote> implements ZHealthNoteService { + @Override + public AjaxResult listAll() { + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + + LambdaQueryWrapper<ZHealthNote> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZHealthNote::getUid,userId); + ZHealthNote result = getOne(lqw); + if(result == null){ + throw new RuntimeException("璇峰厛濉啓濂芥暟鎹�"); + } + + return AjaxResult.success(result); + + } + + @Override + public AjaxResult saveData(ZHealthNote zHealthNote) { + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + + LambdaQueryWrapper<ZHealthNote> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZHealthNote::getUid,userId); + ZHealthNote result = getOne(lqw); + + if(result == null){ + zHealthNote.setUid(userId); + save(zHealthNote); + }else { + zHealthNote.setId(result.getId()); + zHealthNote.setUid(userId); + updateById(zHealthNote); + } + + return AjaxResult.success(); + } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZHealthNowServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZHealthNowServiceImpl.java index 9243746..5c5f5d1 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZHealthNowServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZHealthNowServiceImpl.java @@ -1,10 +1,22 @@ package com.ruoyi.service.impl; +import com.alibaba.fastjson2.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.domain.ZHealthNow; +import com.ruoyi.domain.ZHealthNow; +import com.ruoyi.domain.dto.ZHealthNowDto; +import com.ruoyi.domain.dto.ZHealthNowDto; +import com.ruoyi.domain.health.*; import com.ruoyi.mapper.ZHealthNowMapper; import com.ruoyi.service.ZHealthNowService; import org.springframework.stereotype.Service; + +import javax.sql.rowset.BaseRowSet; /** * @Author Jinquan_Ou @@ -14,4 +26,80 @@ **/ @Service public class ZHealthNowServiceImpl extends ServiceImpl<ZHealthNowMapper, ZHealthNow> implements ZHealthNowService { + @Override + public AjaxResult selectData() { + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + + LambdaQueryWrapper<ZHealthNow> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZHealthNow::getUid,userId); + ZHealthNow zHealthNow = getOne(lqw); + + //濡傛灉鏄涓�娆¤繘鏉ワ紝涔嬪墠娌℃湁杩欎釜鐢ㄦ埛鐨勬暟鎹紝鎶涘紓甯歌鐢ㄦ埛鍏堟彃鍏ユ暟鎹� + if(zHealthNow == null){ + throw new RuntimeException("绗竴娆¤繘鏉�,璇峰厛濉啓濂芥暟鎹�"); + } + + //灏佽瑕佽繑鍥炵殑鏁版嵁 + ZHealthNowDto returnData = new ZHealthNowDto(); + BeanUtils.copyProperties(zHealthNow,returnData); + +// returnData.setName(zHealthNow.getName()); +// returnData.setSex(zHealthNow.getSex()); +// returnData.setEducationLevel(zHealthNow.getEducationLevel()); +// returnData.setWork(zHealthNow.getWork()); +// returnData.setPhone(zHealthNow.getPhone()); +// returnData.setEmail(zHealthNow.getEmail()); +// returnData.setMedicine(zHealthNow.getMedicine()); +// returnData.setBaseDisease(zHealthNow.getBaseDisease()); + + //灏唈son鏁扮粍杞崲鎴愬璞� + returnData.setBrainDiseaseClass(JSON.parseObject(zHealthNow.getBrain(), BrainDisease.class)); + returnData.setHeartDiseaseClass(JSON.parseObject(zHealthNow.getHeart(), HeartDisease.class)); + returnData.setVascularDiseaseClass(JSON.parseObject(zHealthNow.getBlood(), VascularDisease.class)); + returnData.setDigestiveSystemDiseaseClass(JSON.parseObject(zHealthNow.getDigestiveSystem(), DigestiveSystemDisease.class)); + returnData.setRespiratorySystemDiseaseClass(JSON.parseObject(zHealthNow.getDigestiveSystem(), RespiratorySystemDisease.class)); + returnData.setKidneyDiseaseClass(JSON.parseObject(zHealthNow.getKidney(), KidneyDisease.class)); + returnData.setOtherDiseaseClass(JSON.parseObject(zHealthNow.getOther(), OtherDisease.class)); + + return AjaxResult.success(returnData); + + + } + + @Override + public AjaxResult saveOrUpdateData(ZHealthNowDto zHealthNowDto) { + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + + LambdaQueryWrapper<ZHealthNow> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZHealthNow::getUid,userId); + ZHealthNow getResult = getOne(lqw); + + ZHealthNow zHealthNow = new ZHealthNow(); + + BeanUtils.copyProperties(zHealthNowDto,zHealthNow); + zHealthNow.setUid(userId); + zHealthNow.setBrain(JSON.toJSONString(zHealthNowDto.getBrainDiseaseClass())); + zHealthNow.setHeart(JSON.toJSONString(zHealthNowDto.getHeartDiseaseClass())); + zHealthNow.setBlood(JSON.toJSONString(zHealthNowDto.getVascularDiseaseClass())); + zHealthNow.setDigestiveSystem(JSON.toJSONString(zHealthNowDto.getDigestiveSystemDiseaseClass())); + zHealthNow.setBreathSystem(JSON.toJSONString(zHealthNowDto.getRespiratorySystemDiseaseClass())); + zHealthNow.setKidney(JSON.toJSONString(zHealthNowDto.getKidneyDiseaseClass())); + zHealthNow.setOther(JSON.toJSONString(zHealthNowDto.getOtherDiseaseClass())); + + + if(getResult == null){ + //濡傛灉鏄涓�娆¤繘鏉ワ紝閭d箞鏄柊澧炴暟鎹� + save(zHealthNow); + }else { + //濡傛灉涓嶆槸绗竴娆★紝閭e氨鏄慨鏀规暟鎹簡 + zHealthNow.setId(getResult.getId()); + updateById(zHealthNow); + } + + return AjaxResult.success(); + + + } } -- Gitblit v1.9.1