Merge remote-tracking branch 'origin/zcc'

This commit is contained in:
wangjinlei
2024-01-29 14:54:59 +08:00
4 changed files with 83 additions and 48 deletions

View File

@@ -107,7 +107,6 @@ public class MedicaldesController {
wrapper.leftJoin(MedicaldesBook.class,MedicaldesBook::getBookId,BookEntity::getId); wrapper.leftJoin(MedicaldesBook.class,MedicaldesBook::getBookId,BookEntity::getId);
wrapper.eq(MedicaldesBook::getTypeId,type); wrapper.eq(MedicaldesBook::getTypeId,type);
wrapper.eq(BookEntity::getBookType,0); wrapper.eq(BookEntity::getBookType,0);
wrapper.eq(BookEntity::getState,1);
wrapper.orderByAsc(MedicaldesBook::getSort); wrapper.orderByAsc(MedicaldesBook::getSort);
List<BookEntity> list = bookService.list(wrapper); List<BookEntity> list = bookService.list(wrapper);
return R.ok().put("result", list); return R.ok().put("result", list);
@@ -156,17 +155,18 @@ public class MedicaldesController {
} }
//国际医师可能来自国外在省市里加入外国 //国际医师可能来自国外在省市里加入外国
public String[] getCounts() { public List<SysDictDataEntity> getCounts() {
//countId 为1 2 3 LambdaQueryWrapper<SysDictDataEntity> wrapper = new LambdaQueryWrapper();
String[] count = {"马来西亚","越南","加拿大"}; wrapper.eq(SysDictDataEntity::getDictLabel,"inheritPro");
return count; List<SysDictDataEntity> dataList = sysDictDataService.list(wrapper);
return dataList;
} }
public List getCityList(String count,int countId) { public List getCityList(String cityName,int countId) {
List<City> cityList = new ArrayList<>(); List<City> cityList = new ArrayList<>();
City city = new City(); City city = new City();
city.setProvId((long)countId); city.setProvId((long)countId);
city.setCityName(count); city.setCityName(cityName);
city.setCityId((long)countId); city.setCityId((long)countId);
cityList.add(city); cityList.add(city);
return cityList; return cityList;
@@ -184,8 +184,14 @@ public class MedicaldesController {
wrapper.leftJoin(Province.class,Province::getProvId,City::getProvId); wrapper.leftJoin(Province.class,Province::getProvId,City::getProvId);
wrapper.selectAll(MedicaldesInherit.class); wrapper.selectAll(MedicaldesInherit.class);
if ("0".equals(provId)){ 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 { }else {
wrapper.eq(Province::getProvId,provId); wrapper.eq(Province::getProvId,provId);
} }
@@ -200,12 +206,12 @@ public class MedicaldesController {
public R getMedicaldesProList() { public R getMedicaldesProList() {
String s = redisTemplate.opsForValue().get("Province"); String s = redisTemplate.opsForValue().get("Province");
List<Province> provinceList = new ArrayList<>(); List<Province> provinceList = new ArrayList<>();
if (getCounts() != null){ if (getCounts() != null&&getCounts().size() > 0){
for (int i=0;i<getCounts().length;i++){ for (int i=0;i<getCounts().size();i++){
Province p = new Province(); Province p = new Province();
p.setProvName(getCounts()[i]); p.setProvName(getCounts().get(i).getDictValue());
p.setProvId((long)i+1); p.setProvId(Long.valueOf(getCounts().get(i).getDictType()));
p.setCityList(getCityList(getCounts()[i],i+1)); p.setCityList(getCityList(getCounts().get(i).getDictValue(),Integer.parseInt(getCounts().get(i).getDictType())));
provinceList.add(p); provinceList.add(p);
} }
} }
@@ -226,13 +232,17 @@ public class MedicaldesController {
@RequestMapping(path = "/getCityByPro") @RequestMapping(path = "/getCityByPro")
public R getCityByPro(@RequestParam("provId") Integer provId) { public R getCityByPro(@RequestParam("provId") Integer provId) {
List<City> prov = new ArrayList<>(); List<City> prov = new ArrayList<>();
if (1==provId){ List<SysDictDataEntity> list = getCounts();
prov.addAll(getCityList(getCounts()[0],1)); boolean flag = false;
}else if (2==provId){ if (list != null && list.size() > 0) {
prov.addAll(getCityList(getCounts()[1],2)); for (SysDictDataEntity data:list) {
}else if (3==provId){ if (provId==Integer.parseInt(data.getDictType())){
prov.addAll(getCityList(getCounts()[2],3)); prov.addAll(getCityList(data.getDictValue(),Integer.parseInt(data.getDictType())));
}else { flag = true;
}
}
}
if (!flag) {
prov = cityService.getBaseMapper().selectList(new QueryWrapper<City>() prov = cityService.getBaseMapper().selectList(new QueryWrapper<City>()
.eq("prov_id", provId)); .eq("prov_id", provId));
} }
@@ -241,11 +251,14 @@ public class MedicaldesController {
@RequestMapping(path = "/getInheritById") @RequestMapping(path = "/getInheritById")
public R getInheritById(String id) { public R getInheritById(String id) {
LambdaQueryWrapper<MedicaldesInheritRelation> wrapper = new LambdaQueryWrapper(); MPJLambdaWrapper<MedicaldesInherit> wrapper = new MPJLambdaWrapper();
wrapper.eq(MedicaldesInheritRelation::getInheritId,id); wrapper.eq(MedicaldesInherit::getId,id);
MedicaldesInheritRelation relation = relationService.getOne(wrapper); wrapper.leftJoin(MedicaldesInheritRelation.class,MedicaldesInheritRelation::getInheritId,MedicaldesInherit::getId);
MedicaldesInherit inherit = inheritService.getById(id); wrapper.leftJoin(City.class,City::getCityId,MedicaldesInherit::getCityId);
inherit.setSort(relation.getSort()); 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<String,Object> inherit = inheritService.getMap(wrapper);
return R.ok().put("result",inherit); return R.ok().put("result",inherit);
} }
@@ -279,15 +292,14 @@ public class MedicaldesController {
@RequestMapping(path = "/getList") @RequestMapping(path = "/getList")
public List<Map<String,Object>> getList(String type) { public List<Map<String,Object>> getList(String type) {
MPJLambdaWrapper<MedicaldesInherit> wrapper = new MPJLambdaWrapper(); MPJLambdaWrapper<MedicaldesInherit> 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.leftJoin(MedicaldesInheritRelation.class,MedicaldesInheritRelation::getInheritId,MedicaldesInherit::getId);
wrapper.eq(MedicaldesInheritRelation::getTypeId,type); wrapper.eq(MedicaldesInheritRelation::getTypeId,type);
wrapper.leftJoin(City.class,City::getCityId,MedicaldesInherit::getCityId); wrapper.leftJoin(City.class,City::getCityId,MedicaldesInherit::getCityId);
wrapper.leftJoin(Province.class,Province::getProvId,City::getProvId); wrapper.leftJoin(Province.class,Province::getProvId,City::getProvId);
wrapper.select("IFNULL(t3.prov_name, '其他') AS provinceName"); 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("IFNULL(t3.prov_id, 0) AS provinceId"); wrapper.groupBy("prov_name","dict_value");
wrapper.select("count(*) as count"); wrapper.orderByAsc("t3.region_code","dict_value");
wrapper.groupBy("provinceName");
wrapper.orderByAsc(MedicaldesInheritRelation::getSort);
List<Map<String,Object>> list = inheritService.listMaps(wrapper); List<Map<String,Object>> list = inheritService.listMaps(wrapper);
return list; return list;
} }

View File

@@ -9,9 +9,6 @@ import com.peanut.modules.book.service.MedicinalDrugService;
import com.peanut.modules.book.service.MedicinalMaterialsService; import com.peanut.modules.book.service.MedicinalMaterialsService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; 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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@@ -36,22 +33,28 @@ public class MedicinalMaterialsController {
@RequestMapping("/getMaterialsList") @RequestMapping("/getMaterialsList")
public R getMaterialsList(@RequestBody Map params){ public R getMaterialsList(@RequestBody Map params){
MPJLambdaWrapper<MedicinalMaterials> wrapper = new MPJLambdaWrapper(); MPJLambdaWrapper<MedicinalMaterials> wrapper = new MPJLambdaWrapper();
if (params.containsKey("name")&&StringUtils.isNotEmpty(params.get("name").toString())){ wrapper.select("id,name,img,latinname,othername,effect,taste,property,tropism,type,sort,hits");
wrapper.and(StringUtils.isNotEmpty(params.get("name").toString()),t->t.like(MedicinalMaterials::getName,params.get("name")).or().like(MedicinalMaterials::getOthername,params.get("name"))); 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")); wrapper.like(MedicinalMaterials::getType,params.get("type"));
} }
if (params.containsKey("taste")&&StringUtils.isNotEmpty(params.get("taste").toString())){ if (StringUtils.isNotEmpty(params.get("effect").toString())){
wrapper.like(MedicinalMaterials::getProperty,params.get("taste")); wrapper.like(MedicinalMaterials::getEffect,params.get("effect"));
} }
if (params.containsKey("property")&&StringUtils.isNotEmpty(params.get("property").toString())){ 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")); wrapper.like(MedicinalMaterials::getProperty,params.get("property"));
} }
if (params.containsKey("tropism")&&StringUtils.isNotEmpty(params.get("tropism").toString())){ if (StringUtils.isNotEmpty(params.get("tropism").toString())){
wrapper.like(MedicinalMaterials::getProperty,params.get("tropism")); wrapper.like(MedicinalMaterials::getTropism,params.get("tropism"));
} }
wrapper.orderByAsc(MedicinalMaterials::getSort); wrapper.orderByAsc(MedicinalMaterials::getSort);
wrapper.orderByDesc(MedicinalMaterials::getHits);
Page<MedicinalMaterials> page = materialsService.page(new Page<>( Page<MedicinalMaterials> page = materialsService.page(new Page<>(
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper); Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
return R.ok().put("result", page); return R.ok().put("result", page);
@@ -59,7 +62,11 @@ public class MedicinalMaterialsController {
@RequestMapping(path = "/getMaterials") @RequestMapping(path = "/getMaterials")
public R getMaterials(String id) { 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") @RequestMapping(path = "/saveOrUpdateMaterials")
@@ -81,25 +88,27 @@ public class MedicinalMaterialsController {
@RequestMapping("/getDrugList") @RequestMapping("/getDrugList")
public R getDrugList(@RequestBody Map params){ public R getDrugList(@RequestBody Map params){
MPJLambdaWrapper<MedicinalDrug> wrapper = new MPJLambdaWrapper(); MPJLambdaWrapper<MedicinalDrug> 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()), wrapper.and(StringUtils.isNotEmpty(params.get("name").toString()),
t->t.like(MedicinalDrug::getName,params.get("name")) t->t.like(MedicinalDrug::getName,params.get("name"))
.or().like(MedicinalDrug::getEnglishName,params.get("name")) .or().like(MedicinalDrug::getEnglishName,params.get("name"))
.or().like(MedicinalDrug::getPinyinName,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")); 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")); 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")); 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.like(MedicinalDrug::getType,params.get("type"));
} }
wrapper.orderByAsc(MedicinalDrug::getSort); wrapper.orderByAsc(MedicinalDrug::getSort);
wrapper.orderByDesc(MedicinalDrug::getHits);
Page<MedicinalDrug> page = drugService.page(new Page<>( Page<MedicinalDrug> page = drugService.page(new Page<>(
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper); Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
return R.ok().put("result", page); return R.ok().put("result", page);
@@ -107,7 +116,11 @@ public class MedicinalMaterialsController {
@RequestMapping(path = "/getDrug") @RequestMapping(path = "/getDrug")
public R getDrug(String id) { 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") @RequestMapping(path = "/saveOrUpdateDrug")

View File

@@ -63,6 +63,11 @@ public class MedicinalDrug {
*/ */
private Integer sort; private Integer sort;
/**
* 点击量
*/
private Integer hits;
@TableLogic @TableLogic
private Integer delFlag; private Integer delFlag;
} }

View File

@@ -73,6 +73,11 @@ public class MedicinalMaterials {
*/ */
private Integer sort; private Integer sort;
/**
* 点击量
*/
private Integer hits;
@TableLogic @TableLogic
private Integer delFlag; private Integer delFlag;