Browse Source

Merge branch '2.0' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into 2.0

 Conflicts:
	svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/common/service/LabelService.java
LAPTOP-KB9HII50\70708 9 months ago
parent
commit
1481531925
17 changed files with 835 additions and 777 deletions
  1. 6 2
      business/base-service/src/main/java/com/yihu/jw/article/service/KnowledgeArticleDictService.java
  2. 20 5
      business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java
  3. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/article/ArticleEndpoint.java
  4. 18 24
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/article/ArticleDictEndpoint.java
  5. 470 484
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/article/ArticleEndpoint.java
  6. 13 20
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  7. 69 82
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/specialist/BaseDiseaseHospitalController.java
  8. 2 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/BasePatientBusinessService.java
  9. 12 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeArticleService.java
  10. 33 2
      svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/common/LabelController.java
  11. 74 31
      svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/common/service/LabelService.java
  12. 2 2
      svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/door/service/WlyyDoorServiceOrderService.java
  13. 7 5
      svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/followup/controller/DoctorFollowUpController.java
  14. 6 12
      svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/followup/dao/FollowUpDao.java
  15. 6 4
      svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/followup/service/FollowUpService.java
  16. 53 49
      svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/template/controller/DoctorGuidanceTempController.java
  17. 42 49
      svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/template/service/DoctorGuidanceTempService.java

+ 6 - 2
business/base-service/src/main/java/com/yihu/jw/article/service/KnowledgeArticleDictService.java

@ -25,6 +25,7 @@ import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.user.UserDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.EntityUtils;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -167,7 +168,9 @@ public class KnowledgeArticleDictService extends BaseJpaService<KnowledgeArticle
            // 新增
            knowledgeArticleDO.setId(UUID.randomUUID().toString().replace("-", ""));
            knowledgeArticleDO.setCreateTime(new Date());
            knowledgeArticleDO.setStatus(0);
            knowledgeArticleDO.setReleaseStatus(0);
            knowledgeArticleDO.setDel(1);
            knowledgeArticleDO.setType(type);
@ -182,13 +185,11 @@ public class KnowledgeArticleDictService extends BaseJpaService<KnowledgeArticle
            if (type == 1) {
                BaseDoctorDO userDO = doctorDao.findById(knowledgeArticleDO.getCreateUser()).orElse(null);
                if (userDO != null) {
                    knowledgeArticleDO.setCreateUserName(userDO.getName());
                }
            } else {
                BaseDoctorDO userDO = doctorDao.findById(knowledgeArticleDO.getCreateUser()).orElse(null);
                if (userDO != null) {
                    knowledgeArticleDO.setCreateUserName(userDO.getName());
                }
@ -198,6 +199,9 @@ public class KnowledgeArticleDictService extends BaseJpaService<KnowledgeArticle
                knowledgeArticleDO.setStatus(1);
                knowledgeArticleDO.setReleaseStatus(1);
            }
            knowledgeArticleDO = knowledgeArticleDictDao.save(knowledgeArticleDO);
            return knowledgeArticleDO;
        } else {

+ 20 - 5
business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java

@ -881,7 +881,7 @@ public class WlyyBusinessService {
    //获取i健康医生信息
    public JSONObject getDoctorInfo_IJK(String idcard) {
        String param = "?idcard=" + nullToTransfor(idcard);
        String param = "?idCard=" + nullToTransfor(idcard);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getDoctorInfo_IJK", param);
        return re;
    }
@ -894,10 +894,15 @@ public class WlyyBusinessService {
    }
    public JSONObject getScreeList_IJK(
            String doctor, Integer type, int pageNo, int pageSize, String patientName,
            String doctor, String type, int pageNo, int pageSize, String patientName,
            String isDanger, String diseaseType, Integer filterType, String patientCode) {
        String param = "?doctor=" + nullToTransfor(doctor) + "&type=" + nullToTransfor(String.valueOf(type)) + "&pageNo=" + nullToTransfor(String.valueOf(pageNo)) + "&pageSize=" + nullToTransfor(String.valueOf(pageSize)) + "&patientName=" + nullToTransfor(patientName) +
        String param = "?doctor=" + nullToTransfor(doctor);
        if (StringUtils.isNotBlank(type)) {
            param += "&type=" + nullToTransfor(type);
        }
        param += "&pageNo=" + nullToTransfor(String.valueOf(pageNo)) + "&pageSize=" + nullToTransfor(String.valueOf(pageSize)) + "&patientName=" + nullToTransfor(patientName) +
                "&isDanger=" + nullToTransfor(isDanger) + "&diseaseType=" + nullToTransfor(diseaseType) + "&filterType=" + nullToTransfor(String.valueOf(filterType)) + "&patientCode=" + nullToTransfor(patientCode);
        System.out.println("param=>" + param);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getScreeList_IJK", param);
        return re;
    }
@ -910,18 +915,21 @@ public class WlyyBusinessService {
    public JSONObject queryByConsultCode_IJK(String code, Integer type) {
        String param = "?code=" + nullToTransfor(code) + "&type=" + nullToTransfor(String.valueOf(type));
        System.out.println("param=>" + param);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("queryByConsultCode_IJK", param);
        return re;
    }
    public JSONObject getScreenResultDetail_IJK(String code) {
        String param = "?code=" + nullToTransfor(code);
        System.out.println("param=>" + param);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getScreenResultDetail_IJK", param);
        return re;
    }
    public JSONObject findPatientSignFamily_IJK(String patient) {
        String param = "?patient=" + nullToTransfor(patient);
        System.out.println("param=>" + param);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("findPatientSignFamily_IJK", param);
        return re;
    }
@ -934,18 +942,21 @@ public class WlyyBusinessService {
    public JSONObject last_IJK(String patient) {
        String param = "?patient=" + nullToTransfor(patient);
        System.out.println("param=>" + param);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("last_IJK", param);
        return re;
    }
    public JSONObject patient_IJK(String patient) {
        String param = "?patient=" + nullToTransfor(patient);
        System.out.println("param=>" + param);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("patient_IJK", param);
        return re;
    }
    public JSONObject getPatientSpecialAndFamilyDoctor_IJK(String patientCode) {
        String param = "?patientCode=" + nullToTransfor(patientCode);
        System.out.println("param=>" + param);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getPatientSpecialAndFamilyDoctor_IJK", param);
        return re;
@ -953,6 +964,7 @@ public class WlyyBusinessService {
    public JSONObject selectAllCompleteServiceItemsByPatient_IJK(String patient) {
        String param = "?patient=" + nullToTransfor(patient);
        System.out.println("param=>" + param);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("selectAllCompleteServiceItemsByPatient_IJK", param);
        return re;
    }
@ -972,9 +984,12 @@ public class WlyyBusinessService {
        return re;
    }
    public JSONObject calendarPlanDetailItems_IJK(String executeStartTime, String executeEndTime, String planId, Integer searchTask, String doctorCode, Integer status) {
    public JSONObject calendarPlanDetailItems_IJK(String executeStartTime, String executeEndTime, String planId, Integer searchTask, String doctorCode, String status) {
        String param = "?executeStartTime=" + nullToTransfor(executeStartTime) + "&executeEndTime=" + nullToTransfor(executeEndTime) + "&planId=" + nullToTransfor(planId) + "&searchTask=" + nullToTransfor(String.valueOf(searchTask)) +
                "&doctorCode=" + nullToTransfor(doctorCode) + "&status=" + nullToTransfor(String.valueOf(status));
                "&doctorCode=" + nullToTransfor(doctorCode);
        if (StringUtils.isNotBlank(status)) {
            param += "&status=" + nullToTransfor(status);
        }
        JSONObject re = wlyyHttpService.sendWlyyMesGet("calendarPlanDetailItems_IJK", param);
        return re;
    }

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/article/ArticleEndpoint.java

@ -155,8 +155,8 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.saveArticle)
	@ApiOperation(value = "保存/更新文章")
	public Envelop saveArticle(
			@ApiParam(name = "jsonData", value = "Json数据", required = true)
			@RequestParam String jsonData)throws Exception {
			@ApiParam(name = "jsonData", value = "Json数据", required = true) @RequestParam String jsonData
	)throws Exception {
		try {
			knowledgeArticleDictService.saveArticle(jsonData,1);

+ 18 - 24
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/article/ArticleDictEndpoint.java

@ -108,23 +108,21 @@ public class ArticleDictEndpoint extends EnvelopRestEndpoint {
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchKnowledgeList)
	@ApiOperation(value = "获取文章列表")
	public Envelop searchKnowledgeList(
			@ApiParam(name = "first", value = "second")
			@RequestParam(value = "first", required = false) String first,
			@ApiParam(name = "second", value = "second")
			@RequestParam(value = "second", required = false) String second,
			@ApiParam(name = "key", value = "关键字")
			@RequestParam(value = "key", required = false) String key,
			@ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1")
			@RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
			@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
			@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize){
			@ApiParam(name = "first", value = "second") @RequestParam(value = "first", required = false) String first,
			@ApiParam(name = "second", value = "second") @RequestParam(value = "second", required = false) String second,
			@ApiParam(name = "key", value = "关键字") @RequestParam(value = "key", required = false) String key,
			@ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1") @RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
			@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10") @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize
	){
		try {
			return success(knowledgeArticleDictService.findArticleList(first,second,2,key,page,pageSize));
		}catch (Exception e){
			return failedException2(e);
		}
	}
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.queryById)
	@ApiOperation(value = "根据id查询文章")
	public Envelop queryByCode(
@ -160,9 +158,8 @@ public class ArticleDictEndpoint extends EnvelopRestEndpoint {
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.saveArticle)
	@ApiOperation(value = "保存/更新文章")
	public Envelop saveArticle(
			@ApiParam(name = "jsonData", value = "Json数据", required = true)
			@RequestParam String jsonData) {
			@ApiParam(name = "jsonData", value = "Json数据", required = true) @RequestParam String jsonData
	) {
		try {
			knowledgeArticleDictService.saveArticle(jsonData,2);
			return success("操作成功");
@ -189,12 +186,9 @@ public class ArticleDictEndpoint extends EnvelopRestEndpoint {
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.reviewArticle)
	@ApiOperation(value = "审核/退回文章")
	public Envelop saveArticle(
			@ApiParam(name = "articleId", value = "文章ID")
			@RequestParam(value = "articleId", required = true) String articleId,
			@ApiParam(name = "status", value = "0未审核,1已审核,2退回")
			@RequestParam(value = "status", required = true) Integer status,
			@ApiParam(name = "reason", value = "退回理由")
			@RequestParam(value = "reason", required = false) String reason
			@ApiParam(name = "articleId", value = "文章ID") @RequestParam(value = "articleId", required = true) String articleId,
			@ApiParam(name = "status", value = "0未审核,1已审核,2退回") @RequestParam(value = "status", required = true) Integer status,
			@ApiParam(name = "reason", value = "退回理由") @RequestParam(value = "reason", required = false) String reason
	){
		try {
			knowledgeArticleDictService.reviewArticle(articleId,status,reason);
@ -207,10 +201,10 @@ public class ArticleDictEndpoint extends EnvelopRestEndpoint {
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.setArticleUsed)
	@ApiOperation(value = "发布文章")
	public ObjEnvelop setArticleUsed(@ApiParam(name = "id", value = "文章id")
									  @RequestParam(value = "id",required = true)String id,
									  @ApiParam(name = "status", value = "1发布0未发布")
									  @RequestParam(value = "status",required = false)Integer status){
	public ObjEnvelop setArticleUsed(
			@ApiParam(name = "id", value = "文章id") @RequestParam(value = "id",required = true)String id,
			@ApiParam(name = "status", value = "1发布0未发布") @RequestParam(value = "status",required = false)Integer status
	){
		try {
			return success(knowledgeArticleDictService.releaseArticle(id,status));
		}catch (Exception e){

+ 470 - 484
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/article/ArticleEndpoint.java

@ -30,501 +30,487 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
 * 健康文章
 *
 * @author huangwenjie
 */
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.PREFIX)
@Api(value = "健康文章", description = "健康文章接口", tags = {"健康文章接口"})
public class ArticleEndpoint extends EnvelopRestEndpoint {
	
	@Autowired
	private KnowledgeArticleService  knowledgeArticleService;
	@Autowired
	private KnowledgeCategoryService knowledgeCategoryService;
	@Autowired
	private BasePatientBusinessService patientBusinessService;
	@Autowired
	private BaseDoctorHospitalDao doctorHospitalDao;
	@Autowired
	private KnowledgeArticleUserService knowledgeArticleUserService;
	@Autowired
	private KnowledgeArticleUserDao knowledgeArticleUserDao;
	@Autowired
	private KnowledgeArticleDao knowledgeArticleDao;
	@Autowired
	private KnowledgeArticleDictDao knowledgeArticleDictDao;
	
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchKnowledgePageList)
	@ApiOperation(value = "获取文章列表")
	public Envelop searchKnowledgePageList(
			@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
			@RequestParam(value = "fields", required = false) String fields,
			@ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
			@RequestParam(value = "filters", required = false) String filters,
			@ApiParam(name = "sorts", value = "排序,规则参见说明文档")
			@RequestParam(value = "sorts", required = false) String sorts,
			@ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1")
			@RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
			@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
			@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
		try {
			if(StringUtils.isBlank(filters)){
				filters=filters+"del=1";
			}else{
				filters=filters+";del=1";
			}
			List<KnowledgeArticleDO> list  = knowledgeArticleService.search(fields,filters,sorts,page,pageSize);
			for (KnowledgeArticleDO knowledgeArticleDO:list){
				List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
				if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
					BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
					knowledgeArticleDO.setDeptName(doctorHospitalDO.getDeptName());
					knowledgeArticleDO.setHospitalName(doctorHospitalDO.getOrgName());
				}
				KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(knowledgeArticleDO.getId(),getUID());
				if (knowledgeArticleUserDO!=null){
					if (knowledgeArticleUserDO.getUsed()!=null&&knowledgeArticleUserDO.getUsed()==1){
						knowledgeArticleDO.setIsUsed(1);
					}
				}
			}
			List<KnowledgeArticleDO> totals  = knowledgeArticleService.search(fields,filters,sorts);
			JSONObject result = new JSONObject();
			result.put("total",totals.size());
			result.put("detailModelList",list);
			return success(result);
		}catch (Exception e){
			return failedException2(e);
		}
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.queryById)
	@ApiOperation(value = "根据id查询文章")
	public Envelop queryByCode(
			@ApiParam(name = "id", value = "id", required = true)
			@RequestParam(value = "id", required = true)String id) throws Exception{
			try {
				KnowledgeArticleDO articleDO = knowledgeArticleDao.findById(id).orElse(null);
				if(articleDO==null){
					KnowledgeArticleDictDO articleDictDO = knowledgeArticleDictDao.findByIdAndDel(id);
					KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(articleDictDO.getId(),getUID());
					if (knowledgeArticleUserDO!=null){
						articleDictDO.setIsUsed(knowledgeArticleUserDO.getUsed());
						articleDictDO.setKnowledgeArticleUserDO(knowledgeArticleUserDO);
					}
					List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(articleDictDO.getCreateUser());
					if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
						articleDictDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
						articleDictDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
					}
					return success(articleDictDO);
				}
				KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(articleDO.getId(),getUID());
				if (knowledgeArticleUserDO!=null){
					articleDO.setIsUsed(knowledgeArticleUserDO.getUsed());
					articleDO.setKnowledgeArticleUserDO(knowledgeArticleUserDO);
				}
				List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(articleDO.getCreateUser());
				if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
					articleDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
					articleDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
				}
				return success(articleDO);
			}catch (Exception e){
				return failedException2(e);
			}
	}
	
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.deleteById)
	@ApiOperation(value = "根据id删除文章")
	public Envelop deleteById(
			@ApiParam(name = "id", value = "id,多个使用英文逗号分隔", required = true)
			@RequestParam(value = "id", required = true)String id)throws Exception {
			try {
				knowledgeArticleService.delArticle(id);
				return success("操作成功");
			}catch (Exception e){
				return failedException2(e);
			}
	}
	
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.saveArticle)
	@ApiOperation(value = "保存/更新文章")
	public Envelop saveArticle(
			@ApiParam(name = "jsonData", value = "Json数据", required = true)
			@RequestParam String jsonData)throws Exception {
		try {
			knowledgeArticleService.saveArticle(jsonData);
			return success("操作成功");
		}catch (Exception e){
			return failedException2(e);
		}
	}
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.updateIsShow)
	@ApiOperation(value = "修改文章是否展示首页")
	public Envelop updateIsShow(
			@ApiParam(name = "id", value = "id", required = true)
			@RequestParam String id,
			@ApiParam(name = "isShow", value = "isShow", required = true)
			@RequestParam Integer isShow)throws Exception {
		try {
			knowledgeArticleService.updateIsShow(id,isShow);
			return success("操作成功");
		}catch (Exception e){
			return failedException2(e);
		}
	}
	
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.reviewArticle)
	@ApiOperation(value = "审核/退回文章")
	public Envelop saveArticle(
			@ApiParam(name = "articleId", value = "文章ID")
			@RequestParam(value = "articleId", required = true) String articleId,
			@ApiParam(name = "status", value = "0未审核,1已审核,2退回")
			@RequestParam(value = "status", required = true) Integer status,
			@ApiParam(name = "reason", value = "退回理由")
			@RequestParam(value = "reason", required = false) String reason
	)throws Exception {
		try {
			knowledgeArticleService.reviewArticle(articleId,status,reason);
			return success("操作成功");
		}catch (Exception e){
			return failedException2(e);
		}
	}
	
	
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchCategoryList)
	@ApiOperation(value = "获取分类列表")
	public ListEnvelop searchCategoryList(
			@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
			@RequestParam(value = "fields", required = false) String fields,
			@ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
			@RequestParam(value = "filters", required = false) String filters,
			@ApiParam(name = "sorts", value = "排序,规则参见说明文档")
			@RequestParam(value = "sorts", required = false) String sorts,
			@ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1")
			@RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
			@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
			@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
		try {
			if(org.apache.commons.lang3.StringUtils.isNotBlank(filters)){
				filters += ";del=1";
			}else {
				filters = "del=1";
			}
			List<KnowledgeCategoryDO> list  = knowledgeCategoryService.search(fields,filters,sorts,page,pageSize);
			return success(list);
		}catch (Exception e){
			return failedListEnvelopException(e);
		}
	}
	
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.saveCategory)
	@ApiOperation(value = "保存/更新分类")
	public Envelop saveCategory(
			@ApiParam(name = "jsonData", value = "Json数据", required = true)
			@RequestParam String jsonData)throws Exception {
		try {
			knowledgeCategoryService.saveCategory(jsonData);
			return success("操作成功");
		} catch (Exception e){
			return failedException2(e);
		}
	}
	
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.updateDel)
	@ApiOperation(value = "根据分类code删除分类")
	public Envelop updateDel(
			@ApiParam(name = "id", value = "id", required = true)
			@RequestParam(value = "id", required = true)String id)throws Exception {
		try {
			Boolean flag = knowledgeCategoryService.updateDel(id);
			if (flag) {
				return success("操作成功");
			}else{
				return failed("存在一级或二级分类,删除失败");
			}
		}catch (Exception e){
			e.printStackTrace();
			return failedException2(e);
		}
		
	}
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.saveArticleDept)
	@ApiOperation(value = "设置文章发送的科室")
	public ObjEnvelop saveArticleDept(@ApiParam(name = "articleId", value = "文章ID")
	                                 @RequestParam(value = "articleId",required = true)String articleId,
	                                 @ApiParam(name = "sdJsons", value = "部门与科室关系json")
	                                 @RequestParam(value = "sdJsons",required = true)String sdJsons)throws Exception {
		try {
			return success(knowledgeArticleService.saveArticleDept(articleId,sdJsons));
		}catch (Exception e){
			return failedObjEnvelopException(e);
		}
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.findDeptByArticle)
	@ApiOperation(value = "查询文章下的科室")
	public ListEnvelop findDeptByArticle(@ApiParam(name = "articleId", value = "文章ID")
	                                    @RequestParam(value = "articleId",required = true)String articleId)throws Exception {
		try {
			return success(knowledgeArticleService.findDeptByArticle(articleId));
		}catch (Exception e){
			return failedListEnvelopException(e);
		}
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.findArticleByDept)
	@ApiOperation(value = "查询部门下发放的文章")
	public ListEnvelop findArticleByDept(@ApiParam(name = "dept", value = "科室")
	                                    @RequestParam(value = "dept",required = true)String dept)throws Exception {
		try {
			return success(knowledgeArticleService.findArticleByDept(dept));
		}catch (Exception e){
			return failedListEnvelopException(e);
		}
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.saveDeptArticle)
	@ApiOperation(value = "设置科室发送的文章")
	public ObjEnvelop saveDeptArticle(@ApiParam(name = "dept", value = "部门code")
	                                 @RequestParam(value = "dept",required = true)String dept,
	                                 @ApiParam(name = "sdJsons", value = "部门与科室关系json")
	                                 @RequestParam(value = "sdJsons",required = false)String sdJsons)throws Exception {
		try {
			return success(knowledgeArticleService.saveDeptArticle(dept,sdJsons));
		}catch (Exception e){
			return failedObjEnvelopException(e);
		}
	}
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.sendPatientBusiness)
	@ApiOperation(value = "发送文章/问卷")
	public ListEnvelop sendPatientBusiness(@ApiParam(name = "json", value = "患者业务关联表")
									  @RequestParam(value = "json",required = false)String json)throws Exception {
		try {
			ListEnvelop listEnvelop = new ListEnvelop();
			JSONArray jsonArray = JSONArray.parseArray(json);
			List<BasePatientBusinessDO> patientBusinessDOList = new ArrayList<>();
			for (int i=0;i<jsonArray.size();i++){
				JSONObject jsonObject = jsonArray.getJSONObject(i);
				BasePatientBusinessDO patientBusinessDO = toEntity(jsonObject.toJSONString(),BasePatientBusinessDO.class);
				patientBusinessDOList.add(patientBusinessDO);
			}
			listEnvelop.setDetailModelList(knowledgeArticleService.sendBusinessToPatient(patientBusinessDOList));
			return  listEnvelop;
		}catch (Exception e){
			return failedListEnvelopException(e);
		}
	}
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.setArticleUsed)
	@ApiOperation(value = "设置文章为常用/不常用")
	public ObjEnvelop setArticleUsed(@ApiParam(name = "id", value = "文章id")
									  @RequestParam(value = "id",required = true)String id,
									  @ApiParam(name = "used", value = "常用")
									  @RequestParam(value = "used",required = false)Integer used,
									 @ApiParam(name = "doctor", value = "医生code")
										 @RequestParam(value = "doctor",required = false)String doctor)throws Exception {
		try {
			return success(knowledgeArticleService.setUsed(id,used,doctor));
		}catch (Exception e){
			return failedObjEnvelopException(e);
		}
}
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchPatientArticle)
	@ApiOperation(value = "获取患者文章列表")
	public Envelop searchPatientArticle(
			@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
			@RequestParam(value = "fields", required = false) String fields,
			@ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
			@RequestParam(value = "filters", required = false) String filters,
			@ApiParam(name = "sorts", value = "排序,规则参见说明文档")
			@RequestParam(value = "sorts", required = false) String sorts,
			@ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1")
			@RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
			@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
			@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
		try {
			if(StringUtils.isBlank(filters)){
				filters=filters+"del=1";
			}else{
				filters=filters+";del=1";
			}
			List<BasePatientBusinessDO> list  = patientBusinessService.search(fields,filters,sorts,page,pageSize);
			for (BasePatientBusinessDO patientBusinessDO:list){
				Integer type = patientBusinessDO.getRelationType();
				if (type==1){
					KnowledgeArticleDO knowledgeArticleDO = knowledgeArticleService.selectById(patientBusinessDO.getRelationCode());
					if (knowledgeArticleDO!=null){
						List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
						if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
							knowledgeArticleDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
							knowledgeArticleDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
						}
					}
					patientBusinessDO.setKnowledgeArticleDO(knowledgeArticleDO);
					KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(patientBusinessDO.getRelationCode(),patientBusinessDO.getPatient());
					if (knowledgeArticleUserDO!=null){
						patientBusinessDO.setIsRead(knowledgeArticleUserDO.getIsRead());
						patientBusinessDO.setShare(knowledgeArticleUserDO.getShare());
						patientBusinessDO.setFabulous(knowledgeArticleUserDO.getFabulous());
						patientBusinessDO.setCollection(knowledgeArticleUserDO.getCollection());
					}
				}
			}
			List<BasePatientBusinessDO> totals  = patientBusinessService.search(fields,filters,sorts);
			JSONObject result = new JSONObject();
			result.put("total",totals.size());
			result.put("detailModelList",list);
			return success(result);
		}catch (Exception e){
			return failedException2(e);
		}
	}
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.setArticleCollection)
	@ApiOperation(value = "设置文章状态")
	public ObjEnvelop setArticleCollection(@ApiParam(name = "id", value = "文章id")
									 @RequestParam(value = "id",required = true)String id,
									 @ApiParam(name = "flag", value = "1收藏2阅读3点赞4分享")
									 @RequestParam(value = "flag",required = true)Integer flag,
									 @ApiParam(name = "status", value = "收藏(1收藏0未收藏)/阅读(1已读0未读)/点赞(1已赞0未赞)分享(1已分享0未分享)")
									 @RequestParam(value = "status",required = true)Integer status,
										   @ApiParam(name = "user", value = "用户code")
											   @RequestParam(value = "user",required = true)String user,
										   @ApiParam(name = "userType", value = "用户类型(1患者2医生)")
											   @RequestParam(value = "userType",required = true)String userType)throws Exception {
		try {
			return success(patientBusinessService.setCollectionById(id,flag,status,user,userType));
		}catch (Exception e){
			return failedObjEnvelopException(e);
		}
	}
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchArticleByStatus)
	@ApiOperation(value = "获取患者文章状态列表")
	public Envelop searchPatientArticleByStatus(
			@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
			@RequestParam(value = "fields", required = false) String fields,
			@ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
			@RequestParam(value = "filters", required = false) String filters,
			@ApiParam(name = "sorts", value = "排序,规则参见说明文档")
			@RequestParam(value = "sorts", required = false) String sorts,
			@ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1")
			@RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
			@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
			@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
		try {
			if(StringUtils.isBlank(filters)){
				filters=filters+"del=1";
			}else{
				filters=filters+";del=1";
			}
			List<KnowledgeArticleUserDO> list  = knowledgeArticleUserService.search(fields,filters,sorts,page,pageSize);
			for (KnowledgeArticleUserDO knowledgeArticleUserDO:list){
				Integer type = knowledgeArticleUserDO.getRelationType();
				if (type==1){
					KnowledgeArticleDO knowledgeArticleDO = knowledgeArticleService.selectById(knowledgeArticleUserDO.getRelationCode());
					if (knowledgeArticleDO!=null){
						List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
						if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
							knowledgeArticleDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
							knowledgeArticleDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
						}
					}
					knowledgeArticleUserDO.setKnowledgeArticleDO(knowledgeArticleDO);
				}
			}
			List<KnowledgeArticleUserDO> totals  = knowledgeArticleUserService.search(fields,filters,sorts);
			JSONObject result = new JSONObject();
			result.put("total",totals.size());
			result.put("detailModelList",list);
			return success(result);
		}catch (Exception e){
			return failedException2(e);
		}
	}
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.findArticleByCategoryAndName)
	@ApiOperation(value = "查询文章")
	public MixEnvelop findArticleByCategoryAndName(@ApiParam(name = "categoryFirst", value = "一级分类code")
										   @RequestParam(value = "categoryFirst",required = false)String categoryFirst,
												   @ApiParam(name = "categorySecond", value = "二级分类code")
										   @RequestParam(value = "categorySecond",required = false)String categorySecond,
												   @ApiParam(name = "keyWords", value = "关键词")
										   @RequestParam(value = "keyWords",required = false)String keyWords,
												   @ApiParam(name = "page", value = "当前页")
										   @RequestParam(value = "page",required = false)Integer page,
												   @ApiParam(name = "pageSize", value = "分页大小)")
										   @RequestParam(value = "pageSize",required = false)Integer pageSize)throws Exception {
		MixEnvelop mixEnvelop=knowledgeArticleService.findArticleByCategoryAndName(categoryFirst,categorySecond,keyWords,page,pageSize);
		return mixEnvelop;
	}
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.getArticleGroup)
	@ApiOperation(value = "查询分类")
	public MixEnvelop getGroup(){
		try {
			MixEnvelop envelop = knowledgeCategoryService.findAllGroup();
			return envelop;
		}catch (Exception e){
			return failedMixEnvelopException(e);
		}
	}
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.findPatientFavorite)
	@ApiOperation(value = "查询收藏文章")
	public Envelop findPatientFavorite(@ApiParam(name = "patient", value = "病人id")
												   @RequestParam(value = "patient",required = false)String patient,
												   @ApiParam(name = "page", value = "当前页")
												   @RequestParam(value = "page",required = false)Integer page,
												   @ApiParam(name = "pageSize", value = "分页大小)")
												   @RequestParam(value = "pageSize",required = false)Integer pageSize)throws Exception {
		try {
			return success(knowledgeArticleService.findPatientFavorite(patient,page,pageSize));
		}catch (Exception e){
			return failedException2(e);
		}
	}
    @Autowired
    private KnowledgeArticleService knowledgeArticleService;
    @Autowired
    private KnowledgeCategoryService knowledgeCategoryService;
    @Autowired
    private BasePatientBusinessService patientBusinessService;
    @Autowired
    private BaseDoctorHospitalDao doctorHospitalDao;
    @Autowired
    private KnowledgeArticleUserService knowledgeArticleUserService;
    @Autowired
    private KnowledgeArticleUserDao knowledgeArticleUserDao;
    @Autowired
    private KnowledgeArticleDao knowledgeArticleDao;
    @Autowired
    private KnowledgeArticleDictDao knowledgeArticleDictDao;
    @GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchKnowledgePageList)
    @ApiOperation(value = "获取文章列表")
    public Envelop searchKnowledgePageList(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段") @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件") @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档") @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1") @RequestParam(value = "page", required = true, defaultValue = "1") Integer page,
            @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10") @RequestParam(value = "pageSize", required = true, defaultValue = "10") Integer pageSize
    ) throws Exception {
        try {
            if (StringUtils.isBlank(filters)) {
                filters = filters + "del=1";
            } else {
                filters = filters + ";del=1";
            }
            List<KnowledgeArticleDO> list = knowledgeArticleService.search(fields, filters, sorts, page, pageSize);
            for (KnowledgeArticleDO knowledgeArticleDO : list) {
                List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
                if (doctorHospitalDOS != null && doctorHospitalDOS.size() != 0) {
                    BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
                    knowledgeArticleDO.setDeptName(doctorHospitalDO.getDeptName());
                    knowledgeArticleDO.setHospitalName(doctorHospitalDO.getOrgName());
                }
                KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(knowledgeArticleDO.getId(), getUID());
                if (knowledgeArticleUserDO != null) {
                    if (knowledgeArticleUserDO.getUsed() != null && knowledgeArticleUserDO.getUsed() == 1) {
                        knowledgeArticleDO.setIsUsed(1);
                    }
                }
            }
            List<KnowledgeArticleDO> totals = knowledgeArticleService.search(fields, filters, sorts);
            JSONObject result = new JSONObject();
            result.put("total", totals.size());
            result.put("detailModelList", list);
            return success(result);
        } catch (Exception e) {
            return failedException2(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.queryById)
    @ApiOperation(value = "根据id查询文章")
    public Envelop queryByCode(
            @ApiParam(name = "id", value = "id", required = true) @RequestParam(value = "id", required = true) String id) throws Exception {
        try {
            KnowledgeArticleDO articleDO = knowledgeArticleDao.findById(id).orElse(null);
            if (articleDO == null) {
                KnowledgeArticleDictDO articleDictDO = knowledgeArticleDictDao.findByIdAndDel(id);
                KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(articleDictDO.getId(), getUID());
                if (knowledgeArticleUserDO != null) {
                    articleDictDO.setIsUsed(knowledgeArticleUserDO.getUsed());
                    articleDictDO.setKnowledgeArticleUserDO(knowledgeArticleUserDO);
                }
                List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(articleDictDO.getCreateUser());
                if (doctorHospitalDOS != null && doctorHospitalDOS.size() != 0) {
                    articleDictDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
                    articleDictDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
                }
                return success(articleDictDO);
            }
            KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(articleDO.getId(), getUID());
            if (knowledgeArticleUserDO != null) {
                articleDO.setIsUsed(knowledgeArticleUserDO.getUsed());
                articleDO.setKnowledgeArticleUserDO(knowledgeArticleUserDO);
            }
            List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(articleDO.getCreateUser());
            if (doctorHospitalDOS != null && doctorHospitalDOS.size() != 0) {
                articleDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
                articleDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
            }
            return success(articleDO);
        } catch (Exception e) {
            return failedException2(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.deleteById)
    @ApiOperation(value = "根据id删除文章")
    public Envelop deleteById(
            @ApiParam(name = "id", value = "id,多个使用英文逗号分隔", required = true) @RequestParam(value = "id", required = true) String id) throws Exception {
        try {
            knowledgeArticleService.delArticle(id);
            return success("操作成功");
        } catch (Exception e) {
            return failedException2(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.saveArticle)
    @ApiOperation(value = "保存/更新文章")
    public Envelop saveArticle(
            @ApiParam(name = "jsonData", value = "Json数据", required = true) @RequestParam String jsonData
    ) throws Exception {
        try {
            knowledgeArticleService.saveArticle(jsonData);
            return success("操作成功");
        } catch (Exception e) {
            return failedException2(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.updateIsShow)
    @ApiOperation(value = "修改文章是否展示首页")
    public Envelop updateIsShow(
            @ApiParam(name = "id", value = "id", required = true) @RequestParam String id,
            @ApiParam(name = "isShow", value = "isShow", required = true) @RequestParam Integer isShow
    ) throws Exception {
        try {
            knowledgeArticleService.updateIsShow(id, isShow);
            return success("操作成功");
        } catch (Exception e) {
            return failedException2(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.reviewArticle)
    @ApiOperation(value = "审核/退回文章")
    public Envelop saveArticle(
            @ApiParam(name = "articleId", value = "文章ID") @RequestParam(value = "articleId", required = true) String articleId,
            @ApiParam(name = "status", value = "0未审核,1已审核,2退回") @RequestParam(value = "status", required = true) Integer status,
            @ApiParam(name = "reason", value = "退回理由") @RequestParam(value = "reason", required = false) String reason
    ) throws Exception {
        try {
            knowledgeArticleService.reviewArticle(articleId, status, reason);
            return success("操作成功");
        } catch (Exception e) {
            return failedException2(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchCategoryList)
    @ApiOperation(value = "获取分类列表")
    public ListEnvelop searchCategoryList(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段") @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件") @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档") @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1") @RequestParam(value = "page", required = true, defaultValue = "1") Integer page,
            @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10") @RequestParam(value = "pageSize", required = true, defaultValue = "10") Integer pageSize
    ) throws Exception {
        try {
            if (org.apache.commons.lang3.StringUtils.isNotBlank(filters)) {
                filters += ";del=1";
            } else {
                filters = "del=1";
            }
            List<KnowledgeCategoryDO> list = knowledgeCategoryService.search(fields, filters, sorts, page, pageSize);
            return success(list);
        } catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.saveCategory)
    @ApiOperation(value = "保存/更新分类")
    public Envelop saveCategory(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        try {
            knowledgeCategoryService.saveCategory(jsonData);
            return success("操作成功");
        } catch (Exception e) {
            return failedException2(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.updateDel)
    @ApiOperation(value = "根据分类code删除分类")
    public Envelop updateDel(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id", required = true) String id) throws Exception {
        try {
            Boolean flag = knowledgeCategoryService.updateDel(id);
            if (flag) {
                return success("操作成功");
            } else {
                return failed("存在一级或二级分类,删除失败");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return failedException2(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.saveArticleDept)
    @ApiOperation(value = "设置文章发送的科室")
    public ObjEnvelop saveArticleDept(@ApiParam(name = "articleId", value = "文章ID")
                                      @RequestParam(value = "articleId", required = true) String articleId,
                                      @ApiParam(name = "sdJsons", value = "部门与科室关系json")
                                      @RequestParam(value = "sdJsons", required = true) String sdJsons) throws Exception {
        try {
            return success(knowledgeArticleService.saveArticleDept(articleId, sdJsons));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.findDeptByArticle)
    @ApiOperation(value = "查询文章下的科室")
    public ListEnvelop findDeptByArticle(@ApiParam(name = "articleId", value = "文章ID")
                                         @RequestParam(value = "articleId", required = true) String articleId) throws Exception {
        try {
            return success(knowledgeArticleService.findDeptByArticle(articleId));
        } catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.findArticleByDept)
    @ApiOperation(value = "查询部门下发放的文章")
    public ListEnvelop findArticleByDept(@ApiParam(name = "dept", value = "科室")
                                         @RequestParam(value = "dept", required = true) String dept) throws Exception {
        try {
            return success(knowledgeArticleService.findArticleByDept(dept));
        } catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.saveDeptArticle)
    @ApiOperation(value = "设置科室发送的文章")
    public ObjEnvelop saveDeptArticle(
            @ApiParam(name = "dept", value = "部门code") @RequestParam(value = "dept", required = true) String dept,
            @ApiParam(name = "sdJsons", value = "部门与科室关系json") @RequestParam(value = "sdJsons", required = false) String sdJsons
    ) throws Exception {
        try {
            return success(knowledgeArticleService.saveDeptArticle(dept, sdJsons));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.sendPatientBusiness)
    @ApiOperation(value = "发送文章/问卷")
    public ListEnvelop sendPatientBusiness(
            @ApiParam(name = "json", value = "患者业务关联表") @RequestParam(value = "json", required = false) String json
    ) throws Exception {
        try {
            ListEnvelop listEnvelop = new ListEnvelop();
            JSONArray jsonArray = JSONArray.parseArray(json);
            List<BasePatientBusinessDO> patientBusinessDOList = new ArrayList<>();
            for (int i = 0; i < jsonArray.size(); i++) {
                JSONObject jsonObject = jsonArray.getJSONObject(i);
                BasePatientBusinessDO patientBusinessDO = toEntity(jsonObject.toJSONString(), BasePatientBusinessDO.class);
                patientBusinessDOList.add(patientBusinessDO);
            }
            listEnvelop.setDetailModelList(knowledgeArticleService.sendBusinessToPatient(patientBusinessDOList));
            return listEnvelop;
        } catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.setArticleUsed)
    @ApiOperation(value = "设置文章为常用/不常用")
    public ObjEnvelop setArticleUsed(
            @ApiParam(name = "id", value = "文章id") @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "used", value = "常用") @RequestParam(value = "used", required = false) Integer used,
            @ApiParam(name = "doctor", value = "医生code") @RequestParam(value = "doctor", required = false) String doctor
    ) throws Exception {
        try {
            return success(knowledgeArticleService.setUsed(id, used, doctor));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchPatientArticle)
    @ApiOperation(value = "获取患者文章列表")
    public Envelop searchPatientArticle(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段") @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件") @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档") @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1") @RequestParam(value = "page", required = true, defaultValue = "1") Integer page,
            @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10") @RequestParam(value = "pageSize", required = true, defaultValue = "10") Integer pageSize
    ) throws Exception {
        try {
            if (StringUtils.isBlank(filters)) {
                filters = filters + "del=1";
            } else {
                filters = filters + ";del=1";
            }
            List<BasePatientBusinessDO> list = patientBusinessService.search(fields, filters, sorts, page, pageSize);
            for (BasePatientBusinessDO patientBusinessDO : list) {
                Integer type = patientBusinessDO.getRelationType();
                if (type == 1) {
                    KnowledgeArticleDO knowledgeArticleDO = knowledgeArticleService.selectById(patientBusinessDO.getRelationCode());
                    if (knowledgeArticleDO != null) {
                        List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
                        if (doctorHospitalDOS != null && doctorHospitalDOS.size() != 0) {
                            knowledgeArticleDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
                            knowledgeArticleDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
                        }
                    }
                    patientBusinessDO.setKnowledgeArticleDO(knowledgeArticleDO);
                    KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(patientBusinessDO.getRelationCode(), patientBusinessDO.getPatient());
                    if (knowledgeArticleUserDO != null) {
                        patientBusinessDO.setIsRead(knowledgeArticleUserDO.getIsRead());
                        patientBusinessDO.setShare(knowledgeArticleUserDO.getShare());
                        patientBusinessDO.setFabulous(knowledgeArticleUserDO.getFabulous());
                        patientBusinessDO.setCollection(knowledgeArticleUserDO.getCollection());
                    }
                }
            }
            List<BasePatientBusinessDO> totals = patientBusinessService.search(fields, filters, sorts);
            JSONObject result = new JSONObject();
            result.put("total", totals.size());
            result.put("detailModelList", list);
            return success(result);
        } catch (Exception e) {
            return failedException2(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.setArticleCollection)
    @ApiOperation(value = "设置文章状态")
    public ObjEnvelop setArticleCollection(
            @ApiParam(name = "id", value = "文章id") @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "flag", value = "1收藏2阅读3点赞4分享") @RequestParam(value = "flag", required = true) Integer flag,
            @ApiParam(name = "status", value = "收藏(1收藏0未收藏)/阅读(1已读0未读)/点赞(1已赞0未赞)分享(1已分享0未分享)") @RequestParam(value = "status", required = true) Integer status,
            @ApiParam(name = "user", value = "用户code") @RequestParam(value = "user", required = true) String user,
            @ApiParam(name = "userType", value = "用户类型(1患者2医生)") @RequestParam(value = "userType", required = true) String userType
    ) throws Exception {
        try {
            return success(patientBusinessService.setCollectionById(id, flag, status, user, userType));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchArticleByStatus)
    @ApiOperation(value = "获取患者文章状态列表")
    public Envelop searchPatientArticleByStatus(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段") @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件") @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档") @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1") @RequestParam(value = "page", required = true, defaultValue = "1") Integer page,
            @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10") @RequestParam(value = "pageSize", required = true, defaultValue = "10") Integer pageSize
    ) throws Exception {
        try {
            if (StringUtils.isBlank(filters)) {
                filters = filters + "del=1";
            } else {
                filters = filters + ";del=1";
            }
            List<KnowledgeArticleUserDO> list = knowledgeArticleUserService.search(fields, filters, sorts, page, pageSize);
            for (KnowledgeArticleUserDO knowledgeArticleUserDO : list) {
                Integer type = knowledgeArticleUserDO.getRelationType();
                if (type == 1) {
                    KnowledgeArticleDO knowledgeArticleDO = knowledgeArticleService.selectById(knowledgeArticleUserDO.getRelationCode());
                    if (knowledgeArticleDO != null) {
                        List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
                        if (doctorHospitalDOS != null && doctorHospitalDOS.size() != 0) {
                            knowledgeArticleDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
                            knowledgeArticleDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
                        }
                    }
                    knowledgeArticleUserDO.setKnowledgeArticleDO(knowledgeArticleDO);
                }
            }
            List<KnowledgeArticleUserDO> totals = knowledgeArticleUserService.search(fields, filters, sorts);
            JSONObject result = new JSONObject();
            result.put("total", totals.size());
            result.put("detailModelList", list);
            return success(result);
        } catch (Exception e) {
            return failedException2(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.findArticleByCategoryAndName)
    @ApiOperation(value = "查询文章")
    public MixEnvelop findArticleByCategoryAndName(
            @ApiParam(name = "categoryFirst", value = "一级分类code") @RequestParam(value = "categoryFirst", required = false) String categoryFirst,
            @ApiParam(name = "categorySecond", value = "二级分类code") @RequestParam(value = "categorySecond", required = false) String categorySecond,
            @ApiParam(name = "keyWords", value = "关键词") @RequestParam(value = "keyWords", required = false) String keyWords,
            @ApiParam(name = "page", value = "当前页") @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "pageSize", value = "分页大小)") @RequestParam(value = "pageSize", required = false) Integer pageSize
    ) throws Exception {
        MixEnvelop mixEnvelop = knowledgeArticleService.findArticleByCategoryAndName(categoryFirst, categorySecond, keyWords, page, pageSize);
        return mixEnvelop;
    }
    @GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.getArticleGroup)
    @ApiOperation(value = "查询分类")
    public MixEnvelop getGroup() {
        try {
            MixEnvelop envelop = knowledgeCategoryService.findAllGroup();
            return envelop;
        } catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.findPatientFavorite)
    @ApiOperation(value = "查询收藏文章")
    public Envelop findPatientFavorite(
            @ApiParam(name = "patient", value = "病人id") @RequestParam(value = "patient", required = false) String patient,
            @ApiParam(name = "page", value = "当前页") @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "pageSize", value = "分页大小)") @RequestParam(value = "pageSize", required = false) Integer pageSize
    ) throws Exception {
        try {
            return success(knowledgeArticleService.findPatientFavorite(patient, page, pageSize));
        } catch (Exception e) {
            return failedException2(e);
        }
    }
    /**
     * 查询发送记录
     * base_patient_business
     */
    @PostMapping(value = "/findSendLogList")
    @ApiOperation(value = "查询医生的发送记录")
    public Envelop findSendLogList(
            @ApiParam(name = "doctorCode", value = "病人id") @RequestParam(value = "doctorCode", required = false) String doctorCode,
            @ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient", required = false) String patient,
            @ApiParam(name = "page", value = "当前页") @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "pageSize", value = "分页大小)") @RequestParam(value = "pageSize", required = false) Integer pageSize
    ) throws Exception {
        try {
            HashMap<String, Object> result = knowledgeArticleService.findSendLogList(doctorCode,patient, page, pageSize);
            return success(result);
        } catch (Exception e) {
            return failedException2(e);
        }
    }
}

+ 13 - 20
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -1884,16 +1884,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @GetMapping(value = "searchKnowledgeDictPageList")
    @ApiOperation(value = "获取文章列表")
    public Envelop searchKnowledgeDictPageList(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1")
            @RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
            @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
            @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段") @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件") @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档") @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1") @RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
            @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10") @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize
    )throws Exception{
        try {
            if(org.apache.commons.lang.StringUtils.isBlank(filters)){
@ -1931,16 +1927,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchKnowledgePageList)
    @ApiOperation(value = "获取文章列表")
    public Envelop searchKnowledgePageList(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1")
            @RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
            @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
            @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段") @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件") @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档") @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1") @RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
            @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10") @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize
    )throws Exception{
        try {
            if(org.apache.commons.lang.StringUtils.isBlank(filters)){
@ -2033,6 +2025,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            return failedListEnvelopException2(e);
        }
    }
    // /open/noLogin/getArticleGroup
    @GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.getArticleGroup)
    @ApiOperation(value = "查询分类")
    public MixEnvelop getGroup(){

+ 69 - 82
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/specialist/BaseDiseaseHospitalController.java

@ -2,11 +2,8 @@ package com.yihu.jw.hospital.endpoint.specialist;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
import com.yihu.jw.entity.specialist.BaseDiseaseHospitalDO;
import com.yihu.jw.entity.specialist.rehabilitation.PatientMedicalRecordsDO;
import com.yihu.jw.hospital.disease.service.BaseDiseaseHospitalService;
import com.yihu.jw.restmodel.specialist.SurveyScreenResultVo;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
@ -14,14 +11,9 @@ import com.yihu.jw.wlyy.service.WlyyBusinessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.BaseDiseaseHospital.PREFIX)
@ -153,6 +145,7 @@ public class BaseDiseaseHospitalController extends EnvelopRestEndpoint {
    public Envelop getDoctorInfo_IJK(
            @ApiParam(name = "idCard", value = "身份证", required = false) @RequestParam(value = "idCard", required = false) String idCard) {
        try {
            System.out.println("参数==>idCard=>" + idCard);
            return success(wlyyBusinessService.getDoctorInfo_IJK(idCard));
        } catch (Exception e) {
            return failedException(e);
@ -176,23 +169,23 @@ public class BaseDiseaseHospitalController extends EnvelopRestEndpoint {
    }
    @RequestMapping(value = "/getScreeList_IJK",method = RequestMethod.GET)
    @RequestMapping(value = "/getScreeList_IJK", method = RequestMethod.GET)
    @ApiOperation(value = "专科医生获取筛查记录列表")
    public Envelop getScreeList_IJK(
            @ApiParam(name = "doctor", value = "专科医生ID")@RequestParam(value = "doctor",required = false)String doctor,
            @ApiParam(value = "处理方式(1已预约 2已跟踪 3已接诊 4待处理),多个用逗号隔开")@RequestParam(value = "type",required = false) Integer type,
            @ApiParam(name = "doctor", value = "专科医生ID") @RequestParam(value = "doctor", required = false) String doctor,
            @ApiParam(value = "处理方式(1已预约 2已跟踪 3已接诊 4待处理),多个用逗号隔开") @RequestParam(value = "type", required = false) String type,
            @ApiParam(value = "搜索居民的姓名或身份证") @RequestParam(value = "patientName", required = false) String patientName,
            @ApiParam(value = "是否高危预警(0否 1是)") @RequestParam(value = "isDanger", required = false) String isDanger,
            @ApiParam(value = "疾病类型,多个用逗号隔开") @RequestParam(value = "diseaseType", required = false) String diseaseType,
            @ApiParam(value = "传1则根据类型查一条数据")@RequestParam(value = "filterType",required = false,defaultValue = "0")Integer filterType,
            @ApiParam(value = "居民code")@RequestParam(value = "patientCode",required = false)String patientCode,
            @ApiParam(value = "当前页")@RequestParam(value = "pageNo") int pageNo,
            @ApiParam(value = "显示记录数")@RequestParam(value = "pageSize") int pageSize
    ){
            @ApiParam(value = "传1则根据类型查一条数据") @RequestParam(value = "filterType", required = false, defaultValue = "0") Integer filterType,
            @ApiParam(value = "居民code") @RequestParam(value = "patientCode", required = false) String patientCode,
            @ApiParam(value = "当前页") @RequestParam(value = "pageNo") int pageNo,
            @ApiParam(value = "显示记录数") @RequestParam(value = "pageSize") int pageSize
    ) {
        try {
            JSONObject result = wlyyBusinessService.getScreeList_IJK(doctor,type,pageNo,pageSize,patientName, isDanger, diseaseType,filterType,patientCode);
            JSONObject result = wlyyBusinessService.getScreeList_IJK(doctor, type, pageNo, pageSize, patientName, isDanger, diseaseType, filterType, patientCode);
            return success(result);
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
@ -210,40 +203,39 @@ public class BaseDiseaseHospitalController extends EnvelopRestEndpoint {
    }
    @RequestMapping(value = "queryByConsultCode_IJK",method = RequestMethod.GET)
    @RequestMapping(value = "queryByConsultCode_IJK", method = RequestMethod.GET)
    @ApiOperation("根据咨询code查询关联业务项详情")
    public Envelop queryByConsultCode_IJK(
            @ApiParam(name = "code", value = "咨询code") @RequestParam(value = "code", required = true) String code,
            @ApiParam(name = "type", value = "咨询类型") @RequestParam(value = "type", required = true) Integer type){
        try{
            JSONObject result = wlyyBusinessService.queryByConsultCode_IJK(code,type);
            @ApiParam(name = "type", value = "咨询类型") @RequestParam(value = "type", required = true) Integer type) {
        try {
            JSONObject result = wlyyBusinessService.queryByConsultCode_IJK(code, type);
            return success(result);
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @RequestMapping(value = "getScreenResultDetail_IJK",method = RequestMethod.GET)
    @RequestMapping(value = "getScreenResultDetail_IJK", method = RequestMethod.GET)
    @ApiOperation(value = "查看筛查结果记录详情")
    public Envelop getScreenResultDetail_IJK(@ApiParam(value = "筛查结果唯一code")@RequestParam(value = "code") String code) {
        try{
    public Envelop getScreenResultDetail_IJK(@ApiParam(value = "筛查结果唯一code") @RequestParam(value = "code") String code) {
        try {
            JSONObject result = wlyyBusinessService.getScreenResultDetail_IJK(code);
            return success(result);
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @RequestMapping(value = "/findPatientSignFamily_IJK", method = RequestMethod.GET)
    @ApiOperation(value = "获取居民所有专科医生签约信息")
    public Envelop findPatientSignFamily_IJK(@ApiParam(name = "patient", value = "居民code") @RequestParam(required = true)String patient)  {
        try{
    public Envelop findPatientSignFamily_IJK(@ApiParam(name = "patient", value = "居民code") @RequestParam(required = true) String patient) {
        try {
            JSONObject result = wlyyBusinessService.findPatientSignFamily_IJK(patient);
            return success(result);
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
@ -251,23 +243,23 @@ public class BaseDiseaseHospitalController extends EnvelopRestEndpoint {
    @RequestMapping(value = "getSpecialDisease_IJK", method = RequestMethod.GET)
    @ApiOperation(value = "获取专科疾病类型")
    public Envelop getSpecialDisease_IJK() {
        try{
        try {
            JSONObject result = wlyyBusinessService.getSpecialDisease_IJK();
            return success(result);
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @RequestMapping(value = "last_IJK",method = RequestMethod.GET)
    @RequestMapping(value = "last_IJK", method = RequestMethod.GET)
    @ApiOperation("患者最新健康指标信息")
    public Envelop last_IJK(
            @ApiParam(name="patient",value="患者代码",defaultValue = "") @RequestParam(value="patient",required = true) String patient) {
        try{
            @ApiParam(name = "patient", value = "患者代码", defaultValue = "") @RequestParam(value = "patient", required = true) String patient) {
        try {
            JSONObject result = wlyyBusinessService.last_IJK(patient);
            return success(result);
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
@ -278,11 +270,11 @@ public class BaseDiseaseHospitalController extends EnvelopRestEndpoint {
     */
    @RequestMapping(value = "/patient_IJK")
    @ApiOperation("查询居民信息")
    public Envelop patient_IJK(@ApiParam(name="patient",value="患者代码",defaultValue = "") @RequestParam(value="patient",required = true) String patient) {
        try{
    public Envelop patient_IJK(@ApiParam(name = "patient", value = "患者代码", defaultValue = "") @RequestParam(value = "patient", required = true) String patient) {
        try {
            JSONObject result = wlyyBusinessService.patient_IJK(patient);
            return success(result);
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
@ -290,10 +282,10 @@ public class BaseDiseaseHospitalController extends EnvelopRestEndpoint {
    @RequestMapping(value = "getPatientSpecialAndFamilyDoctor_IJK", method = RequestMethod.GET)
    @ApiOperation("获取为某患者创建康复计划的医生专科列表、家庭医生")
    public Envelop getPatientSpecialAndFamilyDoctor_IJK(@RequestParam("patientCode") String patientCode) {
        try{
        try {
            JSONObject result = wlyyBusinessService.getPatientSpecialAndFamilyDoctor_IJK(patientCode);
            return success(result);
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
@ -303,10 +295,10 @@ public class BaseDiseaseHospitalController extends EnvelopRestEndpoint {
    @ApiOperation("康复计划主页动态")
    public Envelop selectAllCompleteServiceItemsByPatient(
            @ApiParam(name = "patient", value = "居民Code", required = true) @RequestParam(value = "patient", required = true) String patient) {
        try{
        try {
            JSONObject result = wlyyBusinessService.selectAllCompleteServiceItemsByPatient_IJK(patient);
            return success(result);
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
@ -317,10 +309,10 @@ public class BaseDiseaseHospitalController extends EnvelopRestEndpoint {
            @ApiParam(name = "patient", value = "居民Code", required = true) @RequestParam(value = "patient", required = true) String patient,
            @ApiParam(name = "eventType", value = "1门诊 2住院", required = false) @RequestParam(value = "eventType", required = false) String eventType
    ) {
        try{
            JSONObject result = wlyyBusinessService.selectAllPlaneByPatient_IJK(patient,eventType);
        try {
            JSONObject result = wlyyBusinessService.selectAllPlaneByPatient_IJK(patient, eventType);
            return success(result);
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
@ -336,10 +328,10 @@ public class BaseDiseaseHospitalController extends EnvelopRestEndpoint {
            @ApiParam(name = "status", value = "任务状态(0未完成,1已完成,2已预约)", required = false) @RequestParam(value = "status", required = false) Integer status,
            @ApiParam(name = "taskExecutor", value = "任务执行人:0全部;1我的任务:2他人任务", required = false) @RequestParam(value = "taskExecutor", required = false, defaultValue = "0") String taskExecutor
    ) {
        try{
            JSONObject result = wlyyBusinessService.calendarPlanDetailListBypatient_IJK(executeStartTime,executeEndTime,patient,searchTask,doctorCode,status,taskExecutor);
        try {
            JSONObject result = wlyyBusinessService.calendarPlanDetailListBypatient_IJK(executeStartTime, executeEndTime, patient, searchTask, doctorCode, status, taskExecutor);
            return success(result);
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
@ -352,12 +344,12 @@ public class BaseDiseaseHospitalController extends EnvelopRestEndpoint {
            @ApiParam(name = "planId", value = "计划id", required = true) @RequestParam(value = "planId", required = true) String planId,
            @ApiParam(name = "searchTask", value = "快速查找任务:(1、我的任务,2、健康教育,3、健康指导,4、随访,5、复诊)", required = false) @RequestParam(value = "searchTask", required = false) Integer searchTask,
            @ApiParam(name = "doctorCode", value = "医生code(专科医生、家庭医生)", required = false) @RequestParam(value = "doctorCode", required = false) String doctorCode,
            @ApiParam(name = "status", value = "任务状态(0未完成,1已完成,2已预约)", required = false) @RequestParam(value = "status", required = false) Integer status
            @ApiParam(name = "status", value = "任务状态(0未完成,1已完成,2已预约)", required = false) @RequestParam(value = "status", required = false) String status
    ) {
        try{
            JSONObject result = wlyyBusinessService.calendarPlanDetailItems_IJK(executeStartTime,executeEndTime,planId,searchTask,doctorCode,status);
        try {
            JSONObject result = wlyyBusinessService.calendarPlanDetailItems_IJK(executeStartTime, executeEndTime, planId, searchTask, doctorCode, status);
            return success(result);
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
@ -368,10 +360,10 @@ public class BaseDiseaseHospitalController extends EnvelopRestEndpoint {
    public Envelop planSchedule_IJK(
            @ApiParam(name = "planId", value = "计划id", required = true) @RequestParam(value = "planId", required = true) String planId,
            @ApiParam(name = "patientCode", value = "居民code", required = true) @RequestParam(value = "patientCode", required = true) String patientCode) {
        try{
            JSONObject result = wlyyBusinessService.planSchedule_IJK(planId,patientCode);
        try {
            JSONObject result = wlyyBusinessService.planSchedule_IJK(planId, patientCode);
            return success(result);
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
@ -381,10 +373,10 @@ public class BaseDiseaseHospitalController extends EnvelopRestEndpoint {
    @ApiOperation("获取医院病历")
    public Envelop selectByMedicalCode_IJK(
            @ApiParam(name = "medical", value = "住院code", required = true) @RequestParam(value = "medical", required = true) String medical) {
        try{
        try {
            JSONObject result = wlyyBusinessService.selectByMedicalCode_IJK(medical);
            return success(result);
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
@ -393,29 +385,28 @@ public class BaseDiseaseHospitalController extends EnvelopRestEndpoint {
    @RequestMapping(value = "selectPlanServerDoctor_IJK", method = RequestMethod.POST)
    @ApiOperation("康复管理-康复计划的服务医生")
    public Envelop selectPlanServerDoctor_IJK(@ApiParam(name = "planId", value = "康复计划ID") @RequestParam(value = "planId", required = true) String planId) {
        try{
        try {
            JSONObject result = wlyyBusinessService.selectPlanServerDoctor_IJK(planId);
            return success(result);
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @RequestMapping(value = "getRehabilitationPlanLog_IJK",method = RequestMethod.GET)
    @RequestMapping(value = "getRehabilitationPlanLog_IJK", method = RequestMethod.GET)
    @ApiOperation(value = "获取康复计划修改记录")
    public Envelop getRehabilitationPlanLog_IJK(
            @ApiParam(name = "planId",value = "康复计划Id",required = true) @RequestParam(value = "planId",required = true) String planId){
        try{
            @ApiParam(name = "planId", value = "康复计划Id", required = true) @RequestParam(value = "planId", required = true) String planId) {
        try {
            JSONObject result = wlyyBusinessService.getRehabilitationPlanLog_IJK(planId);
            return success(result);
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @RequestMapping(value = "calendarPlanDetailList_IJK", method = RequestMethod.GET)
    @ApiOperation("康复管理-康复计划按列表展示-限定频次")
    public Envelop calendarPlanDetailList_IJK(
@ -424,12 +415,12 @@ public class BaseDiseaseHospitalController extends EnvelopRestEndpoint {
            @ApiParam(name = "planId", value = "计划id", required = true) @RequestParam(value = "planId", required = true) String planId,
            @ApiParam(name = "searchTask", value = "快速查找任务:(1电话/短信关怀,2康复咨询,3健康监测,4上门服务,5康复指导,6康复随访,7康复复诊)", required = false) @RequestParam(value = "searchTask", required = false) Integer searchTask,
            @ApiParam(name = "doctorCode", value = "医生code(专科医生、家庭医生)", required = false) @RequestParam(value = "doctorCode", required = false) String doctorCode,
            @ApiParam(name = "status", value = "任务状态(0未完成,1已完成,2已预约)", required = false)@RequestParam(value = "status", required = false) Integer status,
            @ApiParam(name = "status", value = "任务状态(0未完成,1已完成,2已预约)", required = false) @RequestParam(value = "status", required = false) Integer status,
            @ApiParam(name = "taskExecutor", value = "任务执行人:0全部;1我的任务:2他人任务", required = false) @RequestParam(value = "taskExecutor", required = false, defaultValue = "0") String taskExecutor) {
        try{
            JSONObject result = wlyyBusinessService.calendarPlanDetailList_IJK(executeStartTime,executeEndTime,planId,searchTask,doctorCode,status,taskExecutor );
        try {
            JSONObject result = wlyyBusinessService.calendarPlanDetailList_IJK(executeStartTime, executeEndTime, planId, searchTask, doctorCode, status, taskExecutor);
            return success(result);
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
@ -438,11 +429,11 @@ public class BaseDiseaseHospitalController extends EnvelopRestEndpoint {
    @RequestMapping(value = "getPatientDrugList_IJK", method = RequestMethod.GET)
    @ApiOperation("获取居民出院带药列表")
    public Envelop getPatientDrugList_IJK(@ApiParam(name = "patient", value = "居民Code", required = true)
                                     @RequestParam(value = "patient", required = true) String patient) {
        try{
                                          @RequestParam(value = "patient", required = true) String patient) {
        try {
            JSONObject result = wlyyBusinessService.getPatientDrugList_IJK(patient);
            return success(result);
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
@ -476,10 +467,10 @@ public class BaseDiseaseHospitalController extends EnvelopRestEndpoint {
            @ApiParam(name = "turnDownState", value = "下转状态 0全部;1已下转;2已接受;3未下转", required = false) @RequestParam(value = "turnDownState", required = false, defaultValue = "0") String turnDownState,
            @ApiParam(name = "eventType", value = "1为门诊  2或者空为住院", required = false) @RequestParam(value = "eventType", required = false) String eventType
    ) {
        try{
            JSONObject result = wlyyBusinessService.selectBySpecialistDoctor_IJK(doctorCode,doctorType,patientInfo,diseaseCode,level,area,page,pageSize,filterPlan,turnDownState,eventType);
        try {
            JSONObject result = wlyyBusinessService.selectBySpecialistDoctor_IJK(doctorCode, doctorType, patientInfo, diseaseCode, level, area, page, pageSize, filterPlan, turnDownState, eventType);
            return success(result);
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
@ -490,17 +481,13 @@ public class BaseDiseaseHospitalController extends EnvelopRestEndpoint {
    public Envelop getPatientCount_IJK(
            @ApiParam(name = "doctor", value = "医生code", required = false) @RequestParam(value = "doctor", required = false) String doctor
    ) {
        try{
        try {
            JSONObject result = wlyyBusinessService.getPatientCount_IJK(doctor);
            return success(result);
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
}

+ 2 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/BasePatientBusinessService.java

@ -167,6 +167,8 @@ public class BasePatientBusinessService extends BaseJpaService<BasePatientBusine
		}
		return knowledgeArticleDO;
	}
	public void setUsed(String id,Integer used,String doctor){
		WlyySurveyTemplateDO wlyySurveyTemplateDO = surveyTemplateDao.findById(id).orElse(null);
		BaseDoctorDO doctorDO = doctorDao.findById(doctor).orElse(null);

+ 12 - 4
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeArticleService.java

@ -32,10 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
/**
 * 健康文章业务层代码
@ -299,6 +296,11 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO,
                        object.put("img", knowledgeArticleDO.getImage());
                    }
                    imUtil.sendImMsg(patientBusinessDO.getDoctor(), patientBusinessDO.getDoctorName(), patientBusinessDO.getSessionId(), "4", object.toJSONString(), "1", null);
                    //增加指导发送次数
                    String sql01 = "UPDATE wlyy_doctor_guidance_temp  " +
                            "SET send_times=send_times+1 " +
                            "WHERE CODE='" + patientBusinessDO.getRelationCode() + "'  AND OWNER = '" + patientBusinessDO.getDoctor() + "'";
                    jdbcTemplate.update(sql01);
                } else {
                    WlyySurveyUserDO wlyySurveyUserDO = new WlyySurveyUserDO();
                    String doctor = patientBusinessDO.getDoctor();
@ -464,4 +466,10 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO,
    }
    public HashMap<String, Object> findSendLogList(String doctorCode, String patient, Integer page, Integer pageSize) {
        HashMap<String, Object> resultMap = new HashMap<>();
        String sql = " select * from base_patient_business a inner  ";
        return null;
    }
}

+ 33 - 2
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/common/LabelController.java

@ -61,10 +61,41 @@ public class LabelController extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "findLabelPatientGroupCount")
    @ApiOperation(value = "查询居民标签分组数量")
    public ListEnvelop findLabelPatientGroupCount(
            @ApiParam(name = "name", value = "姓名") @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "labelType", value = "1健康情况 2疾病类型 3专病类型 4自定义标签") @RequestParam(value = "labelType", required = false) String labelType
    ) {
        try {
            return ListEnvelop.getSuccess("查询成功", labelService.findLabelPatientGroupCount(name,labelType));
        } catch (Exception e) {
            e.printStackTrace();
            return ListEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "findLabelPatientList")
    @ApiOperation(value = "查询居民标签分组数据")
    public ListEnvelop findLabelPatientList(
            @ApiParam(name = "name", value = "姓名") @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "labelType", value = "1健康情况 2疾病类型 3专病类型 4自定义标签") @RequestParam(value = "labelType", required = false) String labelType,
            @ApiParam(name = "labelCode", value = "类型") @RequestParam(value = "labelCode", required = false) String labelCode
    ) {
        try {
            return ListEnvelop.getSuccess("查询成功", labelService.findLabelPatientList(name,labelType,labelCode));
        } catch (Exception e) {
            e.printStackTrace();
            return ListEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "findPatientLabel")
    @ApiOperation(value = "查询居民标签列表")
    public ListEnvelop findPatientLabel(@ApiParam(name = "patient", value = "居民id")
                                        @RequestParam(value = "patient", required = true) String patient) {
    public ListEnvelop findPatientLabel(
            @ApiParam(name = "patient", value = "居民id") @RequestParam(value = "patient", required = true) String patient
    ) {
        try {
            return ListEnvelop.getSuccess("查询成功", labelService.findByPatient(patient));
        } catch (Exception e) {

+ 74 - 31
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/common/service/LabelService.java

@ -36,21 +36,21 @@ public class LabelService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public List<WlyyPatientLabelDO> findByPatient(String patient){
    public List<WlyyPatientLabelDO> findByPatient(String patient) {
        return patientLabelDao.findByPatient(patient);
    }
    //查询专病的康复管理未执行完成数量
    public int existDisease(String patient,String disease){
    public int existDisease(String patient, String disease) {
        String sql = "SELECT COUNT(id) from wlyy_patient_rehabilitation_plan " +
                " WHERE patient='"+patient+"' and disease ='"+disease+"' and `status` in (1,3)";
        return jdbcTemplate.queryForObject(sql,Integer.class);
                " WHERE patient='" + patient + "' and disease ='" + disease + "' and `status` in (1,3)";
        return jdbcTemplate.queryForObject(sql, Integer.class);
    }
    //添加专病标签
    public void addDiseaseLable(String patient,String disease,String diseaseName){
    public void addDiseaseLable(String patient, String disease, String diseaseName) {
        try {
            if(patientLabelDao.findByPatient(patient,disease,"3").size()==0){
            if (patientLabelDao.findByPatient(patient, disease, "3").size() == 0) {
                WlyyPatientLabelDO label = new WlyyPatientLabelDO();
                label.setCzrq(new Date());
                label.setIsSystem(0);
@ -60,52 +60,52 @@ public class LabelService {
                label.setLabelType("3");
                patientLabelDao.save(label);
            }
        }catch (Exception e){
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    //查询标签新增日志
    public PageEnvelop patientLabelLogPage(String patient, String doctor, String labelType, int page, int size){
    public PageEnvelop patientLabelLogPage(String patient, String doctor, String labelType, int page, int size) {
        String sql = "select * ";
        String countSql = "select count(*) ";
        String filter = " from wlyy_patient_label_log where 1=1 ";
        String orderBy = " order by create_time desc limit "+(page-1)*size+","+size;
        if(StringUtils.isNotBlank(patient)){
            filter += " and patient = '"+patient+"' ";
        String orderBy = " order by create_time desc limit " + (page - 1) * size + "," + size;
        if (StringUtils.isNotBlank(patient)) {
            filter += " and patient = '" + patient + "' ";
        }
        if(StringUtils.isNotBlank(doctor)){
            filter += " and doctor = '"+doctor+"' ";
        if (StringUtils.isNotBlank(doctor)) {
            filter += " and doctor = '" + doctor + "' ";
        }
        if(StringUtils.isNotBlank(labelType)){
            filter += " and label_type = '"+labelType+"' ";
        if (StringUtils.isNotBlank(labelType)) {
            filter += " and label_type = '" + labelType + "' ";
        }
        List<WlyyPatientLabelLogDO> logDOS = jdbcTemplate.query(sql+filter+orderBy,new BeanPropertyRowMapper<>(WlyyPatientLabelLogDO.class));
        Long count = jdbcTemplate.queryForObject(countSql+filter,Long.class);
        return PageEnvelop.getSuccessListWithPage("查询成功",logDOS,page,size,count);
        List<WlyyPatientLabelLogDO> logDOS = jdbcTemplate.query(sql + filter + orderBy, new BeanPropertyRowMapper<>(WlyyPatientLabelLogDO.class));
        Long count = jdbcTemplate.queryForObject(countSql + filter, Long.class);
        return PageEnvelop.getSuccessListWithPage("查询成功", logDOS, page, size, count);
    }
    //保存居民标签
    @Transactional
    public void savePatientLabel(List<WlyyPatientLabelDO> labelDOS, String patient,String doctor) throws Exception{
    public void savePatientLabel(List<WlyyPatientLabelDO> labelDOS, String patient, String doctor) throws Exception {
        List<WlyyPatientLabelDO> patientLabelDOS = patientLabelDao.findByPatient(patient);
        Map<String,String> map = new HashMap<>();
        for (WlyyPatientLabelDO label:patientLabelDOS){
        Map<String, String> map = new HashMap<>();
        for (WlyyPatientLabelDO label : patientLabelDOS) {
            String labelCode = label.getLabelCode();
            String labelType = label.getLabelType();
            map.put(labelType+"_"+labelCode,label.getLabelName());
            map.put(labelType + "_" + labelCode, label.getLabelName());
        }
        patientLabelDao.deleteByPatient(patient);
        List<WlyyPatientLabelLogDO> labelLogDOS = new ArrayList<>();
        Date now = new Date();
        BaseDoctorDO doctorDO = doctorDao.findByIdAndDel(doctor);
        if(labelDOS!=null&&labelDOS.size()>0){
            for (WlyyPatientLabelDO label:labelDOS){
        if (labelDOS != null && labelDOS.size() > 0) {
            for (WlyyPatientLabelDO label : labelDOS) {
                label.setPatient(patient);
                label.setCzrq(new Date());
                label.setIsSystem(0);
                String key = label.getLabelType()+"_"+label.getLabelCode();
                if(!map.containsKey(key)){
                String key = label.getLabelType() + "_" + label.getLabelCode();
                if (!map.containsKey(key)) {
                    WlyyPatientLabelLogDO logDO = new WlyyPatientLabelLogDO();
                    logDO.setCreateTime(now);
                    logDO.setPatient(patient);
@ -119,20 +119,20 @@ public class LabelService {
                }
            }
            patientLabelDao.saveAll(labelDOS);
            if(labelLogDOS.size()>0){
            if (labelLogDOS.size() > 0) {
                logDao.saveAll(labelLogDOS);
            }
        }
    }
    //添加自定义标签字典
    public WlyyHospitalSysDictDO addLabelDict(String labelName) throws Exception{
        if(StringUtils.isBlank(labelName)){
    public WlyyHospitalSysDictDO addLabelDict(String labelName) throws Exception {
        if (StringUtils.isBlank(labelName)) {
            throw new ServiceException("请填写分组名称");
        }
        labelName = labelName.trim();
        List<WlyyHospitalSysDictDO> dictDOList = wlyyHospitalSysDictDao.findByDictNameAndDictCode("patient_lable_custom",labelName);
        if(dictDOList.size()>0){
        List<WlyyHospitalSysDictDO> dictDOList = wlyyHospitalSysDictDao.findByDictNameAndDictCode("patient_lable_custom", labelName);
        if (dictDOList.size() > 0) {
            throw new ServiceException("该分组已存在");
        }
        WlyyHospitalSysDictDO dictDO = new WlyyHospitalSysDictDO();
@ -143,6 +143,49 @@ public class LabelService {
        return dictDO;
    }
    /**
     * //三院 labelType 1健康情况 2疾病类型 3专病类型 4自定义标签
     */
    public List<Map<String, Object>> findLabelPatientGroupCount(String name, String labelType) {
        String sql = "SELECT\n" +
                "	a.label_code,a.label_name,count(1) 'labelCount'\n" +
                "FROM\n" +
                "	wlyy_patient_label a\n" +
                "	INNER JOIN base_patient b ON a.patient=b.id\n" +
                "WHERE\n" +
                "	1 = 1 \n" +
                "  AND a.label_type='" + labelType + "'";
        if (StringUtils.isNotBlank(name)) {
            sql += " AND b.`name` LIKE '%" + name + "%'\n";
        }
        sql += "GROUP BY a.label_code";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    public List findLabelPatientList(String name, String labelType, String labelCode) {
        String sql = "SELECT\n" +
                "	 a.label_code 'labelCode',a.label_name 'labelName',b.* \n" +
                "FROM\n" +
                "	wlyy_patient_label a\n" +
                "	INNER JOIN base_patient b ON a.patient=b.id\n" +
                "WHERE\n" +
                "	1 = 1 \n" +
                "  AND a.label_type='" + labelType + "'";
        if (StringUtils.isNotBlank(name)) {
            sql += " AND b.`name` LIKE '%" + name + "%'\n";
        }
        if (StringUtils.isNotBlank(labelCode)) {
            sql += "  AND a.label_code='" + labelCode + "'";
        }
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    //删除
    public void delLableDict(String labelName) throws Exception{
        List<WlyyHospitalSysDictDO> dictDOList = wlyyHospitalSysDictDao.findByDictNameAndDictCode("patient_lable_custom",labelName);

+ 2 - 2
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/door/service/WlyyDoorServiceOrderService.java

@ -2599,8 +2599,8 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        String sql = "SELECT * FROM wlyy_consult WHERE relation_code='" + orderId + "'";
        ConsultDo consult = null;
        List<ConsultDo> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ConsultDo.class));
        if (list != null && list.size() > 0) {
      `  List<ConsultDo> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ConsultDo.class));
      `  if (list != null && list.size() > 0) {
            consult = list.get(0);
            System.out.println("ConsultDo的list数量==>" + list.size());
        } else {

+ 7 - 5
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/followup/controller/DoctorFollowUpController.java

@ -99,16 +99,18 @@ public class DoctorFollowUpController extends BaseController {
     */
    @RequestMapping(value = "/list_by", method = {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation(value = "查询居民随访列表")
    public String getListByPatient(@RequestParam @ApiParam(value = "居民Code") String patient,
                                          @RequestParam @ApiParam(value = "第几页") int page,
                                          @RequestParam @ApiParam(value = "页大小") int pagesize,
                                          @RequestParam(value = "type",required = false) @ApiParam(value = "类型:放空为全部,1计划,2记录",defaultValue = "0") String type) {
    public String getListByPatient(
            @RequestParam @ApiParam(value = "居民Code") String patient,
            @RequestParam @ApiParam(value = "医生Code") String doctorCode,
            @RequestParam @ApiParam(value = "第几页") int page,
            @RequestParam @ApiParam(value = "页大小") int pagesize,
            @RequestParam(value = "type",required = false) @ApiParam(value = "类型:放空为全部,1计划,2记录",defaultValue = "0") String type) {
        try {
            if (StringUtils.isEmpty(patient)) {
                return error(-1, "请输入需查询的居民");
            }
            page = page > 0 ? page - 1 : 0;
            JSONArray result = followUpService.getListByPatient(patient, page, pagesize,type);
            JSONArray result = followUpService.getListByPatient(patient, page, pagesize,type,doctorCode);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            return errorResult(e);

+ 6 - 12
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/followup/dao/FollowUpDao.java

@ -82,27 +82,21 @@ public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>,
    /**
     * 查找所有的随访数据
     * @param patient
     * @param pageable
     * @return
     */
    @Query("select d.id,d.name,d.photo,a.followupType,a.followupClass,a.status,a.createTime,a.updateTime,a.followupManagerStatus," +
            "c.id,c.name,c.photo" + ",a.followupDate,a.followupPlanDate,a.followupNextDate,a.id,a.followupNo,a.prescriptionCode " +
            "from Followup a, BaseDoctorDO d, BaseDoctorDO c " +
            "where a.doctorCode = d.id and a.creater = c.id and a.patientCode = ?1  and a.status > '0'")
    Page<Object> findByPatient(String patient, PageRequest pageable);
            "where a.doctorCode = d.id and a.creater = c.id and a.patientCode = ?1 and a.doctorCode=?2  and a.status > '0'")
    Page<Object> findByPatient(String patient,String doctor, PageRequest pageable);
    /**
     * 查找所有的随访计划(未开始的归类为计划)
     * @param patient
     * @param pageable
     * @return
     */
    @Query("select d.id,d.name,d.photo,a.followupType,a.followupClass,a.status,a.createTime,a.updateTime,a.followupManagerStatus," +
            "c.id,c.name,c.photo" + ",a.followupDate,a.followupPlanDate,a.followupNextDate,a.id,a.followupNo,a.prescriptionCode " +
            "from Followup a, BaseDoctorDO d, BaseDoctorDO c " +
            "where a.doctorCode = d.id and a.creater = c.id and a.patientCode = ?1 and a.status = '2'")
    Page<Object> findPlanByPatient(String patient, PageRequest pageable);
            "where a.doctorCode = d.id and a.creater = c.id and a.patientCode = ?1  and a.doctorCode=?2 and a.status = '2' ")
    Page<Object> findPlanByPatient(String patient,String doctor, PageRequest pageable);
    /**
     * 查找所有的随访记录(进行中的,已完整的的归类为计划)
@ -113,8 +107,8 @@ public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>,
    @Query("select d.id,d.name,d.photo,a.followupType,a.followupClass,a.status,a.createTime,a.updateTime,a.followupManagerStatus," +
            "c.id,c.name,c.photo" + ",a.followupDate,a.followupPlanDate,a.followupNextDate,a.id,a.followupNo,a.prescriptionCode " +
            "from Followup a, BaseDoctorDO d, BaseDoctorDO c" +
            " where a.doctorCode = d.id and a.creater = c.id and a.patientCode = ?1 and (a.status = '1' or a.status = '3')")
    Page<Object> findRecordByPatient(String patient, PageRequest pageable);
            " where a.doctorCode = d.id and a.creater = c.id and a.patientCode = ?1 and a.doctorCode=?2  and (a.status = '1' or a.status = '3')")
    Page<Object> findRecordByPatient(String patient, String doctor,PageRequest pageable);
    /**
     * 查找所有的随访计划(未开始的归类为计划)

+ 6 - 4
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/followup/service/FollowUpService.java

@ -360,21 +360,23 @@ public class FollowUpService {
     * @param type     类型:0全部,1计划,2记录
     * @return
     */
    public JSONArray getListByPatient(String patient, int page, int pageSize, String type) {
    public JSONArray getListByPatient(
            String patient, int page, int pageSize, String type,String doctorCode) {
//        Sort sort = new Sort(Sort.Direction.DESC, "createTime");
        PageRequest pageRequest = PageRequest.of(page, pageSize);
        Page<Object> result = null;
        if (StringUtils.isBlank(type)) {
            result = followupDao.findByPatient(patient, pageRequest);
            result = followupDao.findByPatient(patient,doctorCode, pageRequest);
        } else if ("1".equals(type)) {
            //已经开始的就是记录
            result = followupDao.findPlanByPatient(patient, pageRequest);
            result = followupDao.findPlanByPatient(patient,doctorCode, pageRequest);
        } else if ("2".equals(type)) {
            //未开始的就是计划
            result = followupDao.findRecordByPatient(patient, pageRequest);
            result = followupDao.findRecordByPatient(patient,doctorCode, pageRequest);
        } else {
            result = followupDao.findByPatient(patient,doctorCode, pageRequest);
        }

+ 53 - 49
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/template/controller/DoctorGuidanceTempController.java

@ -55,27 +55,34 @@ public class DoctorGuidanceTempController extends BaseController {
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ApiOperation(value = "添加指导模板")
   
    public String add(@RequestParam @ApiParam(value = "指导内容") String content,
                      @RequestParam @ApiParam(value = "模板名称") String modelName,
                      @RequestParam(required = false) @ApiParam(value = "图片内容") String imagesUrl) {
    public String add(
            @RequestParam @ApiParam(value = "指导内容") String content,
            @RequestParam @ApiParam(value = "模板名称") String modelName,
            @RequestParam(required = false) @ApiParam(value = "图片内容") String imagesUrl,
            @RequestParam(required = false) @ApiParam(value = "医生code") String doctorCode,
            @RequestParam(required = false) @ApiParam(value = "健康指导文章的code") String articleCode
    ) {
        try {
            if (StringUtils.isEmpty(content)) {
                return error(-1, "内容不能为空");
            }
            if (modelName.length() < 1 || modelName.length() > 10) {
                return error(-1, "模板名称不能为空且在10字之内");
            if (modelName.length() < 1 || modelName.length() > 5) {
                return error(-1, "模板名称不能为空且在5字之内");
            }
            //验证模板名称唯一性
            System.out.println("getUID()==>" + getUID());
            if (StringUtils.isNotBlank(doctorCode)){
                doctorCode=getUID();
            }
            //        验证模板名称唯一性
            List<DoctorGuidanceTemp> templates = guidanceTempDao.findByTitle(getUID(), modelName);
            List<DoctorGuidanceTemp> templates = guidanceTempDao.findByTitle(doctorCode, modelName);
            if (templates != null && templates.size() != 0) {
                return error(-1, "模板名称与现有模板重复,请修改");
            }
            DoctorGuidanceTemp temp = guidanceTempService.add(getUID(), content, modelName, imagesUrl);
            DoctorGuidanceTemp temp = guidanceTempService.add(doctorCode, content, modelName, imagesUrl,articleCode);
            if (temp != null) {
                return write(200, "添加成功","modelCode",temp.getCode());
                return write(200, "添加成功", "modelCode", temp.getCode());
            } else {
                return write(-1, "添加失败");
            }
@ -94,11 +101,12 @@ public class DoctorGuidanceTempController extends BaseController {
     */
    @RequestMapping(value = "/modify", method = RequestMethod.POST)
    @ApiOperation(value = "修改指导模板")
   
    public String modify(@RequestParam @ApiParam(value = "指导编码") String code,
                         @RequestParam @ApiParam(value = "模板标题") String modelName,
                         @RequestParam @ApiParam(value = "指导内容") String content,
                         @RequestParam(required = false) @ApiParam(value = "图片地址") String imagesUrl
    public String modify(
            @RequestParam @ApiParam(value = "指导编码") String code,
            @RequestParam @ApiParam(value = "模板标题") String modelName,
            @RequestParam @ApiParam(value = "指导内容") String content,
            @RequestParam(required = false) @ApiParam(value = "图片地址") String imagesUrl,
            @RequestParam(required = false) @ApiParam(value = "医生code") String doctorCode
    ) {
        try {
            if (StringUtils.isEmpty(code)) {
@ -109,11 +117,14 @@ public class DoctorGuidanceTempController extends BaseController {
                return error(-1, "内容不能为空");
            }
            if (StringUtils.isEmpty(modelName) || modelName.length() > 10) {
                return error(-1, "内容10个汉字之内且不能为空");
            if (StringUtils.isEmpty(content) || content.length() > 5) {
                return error(-1, "内容5个汉字之内且不能为空");
            }
//            验证模板名称唯一性 还要去除掉其本身  (判断查出来的和要修改的同名)
            List<DoctorGuidanceTemp> templates = guidanceTempDao.findByTitle(getUID(), modelName);
            if (StringUtils.isBlank(doctorCode)){
                doctorCode=getUID();
            }
            List<DoctorGuidanceTemp> templates = guidanceTempDao.findByTitle(doctorCode, modelName);
            for (DoctorGuidanceTemp teamplate : templates) {
                if (!code.equals(teamplate.getCode())) {
@ -143,13 +154,11 @@ public class DoctorGuidanceTempController extends BaseController {
     */
    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    @ApiOperation(value = "删除指导模板")
   
    public String delete(@RequestParam @ApiParam(value = "指导编码") String code) {
        try {
            if (StringUtils.isEmpty(code)) {
                return error(-1, "请指定需删除的模板");
            }
            int result = guidanceTempService.delete(code);
            if (result == 1) {
@ -163,30 +172,24 @@ public class DoctorGuidanceTempController extends BaseController {
        }
    }
    /**
     * 查询指导模板
     *
     * @return
     */
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ApiOperation(value = "查询指导模板")
    public String list(
                       @RequestParam(required = false, defaultValue = "")
                       @ApiParam(value = "搜索关键字") String filter,
                       @RequestParam(required = false, defaultValue = "")
                       @ApiParam(value = "模板类型 1:系统 2:自定义 为空:所有") String type,
                       @RequestParam(defaultValue = "10") String pageSize,
                       @RequestParam(defaultValue = "1") @ApiParam(value = "当前页码") String pageNo) {
            @RequestParam(required = true, defaultValue = "") @ApiParam(value = "医生code") String doctorCode,
            @RequestParam(required = false, defaultValue = "") @ApiParam(value = "搜索关键字-模板名称") String templeteName,
            @RequestParam(defaultValue = "10") String pageSize,
            @RequestParam(defaultValue = "1") @ApiParam(value = "当前页码") String pageNo
    ) {
        try {
            int pagesize = Integer.parseInt(pageSize);
            int pageno = Integer.parseInt(pageNo) - 1;
            List<Map<String, Object>> temps = guidanceTempService.list(getUID(),filter, type, pagesize, pageno);
            if (temps == null || temps.size() < 1) {
                return write(200, "查询成功", "data", new JSONArray());
            } else {
                return write(200, "查询成功", "data", new JSONArray(temps));
            }
            Map<String, Object> result = guidanceTempService.list(doctorCode, templeteName, pagesize, pageno);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
@ -196,30 +199,31 @@ public class DoctorGuidanceTempController extends BaseController {
    /**
     * 根据模板类型、文章标题模糊搜索指导模板
     * (自定义即个人模板)
     * @param filter  搜索关键字
     * @param type  模板类型
     * @param type  teamId
     *
     * @param filter   搜索关键字
     * @param type     模板类型
     * @param type     teamId
     * @param pageSize 页展示数量
     * @param pageNo  当前页码
     * @param pageNo   当前页码
     * @return
     */
    @RequestMapping(value = "/search", method = RequestMethod.GET)
    @ApiOperation(value = "模糊搜索指导模板")
    public String searchByTitle(
                        @RequestParam(required = true, defaultValue = "")
                        @ApiParam(value = "搜索关键字") String filter,
                        @RequestParam(required = true, defaultValue = "")
                        @ApiParam(value = "模板类型 1:系统 2:个人 3:团队摸版") String type,
                        @RequestParam(defaultValue = "10")
                        @ApiParam(value = "页展示数量") String pageSize,
                        @RequestParam(defaultValue = "1") @ApiParam(value = "当前页码") String pageNo) {
            @RequestParam(required = true, defaultValue = "")
            @ApiParam(value = "搜索关键字") String filter,
            @RequestParam(required = true, defaultValue = "")
            @ApiParam(value = "模板类型 1:系统 2:个人 3:团队摸版") String type,
            @RequestParam(defaultValue = "10")
            @ApiParam(value = "页展示数量") String pageSize,
            @RequestParam(defaultValue = "1") @ApiParam(value = "当前页码") String pageNo) {
        try {
            int pagesize = Integer.parseInt(pageSize);
            int pageno = Integer.parseInt(pageNo) - 1;
            List<Map<String, Object>> temps = null;
            if (StringUtils.isNotEmpty(type) && StringUtils.isNotEmpty(filter)){
                temps = guidanceTempService.listByTitle(filter,type,pagesize, pageno);
            }else {
            if (StringUtils.isNotEmpty(type) && StringUtils.isNotEmpty(filter)) {
                temps = guidanceTempService.listByTitle(filter, type, pagesize, pageno);
            } else {
                return error(-1, "模板类型不能为空!");
            }
            if (temps == null || temps.size() < 1) {

+ 42 - 49
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/template/service/DoctorGuidanceTempService.java

@ -1,6 +1,7 @@
package com.yihu.jw.hospital.module.template.service;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.template.DoctorGuidanceTemp;
import com.yihu.jw.entity.template.DoctorTeamGuidanceTemplate;
import com.yihu.jw.hospital.module.template.dao.DoctorGuidanceTempDao;
@ -11,6 +12,7 @@ import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -25,7 +27,7 @@ import java.util.*;
 */
@Service
@Transactional
public class DoctorGuidanceTempService  {
public class DoctorGuidanceTempService {
    @Autowired
    DoctorGuidanceTempDao guidanceTempDao;
@ -36,6 +38,7 @@ public class DoctorGuidanceTempService  {
    @Autowired
    private CommonUtil CommonUtil;
    /**
     * 记录医生健康指导模板使用次数
     *
@ -90,12 +93,17 @@ public class DoctorGuidanceTempService  {
     * @param content 指导内容
     * @return
     */
    public DoctorGuidanceTemp add(String doctor, String content, String modelName, String imagesUrl) throws Exception{
    public DoctorGuidanceTemp add(String doctor, String content, String modelName, String imagesUrl, String articleCode) throws Exception {
        DoctorGuidanceTemp guidanceTemp = new DoctorGuidanceTemp();
        String imageUrls = "";
        String imageRow = "";
        guidanceTemp.setCode(getCode());
        if (StringUtils.isNotBlank(articleCode)) {
            guidanceTemp.setCode(getCode());
        } else {
            guidanceTemp.setCode(getCode());
        }
        guidanceTemp.setOwner(doctor);
        guidanceTemp.setContent(content);
        guidanceTemp.setSendTimes(0);
@ -182,66 +190,50 @@ public class DoctorGuidanceTempService  {
     * 查询指导模板
     *
     * @param doctor 医生
     * @param type   模板类型
     * @return
     */
    public List<Map<String, Object>> list(String doctor,String filter, String type, int pageSize, int pageNo) throws Exception {
        Page<DoctorGuidanceTemp> temps = null;
        PageRequest pageRequest =  PageRequest.of(pageNo, pageSize);
        List<Map<String, Object>> listMap = new ArrayList<>();
        if (StringUtils.isEmpty(filter)){
            if (type.equals("1")) {
                temps = guidanceTempDao.findByOwner("system", pageRequest);
            } else if (type.equals("2")) {
                temps = guidanceTempDao.findByOwner(doctor, pageRequest);
            } else {
                temps = guidanceTempDao.findByOwnerAndSystem(doctor, pageRequest);
            }
        }else {
            if (type.equals("1")) {
                temps = guidanceTempDao.listByTileSystem("%"+filter+"%", pageRequest);
            } else if (type.equals("2")) {
                temps = guidanceTempDao.listOwnerByTile(doctor,"%"+filter+"%", pageRequest);
            } else {
                temps = guidanceTempDao.listByTileAll(doctor,"%"+filter+"%", pageRequest);
            }
    public Map<String, Object> list(String doctor, String templeteName, int pageSize, int pageNo) throws Exception {
        String detailSql = "SELECT 	a.* ";
        String countSql = "SELECT 	count(1) ";
        String sql = "FROM\n" +
                "	wlyy_doctor_guidance_temp a\n" +
                "	INNER JOIN wlyy_knowledge_article_dict b ON a.CODE = b.id \n" +
                "WHERE\n" +
                "	1 = 1 \n" +
                "	AND b.`status` = '1' \n";
        if (StringUtils.isNotBlank(templeteName)) {
            sql += "	AND a.model_name LIKE '%" + templeteName + "%'\n";
        }
        List<DoctorGuidanceTemp> list = temps.getContent();
        for (int i = 0; i < list.size(); i++) {
            DoctorGuidanceTemp dgt = list.get(i);
            Map<String, Object> tem = new HashMap<>();
            tem.put("code", dgt.getCode());
            tem.put("owner", dgt.getOwner());
            tem.put("sendTimes", dgt.getSendTimes());
            tem.put("lastTime", dgt.getLastTime());
            tem.put("modelName", dgt.getModelName());
            if(i == 0) {
                tem.put("total", temps.getTotalElements());
                tem.put("pages", temps.getTotalPages());
            }
            listMap.add(tem);
        if (StringUtils.isNotBlank(doctor)) {
            sql += "	AND a.OWNER = '" + doctor + "' order by create_time desc  \n";
        }
        return listMap;
        String limitSql = " limit "+(pageNo-1)*pageSize+","+pageSize ;
        detailSql += sql + limitSql;
        countSql += sql;
        List<DoctorGuidanceTemp> list = jdbcTemplate.query(detailSql, new BeanPropertyRowMapper<>(DoctorGuidanceTemp.class));
        Integer integer = jdbcTemplate.queryForObject(countSql, Integer.class);
        HashMap<String, Object> resultMap = new HashMap<>();
        resultMap.put("data",list);
        resultMap.put("count",integer);
        return resultMap;
    }
    /**
     * 根据模板类型、文章标题模糊搜索指导模板
     *
     * @param filter 搜索关键字
     * @param type 1:系统 2:个人 3:团队摸版
     * @param filter   搜索关键字
     * @param type     1:系统 2:个人 3:团队摸版
     * @param pageSize
     * @param pageNo
     * @return
     * @throws Exception
     */
    public List<Map<String, Object>> listByTitle(String filter,String type, int pageSize, int pageNo) throws Exception {
    public List<Map<String, Object>> listByTitle(String filter, String type, int pageSize, int pageNo) throws Exception {
        PageRequest pageRequest = PageRequest.of(pageNo, pageSize);
        List<Map<String, Object>> listMap = new ArrayList<>();
        if ("1".equals(type)) {
            Page<DoctorGuidanceTemp> temps = guidanceTempDao.listByTileSystem("%"+filter+"%", pageRequest);
            Page<DoctorGuidanceTemp> temps = guidanceTempDao.listByTileSystem("%" + filter + "%", pageRequest);
            List<DoctorGuidanceTemp> list = temps.getContent();
            for (int i = 0; i < list.size(); i++) {
@ -255,7 +247,7 @@ public class DoctorGuidanceTempService  {
                listMap.add(tem);
            }
        } else if ("2".equals(type)) {
            Page<DoctorGuidanceTemp> temps = guidanceTempDao.listByTile("%"+filter+"%", pageRequest);
            Page<DoctorGuidanceTemp> temps = guidanceTempDao.listByTile("%" + filter + "%", pageRequest);
            List<DoctorGuidanceTemp> list = temps.getContent();
            for (int i = 0; i < list.size(); i++) {
@ -268,8 +260,8 @@ public class DoctorGuidanceTempService  {
                tem.put("modelName", dgt.getModelName());
                listMap.add(tem);
            }
        } else if("3".equals(type)){
            Page<DoctorTeamGuidanceTemplate> temps = doctorTeamGuidanceTemplateDao.listByTile("%"+filter+"%", pageRequest);
        } else if ("3".equals(type)) {
            Page<DoctorTeamGuidanceTemplate> temps = doctorTeamGuidanceTemplateDao.listByTile("%" + filter + "%", pageRequest);
            List<DoctorTeamGuidanceTemplate> list = temps.getContent();
            for (int i = 0; i < list.size(); i++) {
@ -291,6 +283,7 @@ public class DoctorGuidanceTempService  {
    /**
     * 根据code获取详情
     *
     * @param code
     * @return
     */