Merge remote-tracking branch 'origin/zcc'
This commit is contained in:
@@ -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<BookEntity> list = bookService.list(wrapper);
|
||||
return R.ok().put("result", list);
|
||||
@@ -156,17 +155,18 @@ public class MedicaldesController {
|
||||
}
|
||||
|
||||
//国际医师可能来自国外在省市里加入外国
|
||||
public String[] getCounts() {
|
||||
//countId 为1 2 3
|
||||
String[] count = {"马来西亚","越南","加拿大"};
|
||||
return count;
|
||||
public List<SysDictDataEntity> getCounts() {
|
||||
LambdaQueryWrapper<SysDictDataEntity> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(SysDictDataEntity::getDictLabel,"inheritPro");
|
||||
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<>();
|
||||
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 +184,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 +206,12 @@ public class MedicaldesController {
|
||||
public R getMedicaldesProList() {
|
||||
String s = redisTemplate.opsForValue().get("Province");
|
||||
List<Province> provinceList = new ArrayList<>();
|
||||
if (getCounts() != null){
|
||||
for (int i=0;i<getCounts().length;i++){
|
||||
if (getCounts() != null&&getCounts().size() > 0){
|
||||
for (int i=0;i<getCounts().size();i++){
|
||||
Province p = new Province();
|
||||
p.setProvName(getCounts()[i]);
|
||||
p.setProvId((long)i+1);
|
||||
p.setCityList(getCityList(getCounts()[i],i+1));
|
||||
p.setProvName(getCounts().get(i).getDictValue());
|
||||
p.setProvId(Long.valueOf(getCounts().get(i).getDictType()));
|
||||
p.setCityList(getCityList(getCounts().get(i).getDictValue(),Integer.parseInt(getCounts().get(i).getDictType())));
|
||||
provinceList.add(p);
|
||||
}
|
||||
}
|
||||
@@ -226,13 +232,17 @@ public class MedicaldesController {
|
||||
@RequestMapping(path = "/getCityByPro")
|
||||
public R getCityByPro(@RequestParam("provId") Integer provId) {
|
||||
List<City> 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<SysDictDataEntity> 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<City>()
|
||||
.eq("prov_id", provId));
|
||||
}
|
||||
@@ -241,11 +251,14 @@ public class MedicaldesController {
|
||||
|
||||
@RequestMapping(path = "/getInheritById")
|
||||
public R getInheritById(String id) {
|
||||
LambdaQueryWrapper<MedicaldesInheritRelation> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(MedicaldesInheritRelation::getInheritId,id);
|
||||
MedicaldesInheritRelation relation = relationService.getOne(wrapper);
|
||||
MedicaldesInherit inherit = inheritService.getById(id);
|
||||
inherit.setSort(relation.getSort());
|
||||
MPJLambdaWrapper<MedicaldesInherit> 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<String,Object> inherit = inheritService.getMap(wrapper);
|
||||
return R.ok().put("result",inherit);
|
||||
}
|
||||
|
||||
@@ -279,15 +292,14 @@ public class MedicaldesController {
|
||||
@RequestMapping(path = "/getList")
|
||||
public List<Map<String,Object>> getList(String type) {
|
||||
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.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<Map<String,Object>> list = inheritService.listMaps(wrapper);
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -36,22 +33,28 @@ public class MedicinalMaterialsController {
|
||||
@RequestMapping("/getMaterialsList")
|
||||
public R getMaterialsList(@RequestBody Map params){
|
||||
MPJLambdaWrapper<MedicinalMaterials> 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 (StringUtils.isNotEmpty(params.get("effect").toString())){
|
||||
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"));
|
||||
}
|
||||
if (params.containsKey("tropism")&&StringUtils.isNotEmpty(params.get("tropism").toString())){
|
||||
wrapper.like(MedicinalMaterials::getProperty,params.get("tropism"));
|
||||
if (StringUtils.isNotEmpty(params.get("tropism").toString())){
|
||||
wrapper.like(MedicinalMaterials::getTropism,params.get("tropism"));
|
||||
}
|
||||
wrapper.orderByAsc(MedicinalMaterials::getSort);
|
||||
wrapper.orderByDesc(MedicinalMaterials::getHits);
|
||||
Page<MedicinalMaterials> 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 +62,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 +88,27 @@ public class MedicinalMaterialsController {
|
||||
@RequestMapping("/getDrugList")
|
||||
public R getDrugList(@RequestBody Map params){
|
||||
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()),
|
||||
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<MedicinalDrug> 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 +116,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")
|
||||
|
||||
@@ -63,6 +63,11 @@ public class MedicinalDrug {
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 点击量
|
||||
*/
|
||||
private Integer hits;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
}
|
||||
|
||||
@@ -73,6 +73,11 @@ public class MedicinalMaterials {
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 点击量
|
||||
*/
|
||||
private Integer hits;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user