Commit 827b7580f61d7f20f54a26c3b6101d91e3f3de5e
1 parent
80519031a3
Exists in
master
and in
6 other branches
问卷调查
Showing 8 changed files with 368 additions and 16 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IQuestionDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/QuestionDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/QuestionService.java
- platform-common/src/main/java/com/lyms/platform/common/enums/QuestionEnums.java
- platform-dal/src/main/java/com/lyms/platform/pojo/QuestionModel.java
- platform-dal/src/main/java/com/lyms/platform/query/QuestionQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/QuestionController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/QuestionFacade.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IQuestionDao.java
View file @
827b758
1 | 1 | package com.lyms.platform.biz.dal; |
2 | 2 | |
3 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
3 | 4 | import com.lyms.platform.pojo.QuestionModel; |
4 | 5 | |
6 | +import java.util.List; | |
7 | + | |
5 | 8 | /** |
6 | 9 | * Created by Administrator on 2018-09-19. |
7 | 10 | */ |
8 | 11 | public interface IQuestionDao { |
9 | 12 | QuestionModel addQuestions(QuestionModel questionModel); |
13 | + | |
14 | + int queryQuestionsCount(MongoQuery mongoQuery); | |
15 | + | |
16 | + List<QuestionModel> queryQuestions(MongoQuery created); | |
10 | 17 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/QuestionDaoImpl.java
View file @
827b758
... | ... | @@ -2,9 +2,12 @@ |
2 | 2 | |
3 | 3 | import com.lyms.platform.biz.dal.IQuestionDao; |
4 | 4 | import com.lyms.platform.common.dao.BaseMongoDAOImpl; |
5 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
5 | 6 | import com.lyms.platform.pojo.QuestionModel; |
6 | 7 | import org.springframework.stereotype.Repository; |
7 | 8 | |
9 | +import java.util.List; | |
10 | + | |
8 | 11 | /** |
9 | 12 | * Created by Administrator on 2018-09-19. |
10 | 13 | */ |
... | ... | @@ -13,6 +16,16 @@ |
13 | 16 | @Override |
14 | 17 | public QuestionModel addQuestions(QuestionModel questionModel) { |
15 | 18 | return save(questionModel); |
19 | + } | |
20 | + | |
21 | + @Override | |
22 | + public int queryQuestionsCount(MongoQuery mongoQuery) { | |
23 | + return (int)count(mongoQuery.convertToMongoQuery()); | |
24 | + } | |
25 | + | |
26 | + @Override | |
27 | + public List<QuestionModel> queryQuestions(MongoQuery mongoQuery) { | |
28 | + return find(mongoQuery.convertToMongoQuery()); | |
16 | 29 | } |
17 | 30 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/QuestionService.java
View file @
827b758
1 | 1 | package com.lyms.platform.biz.service; |
2 | 2 | |
3 | 3 | import com.lyms.platform.biz.dal.IQuestionDao; |
4 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
4 | 5 | import com.lyms.platform.pojo.QuestionModel; |
6 | +import com.lyms.platform.query.QuestionQuery; | |
7 | +import org.apache.commons.lang.StringUtils; | |
5 | 8 | import org.slf4j.Logger; |
6 | 9 | import org.slf4j.LoggerFactory; |
7 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
11 | +import org.springframework.data.domain.Sort; | |
8 | 12 | import org.springframework.stereotype.Service; |
9 | 13 | |
14 | +import java.util.List; | |
10 | 15 | |
16 | + | |
11 | 17 | /** |
12 | 18 | */ |
13 | 19 | @Service |
... | ... | @@ -20,6 +26,17 @@ |
20 | 26 | |
21 | 27 | public QuestionModel addQuestions(QuestionModel questionModel) { |
22 | 28 | return questionDao.addQuestions(questionModel); |
29 | + } | |
30 | + | |
31 | + public List<QuestionModel> queryQuestions(QuestionQuery questionQuery) { | |
32 | + | |
33 | + MongoQuery query = questionQuery.convertToQuery(); | |
34 | + if (StringUtils.isNotEmpty(questionQuery.getNeed())) { | |
35 | + questionQuery.mysqlBuild(questionDao.queryQuestionsCount(questionQuery.convertToQuery())); | |
36 | + query.start(questionQuery.getOffset()).end(questionQuery.getLimit()); | |
37 | + } | |
38 | + | |
39 | + return questionDao.queryQuestions(query.addOrder(Sort.Direction.DESC, "created")); | |
23 | 40 | } |
24 | 41 | } |
platform-common/src/main/java/com/lyms/platform/common/enums/QuestionEnums.java
View file @
827b758
1 | 1 | package com.lyms.platform.common.enums; |
2 | 2 | |
3 | 3 | |
4 | +import java.util.ArrayList; | |
5 | +import java.util.HashMap; | |
6 | +import java.util.List; | |
7 | +import java.util.Map; | |
4 | 8 | |
5 | - | |
6 | 9 | /** |
7 | - * 发送日期 | |
8 | - * Created by lqy on 2016/06/27 | |
9 | 10 | */ |
10 | 11 | public enum QuestionEnums { |
11 | 12 | |
12 | 13 | |
13 | - Q1(1,"0-4(没有或极少)","在孕期,孕妇开始出现早孕反应(疲劳,乏力,嗜睡,食欲减退,恶心,呕吐等)。这些都属于怀孕期间正常的表现,通过PHQ-9的测量表的测量分数可看出您身心状体良好,请保持充足的休息,不要剧烈运动,做好孕期检查的工作。"), | |
14 | - Q2(2,"5-9(轻微抑郁)","孕妈妈在怀孕期间可能会出现担心胚胎的发育情况,害怕流产或没有准备好当妈妈的心理压力等情绪问题。这种担心表达了对未出生孩子的爱,但有研究表明长期的消极情绪会对胎儿造成不良影响,所以为了更好的给予爱和被孩子感受到爱,请保持良好的心情,积极乐观的看待事情,保持充足的休息,不要剧烈运动,遵医嘱来院做孕期检查。若自我调节无效果,建议及时来我院弘毅楼三楼围产医学科心理门诊预约心理咨询。"), | |
15 | - Q3(3,"10-14(中等程度)","孕期因体内激素分泌水平变化,身体不适的情况增加,患者的饮食及睡眠情况下降,情绪、认知也会随之受到影响。若出现这种情况,请孕妈妈明确这种情绪及认知是由身体的不适所致,此时需放松心情,及时调整心态,建议写感恩日记。若身体不适请及时来院孕检。若自我调节无效果,建议及时来我院弘毅楼三楼围产医学科心理门诊预约心理咨询。"), | |
16 | - Q4(4,"15-19(较严重抑郁)","亲爱的孕妈妈,根据您的测试,您目前可能会体验到高兴不起来、不愿意动、自觉脑子不好使,记不住事、思考问题困难,觉得脑子空空、变笨了等情况。建议多与家人沟通,调整心态,写感恩日记。若自我调节无效果,建议及时来我院弘毅楼三楼围产医学科心理门诊预约心理咨询。"), | |
17 | - Q5(5,"20-27(严重抑郁)","亲爱的孕妈妈,根据您的测试,您目前可能会有不能集中注意力,焦虑,极端易怒,睡眠不好,非常容易疲劳,或有持续的疲劳感,不停地想吃东西或者毫无食欲,对什么都不感兴趣,总是提不起精神,持续的情绪低落,想哭,情绪起伏很大,喜怒无常,经常想一些不太现实的东西等多种体验,建议您多与家人沟通,调整心态,写感恩日记。若自我调节无效果,建议及时来我院弘毅楼三楼围产医学科心理门诊预约心理咨询。"); | |
14 | + Q1(1,0,4,"0-4(没有或极少)","在孕期,孕妇开始出现早孕反应(疲劳,乏力,嗜睡,食欲减退,恶心,呕吐等)。这些都属于怀孕期间正常的表现,通过PHQ-9的测量表的测量分数可看出您身心状体良好,请保持充足的休息,不要剧烈运动,做好孕期检查的工作。"), | |
15 | + Q2(2,5,9,"5-9(轻微抑郁)","孕妈妈在怀孕期间可能会出现担心胚胎的发育情况,害怕流产或没有准备好当妈妈的心理压力等情绪问题。这种担心表达了对未出生孩子的爱,但有研究表明长期的消极情绪会对胎儿造成不良影响,所以为了更好的给予爱和被孩子感受到爱,请保持良好的心情,积极乐观的看待事情,保持充足的休息,不要剧烈运动,遵医嘱来院做孕期检查。若自我调节无效果,建议及时来我院弘毅楼三楼围产医学科心理门诊预约心理咨询。"), | |
16 | + Q3(3,10,14,"10-14(中等程度)","孕期因体内激素分泌水平变化,身体不适的情况增加,患者的饮食及睡眠情况下降,情绪、认知也会随之受到影响。若出现这种情况,请孕妈妈明确这种情绪及认知是由身体的不适所致,此时需放松心情,及时调整心态,建议写感恩日记。若身体不适请及时来院孕检。若自我调节无效果,建议及时来我院弘毅楼三楼围产医学科心理门诊预约心理咨询。"), | |
17 | + Q4(4,15,19,"15-19(较严重抑郁)","亲爱的孕妈妈,根据您的测试,您目前可能会体验到高兴不起来、不愿意动、自觉脑子不好使,记不住事、思考问题困难,觉得脑子空空、变笨了等情况。建议多与家人沟通,调整心态,写感恩日记。若自我调节无效果,建议及时来我院弘毅楼三楼围产医学科心理门诊预约心理咨询。"), | |
18 | + Q5(5,20,27,"20-27(严重抑郁)","亲爱的孕妈妈,根据您的测试,您目前可能会有不能集中注意力,焦虑,极端易怒,睡眠不好,非常容易疲劳,或有持续的疲劳感,不停地想吃东西或者毫无食欲,对什么都不感兴趣,总是提不起精神,持续的情绪低落,想哭,情绪起伏很大,喜怒无常,经常想一些不太现实的东西等多种体验,建议您多与家人沟通,调整心态,写感恩日记。若自我调节无效果,建议及时来我院弘毅楼三楼围产医学科心理门诊预约心理咨询。"); | |
18 | 19 | |
19 | - QuestionEnums(int id, String title, String content) { | |
20 | + QuestionEnums(int id, Integer start,Integer end,String title, String content) { | |
20 | 21 | this.id = id; |
22 | + this.start = start; | |
23 | + this.end = end; | |
21 | 24 | this.title = title; |
22 | 25 | this.content = content; |
23 | 26 | } |
24 | 27 | |
25 | 28 | private int id; |
26 | 29 | private String title; |
30 | + private Integer start; | |
31 | + private Integer end; | |
27 | 32 | private String content; |
28 | 33 | |
34 | + public static String getContentByScore(Integer score) { | |
35 | + if (score != null) | |
36 | + { | |
37 | + for (QuestionEnums e : QuestionEnums.values()) { | |
38 | + if (score >= e.getStart() && score <= e.getEnd()) | |
39 | + { | |
40 | + return e.getContent(); | |
41 | + } | |
42 | + } | |
43 | + } | |
44 | + return ""; | |
45 | + } | |
46 | + public static String getIdByScore(Integer score) { | |
47 | + if (score != null) | |
48 | + { | |
49 | + for (QuestionEnums e : QuestionEnums.values()) { | |
50 | + if (score >= e.getStart() && score <= e.getEnd()) | |
51 | + { | |
52 | + return e.getId()+""; | |
53 | + } | |
54 | + } | |
55 | + } | |
56 | + return ""; | |
57 | + } | |
58 | + | |
59 | + public int getId() { | |
60 | + return id; | |
61 | + } | |
62 | + | |
63 | + public void setId(int id) { | |
64 | + this.id = id; | |
65 | + } | |
66 | + | |
67 | + public String getTitle() { | |
68 | + return title; | |
69 | + } | |
70 | + | |
71 | + public void setTitle(String title) { | |
72 | + this.title = title; | |
73 | + } | |
74 | + | |
75 | + public Integer getStart() { | |
76 | + return start; | |
77 | + } | |
78 | + | |
79 | + public void setStart(Integer start) { | |
80 | + this.start = start; | |
81 | + } | |
82 | + | |
83 | + public Integer getEnd() { | |
84 | + return end; | |
85 | + } | |
86 | + | |
87 | + public void setEnd(Integer end) { | |
88 | + this.end = end; | |
89 | + } | |
90 | + | |
91 | + public String getContent() { | |
92 | + return content; | |
93 | + } | |
94 | + | |
95 | + public void setContent(String content) { | |
96 | + this.content = content; | |
97 | + } | |
29 | 98 | } |
platform-dal/src/main/java/com/lyms/platform/pojo/QuestionModel.java
View file @
827b758
... | ... | @@ -23,7 +23,7 @@ |
23 | 23 | private List<Map<String,String>> questions; |
24 | 24 | |
25 | 25 | //分数 |
26 | - private int score; | |
26 | + private Integer score; | |
27 | 27 | //困难 |
28 | 28 | private String trouble; |
29 | 29 | |
30 | 30 | |
... | ... | @@ -40,7 +40,17 @@ |
40 | 40 | |
41 | 41 | private Date created; |
42 | 42 | private Date modified; |
43 | + //评估结果id | |
44 | + private String resultId; | |
43 | 45 | |
46 | + public String getResultId() { | |
47 | + return resultId; | |
48 | + } | |
49 | + | |
50 | + public void setResultId(String resultId) { | |
51 | + this.resultId = resultId; | |
52 | + } | |
53 | + | |
44 | 54 | public String getId() { |
45 | 55 | return id; |
46 | 56 | } |
47 | 57 | |
... | ... | @@ -57,11 +67,11 @@ |
57 | 67 | this.questions = questions; |
58 | 68 | } |
59 | 69 | |
60 | - public int getScore() { | |
70 | + public Integer getScore() { | |
61 | 71 | return score; |
62 | 72 | } |
63 | 73 | |
64 | - public void setScore(int score) { | |
74 | + public void setScore(Integer score) { | |
65 | 75 | this.score = score; |
66 | 76 | } |
67 | 77 |
platform-dal/src/main/java/com/lyms/platform/query/QuestionQuery.java
View file @
827b758
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 | +import org.apache.commons.collections.CollectionUtils; | |
9 | +import org.springframework.data.mongodb.core.query.Criteria; | |
10 | + | |
11 | +import java.util.Date; | |
12 | +import java.util.List; | |
13 | +import java.util.Map; | |
14 | + | |
15 | +/** | |
16 | + * | |
17 | + */ | |
18 | +public class QuestionQuery extends BaseQuery implements IConvertToNativeQuery { | |
19 | + | |
20 | + private String id; | |
21 | + | |
22 | + //分数 | |
23 | + private Integer score; | |
24 | + | |
25 | + //困难 | |
26 | + private String trouble; | |
27 | + | |
28 | + //调查单位 | |
29 | + private String investHospitalId; | |
30 | + | |
31 | + //调查员 | |
32 | + private String investigator; | |
33 | + | |
34 | + //调查日期 | |
35 | + private Date investDateStart; | |
36 | + private Date investDateEnd; | |
37 | + | |
38 | + private String patientId; | |
39 | + private String resultId; | |
40 | + | |
41 | + @Override | |
42 | + public MongoQuery convertToQuery() { | |
43 | + MongoCondition condition=MongoCondition.newInstance(); | |
44 | + if(null != patientId){ | |
45 | + condition= condition.and("patientId",patientId, MongoOper.IS); | |
46 | + } | |
47 | + if(null != resultId){ | |
48 | + condition= condition.and("resultId",resultId, MongoOper.IS); | |
49 | + } | |
50 | + if(null != investHospitalId){ | |
51 | + condition= condition.and("investHospitalId",investHospitalId, MongoOper.IS); | |
52 | + } | |
53 | + if(null != id){ | |
54 | + condition= condition.and("id",id, MongoOper.IS); | |
55 | + } | |
56 | + if(null != investigator){ | |
57 | + condition= condition.and("investigator",investigator, MongoOper.IS); | |
58 | + } | |
59 | + if(null != trouble){ | |
60 | + condition= condition.and("trouble",trouble, MongoOper.IS); | |
61 | + } | |
62 | + if(null != score){ | |
63 | + condition= condition.and("score",score, MongoOper.IS); | |
64 | + } | |
65 | + Criteria c1 = null; | |
66 | + if (investDateStart != null && investDateEnd != null) { | |
67 | + if (c1 != null) { | |
68 | + c1 = c1.and("investDate").gte(investDateStart).lte(investDateEnd); | |
69 | + } else { | |
70 | + c1 = Criteria.where("investDate").gte(investDateStart).lte(investDateEnd); | |
71 | + } | |
72 | + } | |
73 | + if (null != c1) { | |
74 | + condition = condition.andCondition(new MongoCondition(c1)); | |
75 | + } | |
76 | + return condition.toMongoQuery(); | |
77 | + } | |
78 | + | |
79 | + public String getId() { | |
80 | + return id; | |
81 | + } | |
82 | + | |
83 | + public void setId(String id) { | |
84 | + this.id = id; | |
85 | + } | |
86 | + | |
87 | + public Integer getScore() { | |
88 | + return score; | |
89 | + } | |
90 | + | |
91 | + public void setScore(Integer score) { | |
92 | + this.score = score; | |
93 | + } | |
94 | + | |
95 | + public String getTrouble() { | |
96 | + return trouble; | |
97 | + } | |
98 | + | |
99 | + public void setTrouble(String trouble) { | |
100 | + this.trouble = trouble; | |
101 | + } | |
102 | + | |
103 | + public String getInvestHospitalId() { | |
104 | + return investHospitalId; | |
105 | + } | |
106 | + | |
107 | + public void setInvestHospitalId(String investHospitalId) { | |
108 | + this.investHospitalId = investHospitalId; | |
109 | + } | |
110 | + | |
111 | + public String getInvestigator() { | |
112 | + return investigator; | |
113 | + } | |
114 | + | |
115 | + public void setInvestigator(String investigator) { | |
116 | + this.investigator = investigator; | |
117 | + } | |
118 | + | |
119 | + public Date getInvestDateStart() { | |
120 | + return investDateStart; | |
121 | + } | |
122 | + | |
123 | + public void setInvestDateStart(Date investDateStart) { | |
124 | + this.investDateStart = investDateStart; | |
125 | + } | |
126 | + | |
127 | + public Date getInvestDateEnd() { | |
128 | + return investDateEnd; | |
129 | + } | |
130 | + | |
131 | + public void setInvestDateEnd(Date investDateEnd) { | |
132 | + this.investDateEnd = investDateEnd; | |
133 | + } | |
134 | + | |
135 | + public String getPatientId() { | |
136 | + return patientId; | |
137 | + } | |
138 | + | |
139 | + public void setPatientId(String patientId) { | |
140 | + this.patientId = patientId; | |
141 | + } | |
142 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/QuestionController.java
View file @
827b758
... | ... | @@ -18,7 +18,7 @@ |
18 | 18 | * Created by Administrator on 2018-08-06. |
19 | 19 | */ |
20 | 20 | @Controller |
21 | -@RequestMapping("/assist") | |
21 | +@RequestMapping("/questions") | |
22 | 22 | public class QuestionController extends BaseController { |
23 | 23 | |
24 | 24 | @Autowired |
... | ... | @@ -35,6 +35,14 @@ |
35 | 35 | public BaseResponse addQuestions(@Valid @RequestBody QuestionModel questionModel, |
36 | 36 | HttpServletRequest httpServletRequest) { |
37 | 37 | return questionFacade.addQuestions(questionModel); |
38 | + } | |
39 | + | |
40 | + | |
41 | + @RequestMapping(method = RequestMethod.GET, value = "/getQuertionByPatientId/{patientId}") | |
42 | + @ResponseBody | |
43 | + public BaseResponse getQuertionByPatientId(@PathVariable String patientId, | |
44 | + HttpServletRequest httpServletRequest) { | |
45 | + return questionFacade.getQuestionByPatientId(patientId); | |
38 | 46 | } |
39 | 47 | |
40 | 48 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/QuestionFacade.java
View file @
827b758
1 | 1 | package com.lyms.platform.operate.web.facade; |
2 | 2 | |
3 | 3 | |
4 | +import com.lyms.platform.biz.service.BasicConfigService; | |
5 | +import com.lyms.platform.biz.service.PatientsService; | |
4 | 6 | import com.lyms.platform.biz.service.QuestionService; |
5 | 7 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
8 | +import com.lyms.platform.common.enums.QuestionEnums; | |
9 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
6 | 10 | import com.lyms.platform.common.result.BaseResponse; |
7 | 11 | |
12 | +import com.lyms.platform.common.utils.DateUtil; | |
13 | +import com.lyms.platform.operate.web.utils.CollectionUtils; | |
14 | +import com.lyms.platform.operate.web.utils.CommonsHelper; | |
15 | +import com.lyms.platform.permission.service.OrganizationService; | |
16 | +import com.lyms.platform.permission.service.UsersService; | |
17 | +import com.lyms.platform.pojo.Patients; | |
8 | 18 | import com.lyms.platform.pojo.QuestionModel; |
9 | 19 | |
20 | +import com.lyms.platform.query.QuestionQuery; | |
10 | 21 | import org.springframework.beans.factory.annotation.Autowired; |
11 | 22 | import org.springframework.stereotype.Component; |
12 | 23 | |
24 | +import java.util.Date; | |
25 | +import java.util.HashMap; | |
26 | +import java.util.List; | |
27 | +import java.util.Map; | |
13 | 28 | |
14 | 29 | |
15 | 30 | /** |
16 | - * 数据访问权限的门面 Created by Administrator on 2016/3/30 0030. | |
17 | 31 | */ |
18 | 32 | @Component |
19 | 33 | public class QuestionFacade { |
20 | 34 | |
21 | 35 | |
22 | 36 | |
... | ... | @@ -21,13 +35,85 @@ |
21 | 35 | @Autowired |
22 | 36 | private QuestionService questionService; |
23 | 37 | |
24 | - public BaseResponse addQuestions(QuestionModel questionModel) { | |
38 | + @Autowired | |
39 | + private PatientsService patientsService; | |
40 | + @Autowired | |
41 | + private OrganizationService organizationService; | |
25 | 42 | |
43 | + @Autowired | |
44 | + private UsersService usersService; | |
45 | + | |
46 | + @Autowired | |
47 | + private BasicConfigService basicConfigService; | |
48 | + | |
49 | + public BaseResponse addQuestions(QuestionModel questionModel) { | |
50 | + questionModel.setCreated(new Date()); | |
51 | + questionModel.setInvestDate(new Date()); | |
52 | + questionModel.setModified(new Date()); | |
53 | + String resultId = QuestionEnums.getIdByScore(questionModel.getScore()); | |
54 | + questionModel.setResultId(resultId); | |
55 | + Patients patients = patientsService.findOnePatientById(questionModel.getPatientId()); | |
56 | + questionModel.setInvestigator(patients.getBookbuildingDoctor()); | |
26 | 57 | QuestionModel question = questionService.addQuestions(questionModel); |
27 | 58 | |
28 | - BaseResponse response = new BaseResponse(); | |
59 | + BaseObjectResponse response = new BaseObjectResponse(); | |
60 | + response.setData(question.getId()); | |
29 | 61 | response.setErrormsg("成功"); |
30 | 62 | response.setErrorcode(ErrorCodeConstants.SUCCESS); |
63 | + return response; | |
64 | + } | |
65 | + | |
66 | + public BaseResponse getQuestionByPatientId(String patientId) { | |
67 | + | |
68 | + BaseObjectResponse response = new BaseObjectResponse(); | |
69 | + | |
70 | + QuestionQuery questionQuery = new QuestionQuery(); | |
71 | + questionQuery.setPatientId(patientId); | |
72 | + | |
73 | + List<QuestionModel> questions = questionService.queryQuestions(questionQuery); | |
74 | + if (CollectionUtils.isNotEmpty(questions)) | |
75 | + { | |
76 | + QuestionModel questionModel = questions.get(0); | |
77 | + Map data = new HashMap<>(); | |
78 | + data.put("id",questionModel.getId()); | |
79 | + data.put("patientId",questionModel.getPatientId()); | |
80 | + | |
81 | + Patients patients = patientsService.findOnePatientById(patientId); | |
82 | + data.put("userName",patients.getUsername()); | |
83 | + data.put("cardNo", patients.getCardNo()); | |
84 | + data.put("birth", DateUtil.getyyyy_mm(patients.getBirth())); | |
85 | + data.put("pliveType",CommonsHelper.getName1(patients.getPliveTypeId(), basicConfigService)); | |
86 | + data.put("pnation", CommonsHelper.getName1(patients.getPnationId(), basicConfigService)); | |
87 | + data.put("plevelType", CommonsHelper.getName1(patients.getPlevelTypeId(), basicConfigService)); | |
88 | + | |
89 | + data.put("phone",patients.getPhone()); | |
90 | + data.put("week",DateUtil.getWeek(patients.getLastMenses(),questionModel.getInvestDate())/7); | |
91 | + | |
92 | + data.put("questions",questionModel.getQuestions()); | |
93 | + data.put("trouble",questionModel.getTrouble()); | |
94 | + data.put("score",questionModel.getScore()); | |
95 | + | |
96 | + | |
97 | + data.put("investDate",DateUtil.getyyyy_MM_dd1(questionModel.getInvestDate())); | |
98 | + data.put("investigator", CommonsHelper.getUserName(questionModel.getInvestigator(), usersService)); | |
99 | + data.put("hospital", CommonsHelper.getHospitalName(questionModel.getInvestHospitalId(), organizationService)); | |
100 | + | |
101 | + | |
102 | + data.put("content",QuestionEnums.getContentByScore(questionModel.getScore())); | |
103 | + String diary = ""; | |
104 | + if (questionModel.getScore() != null && questionModel.getScore() > 10) | |
105 | + { | |
106 | + diary= "感恩日记:准备一个专门的笔记本,每天写三件让自己感恩的事情,感恩的事情不分大小。例如感恩自己的坚持、感恩家人的付出、感恩胎儿健康、感恩饭桌上的一菜一汤,感恩今天发生的事情。"; | |
107 | + } | |
108 | + data.put("diary",diary); | |
109 | + | |
110 | + response.setErrormsg("成功"); | |
111 | + response.setErrorcode(ErrorCodeConstants.SUCCESS); | |
112 | + return response; | |
113 | + } | |
114 | + | |
115 | + response.setErrormsg("无调查"); | |
116 | + response.setErrorcode(ErrorCodeConstants.NO_DATA); | |
31 | 117 | return response; |
32 | 118 | } |
33 | 119 | } |