合并,报错待解决
parent
bf2c98947f
commit
bd20153ef9
|
@ -117,6 +117,7 @@
|
||||||
<artifactId>mapstruct-processor</artifactId>
|
<artifactId>mapstruct-processor</artifactId>
|
||||||
<version>${mapstruct.version}</version>
|
<version>${mapstruct.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,146 @@
|
||||||
|
package doctor.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import doctor.common.core.domain.HealthR;
|
||||||
|
import doctor.domain.entity.SickCircleEntity;
|
||||||
|
import doctor.service.CollectSickService;
|
||||||
|
|
||||||
|
import doctor.util.HttpUtils;
|
||||||
|
import doctor.util.OssUtil;
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
import org.apache.http.HttpResponse;
|
||||||
|
import org.apache.http.util.EntityUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName CollectSickController
|
||||||
|
* @Description 描述
|
||||||
|
* @Author 栗永斌
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/verify/v1")
|
||||||
|
public class CollectSickController {
|
||||||
|
@Autowired
|
||||||
|
CollectSickService service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消收藏病友圈
|
||||||
|
*
|
||||||
|
* @param sickCircleId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/cancelSickCollection")
|
||||||
|
public HealthR<SickCircleEntity> cancelSickCollection(@RequestParam("sickCircleId") Integer sickCircleId) {
|
||||||
|
return service.cancelSickCollection(sickCircleId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * @param sickCircleId
|
||||||
|
* 收藏病友圈
|
||||||
|
*/
|
||||||
|
@PostMapping("/addUserSickCollection")
|
||||||
|
public HealthR<SickCircleEntity> addUserSickCollection(@RequestParam("sickCircleId") Integer sickCircleId) {
|
||||||
|
return service.addUserSickCollection(sickCircleId);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* orc身份证识别
|
||||||
|
* @param file
|
||||||
|
*/
|
||||||
|
@PostMapping("/file")
|
||||||
|
public void file(MultipartFile file) {
|
||||||
|
// TODO 存储OSS
|
||||||
|
String s = OssUtil.uploadMultipartFile(file);
|
||||||
|
String host = "https://cardnumber.market.alicloudapi.com";
|
||||||
|
String path = "/rest/160601/ocr/ocr_idcard.json";
|
||||||
|
String appcode = "94e0f9d0960f4931ad24eabfa187dcfe";
|
||||||
|
//String imgFile = "C:\\Users\\栗永斌\\Desktop\\aaaa.webp";
|
||||||
|
String imgFile = String.valueOf(s);
|
||||||
|
String method = "POST";
|
||||||
|
|
||||||
|
Map<String, String> headers = new HashMap<String, String>();
|
||||||
|
//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
|
||||||
|
headers.put("Authorization", "APPCODE " + appcode);
|
||||||
|
//根据API的要求,定义相对应的Content-Type
|
||||||
|
headers.put("Content-Type", "application/json; charset=UTF-8");
|
||||||
|
|
||||||
|
Map<String, String> querys = new HashMap<String, String>();
|
||||||
|
// 对图像进行base64编码
|
||||||
|
String imgBase64 = img_base64(imgFile);
|
||||||
|
|
||||||
|
//configure配置
|
||||||
|
JSONObject configObj = new JSONObject();
|
||||||
|
configObj.put("side", "face");
|
||||||
|
|
||||||
|
String config_str = configObj.toString();
|
||||||
|
|
||||||
|
// 拼装请求body的json字符串
|
||||||
|
JSONObject requestObj = new JSONObject();
|
||||||
|
requestObj.put("image", imgBase64);
|
||||||
|
if (configObj.size() > 0) {
|
||||||
|
requestObj.put("configure", config_str);
|
||||||
|
}
|
||||||
|
String bodys = requestObj.toString();
|
||||||
|
|
||||||
|
try {
|
||||||
|
/**
|
||||||
|
* 重要提示如下:
|
||||||
|
* HttpUtils请从
|
||||||
|
* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java
|
||||||
|
* 下载
|
||||||
|
* 相应的依赖请参照
|
||||||
|
* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml
|
||||||
|
*/
|
||||||
|
HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
|
||||||
|
int stat = response.getStatusLine().getStatusCode();
|
||||||
|
if (stat != 200) {
|
||||||
|
System.out.println("Http code: " + stat);
|
||||||
|
System.out.println("http header error msg: " + response.getFirstHeader("X-Ca-Error-Message"));
|
||||||
|
System.out.println("Http body error msg:" + EntityUtils.toString(response.getEntity()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String res = EntityUtils.toString(response.getEntity());
|
||||||
|
JSONObject res_obj = JSON.parseObject(res);
|
||||||
|
|
||||||
|
System.out.println(res_obj.toJSONString());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String img_base64(String path) {
|
||||||
|
/**
|
||||||
|
* 对path进行判断,如果是本地文件就二进制读取并base64编码,如果是url,则返回
|
||||||
|
*/
|
||||||
|
String imgBase64 = "";
|
||||||
|
if (path.startsWith("http")) {
|
||||||
|
imgBase64 = path;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
File file = new File(path);
|
||||||
|
byte[] content = new byte[(int) file.length()];
|
||||||
|
FileInputStream finputstream = new FileInputStream(file);
|
||||||
|
finputstream.read(content);
|
||||||
|
finputstream.close();
|
||||||
|
imgBase64 = new String(Base64.encodeBase64(content));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return imgBase64;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return imgBase64;
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ import doctor.common.core.domain.HealthR;
|
||||||
import doctor.common.core.domain.R;
|
import doctor.common.core.domain.R;
|
||||||
import doctor.domain.entity.*;
|
import doctor.domain.entity.*;
|
||||||
import doctor.service.DiseaseKnowledgeService;
|
import doctor.service.DiseaseKnowledgeService;
|
||||||
|
import doctor.service.HealthJobTitleService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
@ -26,6 +27,13 @@ import static doctor.common.core.utils.PageUtils.startPage;
|
||||||
public class DiseaseKnowledgeController {
|
public class DiseaseKnowledgeController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private DiseaseKnowledgeService diseaseKnowledgeService;
|
private DiseaseKnowledgeService diseaseKnowledgeService;
|
||||||
|
|
||||||
|
@GetMapping("/findDepartment")
|
||||||
|
public HealthR<List<Department>> findDepartment(){
|
||||||
|
List<Department> departments= diseaseKnowledgeService.findDepartment();
|
||||||
|
return HealthR.ok(departments);
|
||||||
|
}
|
||||||
|
|
||||||
//罕见病症详情
|
//罕见病症详情
|
||||||
@GetMapping("/findDiseaseKnowledge")
|
@GetMapping("/findDiseaseKnowledge")
|
||||||
public HealthR<List<DiseaseKnowledge>> findDiseaseKnowledge(@RequestParam Integer diseaseCategoryId){
|
public HealthR<List<DiseaseKnowledge>> findDiseaseKnowledge(@RequestParam Integer diseaseCategoryId){
|
||||||
|
|
|
@ -21,13 +21,6 @@ public class HealthJobTitleController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private HealthJobTitleService healthJobTitleService;
|
private HealthJobTitleService healthJobTitleService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private BannersService bannersService;
|
|
||||||
@GetMapping("/bannersShow")
|
|
||||||
public HealthR<List<Banners>> bannersShow(){
|
|
||||||
List<Banners> banners = bannersService.bannersShow();
|
|
||||||
return HealthR.ok(banners);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/findJobTitleList")
|
@GetMapping("/findJobTitleList")
|
||||||
public HealthR<List<DoctorJobTitleEntity>> findJobTitleList() {
|
public HealthR<List<DoctorJobTitleEntity>> findJobTitleList() {
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package doctor.controller;
|
||||||
|
|
||||||
|
import doctor.common.core.domain.HealthR;
|
||||||
|
import doctor.domain.entity.Banners;
|
||||||
|
import doctor.service.BannersService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/share")
|
||||||
|
public class HealthShareController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BannersService bannersService;
|
||||||
|
@GetMapping("/v1/bannersShow")
|
||||||
|
public HealthR<List<Banners>> bannersShow(){
|
||||||
|
List<Banners> banners = bannersService.bannersShow();
|
||||||
|
return HealthR.ok(banners);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,42 +0,0 @@
|
||||||
package doctor.controller;
|
|
||||||
|
|
||||||
import doctor.common.core.domain.HealthR;
|
|
||||||
import doctor.domain.vo.SearchSickCircleVo;
|
|
||||||
import doctor.domain.vo.SickCircleVo;
|
|
||||||
import doctor.domain.vo.SickInfoVo;
|
|
||||||
import doctor.service.SickCircleService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/sickCircle/v1")
|
|
||||||
public class HealthSickController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SickCircleService sickCircleService;
|
|
||||||
|
|
||||||
@GetMapping("/findSickCircleInfo")
|
|
||||||
public HealthR<SickInfoVo> findSickCircleInfo(@RequestParam Integer sickCircleId) {
|
|
||||||
SickInfoVo sickInfoVo = sickCircleService.findSickCircleInfo(sickCircleId);
|
|
||||||
return HealthR.ok(sickInfoVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/findSickCircleList")
|
|
||||||
public HealthR<List<SickCircleVo>> sickCircleList(@RequestParam Integer page,
|
|
||||||
@RequestParam Integer count,
|
|
||||||
@RequestParam Integer departmentId) {
|
|
||||||
List<SickCircleVo> sickCircleList = sickCircleService.findSickCircleList(page, count, departmentId);
|
|
||||||
return HealthR.ok(sickCircleList);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/searchSickCircle")
|
|
||||||
public HealthR<SearchSickCircleVo> searchSickCircle(@RequestParam String keyWord) {
|
|
||||||
SearchSickCircleVo searchSickCircleVo = sickCircleService.searchSickCircle(keyWord);
|
|
||||||
return HealthR.ok(searchSickCircleVo);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,130 @@
|
||||||
|
package doctor.controller;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.api.model.v2.Result;
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import doctor.common.core.domain.HealthR;
|
||||||
|
import doctor.domain.entity.SickCircleEntity;
|
||||||
|
import doctor.domain.entity.SickCommentEntity;
|
||||||
|
import doctor.domain.entity.SymptomEntity;
|
||||||
|
import doctor.domain.vo.SearchSickCircleVo;
|
||||||
|
import doctor.domain.vo.SickCircleVo;
|
||||||
|
import doctor.domain.vo.SickCommentVo;
|
||||||
|
import doctor.domain.vo.SickInfoVo;
|
||||||
|
import doctor.service.PatientService;
|
||||||
|
import doctor.service.SickCircleService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName PatientController
|
||||||
|
* @Description 描述
|
||||||
|
* @Author 栗永斌
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/sickCircle/v1/")
|
||||||
|
public class PatientController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PatientService patientService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SickCircleService sickCircleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发表评论
|
||||||
|
*/
|
||||||
|
@PostMapping("/publishComment")
|
||||||
|
public Result<SickCommentVo> publishComment(
|
||||||
|
@RequestParam("sickCircleId") Integer sickCircleId,
|
||||||
|
@RequestParam("content") String content) {
|
||||||
|
|
||||||
|
return sickCircleService.publishComment(sickCircleId, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点采
|
||||||
|
* @param opinion
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PutMapping("expressOpinion")
|
||||||
|
public HealthR expressOpinion(@RequestParam("opinion") Integer opinion){
|
||||||
|
// return sickCircleServer.expressOpinion(commentId, opinion);
|
||||||
|
System.out.println(opinion);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增病友圈
|
||||||
|
*/
|
||||||
|
@PostMapping("/publishSickCircle")
|
||||||
|
public HealthR<SickCircleEntity> publishSickCircle(@RequestBody SickCircleEntity sickCircleEntity) {
|
||||||
|
|
||||||
|
return sickCircleService.publishSickCircle(sickCircleEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 病友圈列表
|
||||||
|
*
|
||||||
|
* @param departmentId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/findSickCircleList")
|
||||||
|
public HealthR<List<SickCircleEntity>> sickCircleList(@RequestParam(value = "departmentId",required = false) Integer departmentId,
|
||||||
|
@RequestParam(value = "page",defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(value = "count",defaultValue = "10") Integer count) {
|
||||||
|
return patientService.sickCircleList(departmentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PageInfo<SickCircleEntity> startPage(Integer page, Integer count) {
|
||||||
|
Page<SickCircleEntity> objects = PageHelper.startPage(page, count);
|
||||||
|
return new PageInfo<>(objects);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 病友圈详情
|
||||||
|
*/
|
||||||
|
@GetMapping("/findSickCircleInfo")
|
||||||
|
public HealthR<SickCircleEntity> findSickCircleInfo(@RequestParam("sickCircleId") Integer sickCircleId) {
|
||||||
|
SickCircleEntity sickCircleEntity = patientService.findSickCircleInfo(sickCircleId);
|
||||||
|
return HealthR.ok(sickCircleEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 病症列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/symptomList")
|
||||||
|
public Result<List<SymptomEntity>> symptomList() {
|
||||||
|
return patientService.symptomList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询病友圈评论列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/findSickCircleCommentList")
|
||||||
|
public HealthR<List<SickCommentEntity>> findSickCircleCommentList(@RequestParam(value = "sickCircleId",required = false) Integer sickCircleId,
|
||||||
|
@RequestParam(value = "page",defaultValue = "1") Integer page,
|
||||||
|
@RequestParam(value = "count",defaultValue = "10") Integer count) {
|
||||||
|
startPage(page, count);
|
||||||
|
return patientService.findSickCircleCommentList(sickCircleId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索病友圈
|
||||||
|
* @param keyWord
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("searchSickCircle")
|
||||||
|
public HealthR<List<SickCircleEntity>> searchSickCircle(@RequestParam(value = "keyWord",required = false) String keyWord){
|
||||||
|
return patientService.searchSickCircle(keyWord);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,6 @@ import doctor.domain.entity.VideoEntity;
|
||||||
import doctor.domain.vo.VideoVo;
|
import doctor.domain.vo.VideoVo;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
import org.w3c.dom.stylesheets.LinkStyle;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,92 @@
|
||||||
|
package doctor.domain.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName MySickEntity
|
||||||
|
* @Description 描述
|
||||||
|
* @Author 栗永斌
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MySickEntity {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 整个治疗案例的详细信息
|
||||||
|
*/
|
||||||
|
private Integer sickCircleId;
|
||||||
|
/**
|
||||||
|
* 该治疗案例所属用户的ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 治疗案例的标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
/**
|
||||||
|
* 该治疗案例所属部门的ID
|
||||||
|
*/
|
||||||
|
private Integer departmentId;
|
||||||
|
/**
|
||||||
|
* 采纳的评论的ID,如果该治疗案例被采纳了
|
||||||
|
*/
|
||||||
|
private Integer adoptCommentId;
|
||||||
|
/**
|
||||||
|
* 患者所患病症
|
||||||
|
*/
|
||||||
|
private String disease;
|
||||||
|
/**
|
||||||
|
* 治疗案例的详细描述
|
||||||
|
*/
|
||||||
|
private String detail;
|
||||||
|
/**
|
||||||
|
* 治疗医院的名称
|
||||||
|
*/
|
||||||
|
private String treatmentHospital;
|
||||||
|
/**
|
||||||
|
* 治疗开始时间
|
||||||
|
*/
|
||||||
|
private Date treatmentStartTime;
|
||||||
|
/**
|
||||||
|
* 治疗结束时间
|
||||||
|
*/
|
||||||
|
private Date treatmentEndTime;
|
||||||
|
/**
|
||||||
|
* 治疗过程描述
|
||||||
|
*/
|
||||||
|
private String treatmentProcess;
|
||||||
|
/**
|
||||||
|
* 该治疗案例所附图片的ID,如果有
|
||||||
|
*/
|
||||||
|
private String picture;
|
||||||
|
/**
|
||||||
|
* 治疗案例发布的日期和时间
|
||||||
|
*/
|
||||||
|
private Date releaseTime;
|
||||||
|
/**
|
||||||
|
* 该治疗案例被采纳的日期和时间,如果是采纳的案例
|
||||||
|
*/
|
||||||
|
private Date adoptTime;
|
||||||
|
/**
|
||||||
|
* 治疗案例中包含的药品数量
|
||||||
|
*/
|
||||||
|
private Integer amount;
|
||||||
|
/**
|
||||||
|
* 治疗案例创建的日期和时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
* 治疗案例的收藏数量
|
||||||
|
*/
|
||||||
|
private Integer collectionNum;
|
||||||
|
/**
|
||||||
|
* 治疗案例的评论数量
|
||||||
|
*/
|
||||||
|
private Integer commentNum;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package doctor.domain.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName SickConmentEntity
|
||||||
|
* @Description 评论表
|
||||||
|
* @Author 栗永斌
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SickCommentEntity {
|
||||||
|
|
||||||
|
// 私有变量,评论的ID
|
||||||
|
private String id;
|
||||||
|
// 私有变量,评论所属的圈子ID
|
||||||
|
private String sickCircleId;
|
||||||
|
// 私有变量,评论的用户ID
|
||||||
|
private String userId;
|
||||||
|
// 私有变量,评论的内容
|
||||||
|
private String content;
|
||||||
|
// 私有变量,评论的评论时间
|
||||||
|
private String commentTime;
|
||||||
|
// 私有变量,是否为医生评论
|
||||||
|
private String whetherDoctor;
|
||||||
|
// 私有变量,评论的创建时间
|
||||||
|
private String createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
package doctor.domain.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName SymptomEntity
|
||||||
|
* @Description 描述
|
||||||
|
* @Author 栗永斌
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SymptomEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 私有变量,药品ID
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 私有变量,药品分类ID
|
||||||
|
*/
|
||||||
|
private Integer drugsCategoryId;
|
||||||
|
/**
|
||||||
|
* 私有变量,药品名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 私有变量,药品图片
|
||||||
|
*/
|
||||||
|
private String picture;
|
||||||
|
/**
|
||||||
|
* 私有变量,药品功效
|
||||||
|
*/
|
||||||
|
private String effect;
|
||||||
|
/**
|
||||||
|
* 私有变量,药品禁忌
|
||||||
|
*/
|
||||||
|
private String taboo;
|
||||||
|
/**
|
||||||
|
* 私有变量,药品形状
|
||||||
|
*/
|
||||||
|
private String shape;
|
||||||
|
/**
|
||||||
|
* 私有变量,药品包装
|
||||||
|
*/
|
||||||
|
private String packing;
|
||||||
|
/**
|
||||||
|
* 私有变量,药品成分
|
||||||
|
*/
|
||||||
|
private String component;
|
||||||
|
/**
|
||||||
|
* 私有变量,药品用法
|
||||||
|
*/
|
||||||
|
private String usage;
|
||||||
|
/**
|
||||||
|
* 私有变量,药品副作用
|
||||||
|
*/
|
||||||
|
private String sideEffects;
|
||||||
|
/**
|
||||||
|
* 私有变量,药品存储
|
||||||
|
*/
|
||||||
|
private String storage;
|
||||||
|
/**
|
||||||
|
* 私有变量,药品注意事项
|
||||||
|
*/
|
||||||
|
private String mindMatter;
|
||||||
|
/**
|
||||||
|
* 私有变量,药品批准文号
|
||||||
|
*/
|
||||||
|
private String approvalNumber;
|
||||||
|
/**
|
||||||
|
* 私有变量,药品创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package doctor.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName SickCommentVo
|
||||||
|
* @Description 描述
|
||||||
|
* @Author 栗永斌
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SickCommentVo {
|
||||||
|
private Integer sickCircleId;
|
||||||
|
private String content;
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package doctor.mapper;
|
||||||
|
|
||||||
|
import doctor.domain.entity.MySickEntity;
|
||||||
|
import doctor.domain.entity.SickCircleEntity;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName CollectSickMapper
|
||||||
|
* @Description 描述
|
||||||
|
*/
|
||||||
|
public interface CollectSickMapper {
|
||||||
|
SickCircleEntity shop(@Param("sickCircleId") Integer sickCircleId);
|
||||||
|
|
||||||
|
int ins(SickCircleEntity sickCircleEntity);
|
||||||
|
|
||||||
|
MySickEntity show(@Param("sickCircleId") Integer sickCircleId);
|
||||||
|
|
||||||
|
void del(@Param("sickCircleId") Integer sickCircleId);
|
||||||
|
|
||||||
|
void upd(@Param("sickCircleId") Integer sickCircleId);
|
||||||
|
|
||||||
|
void upda(@Param("sickCircleId") Integer sickCircleId);
|
||||||
|
|
||||||
|
}
|
|
@ -24,4 +24,6 @@ public interface DiseaseKnowledgeMapper {
|
||||||
|
|
||||||
List<PopularSearchEntity> popularSeach();
|
List<PopularSearchEntity> popularSeach();
|
||||||
|
|
||||||
|
List<Department> findDepartment();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
package doctor.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
|
import doctor.domain.entity.DepartmentEntity;
|
||||||
|
import doctor.domain.entity.SickCircleEntity;
|
||||||
|
import doctor.domain.entity.SickCommentEntity;
|
||||||
|
import doctor.domain.entity.SymptomEntity;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName PatientMapper
|
||||||
|
* @Description 描述
|
||||||
|
*/
|
||||||
|
public interface PatientMapper {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SickCircleEntity findSickCircleInfo(@Param("id") Integer id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<SymptomEntity> symptomList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<SickCircleEntity> sickCircleList(@Param("id") Integer id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<DepartmentEntity> DepartmentList(Page<DepartmentEntity> objects);
|
||||||
|
|
||||||
|
|
||||||
|
List<SickCommentEntity> findSickCircleCommentList(@Param("sickCircleId") Integer sickCircleId);
|
||||||
|
|
||||||
|
List<SickCircleEntity> searchSickCircle(@Param("keyWord") String keyWord);
|
||||||
|
|
||||||
|
}
|
|
@ -13,4 +13,8 @@ public interface SickCircleMapper {
|
||||||
SickCircleEntity findSickCircleInfo(Integer sickCircleId);
|
SickCircleEntity findSickCircleInfo(Integer sickCircleId);
|
||||||
|
|
||||||
SickCircleEntity findSickCircleInfoByKeyWord(String keyWord);
|
SickCircleEntity findSickCircleInfoByKeyWord(String keyWord);
|
||||||
|
|
||||||
|
void publishComment(Integer sickCircleId, Long userid, String content);
|
||||||
|
|
||||||
|
void publishSickCircle(SickCircleEntity sickCircleEntity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package doctor.service;
|
||||||
|
|
||||||
|
import doctor.common.core.domain.HealthR;
|
||||||
|
import doctor.domain.entity.SickCircleEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName CollectSickService
|
||||||
|
* @Description 描述
|
||||||
|
*/
|
||||||
|
public interface CollectSickService {
|
||||||
|
HealthR<SickCircleEntity> cancelSickCollection(Integer sickCircleId);
|
||||||
|
|
||||||
|
HealthR<SickCircleEntity> addUserSickCollection(Integer sickCircleId);
|
||||||
|
|
||||||
|
}
|
|
@ -22,4 +22,7 @@ public interface DiseaseKnowledgeService {
|
||||||
|
|
||||||
List<PopularSearchEntity> popularSeach();
|
List<PopularSearchEntity> popularSeach();
|
||||||
|
|
||||||
|
List<Department> findDepartment();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
package doctor.service;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.api.model.v2.Result;
|
||||||
|
import doctor.common.core.domain.HealthR;
|
||||||
|
import doctor.domain.entity.SickCircleEntity;
|
||||||
|
import doctor.domain.entity.SickCommentEntity;
|
||||||
|
import doctor.domain.entity.SymptomEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName PatientService
|
||||||
|
* @Description 描述
|
||||||
|
*/
|
||||||
|
public interface PatientService {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SickCircleEntity findSickCircleInfo(Integer id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Result<List<SymptomEntity>> symptomList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HealthR<List<SickCircleEntity>> sickCircleList(Integer departmentId);
|
||||||
|
|
||||||
|
|
||||||
|
HealthR<List<SickCommentEntity>> findSickCircleCommentList(Integer sickCircleId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HealthR<List<SickCircleEntity>> searchSickCircle(String keyWord);
|
||||||
|
|
||||||
|
}
|
|
@ -1,8 +1,11 @@
|
||||||
package doctor.service;
|
package doctor.service;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.api.model.v2.Result;
|
||||||
import doctor.common.core.domain.HealthR;
|
import doctor.common.core.domain.HealthR;
|
||||||
|
import doctor.domain.entity.SickCircleEntity;
|
||||||
import doctor.domain.vo.SearchSickCircleVo;
|
import doctor.domain.vo.SearchSickCircleVo;
|
||||||
import doctor.domain.vo.SickCircleVo;
|
import doctor.domain.vo.SickCircleVo;
|
||||||
|
import doctor.domain.vo.SickCommentVo;
|
||||||
import doctor.domain.vo.SickInfoVo;
|
import doctor.domain.vo.SickInfoVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -13,4 +16,9 @@ public interface SickCircleService {
|
||||||
SickInfoVo findSickCircleInfo(Integer sickCircleId);
|
SickInfoVo findSickCircleInfo(Integer sickCircleId);
|
||||||
|
|
||||||
SearchSickCircleVo searchSickCircle(String keyWord);
|
SearchSickCircleVo searchSickCircle(String keyWord);
|
||||||
|
|
||||||
|
Result<SickCommentVo> publishComment(Integer sickCircleId, String content);
|
||||||
|
|
||||||
|
HealthR<SickCircleEntity> publishSickCircle(SickCircleEntity sickCircleEntity);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
package doctor.service.impl;
|
||||||
|
|
||||||
|
import doctor.common.core.domain.HealthR;
|
||||||
|
import doctor.domain.entity.MySickEntity;
|
||||||
|
import doctor.domain.entity.SickCircleEntity;
|
||||||
|
import doctor.mapper.CollectSickMapper;
|
||||||
|
import doctor.service.CollectSickService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName CollectSickServiceImpl
|
||||||
|
* @Description 描述
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Log4j2
|
||||||
|
public class CollectSickServiceImpl implements CollectSickService {
|
||||||
|
@Autowired
|
||||||
|
private CollectSickMapper collectSickMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HealthR<SickCircleEntity> cancelSickCollection(Integer sickCircleId) {
|
||||||
|
//查询我的病友圈对象信息看是否存在
|
||||||
|
// 根据sickCircleId获取收藏信息
|
||||||
|
MySickEntity s = collectSickMapper.show(sickCircleId);
|
||||||
|
if (s != null) {
|
||||||
|
// 根据sickCircleId删除收藏信息
|
||||||
|
collectSickMapper.del(sickCircleId);
|
||||||
|
// 根据sickCircleId更新收藏信息
|
||||||
|
collectSickMapper.upda(sickCircleId);
|
||||||
|
// 返回取消收藏成功的提示信息
|
||||||
|
return HealthR.fail("取消收藏成功");
|
||||||
|
} else {
|
||||||
|
// 返回没有收藏过的提示信息
|
||||||
|
return HealthR.fail("没有收藏过");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HealthR<SickCircleEntity> addUserSickCollection(Integer sickCircleId) {
|
||||||
|
//查询我的病友圈对象信息看是否存在
|
||||||
|
MySickEntity s=collectSickMapper.show(sickCircleId);
|
||||||
|
|
||||||
|
if (s==null){
|
||||||
|
//查询病友圈对象信息
|
||||||
|
SickCircleEntity sickCircleEntity= collectSickMapper.shop(sickCircleId);
|
||||||
|
|
||||||
|
//添加我的收藏记录
|
||||||
|
collectSickMapper.ins(sickCircleEntity);
|
||||||
|
|
||||||
|
//更新病友圈的收藏数
|
||||||
|
collectSickMapper.upd(sickCircleId);
|
||||||
|
|
||||||
|
return HealthR.ok(sickCircleEntity);
|
||||||
|
}else {
|
||||||
|
return HealthR.fail("已经收藏过了");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -43,7 +43,10 @@ public class DiseaseKnowledgeServiceimpl implements DiseaseKnowledgeService {
|
||||||
return diseaseKnowledgeMapper.popularSeach();
|
return diseaseKnowledgeMapper.popularSeach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Department> findDepartment() {
|
||||||
|
return diseaseKnowledgeMapper.findDepartment();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,99 @@
|
||||||
|
package doctor.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.api.model.v2.Result;
|
||||||
|
import doctor.common.core.constant.TokenConstants;
|
||||||
|
import doctor.common.core.domain.HealthR;
|
||||||
|
import doctor.common.security.service.TokenService;
|
||||||
|
import doctor.domain.entity.SickCircleEntity;
|
||||||
|
import doctor.domain.entity.SickCommentEntity;
|
||||||
|
import doctor.domain.entity.SymptomEntity;
|
||||||
|
import doctor.mapper.PatientMapper;
|
||||||
|
import doctor.service.PatientService;
|
||||||
|
import doctor.system.api.model.LoginUser;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName PatientServiceImpl
|
||||||
|
* @Description 描述
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Log4j2
|
||||||
|
public class PatientServiceImpl implements PatientService {
|
||||||
|
@Autowired
|
||||||
|
private PatientMapper patientMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HealthR<List<SickCircleEntity>> sickCircleList(Integer departmentId) {
|
||||||
|
/**
|
||||||
|
* 根据科室id获取病人圈列表
|
||||||
|
* @param departmentId 科室id
|
||||||
|
* @return 病人圈列表
|
||||||
|
*/
|
||||||
|
List<SickCircleEntity> sickCircleEntity = patientMapper.sickCircleList(departmentId);
|
||||||
|
return HealthR.ok(sickCircleEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据病人圈id获取病人圈评论列表
|
||||||
|
* @param sickCircleId 病人圈id
|
||||||
|
* @return 病人圈评论列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public HealthR<List<SickCommentEntity>> findSickCircleCommentList(Integer sickCircleId) {
|
||||||
|
List<SickCommentEntity> sickCommentEntity = patientMapper.findSickCircleCommentList(sickCircleId);
|
||||||
|
return HealthR.ok(sickCommentEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HealthR<List<SickCircleEntity>> searchSickCircle(String keyWord) {
|
||||||
|
List<SickCircleEntity> list= patientMapper.searchSickCircle(keyWord);
|
||||||
|
return HealthR.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SickCircleEntity findSickCircleInfo(Integer id) {
|
||||||
|
SickCircleEntity sickCircleList = patientMapper.findSickCircleInfo(id);
|
||||||
|
return sickCircleList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
HttpServletRequest httpServletRequest;
|
||||||
|
@Autowired
|
||||||
|
RedisTemplate<String,String> redisTemplate;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
TokenService tokenService;
|
||||||
|
private LoginUser Login() {
|
||||||
|
|
||||||
|
String header = httpServletRequest.getHeader(TokenConstants.SESSIONID);
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser(header);
|
||||||
|
return loginUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<List<SymptomEntity>> symptomList() {
|
||||||
|
List<SymptomEntity> symptomList = patientMapper.symptomList();
|
||||||
|
return Result.success(symptomList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,17 +1,24 @@
|
||||||
package doctor.service.impl;
|
package doctor.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.api.model.v2.Result;
|
||||||
|
import doctor.common.core.constant.TokenConstants;
|
||||||
import doctor.common.core.domain.HealthR;
|
import doctor.common.core.domain.HealthR;
|
||||||
|
import doctor.common.core.utils.StringUtils;
|
||||||
import doctor.common.core.web.controller.BaseController;
|
import doctor.common.core.web.controller.BaseController;
|
||||||
|
import doctor.common.security.service.TokenService;
|
||||||
import doctor.domain.entity.SickCircleEntity;
|
import doctor.domain.entity.SickCircleEntity;
|
||||||
import doctor.domain.vo.SearchSickCircleVo;
|
import doctor.domain.vo.SearchSickCircleVo;
|
||||||
import doctor.domain.vo.SickCircleVo;
|
import doctor.domain.vo.SickCircleVo;
|
||||||
|
import doctor.domain.vo.SickCommentVo;
|
||||||
import doctor.domain.vo.SickInfoVo;
|
import doctor.domain.vo.SickInfoVo;
|
||||||
import doctor.mapper.SickCircleMapper;
|
import doctor.mapper.SickCircleMapper;
|
||||||
import doctor.service.SickCircleService;
|
import doctor.service.SickCircleService;
|
||||||
|
import doctor.system.api.model.LoginUser;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -20,6 +27,11 @@ public class SickCircleServiceImpl extends BaseController implements SickCircleS
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SickCircleMapper sickCircleMapper;
|
private SickCircleMapper sickCircleMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
HttpServletRequest httpServletRequest;
|
||||||
|
@Autowired
|
||||||
|
TokenService tokenService;
|
||||||
@Override
|
@Override
|
||||||
public List<SickCircleVo> findSickCircleList(Integer page, Integer size, Integer departmentId) {
|
public List<SickCircleVo> findSickCircleList(Integer page, Integer size, Integer departmentId) {
|
||||||
List<SickCircleEntity> list = sickCircleMapper.findSickCircleList(departmentId);
|
List<SickCircleEntity> list = sickCircleMapper.findSickCircleList(departmentId);
|
||||||
|
@ -48,4 +60,46 @@ public class SickCircleServiceImpl extends BaseController implements SickCircleS
|
||||||
BeanUtils.copyProperties(sickCircleInfo,searchSickCircleVo);
|
BeanUtils.copyProperties(sickCircleInfo,searchSickCircleVo);
|
||||||
return searchSickCircleVo;
|
return searchSickCircleVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<SickCommentVo> publishComment(Integer sickCircleId, String content) {
|
||||||
|
//获取用户对象
|
||||||
|
LoginUser login = Login();
|
||||||
|
//获取用户id
|
||||||
|
Long userid = login.getUserid();
|
||||||
|
sickCircleMapper.publishComment(sickCircleId,userid, content);
|
||||||
|
|
||||||
|
return Result.success(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HealthR<SickCircleEntity> publishSickCircle(SickCircleEntity sickCircleEntity) {
|
||||||
|
if (StringUtils.isEmpty(sickCircleEntity.getTitle())) {
|
||||||
|
Result.failure("标题不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(sickCircleEntity.getTitle())) {
|
||||||
|
Result.failure("标题不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(sickCircleEntity.getDisease())) {
|
||||||
|
Result.failure("症状不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(sickCircleEntity.getDetail())) {
|
||||||
|
Result.failure("描述不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(sickCircleEntity.getTreatmentProcess())) {
|
||||||
|
Result.failure("治疗过程不能为空");
|
||||||
|
}
|
||||||
|
LoginUser login = Login();
|
||||||
|
sickCircleEntity.setUserId(login.getUserid().intValue());
|
||||||
|
|
||||||
|
sickCircleMapper.publishSickCircle(sickCircleEntity);
|
||||||
|
return HealthR.ok(sickCircleEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LoginUser Login() {
|
||||||
|
|
||||||
|
String header = httpServletRequest.getHeader(TokenConstants.SESSIONID);
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser(header);
|
||||||
|
return loginUser;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,312 @@
|
||||||
|
package doctor.util;
|
||||||
|
|
||||||
|
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||||
|
import doctor.common.core.utils.StringUtils;
|
||||||
|
import org.apache.http.HttpResponse;
|
||||||
|
import org.apache.http.NameValuePair;
|
||||||
|
import org.apache.http.client.HttpClient;
|
||||||
|
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||||
|
import org.apache.http.client.methods.HttpDelete;
|
||||||
|
import org.apache.http.client.methods.HttpGet;
|
||||||
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.http.client.methods.HttpPut;
|
||||||
|
import org.apache.http.conn.ClientConnectionManager;
|
||||||
|
import org.apache.http.conn.scheme.Scheme;
|
||||||
|
import org.apache.http.conn.scheme.SchemeRegistry;
|
||||||
|
import org.apache.http.conn.ssl.SSLSocketFactory;
|
||||||
|
import org.apache.http.entity.ByteArrayEntity;
|
||||||
|
import org.apache.http.entity.StringEntity;
|
||||||
|
import org.apache.http.impl.client.DefaultHttpClient;
|
||||||
|
import org.apache.http.message.BasicNameValuePair;
|
||||||
|
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.TrustManager;
|
||||||
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.security.KeyManagementException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class HttpUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doGet(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpGet request = new HttpGet(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* post form
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @param bodys
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doPost(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys,
|
||||||
|
Map<String, String> bodys)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bodys != null) {
|
||||||
|
List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
|
||||||
|
|
||||||
|
for (String key : bodys.keySet()) {
|
||||||
|
nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key)));
|
||||||
|
}
|
||||||
|
UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8");
|
||||||
|
formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
|
||||||
|
request.setEntity(formEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post String
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @param body
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doPost(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys,
|
||||||
|
String body)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtil.isNotBlank(body)) {
|
||||||
|
request.setEntity(new StringEntity(body, "utf-8"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post stream
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @param body
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doPost(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys,
|
||||||
|
byte[] body)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (body != null) {
|
||||||
|
request.setEntity(new ByteArrayEntity(body));
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put String
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @param body
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doPut(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys,
|
||||||
|
String body)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpPut request = new HttpPut(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(body)) {
|
||||||
|
request.setEntity(new StringEntity(body, "utf-8"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put stream
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @param body
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doPut(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys,
|
||||||
|
byte[] body)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpPut request = new HttpPut(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (body != null) {
|
||||||
|
request.setEntity(new ByteArrayEntity(body));
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doDelete(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String buildUrl(String host, String path, Map<String, String> querys) throws UnsupportedEncodingException {
|
||||||
|
StringBuilder sbUrl = new StringBuilder();
|
||||||
|
sbUrl.append(host);
|
||||||
|
if (!StringUtils.isBlank(path)) {
|
||||||
|
sbUrl.append(path);
|
||||||
|
}
|
||||||
|
if (null != querys) {
|
||||||
|
StringBuilder sbQuery = new StringBuilder();
|
||||||
|
for (Map.Entry<String, String> query : querys.entrySet()) {
|
||||||
|
if (0 < sbQuery.length()) {
|
||||||
|
sbQuery.append("&");
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {
|
||||||
|
sbQuery.append(query.getValue());
|
||||||
|
}
|
||||||
|
if (!StringUtils.isBlank(query.getKey())) {
|
||||||
|
sbQuery.append(query.getKey());
|
||||||
|
if (!StringUtils.isBlank(query.getValue())) {
|
||||||
|
sbQuery.append("=");
|
||||||
|
sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (0 < sbQuery.length()) {
|
||||||
|
sbUrl.append("?").append(sbQuery);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sbUrl.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static HttpClient wrapClient(String host) {
|
||||||
|
HttpClient httpClient = new DefaultHttpClient();
|
||||||
|
if (host.startsWith("https://")) {
|
||||||
|
sslClient(httpClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void sslClient(HttpClient httpClient) {
|
||||||
|
try {
|
||||||
|
SSLContext ctx = SSLContext.getInstance("TLS");
|
||||||
|
X509TrustManager tm = new X509TrustManager() {
|
||||||
|
public X509Certificate[] getAcceptedIssuers() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public void checkClientTrusted(X509Certificate[] xcs, String str) {
|
||||||
|
|
||||||
|
}
|
||||||
|
public void checkServerTrusted(X509Certificate[] xcs, String str) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ctx.init(null, new TrustManager[] { tm }, null);
|
||||||
|
SSLSocketFactory ssf = new SSLSocketFactory(ctx);
|
||||||
|
ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
||||||
|
ClientConnectionManager ccm = httpClient.getConnectionManager();
|
||||||
|
SchemeRegistry registry = ccm.getSchemeRegistry();
|
||||||
|
registry.register(new Scheme("https", 443, ssf));
|
||||||
|
} catch (KeyManagementException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
} catch (NoSuchAlgorithmException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,11 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 101.34.77.101:8848
|
server-addr: 101.34.77.101:8848
|
||||||
namespace: 7e34f104-f333-4828-b36a-02146e521c9a
|
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 101.34.77.101:8848
|
server-addr: 101.34.77.101:8848
|
||||||
namespace: 7e34f104-f333-4828-b36a-02146e521c9a
|
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="doctor.mapper.CollectSickMapper">
|
||||||
|
<insert id="ins">
|
||||||
|
INSERT INTO `doctor`.`user_sick_circle` (`sick_circle_id`, `user_id`, `title`, `department_id`, `adopt_comment_id`, `disease`, `detail`, `treatment_hospital`, `treatment_start_time`, `treatment_end_time`, `treatment_process`, `picture`, `release_time`, `adopt_time`, `amount`, `create_time`, `collection_num`, `comment_num`)
|
||||||
|
VALUES (#{sickCircleId},#{userId},#{title},#{departmentId},#{adoptCommentId},#{disease},#{detail},#{treatmentHospital},#{treatmentStartTime},#{treatmentEndTime},#{treatmentProcess},#{picture},#{releaseTime},#{adoptTime},#{amount},#{createTime},#{collectionNum},#{commentNum});
|
||||||
|
</insert>
|
||||||
|
<update id="upd">
|
||||||
|
update sick_circle set collection_num=collection_num + 1 where sick_circle_id = #{sickCircleId}
|
||||||
|
</update>
|
||||||
|
<update id="upda">
|
||||||
|
update sick_circle set collection_num=collection_num - 1 where sick_circle_id = #{sickCircleId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="del">
|
||||||
|
delete from user_sick_circle where sick_circle_id = #{sickCircleId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="shop" resultType="doctor.domain.entity.SickCircleEntity">
|
||||||
|
select * from sick_circle where sick_circle_id = #{sickCircleId}
|
||||||
|
</select>
|
||||||
|
<select id="show" resultType="doctor.domain.entity.MySickEntity">
|
||||||
|
select * from user_sick_circle where sick_circle_id = #{sickCircleId}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -22,6 +22,9 @@
|
||||||
<select id="popularSeach" resultType="doctor.domain.entity.PopularSearchEntity">
|
<select id="popularSeach" resultType="doctor.domain.entity.PopularSearchEntity">
|
||||||
select *from popular_search
|
select *from popular_search
|
||||||
</select>
|
</select>
|
||||||
|
<select id="findDepartment" resultType="doctor.domain.entity.Department">
|
||||||
|
select *from department
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -10,4 +10,3 @@
|
||||||
from doctor where department_id = #{deptId}
|
from doctor where department_id = #{deptId}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
2
|
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="doctor.mapper.PatientMapper">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<select id="DepartmentList" resultType="doctor.domain.entity.DepartmentEntity">
|
||||||
|
select id, department_name, pic, rank, create_time from department
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<select id="symptomList" resultType="doctor.domain.entity.SymptomEntity">
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="sickCircleList" resultType="doctor.domain.entity.SickCircleEntity">
|
||||||
|
select sick_circle_id , `user_id`, `title`, `department_id`, `adopt_comment_id`, `disease`, `detail`, `treatment_hospital`, `treatment_start_time`, `treatment_end_time`, `treatment_process`, `picture`, `release_time`, `adopt_time`, `amount`, `create_time`, `collection_num`, `comment_num`
|
||||||
|
from sick_circle where department_id=#{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findSickCircleInfo" resultType="doctor.domain.entity.SickCircleEntity">
|
||||||
|
SELECT sick_circle.*,department.department_name department FROM sick_circle LEFT JOIN department on sick_circle.department_id=department.id
|
||||||
|
WHERE sick_circle.sick_circle_id=#{id}
|
||||||
|
</select>
|
||||||
|
<select id="findSickCircleCommentList" resultType="doctor.domain.entity.SickCommentEntity">
|
||||||
|
select * from sick_circle_comment where sick_circle_id=#{sickCircleId}
|
||||||
|
</select>
|
||||||
|
<select id="searchSickCircle" resultType="doctor.domain.entity.SickCircleEntity">
|
||||||
|
select sick_circle_id , `user_id`, `title`, `department_id`, `adopt_comment_id`, `disease`, `detail`, `treatment_hospital`, `treatment_start_time`, `treatment_end_time`, `treatment_process`, `picture`, `release_time`, `adopt_time`, `amount`, `create_time`, `collection_num`, `comment_num`
|
||||||
|
from sick_circle where
|
||||||
|
|
||||||
|
disease like '%${keyWord}%';
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -14,4 +14,14 @@
|
||||||
<select id="findSickCircleInfoByKeyWord" resultType="doctor.domain.entity.SickCircleEntity">
|
<select id="findSickCircleInfoByKeyWord" resultType="doctor.domain.entity.SickCircleEntity">
|
||||||
SELECT * FROM sick_circle WHERE title LIKE CONCAT('%', #{keyWord}, '%')
|
SELECT * FROM sick_circle WHERE title LIKE CONCAT('%', #{keyWord}, '%')
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<insert id="publishSickCircle">
|
||||||
|
INSERT INTO `doctor`.`sick_circle` ( `user_id`, `title`, `department_id`, `adopt_comment_id`, `disease`, `detail`, `treatment_hospital`, `treatment_start_time`, `treatment_end_time`, `treatment_process`, `picture`, `release_time`, `adopt_time`, `amount`, `create_time`, `collection_num`, `comment_num`)
|
||||||
|
VALUES (#{userId},#{title},#{departmentId},#{adoptCommentId},#{disease},#{detail},#{treatmentHospital},#{treatmentStartTime},#{treatmentEndTime},#{treatmentProcess},#{picture},now(),now(),#{amount},now(),#{collectionNum},#{commentNum});
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="publishComment">
|
||||||
|
INSERT INTO `doctor`.`sick_circle_comment` ( `sick_circle_id`, `user_id`, `content`, `comment_time`, `whether_doctor`, `create_time`)
|
||||||
|
VALUES (#{sickCircleId},#{userid},#{content},now(),1,now())
|
||||||
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue