From 506e8d6b84f1bba47e5d603e16a0714c4bf6df06 Mon Sep 17 00:00:00 2001 From: wuchunlei Date: Mon, 22 Jan 2024 17:53:01 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=90=B4=E9=97=A8=E5=8C=BB=E8=BF=B0-?= =?UTF-8?q?=E5=AD=A6=E6=9C=AF=E4=BC=A0=E6=89=BF-=E5=A4=96=E5=9B=BD?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E4=BF=AE=E6=94=B9=E4=B8=BA=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=AD=97=E5=85=B8=E5=8F=96=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../book/controller/MedicaldesController.java | 49 ++++++++++++------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/peanut/modules/book/controller/MedicaldesController.java b/src/main/java/com/peanut/modules/book/controller/MedicaldesController.java index a676a653..cbb99d5d 100644 --- a/src/main/java/com/peanut/modules/book/controller/MedicaldesController.java +++ b/src/main/java/com/peanut/modules/book/controller/MedicaldesController.java @@ -156,17 +156,18 @@ public class MedicaldesController { } //国际医师可能来自国外在省市里加入外国 - public String[] getCounts() { - //countId 为1 2 3 - String[] count = {"马来西亚","越南","加拿大"}; - return count; + public List getCounts() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper(); + wrapper.eq(SysDictDataEntity::getDictLabel,"inheritPro"); + List dataList = sysDictDataService.list(wrapper); + return dataList; } - public List getCityList(String count,int countId) { + public List getCityList(String cityName,int countId) { List cityList = new ArrayList<>(); City city = new City(); city.setProvId((long)countId); - city.setCityName(count); + city.setCityName(cityName); city.setCityId((long)countId); cityList.add(city); return cityList; @@ -184,8 +185,14 @@ public class MedicaldesController { wrapper.leftJoin(Province.class,Province::getProvId,City::getProvId); wrapper.selectAll(MedicaldesInherit.class); if ("0".equals(provId)){ + int[] val = new int[] {0}; //未知地址 - wrapper.in(MedicaldesInherit::getCityId,0,1,2,3); + if (getCounts()!=null&&getCounts().size() > 0){ + for (int i=1;i<=getCounts().size(); i++){ + val[i] = i; + } + } + wrapper.in(MedicaldesInherit::getCityId,val); }else { wrapper.eq(Province::getProvId,provId); } @@ -200,12 +207,12 @@ public class MedicaldesController { public R getMedicaldesProList() { String s = redisTemplate.opsForValue().get("Province"); List provinceList = new ArrayList<>(); - if (getCounts() != null){ - for (int i=0;i 0){ + for (int i=0;i prov = new ArrayList<>(); - if (1==provId){ - prov.addAll(getCityList(getCounts()[0],1)); - }else if (2==provId){ - prov.addAll(getCityList(getCounts()[1],2)); - }else if (3==provId){ - prov.addAll(getCityList(getCounts()[2],3)); - }else { + List list = getCounts(); + boolean flag = false; + if (list != null && list.size() > 0) { + for (SysDictDataEntity data:list) { + if (provId==Integer.parseInt(data.getDictType())){ + prov.addAll(getCityList(data.getDictValue(),Integer.parseInt(data.getDictType()))); + flag = true; + } + } + } + if (!flag) { prov = cityService.getBaseMapper().selectList(new QueryWrapper() .eq("prov_id", provId)); } From 25814e03ffbcd24c981af73fdf0d471c96e2f648 Mon Sep 17 00:00:00 2001 From: wuchunlei Date: Thu, 25 Jan 2024 13:11:15 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=90=B4=E9=97=A8=E5=8C=BB=E8=BF=B0-?= =?UTF-8?q?=E5=AD=A6=E6=9C=AF=E4=BC=A0=E6=89=BF-=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../book/controller/MedicaldesController.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/peanut/modules/book/controller/MedicaldesController.java b/src/main/java/com/peanut/modules/book/controller/MedicaldesController.java index cbb99d5d..175c4def 100644 --- a/src/main/java/com/peanut/modules/book/controller/MedicaldesController.java +++ b/src/main/java/com/peanut/modules/book/controller/MedicaldesController.java @@ -252,11 +252,14 @@ public class MedicaldesController { @RequestMapping(path = "/getInheritById") public R getInheritById(String id) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper(); - wrapper.eq(MedicaldesInheritRelation::getInheritId,id); - MedicaldesInheritRelation relation = relationService.getOne(wrapper); - MedicaldesInherit inherit = inheritService.getById(id); - inherit.setSort(relation.getSort()); + MPJLambdaWrapper wrapper = new MPJLambdaWrapper(); + wrapper.eq(MedicaldesInherit::getId,id); + wrapper.leftJoin(MedicaldesInheritRelation.class,MedicaldesInheritRelation::getInheritId,MedicaldesInherit::getId); + wrapper.leftJoin(City.class,City::getCityId,MedicaldesInherit::getCityId); + wrapper.leftJoin(Province.class,Province::getProvId,City::getProvId); + wrapper.leftJoin(" (select dict_type,dict_value from sys_dict_data where dict_label = 'inheritPro') dd on dd.dict_type = t.city_id"); + wrapper.select("t.*,ifnull(t2.city_name,ifnull(dd.dict_value,'其他')) as city_name,ifnull(t3.prov_name,ifnull(dd.dict_value,'其他')) as prov_name,t1.sort as sort"); + Map inherit = inheritService.getMap(wrapper); return R.ok().put("result",inherit); } @@ -290,15 +293,14 @@ public class MedicaldesController { @RequestMapping(path = "/getList") public List> getList(String type) { MPJLambdaWrapper wrapper = new MPJLambdaWrapper(); + wrapper.select("count(1) count,ifnull(t3.prov_id,ifnull(dd.dict_type,'0')) AS prov_id,ifnull(t3.prov_name,ifnull(dd.dict_value,'其他')) AS prov_name "); wrapper.leftJoin(MedicaldesInheritRelation.class,MedicaldesInheritRelation::getInheritId,MedicaldesInherit::getId); wrapper.eq(MedicaldesInheritRelation::getTypeId,type); wrapper.leftJoin(City.class,City::getCityId,MedicaldesInherit::getCityId); wrapper.leftJoin(Province.class,Province::getProvId,City::getProvId); - wrapper.select("IFNULL(t3.prov_name, '其他') AS provinceName"); - wrapper.select("IFNULL(t3.prov_id, 0) AS provinceId"); - wrapper.select("count(*) as count"); - wrapper.groupBy("provinceName"); - wrapper.orderByAsc(MedicaldesInheritRelation::getSort); + wrapper.leftJoin(" (select dict_type,dict_value from sys_dict_data where dict_label = 'inheritPro') dd on dd.dict_type = t.city_id"); + wrapper.groupBy("prov_name","dict_value"); + wrapper.orderByAsc("t3.region_code","dict_value"); List> list = inheritService.listMaps(wrapper); return list; } From 928a9599981c70dc6cd79a44665331b72025e7b9 Mon Sep 17 00:00:00 2001 From: wuchunlei Date: Thu, 25 Jan 2024 13:55:32 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=90=B4=E9=97=A8=E5=8C=BB=E8=BF=B0-?= =?UTF-8?q?=E4=B8=93=E8=91=97=E5=87=BA=E7=89=88-=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=88=A0=E9=99=A4=E4=B8=8A=E4=B8=8B=E6=9E=B6?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/peanut/modules/book/controller/MedicaldesController.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/peanut/modules/book/controller/MedicaldesController.java b/src/main/java/com/peanut/modules/book/controller/MedicaldesController.java index 175c4def..451d70b5 100644 --- a/src/main/java/com/peanut/modules/book/controller/MedicaldesController.java +++ b/src/main/java/com/peanut/modules/book/controller/MedicaldesController.java @@ -107,7 +107,6 @@ public class MedicaldesController { wrapper.leftJoin(MedicaldesBook.class,MedicaldesBook::getBookId,BookEntity::getId); wrapper.eq(MedicaldesBook::getTypeId,type); wrapper.eq(BookEntity::getBookType,0); - wrapper.eq(BookEntity::getState,1); wrapper.orderByAsc(MedicaldesBook::getSort); List list = bookService.list(wrapper); return R.ok().put("result", list); From 325dd75bfa937ca49f35491c54ddd5ad0cea48bc Mon Sep 17 00:00:00 2001 From: wuchunlei Date: Fri, 26 Jan 2024 10:16:19 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=96=B9=E8=8D=AF-=E8=8D=AF=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E8=BF=94=E5=9B=9E=E7=BB=93=E6=9E=9C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=8E=92=E5=BA=8F=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MedicinalMaterialsController.java | 46 +++++++++++-------- .../modules/book/entity/MedicinalDrug.java | 5 ++ .../book/entity/MedicinalMaterials.java | 5 ++ 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/peanut/modules/book/controller/MedicinalMaterialsController.java b/src/main/java/com/peanut/modules/book/controller/MedicinalMaterialsController.java index 645d9116..0398d7da 100644 --- a/src/main/java/com/peanut/modules/book/controller/MedicinalMaterialsController.java +++ b/src/main/java/com/peanut/modules/book/controller/MedicinalMaterialsController.java @@ -36,22 +36,22 @@ public class MedicinalMaterialsController { @RequestMapping("/getMaterialsList") public R getMaterialsList(@RequestBody Map params){ MPJLambdaWrapper wrapper = new MPJLambdaWrapper(); - if (params.containsKey("name")&&StringUtils.isNotEmpty(params.get("name").toString())){ - wrapper.and(StringUtils.isNotEmpty(params.get("name").toString()),t->t.like(MedicinalMaterials::getName,params.get("name")).or().like(MedicinalMaterials::getOthername,params.get("name"))); + wrapper.select("id,name,img,latinname,othername,effect,taste,property,tropism,type,sort,hits"); + if (StringUtils.isNotEmpty(params.get("name").toString())){ + wrapper.and(t->t.like(MedicinalMaterials::getName,params.get("name")) + .or().like(MedicinalMaterials::getOthername,params.get("name"))); } - if (params.containsKey("type")&&StringUtils.isNotEmpty(params.get("type").toString())){ + if (StringUtils.isNotEmpty(params.get("type").toString())){ wrapper.like(MedicinalMaterials::getType,params.get("type")); } - if (params.containsKey("taste")&&StringUtils.isNotEmpty(params.get("taste").toString())){ - wrapper.like(MedicinalMaterials::getProperty,params.get("taste")); - } - if (params.containsKey("property")&&StringUtils.isNotEmpty(params.get("property").toString())){ - wrapper.like(MedicinalMaterials::getProperty,params.get("property")); - } - if (params.containsKey("tropism")&&StringUtils.isNotEmpty(params.get("tropism").toString())){ - wrapper.like(MedicinalMaterials::getProperty,params.get("tropism")); + if (StringUtils.isNotEmpty(params.get("effect").toString())){ + wrapper.like(MedicinalMaterials::getEffect,params.get("effect")); } + wrapper.and(t->t.like(MedicinalMaterials::getProperty,params.get("taste")) + .or().like(MedicinalMaterials::getProperty,params.get("property")) + .or().like(MedicinalMaterials::getProperty,params.get("tropism"))); wrapper.orderByAsc(MedicinalMaterials::getSort); + wrapper.orderByDesc(MedicinalMaterials::getHits); Page page = materialsService.page(new Page<>( Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper); return R.ok().put("result", page); @@ -59,7 +59,11 @@ public class MedicinalMaterialsController { @RequestMapping(path = "/getMaterials") public R getMaterials(String id) { - return R.ok().put("result", materialsService.getById(id)); + MedicinalMaterials materials = materialsService.getById(id); + int hits = materials.getHits() + 1; + materials.setHits(hits); + materialsService.saveOrUpdate(materials); + return R.ok().put("result", materials); } @RequestMapping(path = "/saveOrUpdateMaterials") @@ -81,25 +85,27 @@ public class MedicinalMaterialsController { @RequestMapping("/getDrugList") public R getDrugList(@RequestBody Map params){ MPJLambdaWrapper wrapper = new MPJLambdaWrapper(); - if (params.containsKey("name")&&StringUtils.isNotEmpty(params.get("name").toString())){ + wrapper.select("id,name,english_name,pinyin_name,kind,prescription_type,insurance_type,type,sort,hits"); + if (StringUtils.isNotEmpty(params.get("name").toString())){ wrapper.and(StringUtils.isNotEmpty(params.get("name").toString()), t->t.like(MedicinalDrug::getName,params.get("name")) .or().like(MedicinalDrug::getEnglishName,params.get("name")) .or().like(MedicinalDrug::getPinyinName,params.get("name"))); } - if (params.containsKey("kind")&&StringUtils.isNotEmpty(params.get("kind").toString())){ + if (StringUtils.isNotEmpty(params.get("kind").toString())){ wrapper.like(MedicinalDrug::getKind,params.get("kind")); } - if (params.containsKey("prescriptionType")&&StringUtils.isNotEmpty(params.get("prescriptionType").toString())){ + if (StringUtils.isNotEmpty(params.get("prescriptionType").toString())){ wrapper.like(MedicinalDrug::getPrescriptionType,params.get("prescriptionType")); } - if (params.containsKey("insuranceType")&&StringUtils.isNotEmpty(params.get("insuranceType").toString())){ + if (StringUtils.isNotEmpty(params.get("insuranceType").toString())){ wrapper.like(MedicinalDrug::getInsuranceType,params.get("insuranceType")); } - if (params.containsKey("type")&&StringUtils.isNotEmpty(params.get("type").toString())){ + if (StringUtils.isNotEmpty(params.get("type").toString())){ wrapper.like(MedicinalDrug::getType,params.get("type")); } wrapper.orderByAsc(MedicinalDrug::getSort); + wrapper.orderByDesc(MedicinalDrug::getHits); Page page = drugService.page(new Page<>( Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper); return R.ok().put("result", page); @@ -107,7 +113,11 @@ public class MedicinalMaterialsController { @RequestMapping(path = "/getDrug") public R getDrug(String id) { - return R.ok().put("result", drugService.getById(id)); + MedicinalDrug drug = drugService.getById(id); + int hits = drug.getHits() + 1; + drug.setHits(hits); + drugService.saveOrUpdate(drug); + return R.ok().put("result", drug); } @RequestMapping(path = "/saveOrUpdateDrug") diff --git a/src/main/java/com/peanut/modules/book/entity/MedicinalDrug.java b/src/main/java/com/peanut/modules/book/entity/MedicinalDrug.java index 41b9d773..16355a31 100644 --- a/src/main/java/com/peanut/modules/book/entity/MedicinalDrug.java +++ b/src/main/java/com/peanut/modules/book/entity/MedicinalDrug.java @@ -63,6 +63,11 @@ public class MedicinalDrug { */ private Integer sort; + /** + * 点击量 + */ + private Integer hits; + @TableLogic private Integer delFlag; } diff --git a/src/main/java/com/peanut/modules/book/entity/MedicinalMaterials.java b/src/main/java/com/peanut/modules/book/entity/MedicinalMaterials.java index 2f10c542..9eb3ec67 100644 --- a/src/main/java/com/peanut/modules/book/entity/MedicinalMaterials.java +++ b/src/main/java/com/peanut/modules/book/entity/MedicinalMaterials.java @@ -73,6 +73,11 @@ public class MedicinalMaterials { */ private Integer sort; + /** + * 点击量 + */ + private Integer hits; + @TableLogic private Integer delFlag; From e8a5bf08ad3fa43e6bb6237210f2f7b7980eae51 Mon Sep 17 00:00:00 2001 From: wuchunlei Date: Sat, 27 Jan 2024 10:08:44 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=90=B4=E9=97=A8=E5=8C=BB=E8=BF=B0-?= =?UTF-8?q?=E5=AD=A6=E6=9C=AF=E4=BC=A0=E6=89=BF-=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/MedicinalMaterialsController.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/peanut/modules/book/controller/MedicinalMaterialsController.java b/src/main/java/com/peanut/modules/book/controller/MedicinalMaterialsController.java index 0398d7da..a504c737 100644 --- a/src/main/java/com/peanut/modules/book/controller/MedicinalMaterialsController.java +++ b/src/main/java/com/peanut/modules/book/controller/MedicinalMaterialsController.java @@ -9,9 +9,6 @@ import com.peanut.modules.book.service.MedicinalDrugService; import com.peanut.modules.book.service.MedicinalMaterialsService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; -import org.jsoup.select.Elements; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -47,9 +44,15 @@ public class MedicinalMaterialsController { if (StringUtils.isNotEmpty(params.get("effect").toString())){ wrapper.like(MedicinalMaterials::getEffect,params.get("effect")); } - wrapper.and(t->t.like(MedicinalMaterials::getProperty,params.get("taste")) - .or().like(MedicinalMaterials::getProperty,params.get("property")) - .or().like(MedicinalMaterials::getProperty,params.get("tropism"))); + if (StringUtils.isNotEmpty(params.get("taste").toString())){ + wrapper.like(MedicinalMaterials::getTaste,params.get("taste")); + } + if (StringUtils.isNotEmpty(params.get("property").toString())){ + wrapper.like(MedicinalMaterials::getProperty,params.get("property")); + } + if (StringUtils.isNotEmpty(params.get("tropism").toString())){ + wrapper.like(MedicinalMaterials::getTropism,params.get("tropism")); + } wrapper.orderByAsc(MedicinalMaterials::getSort); wrapper.orderByDesc(MedicinalMaterials::getHits); Page page = materialsService.page(new Page<>(