方剂增加药

穴位增加脉络
This commit is contained in:
wuchunlei
2024-01-17 15:12:28 +08:00
parent ca136ec6a6
commit b3bef83b95
14 changed files with 458 additions and 0 deletions

View File

@@ -0,0 +1,126 @@
package com.peanut.modules.book.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.common.utils.R;
import com.peanut.modules.book.entity.MedicinalDrug;
import com.peanut.modules.book.entity.MedicinalMaterials;
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;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@Slf4j
@RestController
@RequestMapping("book/materials")
public class MedicinalMaterialsController {
@Autowired
private MedicinalMaterialsService materialsService;
@Autowired
private MedicinalDrugService drugService;
/**
* 获取中药材列表
* @return
*/
@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")));
}
if (params.containsKey("type")&&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"));
}
wrapper.orderByAsc(MedicinalMaterials::getSort);
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);
}
@RequestMapping(path = "/getMaterials")
public R getMaterials(String id) {
return R.ok().put("result", materialsService.getById(id));
}
@RequestMapping(path = "/saveOrUpdateMaterials")
public R saveOrUpdateMaterials(@RequestBody MedicinalMaterials materials) {
materialsService.saveOrUpdate(materials);
return R.ok();
}
@RequestMapping(path = "/delMaterials")
public R delMaterials(String id) {
materialsService.removeById(id);
return R.ok();
}
/**
* 获取药品列表
* @return
*/
@RequestMapping("/getDrugList")
public R getDrugList(@RequestBody Map params){
MPJLambdaWrapper<MedicinalDrug> wrapper = new MPJLambdaWrapper();
if (params.containsKey("name")&&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())){
wrapper.like(MedicinalDrug::getKind,params.get("kind"));
}
if (params.containsKey("prescriptionType")&&StringUtils.isNotEmpty(params.get("prescriptionType").toString())){
wrapper.like(MedicinalDrug::getPrescriptionType,params.get("prescriptionType"));
}
if (params.containsKey("insuranceType")&&StringUtils.isNotEmpty(params.get("insuranceType").toString())){
wrapper.like(MedicinalDrug::getInsuranceType,params.get("insuranceType"));
}
if (params.containsKey("type")&&StringUtils.isNotEmpty(params.get("type").toString())){
wrapper.like(MedicinalDrug::getType,params.get("type"));
}
wrapper.orderByAsc(MedicinalDrug::getSort);
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);
}
@RequestMapping(path = "/getDrug")
public R getDrug(String id) {
return R.ok().put("result", drugService.getById(id));
}
@RequestMapping(path = "/saveOrUpdateDrug")
public R saveOrUpdateDrug(@RequestBody MedicinalDrug drug) {
drugService.saveOrUpdate(drug);
return R.ok();
}
@RequestMapping(path = "/delDrug")
public R delDrug(String id) {
drugService.removeById(id);
return R.ok();
}
}

View File

@@ -0,0 +1,55 @@
package com.peanut.modules.book.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.common.utils.R;
import com.peanut.modules.book.entity.Meridians;
import com.peanut.modules.book.service.MeridiansService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@Slf4j
@RestController
@RequestMapping("book/meridians")
public class MeridiansController {
@Autowired
private MeridiansService meridiansService;
/**
* 获取经络列表
* @return
*/
@RequestMapping("/getMeridiansList")
public R getMeridiansList(@RequestBody Map params){
MPJLambdaWrapper<Meridians> wrapper = new MPJLambdaWrapper();
wrapper.orderByAsc(Meridians::getSort);
Page<Meridians> page = meridiansService.page(new Page<>(
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
return R.ok().put("result", page);
}
@RequestMapping(path = "/getMeridians")
public R getMeridians(String id) {
return R.ok().put("result", meridiansService.getById(id));
}
@RequestMapping(path = "/saveOrUpdateMeridians")
public R saveOrUpdateMeridians(@RequestBody Meridians meridians) {
meridiansService.saveOrUpdate(meridians);
return R.ok();
}
@RequestMapping(path = "/delMeridians")
public R delMeridians(String id) {
meridiansService.removeById(id);
return R.ok();
}
}