Commit aa9323f91afbf08e166ae132afcdd5f56f40a7e7

Authored by jiangjiazhi
1 parent 83f746b818

增加获取未读报告接口

Showing 8 changed files with 93 additions and 24 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IBpReportDao.java View file @ aa9323f
... ... @@ -33,5 +33,8 @@
33 33  
34 34  
35 35 BpReportModel getBpReport(String id);
  36 +
  37 +
  38 + void updateBpReport(BpReportModel obj, String id);
36 39 }
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BpReportDaoImpl.java View file @ aa9323f
... ... @@ -2,6 +2,8 @@
2 2  
3 3 import com.lyms.platform.biz.dal.IBpReportDao;
4 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;
5 7 import com.lyms.platform.common.dao.operator.MongoQuery;
6 8 import com.lyms.platform.pojo.BpReportModel;
7 9 import org.slf4j.Logger;
... ... @@ -45,6 +47,11 @@
45 47 @Override
46 48 public BpReportModel getBpReport(String id) {
47 49 return findById(id);
  50 + }
  51 +
  52 + @Override
  53 + public void updateBpReport(BpReportModel obj, String id) {
  54 + update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), obj);
48 55 }
49 56 }
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BpReportService.java View file @ aa9323f
... ... @@ -40,6 +40,9 @@
40 40 return bpReportDao.queryBpReport(query1);
41 41 }
42 42  
  43 + public void updateBpReport(BpReportModel obj, String id){
  44 + bpReportDao.updateBpReport(obj,id);
  45 + }
43 46 public BpReportModel findById(String id) {
44 47 return bpReportDao.getBpReport(id);
45 48 }
platform-dal/src/main/java/com/lyms/platform/pojo/BpReportModel.java View file @ aa9323f
... ... @@ -20,7 +20,7 @@
20 20 * @since BME V100R001C40B104
21 21 */
22 22 @Document(collection = "lyms_bp_report")
23   -public class BpReportModel extends BaseModel{
  23 +public class BpReportModel extends BaseModel {
24 24  
25 25 private String pid;
26 26 private Date created;
... ... @@ -40,6 +40,16 @@
40 40 //指导
41 41 private String guide;
42 42 private Integer yn;
  43 + //查看状态 0 未查看 1 已查看
  44 + private Integer status;
  45 +
  46 + public Integer getStatus() {
  47 + return status;
  48 + }
  49 +
  50 + public void setStatus(Integer status) {
  51 + this.status = status;
  52 + }
43 53  
44 54 public Integer getYn() {
45 55 return yn;
platform-dal/src/main/java/com/lyms/platform/query/BpReportQuery.java View file @ aa9323f
... ... @@ -12,7 +12,11 @@
12 12 public class BpReportQuery extends BaseQuery implements IConvertToNativeQuery {
13 13 private String pid;
14 14 private Integer yn;
  15 + private Integer status;
15 16  
  17 + public void setStatus(Integer status) {
  18 + this.status = status;
  19 + }
16 20  
17 21 @Override
18 22 public MongoQuery convertToQuery() {
... ... @@ -20,6 +24,9 @@
20 24  
21 25 if(null!=pid){
22 26 condition=condition.and("pid", pid, MongoOper.IS);
  27 + }
  28 + if(null!=pid){
  29 + condition=condition.and("status", status, MongoOper.IS);
23 30 }
24 31  
25 32 if(null!=yn){
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BloodPressureController.java View file @ aa9323f
... ... @@ -111,6 +111,18 @@
111 111 return bpReportFacade.lookReportDetailById(id, week, type);
112 112 }
113 113  
  114 +
  115 + /**
  116 + * 获取未读的消息
  117 + * @param pid
  118 + * @return
  119 + */
  120 + @ResponseBody
  121 + @RequestMapping(value = "/app/unread/{pid}", method = RequestMethod.GET)
  122 + public BaseResponse checkUnReadReport(@PathVariable String pid){
  123 + return bpReportFacade.checkUnReadReport(pid);
  124 + }
  125 +
114 126 @Autowired
115 127 private BpReportFacade bpReportFacade;
116 128 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BpReportFacade.java View file @ aa9323f
... ... @@ -49,6 +49,29 @@
49 49 private PatientsService patientService;
50 50  
51 51 /**
  52 + * 获取未读的消息信息
  53 + * @return
  54 + */
  55 + public BaseResponse checkUnReadReport(String pid){
  56 + BpReportQuery reportQuery = new BpReportQuery();
  57 + reportQuery.setYn(YnEnums.YES.getId());
  58 + reportQuery.setPid(pid);
  59 + reportQuery.setStatus(0);
  60 + List<BpReportModel> DATA = bpReportService.queryBpReport(reportQuery);
  61 + //查询最近一个生成的没看的记录
  62 + Map map = new HashMap<>();
  63 + if(CollectionUtils.isNotEmpty(DATA)){
  64 + BpReportModel bpReport= DATA.get(DATA.size() - 1);
  65 + map.put("id", bpReport.getId());
  66 + map.put("title", bpReport.getTitle());
  67 + map.put("create", DateUtil.getyyyy_MM_dd(bpReport.getCreated()));
  68 + map.put("type", bpReport.getType());
  69 + map.put("week", bpReport.getWeek());
  70 + }
  71 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(map);
  72 + }
  73 +
  74 + /**
52 75 * 查询某个人的血压报告数据
53 76 *
54 77 * @param pid pid
55 78  
56 79  
57 80  
58 81  
59 82  
60 83  
61 84  
62 85  
63 86  
64 87  
65 88  
66 89  
67 90  
68 91  
... ... @@ -92,54 +115,57 @@
92 115 BpReportModel bpReport = bpReportService.findById(reportId);
93 116 List<PloodPressureGuideModel> guideModelList = pressureGuideService.queryPloodPressureGuides(pressureGuideQuery);
94 117  
  118 + Map data = new HashMap();
95 119  
96   - Map data =new HashMap();
  120 + if (null != bpReport) {
  121 + //修改为已读状态
  122 + bpReport.setStatus(1);
97 123  
98   - if(null!=bpReport){
  124 + bpReportService.updateBpReport(bpReport, bpReport.getId());
99 125 data.put("id", bpReport.getId());
100 126  
101   - PatientsQuery patientsQuery1= new PatientsQuery();
  127 + PatientsQuery patientsQuery1 = new PatientsQuery();
102 128 patientsQuery1.setPid(bpReport.getPid());
103 129 patientsQuery1.setType(1);
104 130 patientsQuery1.setYn(YnEnums.YES.getId());
105 131 List<Patients> patientses = patientService.queryPatient(patientsQuery1);
106 132  
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()));
  133 + if (CollectionUtils.isNotEmpty(patientses)) {
  134 + data.put("age", DateUtil.getAge(patientses.get(0).getBirth()));
  135 + data.put("lastMenses", DateUtil.getyyyy_MM_dd(patientses.get(0).getLastMenses()));
  136 + data.put("name", patientses.get(0).getUsername());
  137 + data.put("dueWeek", DateUtil.getyyyy_MM_dd(patientses.get(0).getDueDate()));
112 138 data.put("week", DateUtil.getWeek(patientses.get(0).getLastMenses(), new Date()));
113 139 }
114   - data.put("title",bpReport.getTitle());
  140 + data.put("title", bpReport.getTitle());
115 141  
116   - data.put("height",bpReport.getId());
  142 + data.put("height", bpReport.getId());
117 143 //测评评估
118   - data.put("assess",bpReport.getAssess());
  144 + data.put("assess", bpReport.getAssess());
119 145 //测评次数
120   - data.put("count",bpReport.getCount());
  146 + data.put("count", bpReport.getCount());
121 147 //血压值异常次数
122   - data.put("bpValExp",bpReport.getBpValExp());
  148 + data.put("bpValExp", bpReport.getBpValExp());
123 149 //血压波动次数
124   - data.put("bpWaveCount",bpReport.getBpWaveCount());
  150 + data.put("bpWaveCount", bpReport.getBpWaveCount());
125 151 //指导
126   - data.put("guide",bpReport.getGuide());
  152 + data.put("guide", bpReport.getGuide());
127 153  
128   - data.put("guideData",convertToResponse(guideModelList));
  154 + data.put("guideData", convertToResponse(guideModelList));
129 155  
130 156 }
131 157  
132 158 return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(data);
133 159 }
134 160  
135   - private List convertToResponse(List<PloodPressureGuideModel> data){
136   - List list =new ArrayList();
137   - for(PloodPressureGuideModel guideModel:data){
  161 + private List convertToResponse(List<PloodPressureGuideModel> data) {
  162 + List list = new ArrayList();
  163 + for (PloodPressureGuideModel guideModel : data) {
138 164 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());
  165 + map.put("category", guideModel.getCategory());
  166 + map.put("categoryType", guideModel.getCategoryType());
  167 + map.put("content", guideModel.getContent());
  168 + map.put("order", guideModel.getOrder());
143 169 list.add(map);
144 170 }
145 171 return list;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodPressureServiceImpl.java View file @ aa9323f
... ... @@ -149,6 +149,7 @@
149 149 }
150 150 }
151 151 }
  152 + report.setStatus(0);
152 153 report.setType(countType+bpCountType);
153 154 report.setGuide(typeGuideMap.get(report.getType()));
154 155 report.setBpWaveCount(String.valueOf(bpcount));