Commit c6400c120a7828c64472a9a811d66a9d01500ab3
1 parent
1bb433dd7d
Exists in
master
and in
6 other branches
血压报告生成
Showing 11 changed files with 575 additions and 10 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IBpReportDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPloodPressureGuideDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BpReportDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PloodPressureGuideDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BpReportService.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PloodPressureGuideService.java
- platform-dal/src/main/java/com/lyms/platform/pojo/PloodPressureGuideModel.java
- platform-dal/src/main/java/com/lyms/platform/query/BpReportQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/PloodPressureGuideQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BloodPressureController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BpReportFacade.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IBpReportDao.java
View file @
c6400c1
| 1 | +package com.lyms.platform.biz.dal; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 4 | +import com.lyms.platform.pojo.BabyModel; | |
| 5 | +import com.lyms.platform.pojo.BpReportModel; | |
| 6 | +import com.lyms.platform.pojo.Patients; | |
| 7 | +import org.slf4j.Logger; | |
| 8 | +import org.slf4j.LoggerFactory; | |
| 9 | + | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * 添加类的一句话简单描述。 | |
| 15 | + * <p> | |
| 16 | + * 详细描述 | |
| 17 | + * <p> | |
| 18 | + * 示例代码 | |
| 19 | + * <pre> | |
| 20 | + * </pre/> | |
| 21 | + * | |
| 22 | + * @author JIAZHI.JIANG | |
| 23 | + * @version BME V100R001 2018-08-23 17:03 | |
| 24 | + * @since BME V100R001C40B104 | |
| 25 | + */ | |
| 26 | +public interface IBpReportDao { | |
| 27 | + | |
| 28 | + BpReportModel addBpReport(BpReportModel obj); | |
| 29 | + | |
| 30 | + int queryBpReportCount(MongoQuery query); | |
| 31 | + | |
| 32 | + List<BpReportModel> queryBpReport(MongoQuery query); | |
| 33 | + | |
| 34 | + | |
| 35 | + BpReportModel getBpReport(String id); | |
| 36 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPloodPressureGuideDao.java
View file @
c6400c1
| 1 | +package com.lyms.platform.biz.dal; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 4 | +import com.lyms.platform.pojo.PersonModel; | |
| 5 | +import com.lyms.platform.pojo.PloodPressureGuideModel; | |
| 6 | +import org.slf4j.Logger; | |
| 7 | +import org.slf4j.LoggerFactory; | |
| 8 | + | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 添加类的一句话简单描述。 | |
| 14 | + * <p> | |
| 15 | + * 详细描述 | |
| 16 | + * <p> | |
| 17 | + * 示例代码 | |
| 18 | + * <pre> | |
| 19 | + * </pre/> | |
| 20 | + * | |
| 21 | + * @author JIAZHI.JIANG | |
| 22 | + * @version BME V100R001 2018-08-23 17:27 | |
| 23 | + * @since BME V100R001C40B104 | |
| 24 | + */ | |
| 25 | +public interface IPloodPressureGuideDao { | |
| 26 | + | |
| 27 | + | |
| 28 | + PloodPressureGuideModel addPloodPressureGuide(PloodPressureGuideModel model); | |
| 29 | + | |
| 30 | + void updateOne(PloodPressureGuideModel obj, String id); | |
| 31 | + | |
| 32 | + List<PloodPressureGuideModel> queryPloodPressureGuides(MongoQuery mongoQuery); | |
| 33 | + | |
| 34 | + int queryCount(MongoQuery query); | |
| 35 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BpReportDaoImpl.java
View file @
c6400c1
| 1 | +package com.lyms.platform.biz.dal.impl; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.IBpReportDao; | |
| 4 | +import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 6 | +import com.lyms.platform.pojo.BpReportModel; | |
| 7 | +import org.slf4j.Logger; | |
| 8 | +import org.slf4j.LoggerFactory; | |
| 9 | +import org.springframework.stereotype.Repository; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * 血压报告dal操作层 | |
| 16 | + * <p> | |
| 17 | + * 详细描述 | |
| 18 | + * <p> | |
| 19 | + * 示例代码 | |
| 20 | + * <pre> | |
| 21 | + * </pre/> | |
| 22 | + * | |
| 23 | + * @author JIAZHI.JIANG | |
| 24 | + * @version BME V100R001 2018-08-23 17:05 | |
| 25 | + * @since BME V100R001C40B104 | |
| 26 | + */ | |
| 27 | +@Repository | |
| 28 | +public class BpReportDaoImpl extends BaseMongoDAOImpl<BpReportModel> implements IBpReportDao { | |
| 29 | + | |
| 30 | + @Override | |
| 31 | + public BpReportModel addBpReport(BpReportModel obj) { | |
| 32 | + return save(obj); | |
| 33 | + } | |
| 34 | + | |
| 35 | + @Override | |
| 36 | + public int queryBpReportCount(MongoQuery query) { | |
| 37 | + return (int) count(query.convertToMongoQuery()); | |
| 38 | + } | |
| 39 | + | |
| 40 | + @Override | |
| 41 | + public List<BpReportModel> queryBpReport(MongoQuery query) { | |
| 42 | + return find(query.convertToMongoQuery()); | |
| 43 | + } | |
| 44 | + | |
| 45 | + @Override | |
| 46 | + public BpReportModel getBpReport(String id) { | |
| 47 | + return findById(id); | |
| 48 | + } | |
| 49 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PloodPressureGuideDaoImpl.java
View file @
c6400c1
| 1 | +package com.lyms.platform.biz.dal.impl; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.IPloodPressureGuideDao; | |
| 4 | +import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 7 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 8 | +import com.lyms.platform.pojo.PloodPressureGuideModel; | |
| 9 | +import org.slf4j.Logger; | |
| 10 | +import org.slf4j.LoggerFactory; | |
| 11 | +import org.springframework.stereotype.Repository; | |
| 12 | + | |
| 13 | +import java.util.List; | |
| 14 | + | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * 添加类的一句话简单描述。 | |
| 18 | + * <p> | |
| 19 | + * 详细描述 | |
| 20 | + * <p> | |
| 21 | + * 示例代码 | |
| 22 | + * <pre> | |
| 23 | + * </pre/> | |
| 24 | + * | |
| 25 | + * @author JIAZHI.JIANG | |
| 26 | + * @version BME V100R001 2018-08-23 17:29 | |
| 27 | + * @since BME V100R001C40B104 | |
| 28 | + */ | |
| 29 | +@Repository | |
| 30 | +public class PloodPressureGuideDaoImpl extends BaseMongoDAOImpl<PloodPressureGuideModel> implements IPloodPressureGuideDao { | |
| 31 | + | |
| 32 | + //日志调测器 | |
| 33 | + private static final Logger logger = LoggerFactory.getLogger(PloodPressureGuideDaoImpl.class); | |
| 34 | + | |
| 35 | + @Override | |
| 36 | + public PloodPressureGuideModel addPloodPressureGuide(PloodPressureGuideModel model) { | |
| 37 | + return save(model); | |
| 38 | + } | |
| 39 | + | |
| 40 | + @Override | |
| 41 | + public void updateOne(PloodPressureGuideModel obj, String id) { | |
| 42 | + update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), obj); | |
| 43 | + } | |
| 44 | + | |
| 45 | + @Override | |
| 46 | + public List<PloodPressureGuideModel> queryPloodPressureGuides(MongoQuery mongoQuery) { | |
| 47 | + return find(mongoQuery.convertToMongoQuery()); | |
| 48 | + } | |
| 49 | + | |
| 50 | + @Override | |
| 51 | + public int queryCount(MongoQuery query) { | |
| 52 | + return (int) count(query.convertToMongoQuery()); | |
| 53 | + } | |
| 54 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BpReportService.java
View file @
c6400c1
| 1 | +package com.lyms.platform.biz.service; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.IBpReportDao; | |
| 4 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 5 | +import com.lyms.platform.pojo.BpReportModel; | |
| 6 | +import com.lyms.platform.query.BpReportQuery; | |
| 7 | +import org.slf4j.Logger; | |
| 8 | +import org.slf4j.LoggerFactory; | |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | +import org.springframework.data.domain.Sort; | |
| 11 | +import org.springframework.stereotype.Service; | |
| 12 | + | |
| 13 | +import java.util.List; | |
| 14 | + | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * 添加类的一句话简单描述。 | |
| 18 | + * <p> | |
| 19 | + * 详细描述 | |
| 20 | + * <p> | |
| 21 | + * 示例代码 | |
| 22 | + * <pre> | |
| 23 | + * </pre/> | |
| 24 | + * | |
| 25 | + * @author JIAZHI.JIANG | |
| 26 | + * @version BME V100R001 2018-08-23 17:08 | |
| 27 | + * @since BME V100R001C40B104 | |
| 28 | + */ | |
| 29 | +@Service | |
| 30 | +public class BpReportService { | |
| 31 | + | |
| 32 | + //日志调测器 | |
| 33 | + private static final Logger logger = LoggerFactory.getLogger(BpReportService.class); | |
| 34 | + @Autowired | |
| 35 | + private IBpReportDao bpReportDao; | |
| 36 | + | |
| 37 | + public List<BpReportModel> queryBpReport(BpReportQuery query) { | |
| 38 | + MongoQuery query1 = query.convertToQuery(); | |
| 39 | + query1.addOrder(Sort.Direction.ASC, "created"); | |
| 40 | + return bpReportDao.queryBpReport(query1); | |
| 41 | + } | |
| 42 | + | |
| 43 | + public BpReportModel findById(String id) { | |
| 44 | + return bpReportDao.getBpReport(id); | |
| 45 | + } | |
| 46 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PloodPressureGuideService.java
View file @
c6400c1
| 1 | +package com.lyms.platform.biz.service; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.IPloodPressureGuideDao; | |
| 4 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 5 | +import com.lyms.platform.pojo.PloodPressureGuideModel; | |
| 6 | +import com.lyms.platform.query.PloodPressureGuideQuery; | |
| 7 | +import org.slf4j.Logger; | |
| 8 | +import org.slf4j.LoggerFactory; | |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | +import org.springframework.data.domain.Sort; | |
| 11 | +import org.springframework.stereotype.Service; | |
| 12 | + | |
| 13 | +import java.util.List; | |
| 14 | + | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * 添加类的一句话简单描述。 | |
| 18 | + * <p> | |
| 19 | + * 详细描述 | |
| 20 | + * <p> | |
| 21 | + * 示例代码 | |
| 22 | + * <pre> | |
| 23 | + * </pre/> | |
| 24 | + * | |
| 25 | + * @author JIAZHI.JIANG | |
| 26 | + * @version BME V100R001 2018-08-23 17:30 | |
| 27 | + * @since BME V100R001C40B104 | |
| 28 | + */ | |
| 29 | +@Service | |
| 30 | +public class PloodPressureGuideService { | |
| 31 | + | |
| 32 | + //日志调测器 | |
| 33 | + private static final Logger logger = LoggerFactory.getLogger(PloodPressureGuideService.class); | |
| 34 | + @Autowired | |
| 35 | + private IPloodPressureGuideDao pressureGuideDao; | |
| 36 | + | |
| 37 | + | |
| 38 | + public List<PloodPressureGuideModel> queryPloodPressureGuides(PloodPressureGuideQuery mongoQuery){ | |
| 39 | + return pressureGuideDao.queryPloodPressureGuides(mongoQuery.convertToQuery().addOrder(Sort.Direction.DESC,"order")); | |
| 40 | + } | |
| 41 | +} |
platform-dal/src/main/java/com/lyms/platform/pojo/PloodPressureGuideModel.java
View file @
c6400c1
| ... | ... | @@ -23,7 +23,9 @@ |
| 23 | 23 | @Document(collection = "lyms_bpguide") |
| 24 | 24 | public class PloodPressureGuideModel extends BaseModel { |
| 25 | 25 | |
| 26 | + private String id; | |
| 26 | 27 | |
| 28 | + | |
| 27 | 29 | /* 血压值正常/异常 0/1 |
| 28 | 30 | 血压波动正常/异常 0/1 |
| 29 | 31 | |
| ... | ... | @@ -46,6 +48,14 @@ |
| 46 | 48 | |
| 47 | 49 | //排序字段 |
| 48 | 50 | private Integer order; |
| 51 | + | |
| 52 | + public String getId() { | |
| 53 | + return id; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public void setId(String id) { | |
| 57 | + this.id = id; | |
| 58 | + } | |
| 49 | 59 | |
| 50 | 60 | public Integer getOrder() { |
| 51 | 61 | return order; |
platform-dal/src/main/java/com/lyms/platform/query/BpReportQuery.java
View file @
c6400c1
| 1 | +package com.lyms.platform.query; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.base.IConvertToNativeQuery; | |
| 4 | +import com.lyms.platform.common.dao.BaseQuery; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 7 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * Created by Administrator on 2017/1/13 0013. | |
| 11 | + */ | |
| 12 | +public class BpReportQuery extends BaseQuery implements IConvertToNativeQuery { | |
| 13 | + private String pid; | |
| 14 | + private Integer yn; | |
| 15 | + | |
| 16 | + | |
| 17 | + @Override | |
| 18 | + public MongoQuery convertToQuery() { | |
| 19 | + MongoCondition condition = MongoCondition.newInstance(); | |
| 20 | + | |
| 21 | + if(null!=pid){ | |
| 22 | + condition=condition.and("pid", pid, MongoOper.IS); | |
| 23 | + } | |
| 24 | + | |
| 25 | + if(null!=yn){ | |
| 26 | + condition=condition.and("yn", yn, MongoOper.IS); | |
| 27 | + } | |
| 28 | + return condition.toMongoQuery(); | |
| 29 | + } | |
| 30 | + | |
| 31 | + public String getPid() { | |
| 32 | + return pid; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public void setPid(String pid) { | |
| 36 | + this.pid = pid; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public Integer getYn() { | |
| 40 | + return yn; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public void setYn(Integer yn) { | |
| 44 | + this.yn = yn; | |
| 45 | + } | |
| 46 | +} |
platform-dal/src/main/java/com/lyms/platform/query/PloodPressureGuideQuery.java
View file @
c6400c1
| 1 | +package com.lyms.platform.query; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.base.IConvertToNativeQuery; | |
| 4 | +import com.lyms.platform.common.dao.BaseQuery; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 7 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * Created by Administrator on 2017/1/13 0013. | |
| 11 | + */ | |
| 12 | +public class PloodPressureGuideQuery extends BaseQuery implements IConvertToNativeQuery { | |
| 13 | + private String pid; | |
| 14 | + private Integer yn; | |
| 15 | + private String type; | |
| 16 | + private Integer week; | |
| 17 | + private Integer categoryType; | |
| 18 | + | |
| 19 | + | |
| 20 | + public void setCategoryType(Integer categoryType) { | |
| 21 | + this.categoryType = categoryType; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public void setType(String type) { | |
| 25 | + this.type = type; | |
| 26 | + } | |
| 27 | + | |
| 28 | + | |
| 29 | + public void setWeek(Integer week) { | |
| 30 | + this.week = week; | |
| 31 | + } | |
| 32 | + | |
| 33 | + @Override | |
| 34 | + public MongoQuery convertToQuery() { | |
| 35 | + MongoCondition condition = MongoCondition.newInstance(); | |
| 36 | + | |
| 37 | + if(null!=pid){ | |
| 38 | + condition=condition.and("pid", pid, MongoOper.IS); | |
| 39 | + } | |
| 40 | + if(null!=type){ | |
| 41 | + condition=condition.and("type", type, MongoOper.IS); | |
| 42 | + } | |
| 43 | + if(null!=week){ | |
| 44 | + condition=condition.and("week", week, MongoOper.IS); | |
| 45 | + } | |
| 46 | + if(null!=categoryType){ | |
| 47 | + condition=condition.and("categoryType", categoryType, MongoOper.IS); | |
| 48 | + } | |
| 49 | + | |
| 50 | + if(null!=yn){ | |
| 51 | + condition=condition.and("yn", yn, MongoOper.IS); | |
| 52 | + } | |
| 53 | + return condition.toMongoQuery(); | |
| 54 | + } | |
| 55 | + | |
| 56 | + public String getPid() { | |
| 57 | + return pid; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public void setPid(String pid) { | |
| 61 | + this.pid = pid; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public Integer getYn() { | |
| 65 | + return yn; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public void setYn(Integer yn) { | |
| 69 | + this.yn = yn; | |
| 70 | + } | |
| 71 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BloodPressureController.java
View file @
c6400c1
| 1 | 1 | package com.lyms.platform.operate.web.controller; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.biz.service.BpReportService; | |
| 3 | 4 | import com.lyms.platform.common.annotation.TokenRequired; |
| 4 | 5 | import com.lyms.platform.common.base.BaseController; |
| 6 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
| 7 | +import com.lyms.platform.common.enums.YnEnums; | |
| 8 | +import com.lyms.platform.common.result.BaseListResponse; | |
| 5 | 9 | import com.lyms.platform.common.result.BaseResponse; |
| 6 | 10 | import com.lyms.platform.common.result.RespBuilder; |
| 11 | +import com.lyms.platform.common.utils.DateUtil; | |
| 12 | +import com.lyms.platform.operate.web.facade.BpReportFacade; | |
| 7 | 13 | import com.lyms.platform.operate.web.service.IBloodPressureService; |
| 14 | +import com.lyms.platform.operate.web.utils.CollectionUtils; | |
| 8 | 15 | import com.lyms.platform.pojo.BloodPressure; |
| 16 | +import com.lyms.platform.pojo.BpReportModel; | |
| 17 | +import com.lyms.platform.query.BpReportQuery; | |
| 18 | +import org.apache.commons.lang.StringUtils; | |
| 19 | +import org.apache.commons.lang.math.NumberUtils; | |
| 9 | 20 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | 21 | import org.springframework.stereotype.Controller; |
| 11 | 22 | import org.springframework.web.bind.annotation.*; |
| 12 | 23 | |
| 13 | 24 | import javax.servlet.http.HttpServletRequest; |
| 14 | -import java.util.Date; | |
| 25 | +import java.util.*; | |
| 15 | 26 | |
| 16 | 27 | /** |
| 17 | 28 | * 血压 |
| 18 | 29 | |
| 19 | 30 | |
| 20 | 31 | |
| 21 | 32 | |
| ... | ... | @@ -66,25 +77,41 @@ |
| 66 | 77 | @ResponseBody |
| 67 | 78 | @RequestMapping(value = "/app/list/{pid}", method = RequestMethod.GET) |
| 68 | 79 | public BaseResponse getReportList(@PathVariable String pid) { |
| 69 | - return null; | |
| 80 | + | |
| 81 | + if (StringUtils.isEmpty(pid) || "null".equals(pid)) { | |
| 82 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("pid参数不能为空"); | |
| 83 | + } | |
| 84 | + | |
| 85 | + return bpReportFacade.findReportList(pid); | |
| 70 | 86 | } |
| 71 | 87 | |
| 72 | 88 | /** |
| 73 | 89 | * 获取某个人的血压列表报告 |
| 74 | 90 | * |
| 75 | - * @param type | |
| 76 | - 血压值正常无波动 00 | |
| 77 | - 血压波动异常,血压值正常 10 | |
| 78 | - 血压值异常(血压值异常但基本平稳) 01 | |
| 79 | - 血压值异常,波动异常 11 | |
| 91 | + * @param type 血压值正常无波动 00 | |
| 92 | + * 血压波动异常,血压值正常 10 | |
| 93 | + * 血压值异常(血压值异常但基本平稳) 01 | |
| 94 | + * 血压值异常,波动异常 11 | |
| 80 | 95 | * @param week 孕周 |
| 81 | 96 | * @return |
| 82 | 97 | */ |
| 83 | 98 | @ResponseBody |
| 84 | - @RequestMapping(value = "/app/report", method = RequestMethod.GET) | |
| 99 | + @RequestMapping(value = "/app/report/{id}", method = RequestMethod.GET) | |
| 85 | 100 | public BaseResponse getReportDetail(@RequestParam("type") String type, |
| 86 | - @RequestParam("week") String week) { | |
| 87 | - return null; | |
| 101 | + @RequestParam("week") String week, | |
| 102 | + @PathVariable String id) { | |
| 103 | + if (StringUtils.isEmpty(id) || "null".equals(id)) { | |
| 104 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("id参数不能为空"); | |
| 105 | + } | |
| 106 | + | |
| 107 | + if (StringUtils.isEmpty(week) || "null".equals(week) || !NumberUtils.isNumber(week)) { | |
| 108 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("week参数错误"); | |
| 109 | + } | |
| 110 | + | |
| 111 | + return bpReportFacade.lookReportDetailById(id, week, type); | |
| 88 | 112 | } |
| 113 | + | |
| 114 | + @Autowired | |
| 115 | + private BpReportFacade bpReportFacade; | |
| 89 | 116 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BpReportFacade.java
View file @
c6400c1
| 1 | +package com.lyms.platform.operate.web.facade; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.BpReportService; | |
| 4 | +import com.lyms.platform.biz.service.PatientsService; | |
| 5 | +import com.lyms.platform.biz.service.PloodPressureGuideService; | |
| 6 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
| 7 | +import com.lyms.platform.common.enums.YnEnums; | |
| 8 | +import com.lyms.platform.common.result.BaseListResponse; | |
| 9 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
| 10 | +import com.lyms.platform.common.result.BaseResponse; | |
| 11 | +import com.lyms.platform.common.utils.DateUtil; | |
| 12 | +import com.lyms.platform.operate.web.utils.CollectionUtils; | |
| 13 | +import com.lyms.platform.pojo.BpReportModel; | |
| 14 | +import com.lyms.platform.pojo.Patients; | |
| 15 | +import com.lyms.platform.pojo.PloodPressureGuideModel; | |
| 16 | +import com.lyms.platform.query.BpReportQuery; | |
| 17 | +import com.lyms.platform.query.PatientsQuery; | |
| 18 | +import com.lyms.platform.query.PloodPressureGuideQuery; | |
| 19 | +import org.apache.commons.lang.math.NumberUtils; | |
| 20 | +import org.slf4j.Logger; | |
| 21 | +import org.slf4j.LoggerFactory; | |
| 22 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 23 | +import org.springframework.stereotype.Component; | |
| 24 | + | |
| 25 | +import java.util.*; | |
| 26 | + | |
| 27 | + | |
| 28 | +/** | |
| 29 | + * 添加类的一句话简单描述。 | |
| 30 | + * <p> | |
| 31 | + * 详细描述 | |
| 32 | + * <p> | |
| 33 | + * 示例代码 | |
| 34 | + * <pre> | |
| 35 | + * </pre/> | |
| 36 | + * | |
| 37 | + * @author JIAZHI.JIANG | |
| 38 | + * @version BME V100R001 2018-08-23 17:21 | |
| 39 | + * @since BME V100R001C40B104 | |
| 40 | + */ | |
| 41 | +@Component | |
| 42 | +public class BpReportFacade { | |
| 43 | + | |
| 44 | + //日志调测器 | |
| 45 | + private static final Logger logger = LoggerFactory.getLogger(BpReportFacade.class); | |
| 46 | + @Autowired | |
| 47 | + private BpReportService bpReportService; | |
| 48 | + @Autowired | |
| 49 | + private PatientsService patientService; | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 查询某个人的血压报告数据 | |
| 53 | + * | |
| 54 | + * @param pid pid | |
| 55 | + * @return 返回内容结果 | |
| 56 | + */ | |
| 57 | + public BaseResponse findReportList(String pid) { | |
| 58 | + BpReportQuery reportQuery = new BpReportQuery(); | |
| 59 | + reportQuery.setYn(YnEnums.YES.getId()); | |
| 60 | + reportQuery.setPid(pid); | |
| 61 | + List<BpReportModel> DATA = bpReportService.queryBpReport(reportQuery); | |
| 62 | + List data = new ArrayList(); | |
| 63 | + if (CollectionUtils.isNotEmpty(DATA)) { | |
| 64 | + for (BpReportModel report : DATA) { | |
| 65 | + Map map = new HashMap<>(); | |
| 66 | + map.put("id", report.getId()); | |
| 67 | + map.put("title", report.getTitle()); | |
| 68 | + map.put("create", DateUtil.getyyyy_MM_dd(report.getCreated())); | |
| 69 | + map.put("type", report.getType()); | |
| 70 | + map.put("week", report.getWeek()); | |
| 71 | + data.add(map); | |
| 72 | + } | |
| 73 | + } | |
| 74 | + return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(data); | |
| 75 | + } | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * 根据reportid查看某次报告的详细数据 | |
| 79 | + * | |
| 80 | + * @param reportId 报告id | |
| 81 | + * @param week 孕周 | |
| 82 | + * @param type 类型 | |
| 83 | + * @return | |
| 84 | + */ | |
| 85 | + public BaseResponse lookReportDetailById(String reportId, String week, String type) { | |
| 86 | + | |
| 87 | + PloodPressureGuideQuery pressureGuideQuery = new PloodPressureGuideQuery(); | |
| 88 | + pressureGuideQuery.setYn(YnEnums.YES.getId()); | |
| 89 | + pressureGuideQuery.setType(type); | |
| 90 | + pressureGuideQuery.setWeek(NumberUtils.toInt(week, 0)); | |
| 91 | + | |
| 92 | + BpReportModel bpReport = bpReportService.findById(reportId); | |
| 93 | + List<PloodPressureGuideModel> guideModelList = pressureGuideService.queryPloodPressureGuides(pressureGuideQuery); | |
| 94 | + | |
| 95 | + | |
| 96 | + Map data =new HashMap(); | |
| 97 | + | |
| 98 | + if(null!=bpReport){ | |
| 99 | + data.put("id", bpReport.getId()); | |
| 100 | + | |
| 101 | + PatientsQuery patientsQuery1= new PatientsQuery(); | |
| 102 | + patientsQuery1.setPid(bpReport.getPid()); | |
| 103 | + patientsQuery1.setType(1); | |
| 104 | + patientsQuery1.setYn(YnEnums.YES.getId()); | |
| 105 | + List<Patients> patientses = patientService.queryPatient(patientsQuery1); | |
| 106 | + | |
| 107 | + if(CollectionUtils.isNotEmpty(patientses)){ | |
| 108 | + data.put("age",DateUtil.getAge(patientses.get(0).getBirth())); | |
| 109 | + data.put("lastMenses",DateUtil.getyyyy_MM_dd(patientses.get(0).getLastMenses())); | |
| 110 | + data.put("name",patientses.get(0).getUsername()); | |
| 111 | + data.put("dueWeek",DateUtil.getyyyy_MM_dd(patientses.get(0).getDueDate())); | |
| 112 | + data.put("week", DateUtil.getWeek(patientses.get(0).getLastMenses(), new Date())); | |
| 113 | + } | |
| 114 | + data.put("title",bpReport.getTitle()); | |
| 115 | + | |
| 116 | + data.put("height",bpReport.getId()); | |
| 117 | + //测评评估 | |
| 118 | + data.put("assess",bpReport.getAssess()); | |
| 119 | + //测评次数 | |
| 120 | + data.put("count",bpReport.getCount()); | |
| 121 | + //血压值异常次数 | |
| 122 | + data.put("bpValExp",bpReport.getBpValExp()); | |
| 123 | + //血压波动次数 | |
| 124 | + data.put("bpWaveCount",bpReport.getBpWaveCount()); | |
| 125 | + //指导 | |
| 126 | + data.put("guide",bpReport.getGuide()); | |
| 127 | + | |
| 128 | + data.put("guideData",convertToResponse(guideModelList)); | |
| 129 | + | |
| 130 | + } | |
| 131 | + | |
| 132 | + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(data); | |
| 133 | + } | |
| 134 | + | |
| 135 | + private List convertToResponse(List<PloodPressureGuideModel> data){ | |
| 136 | + List list =new ArrayList(); | |
| 137 | + for(PloodPressureGuideModel guideModel:data){ | |
| 138 | + Map map = new HashMap(); | |
| 139 | + map.put("category",guideModel.getCategory()); | |
| 140 | + map.put("categoryType",guideModel.getCategoryType()); | |
| 141 | + map.put("content",guideModel.getContent()); | |
| 142 | + map.put("order",guideModel.getOrder()); | |
| 143 | + list.add(map); | |
| 144 | + } | |
| 145 | + return list; | |
| 146 | + } | |
| 147 | + | |
| 148 | + @Autowired | |
| 149 | + private PloodPressureGuideService pressureGuideService; | |
| 150 | +} |