Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/dev' into dev

hill9868 5 rokov pred
rodič
commit
cb3fbdef3c

+ 13 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -1991,7 +1991,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "patient.photo AS photo," +
                "patient.birthday AS birthday," +
                "room.consult_type AS consult_type," +
                "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS time," +
                "(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS timedate_format," +
                "outpatient.disease_img AS disease_img," +
                "outpatient.description AS description," +
                "room.reservation_type AS reservation_type," +
@ -3449,4 +3449,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        rs.put("mes","取消成功");
        return  rs;
	}
    
    /**
     * 获取居民当日就诊列表
     * @param patient
     * @return
     */
	public List<Map<String,Object>> getTodayOutpatinetList(String patient) {
        String sql ="SELECT date_format(p.register_date ,'%Y-%m-%d %H:%i:%S' ) AS time,d.NAME as doctorName,d.job_title_name,d.photo AS photo,p.id as outpatientid FROM wlyy_outpatient p,base_doctor d " +
                "WHERE p.patient='"+patient+"' AND p.doctor=d.id AND p.status=0 AND p.register_date BETWEEN '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' AND '"+DateUtil.dateToStrShort(new Date())+" 23:59:59'";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
	}
}

+ 121 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeArticleDO.java

@ -0,0 +1,121 @@
package com.yihu.jw.entity.hospital.article;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 健康文章
 * @author huangwenjie
 * @date 2019/9/10 13:58
 */
@Entity
@Table(name = "wlyy_knowledge_article")
public class KnowledgeArticleDO extends UuidIdentityEntity {
	
	private String createUser; // 创建人
	private String title;   // 文章标题
	private String categoryFirst;    // 1级分类标识
	private String categorySecond;    // 2级分类标识
	private String content; // 文章内容
	private String source;  // 文章来源--客服
	private String image;   // 封面图片
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	private Date createTime;  // 添加时间
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	private Date updateTime;  // 编辑时间
	private Integer del; // 是否删除,1正常,0删除
	private Integer status;// 0未审核 1已审核
	
	
	public String getCreateUser() {
		return createUser;
	}
	
	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}
	
	public String getTitle() {
		return title;
	}
	
	public void setTitle(String title) {
		this.title = title;
	}
	
	public String getCategoryFirst() {
		return categoryFirst;
	}
	
	public void setCategoryFirst(String categoryFirst) {
		this.categoryFirst = categoryFirst;
	}
	
	public String getCategorySecond() {
		return categorySecond;
	}
	
	public void setCategorySecond(String categorySecond) {
		this.categorySecond = categorySecond;
	}
	
	public String getContent() {
		return content;
	}
	
	public void setContent(String content) {
		this.content = content;
	}
	
	public String getSource() {
		return source;
	}
	
	public void setSource(String source) {
		this.source = source;
	}
	
	public String getImage() {
		return image;
	}
	
	public void setImage(String image) {
		this.image = image;
	}
	
	public Date getCreateTime() {
		return createTime;
	}
	
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	public Date getUpdateTime() {
		return updateTime;
	}
	
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	
	public Integer getDel() {
		return del;
	}
	
	public void setDel(Integer del) {
		this.del = del;
	}
	
	public Integer getStatus() {
		return status;
	}
	
	public void setStatus(Integer status) {
		this.status = status;
	}
}

+ 36 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -280,6 +280,9 @@ public class BaseHospitalRequestMapping {
         * 居民取消续方
         */
        public static final String cancelPrescription ="/cancelPrescription";
    
        //居民获取当日就诊列表
        public static final String getTodayOutpatinetList ="/getTodayOutpatinetList";
    }
@ -339,6 +342,7 @@ public class BaseHospitalRequestMapping {
        //获取微信签名
        public static final String getSign ="/getSign";
        
    }
    
@ -417,5 +421,37 @@ public class BaseHospitalRequestMapping {
        public static final String setDefault  = "/setDefault";
        public static final String hasDefault  = "/hasDefault";
    }
    
    /**
     * 健康文章
     */
    public static class KnowledgeArticle extends Basic {
        public static final String PREFIX  = "/article";
        //获取文章列表
        public static final String searchKnowledgePageList  = "/searchKnowledgePageList";
        
        //获取我的文章列表
        public static final String searchMyPageList  = "/searchMyPageList";
    
        //根据id查询文章
        public static final String queryById  = "/queryById";
    
        //根据id删除文章
        public static final String deleteById  = "/deleteById";
    
        //添加/修改文章
        public static final String saveArticle  = "/saveArticle";
    
        //新增/修改分类
        public static final String saveCategory  = "/saveCategory";
        
        //获取分类列表
        public static final String searchCategoryList  = "/searchCategoryList";
        
        //根据分类code删除分类
        public static final String updateDel  = "/updateDel";
        
        
    }
}

+ 13 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/dao/consult/KnowledgeArticleDao.java

@ -0,0 +1,13 @@
package com.yihu.jw.hospital.dao.consult;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 健康文章DAO
 * @author huangwenjie
 * @date 2019/9/10 14:07
 */
public interface KnowledgeArticleDao extends PagingAndSortingRepository<KnowledgeArticleDO, String>, JpaSpecificationExecutor<KnowledgeArticleDO> {
}

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

@ -0,0 +1,84 @@
package com.yihu.jw.hospital.endpoint.article;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.hospital.service.consult.KnowledgeArticleService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
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;
	
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchKnowledgePageList)
	@ApiOperation(value = "获取文章列表")
	public ListEnvelop searchKnowledgePageList(
//			@ApiParam(name = "category_first", value = "1级分类编码")
//			@RequestParam(value = "category_first", required = false) String category_first,
//			@ApiParam(name = "category_secend", value = "2级分类编码")
//			@RequestParam(value = "category_second", required = false) String category_second,
//			@ApiParam(name = "keyword", value = "关键字")
//			@RequestParam(value = "keyword", required = false) String keyword,
//			@ApiParam(name = "status", value = "审核状态:0未审核,1已审核")
//			@RequestParam(value = "status", required = false) String status,
//			@ApiParam(name = "start", value = "开始时间")
//			@RequestParam(value = "start", required = false) String start,
//			@ApiParam(name = "end", value = "结束时间")
//			@RequestParam(value = "end", required = false) String end,
			@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{
		List<KnowledgeArticleDO> result  = knowledgeArticleService.search(fields,filters,sorts,page,pageSize);
		return success(result);
	}
	
	@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{
			KnowledgeArticleDO articleDO = knowledgeArticleService.retrieve(id);
		return success(articleDO);
	}
	
	@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 {
			knowledgeArticleService.delArticle(id);
			return success("操作成功");
	}
	
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.saveArticle)
	@ApiOperation(value = "保存/更新文章")
	public Envelop saveArticle(
			@ApiParam(name = "jsonData", value = "Json数据", required = true)
			@RequestParam String jsonData)throws Exception {
		knowledgeArticleService.saveArticle(jsonData);
		return success("操作成功");
	}
}

+ 6 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java

@ -248,6 +248,12 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			object.put("socket_sms_type",6);
			object.put("relation_code",wlyyOutpatientDO.getId());
			imService.sendWaiSocketMessage(wlyyOutpatientDO.getDoctor(),wlyyOutpatientDO.getGeneralDoctor(),object.toString(),"1");
		}else{
			System.out.println("发送外层SOCKET消息:协同门诊医生抢单之后,通知居民修改状态");
			JSONObject object = new JSONObject();
			object.put("socket_sms_type",6);
			object.put("relation_code",wlyyOutpatientDO.getId());
			imService.sendWaiSocketMessage(wlyyOutpatientDO.getDoctor(),wlyyOutpatientDO.getPatient(),object.toString(),"1");
		}
		return success("请求成功");
	}

+ 7 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -599,7 +599,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        return success(wlyyBusinessService.readWlyyOutpatientMes(outPatientId));
    }
    //===========
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getTodayOutpatinetList)
    @ApiOperation(value = "居民获取当日就诊列表", notes = "居民获取当日就诊列表")
    public ListEnvelop getTodayOutpatinetList(@ApiParam(name = "patient", value = "居民ID")
                                                  @RequestParam(value = "patient", required = true) String patient){
        return success(prescriptionService.getTodayOutpatinetList(patient));
    }
}

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

@ -0,0 +1,66 @@
package com.yihu.jw.hospital.service.consult;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleDao;
import com.yihu.jw.utils.EntityUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.UUID;
/**
 * 健康文章业务层代码
 * @author huangwenjie
 * @date 2019/9/10 13:54
 */
@Service
public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO, KnowledgeArticleDao> {
	
	@Autowired
	private KnowledgeArticleDao knowledgeArticleDao;
	
	/**
	 * 删除,支持批量
	 * @param id
	 */
	public boolean delArticle(String id){
		String[] split = id.split(",|,");
		String ids = StringUtils.join(split, ",");
		String sql = "update wlyy_knowledge_article a set a.del = 0 where a.id in(" + ids + ")";
		int update = jdbcTemplate.update(sql);
		if (update > 0) {
			return true;
		}
		return false;
	}
	
	/**
	 * 更新/保存健康文章
	 * @param jsonData
	 * @return
	 * @throws Exception
	 */
	public KnowledgeArticleDO saveArticle(String jsonData) throws  Exception {
		KnowledgeArticleDO knowledgeArticleDO = EntityUtils.jsonToEntity(jsonData, KnowledgeArticleDO.class);
		if (null == knowledgeArticleDO.getId()) {
			// 新增
			knowledgeArticleDO.setId(UUID.randomUUID().toString().replace("-", ""));
			knowledgeArticleDO.setCreateTime(new Date());
//			knowledgeArticleDO.setSource("客服");
			knowledgeArticleDO.setDel(1);
			knowledgeArticleDO = knowledgeArticleDao.save(knowledgeArticleDO);
			return knowledgeArticleDO;
		} else {
			KnowledgeArticleDO one = knowledgeArticleDao.findOne(knowledgeArticleDO.getId());
			one.setTitle(knowledgeArticleDO.getTitle());
			one.setContent(knowledgeArticleDO.getContent());
			one.setImage(knowledgeArticleDO.getImage());
			one.setUpdateTime(new Date());
			knowledgeArticleDao.save(one);
			return  one;
		}
	}
}