Commit 0db77de8e6cb430e171aad924c28c89f9104101c
1 parent
0c7153310d
Exists in
master
and in
6 other branches
update
Showing 9 changed files with 1162 additions and 0 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/EmotionalMiniTestService.java
- platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java
- platform-dal/src/main/java/com/lyms/platform/pojo/EmotionalMiniTestModel.java
- platform-dal/src/main/java/com/lyms/platform/query/EmotionalMiniTestQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/EmotionalMiniTestController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/EmotionalMiniTestFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/EmotionalMiniTestRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/EmotionalMiniTestResult.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/EmotionalMiniTestService.java
View file @
0db77de
1 | +package com.lyms.platform.biz.service; | |
2 | + | |
3 | +import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
4 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
5 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
6 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
7 | +import com.lyms.platform.common.enums.YnEnums; | |
8 | +import com.lyms.platform.pojo.EmotionalMiniTestModel; | |
9 | +import com.lyms.platform.query.EmotionalMiniTestQuery; | |
10 | +import org.apache.commons.lang.StringUtils; | |
11 | +import org.springframework.data.domain.Sort; | |
12 | +import org.springframework.stereotype.Service; | |
13 | + | |
14 | +import java.util.List; | |
15 | + | |
16 | +/** | |
17 | + * 逻辑 | |
18 | + * | |
19 | + * 由于是基本增删改查功能直接使用BaseMongoDAOImpl接口 | |
20 | + * @Author: 武涛涛 | |
21 | + */ | |
22 | +@Service("emotionalMiniTestService") | |
23 | +public class EmotionalMiniTestService extends BaseMongoDAOImpl<EmotionalMiniTestModel> { | |
24 | + | |
25 | + public EmotionalMiniTestModel add(EmotionalMiniTestModel model) { | |
26 | + return save(model); | |
27 | + } | |
28 | + | |
29 | + public void update(EmotionalMiniTestModel model, String id) { | |
30 | + update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), model); | |
31 | + } | |
32 | + | |
33 | + public void deleteById(String id) { | |
34 | + EmotionalMiniTestModel obj = new EmotionalMiniTestModel(); | |
35 | + obj.setYn(YnEnums.NO.getId()); | |
36 | + obj.setId(id); | |
37 | + update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), obj); | |
38 | + } | |
39 | + public List<EmotionalMiniTestModel> queryOne(EmotionalMiniTestQuery babyQuery) { | |
40 | + MongoQuery query = babyQuery.convertToQuery(); | |
41 | + if (StringUtils.isNotEmpty(babyQuery.getNeed())) { | |
42 | + babyQuery.mysqlBuild((int)count(babyQuery.convertToQuery().convertToMongoQuery())); | |
43 | + query.start(babyQuery.getOffset()).end(babyQuery.getLimit()); | |
44 | + } | |
45 | + query.addOrder(Sort.Direction.ASC, babyQuery.getSort()); | |
46 | + return find(query.convertToMongoQuery()); | |
47 | + } | |
48 | + | |
49 | + public List<EmotionalMiniTestModel> queryAll(EmotionalMiniTestQuery babyQuery) { | |
50 | + MongoQuery query = babyQuery.convertToQuery(); | |
51 | + if (StringUtils.isNotEmpty(babyQuery.getNeed())) { | |
52 | + babyQuery.mysqlBuild((int)count(babyQuery.convertToQuery().convertToMongoQuery())); | |
53 | + query.start(babyQuery.getOffset()).end(babyQuery.getLimit()); | |
54 | + } | |
55 | + query.addOrder(Sort.Direction.DESC, babyQuery.getSort());// Sort "createDate" | |
56 | + return find(query.convertToMongoQuery()); | |
57 | + } | |
58 | + | |
59 | + | |
60 | + public EmotionalMiniTestModel queryById(String id) { | |
61 | + EmotionalMiniTestQuery emotionalMiniTestQuery = new EmotionalMiniTestQuery(); | |
62 | + emotionalMiniTestQuery.setId(id); | |
63 | + MongoQuery query = emotionalMiniTestQuery.convertToQuery(); | |
64 | + return findOne(query.convertToMongoQuery()); | |
65 | + } | |
66 | + | |
67 | + | |
68 | + | |
69 | + | |
70 | + | |
71 | +} |
platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java
View file @
0db77de
... | ... | @@ -27,6 +27,7 @@ |
27 | 27 | FamilyPlanningModel("FamilyPlanningModel", 8090991974395394537L), |
28 | 28 | BabyFirstCheckModel("BabyHighRiskBabyModel", -6200631186554568668L), |
29 | 29 | BabyStuntingModel("BabyStuntingModel", 6185807286762682531L), |
30 | + EmotionalMiniTestModel("EmotionalMiniTestModel", -8467545877185359482L), | |
30 | 31 | BabyModel("BabyModel", 97531000080L), |
31 | 32 | BabyRecordModel("BabyModel", 97531050080L), |
32 | 33 | Records("records", 97531000081L), |
platform-dal/src/main/java/com/lyms/platform/pojo/EmotionalMiniTestModel.java
View file @
0db77de
1 | +package com.lyms.platform.pojo; | |
2 | + | |
3 | +import com.lyms.platform.beans.SerialIdEnum; | |
4 | +import com.lyms.platform.common.result.BaseModel; | |
5 | +import org.springframework.data.mongodb.core.mapping.Document; | |
6 | + | |
7 | +import java.io.Serializable; | |
8 | +import java.util.Date; | |
9 | +import java.util.List; | |
10 | + | |
11 | +/** | |
12 | + * 实体类 | |
13 | + * @Author: 武涛涛 | |
14 | + */ | |
15 | +@Document(collection = "lyms_emotional_mini_test") | |
16 | +public class EmotionalMiniTestModel extends BaseModel { | |
17 | + private static final long serialVersionUID = SerialIdEnum.EmotionalMiniTestModel.getCid(); | |
18 | + | |
19 | + private String id; | |
20 | + private Integer yn; | |
21 | + //档案id | |
22 | + private String patientId; | |
23 | + private String pid; | |
24 | + //患者姓名 | |
25 | + private String username; | |
26 | + //手机 | |
27 | + private String phone; | |
28 | + //身份证号 | |
29 | + private String cardNo; | |
30 | + //年龄 | |
31 | + private Integer age; | |
32 | + //登记时间 | |
33 | + private Date createDate; | |
34 | + private Date modifyDate; | |
35 | + //机构 | |
36 | + private String hospitalId; | |
37 | + private String hospitalName; | |
38 | + private List <TestQuestions> testQuestionsList; | |
39 | + | |
40 | + public String getId() { | |
41 | + return id; | |
42 | + } | |
43 | + | |
44 | + public void setId(String id) { | |
45 | + this.id = id; | |
46 | + } | |
47 | + | |
48 | + public Integer getYn() { | |
49 | + return yn; | |
50 | + } | |
51 | + | |
52 | + public void setYn(Integer yn) { | |
53 | + this.yn = yn; | |
54 | + } | |
55 | + | |
56 | + public String getPatientId() { | |
57 | + return patientId; | |
58 | + } | |
59 | + | |
60 | + public void setPatientId(String patientId) { | |
61 | + this.patientId = patientId; | |
62 | + } | |
63 | + | |
64 | + public String getPid() { | |
65 | + return pid; | |
66 | + } | |
67 | + | |
68 | + public void setPid(String pid) { | |
69 | + this.pid = pid; | |
70 | + } | |
71 | + | |
72 | + public String getUsername() { | |
73 | + return username; | |
74 | + } | |
75 | + | |
76 | + public void setUsername(String username) { | |
77 | + this.username = username; | |
78 | + } | |
79 | + | |
80 | + public String getCardNo() { | |
81 | + return cardNo; | |
82 | + } | |
83 | + | |
84 | + public void setCardNo(String cardNo) { | |
85 | + this.cardNo = cardNo; | |
86 | + } | |
87 | + | |
88 | + public Integer getAge() { | |
89 | + return age; | |
90 | + } | |
91 | + | |
92 | + public void setAge(Integer age) { | |
93 | + this.age = age; | |
94 | + } | |
95 | + | |
96 | + public String getPhone() { | |
97 | + return phone; | |
98 | + } | |
99 | + | |
100 | + public void setPhone(String phone) { | |
101 | + this.phone = phone; | |
102 | + } | |
103 | + | |
104 | + public Date getCreateDate() { | |
105 | + return createDate; | |
106 | + } | |
107 | + | |
108 | + public void setCreateDate(Date createDate) { | |
109 | + this.createDate = createDate; | |
110 | + } | |
111 | + | |
112 | + public Date getModifyDate() { | |
113 | + return modifyDate; | |
114 | + } | |
115 | + | |
116 | + public void setModifyDate(Date modifyDate) { | |
117 | + this.modifyDate = modifyDate; | |
118 | + } | |
119 | + | |
120 | + public String getHospitalId() { | |
121 | + return hospitalId; | |
122 | + } | |
123 | + | |
124 | + public void setHospitalId(String hospitalId) { | |
125 | + this.hospitalId = hospitalId; | |
126 | + } | |
127 | + | |
128 | + public String getHospitalName() { | |
129 | + return hospitalName; | |
130 | + } | |
131 | + | |
132 | + public void setHospitalName(String hospitalName) { | |
133 | + this.hospitalName = hospitalName; | |
134 | + } | |
135 | + | |
136 | + public List <TestQuestions> getTestQuestionsList() { | |
137 | + return testQuestionsList; | |
138 | + } | |
139 | + | |
140 | + public void setTestQuestionsList(List <TestQuestions> testQuestionsList) { | |
141 | + this.testQuestionsList = testQuestionsList; | |
142 | + } | |
143 | + | |
144 | + | |
145 | + public static class TestQuestions implements Serializable { | |
146 | + | |
147 | + private static final long serialVersionUID = -6747362940632598075L; | |
148 | + //1. 我能笑的起来和看到事物有趣的一面:2.我看待事物的乐趣: | |
149 | + private String title; | |
150 | + | |
151 | + // A.像以前一样多 B.不那么多 C.肯定没那么多 D.根本没有了 | |
152 | + private String project; | |
153 | + | |
154 | + //0 A.像以前一样多, 0分 | |
155 | + private String fraction; | |
156 | + | |
157 | + public String getTitle() { | |
158 | + return title; | |
159 | + } | |
160 | + | |
161 | + public void setTitle(String title) { | |
162 | + this.title = title; | |
163 | + } | |
164 | + | |
165 | + public String getProject() { | |
166 | + return project; | |
167 | + } | |
168 | + | |
169 | + public void setProject(String project) { | |
170 | + this.project = project; | |
171 | + } | |
172 | + | |
173 | + public String getFraction() { | |
174 | + return fraction; | |
175 | + } | |
176 | + | |
177 | + public void setFraction(String fraction) { | |
178 | + this.fraction = fraction; | |
179 | + } | |
180 | + } | |
181 | + | |
182 | + | |
183 | + | |
184 | +} |
platform-dal/src/main/java/com/lyms/platform/query/EmotionalMiniTestQuery.java
View file @
0db77de
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 com.lyms.platform.common.utils.StringUtils; | |
9 | +import org.springframework.data.mongodb.core.query.Criteria; | |
10 | + | |
11 | +import java.util.Date; | |
12 | + | |
13 | +/** | |
14 | + * 发育迟缓专科检查 查询模型 | |
15 | + * | |
16 | + * @author Administrator | |
17 | + */ | |
18 | +public class EmotionalMiniTestQuery extends BaseQuery implements IConvertToNativeQuery { | |
19 | + | |
20 | + private String id; | |
21 | + private Integer yn; | |
22 | + //档案id | |
23 | + private String patientId; | |
24 | + private String pid; | |
25 | + //患者姓名 | |
26 | + private String username; | |
27 | + //手机 | |
28 | + private String phone; | |
29 | + //身份证号 | |
30 | + private String cardNo; | |
31 | + | |
32 | + private String queryNo; | |
33 | + | |
34 | + private String hospitalId; | |
35 | + //登记时间 | |
36 | + private Date createDateStart; | |
37 | + private Date createDateEnd; | |
38 | + | |
39 | + private String sort; | |
40 | + | |
41 | + public String getId() { | |
42 | + return id; | |
43 | + } | |
44 | + | |
45 | + public void setId(String id) { | |
46 | + this.id = id; | |
47 | + } | |
48 | + | |
49 | + public Integer getYn() { | |
50 | + return yn; | |
51 | + } | |
52 | + | |
53 | + public String getHospitalId() { | |
54 | + return hospitalId; | |
55 | + } | |
56 | + | |
57 | + public void setHospitalId(String hospitalId) { | |
58 | + this.hospitalId = hospitalId; | |
59 | + } | |
60 | + | |
61 | + public void setYn(Integer yn) { | |
62 | + this.yn = yn; | |
63 | + } | |
64 | + | |
65 | + public String getPatientId() { | |
66 | + return patientId; | |
67 | + } | |
68 | + | |
69 | + public void setPatientId(String patientId) { | |
70 | + this.patientId = patientId; | |
71 | + } | |
72 | + | |
73 | + public String getPid() { | |
74 | + return pid; | |
75 | + } | |
76 | + | |
77 | + public void setPid(String pid) { | |
78 | + this.pid = pid; | |
79 | + } | |
80 | + | |
81 | + public String getUsername() { | |
82 | + return username; | |
83 | + } | |
84 | + | |
85 | + public void setUsername(String username) { | |
86 | + this.username = username; | |
87 | + } | |
88 | + | |
89 | + public String getPhone() { | |
90 | + return phone; | |
91 | + } | |
92 | + | |
93 | + public void setPhone(String phone) { | |
94 | + this.phone = phone; | |
95 | + } | |
96 | + | |
97 | + public String getCardNo() { | |
98 | + return cardNo; | |
99 | + } | |
100 | + | |
101 | + public void setCardNo(String cardNo) { | |
102 | + this.cardNo = cardNo; | |
103 | + } | |
104 | + | |
105 | + public Date getCreateDateStart() { | |
106 | + return createDateStart; | |
107 | + } | |
108 | + | |
109 | + public void setCreateDateStart(Date createDateStart) { | |
110 | + this.createDateStart = createDateStart; | |
111 | + } | |
112 | + | |
113 | + public Date getCreateDateEnd() { | |
114 | + return createDateEnd; | |
115 | + } | |
116 | + | |
117 | + public void setCreateDateEnd(Date createDateEnd) { | |
118 | + this.createDateEnd = createDateEnd; | |
119 | + } | |
120 | + | |
121 | + public String getQueryNo() { | |
122 | + return queryNo; | |
123 | + } | |
124 | + | |
125 | + public void setQueryNo(String queryNo) { | |
126 | + this.queryNo = queryNo; | |
127 | + } | |
128 | + | |
129 | + @Override | |
130 | + public String getSort() { | |
131 | + return sort; | |
132 | + } | |
133 | + | |
134 | + @Override | |
135 | + public void setSort(String sort) { | |
136 | + this.sort = sort; | |
137 | + } | |
138 | + | |
139 | + @Override | |
140 | + public MongoQuery convertToQuery() { | |
141 | + MongoCondition condition = MongoCondition.newInstance(); | |
142 | + | |
143 | + if (StringUtils.isNotEmpty(id)) { | |
144 | + | |
145 | + condition = condition.and("id", id, MongoOper.IS); | |
146 | + } | |
147 | + if (null != yn) { | |
148 | + condition = condition.and("yn", yn, MongoOper.IS); | |
149 | + } | |
150 | + if (StringUtils.isNotEmpty(patientId)) { | |
151 | + condition = condition.and("patientId", patientId, MongoOper.IS); | |
152 | + } | |
153 | + if (StringUtils.isNotEmpty(pid)) { | |
154 | + condition = condition.and("pid", pid, MongoOper.IS); | |
155 | + } | |
156 | + if (StringUtils.isNotEmpty(username)) { | |
157 | + condition = condition.and("username", username, MongoOper.IS); | |
158 | + } | |
159 | + if (StringUtils.isNotEmpty(phone)) { | |
160 | + condition = condition.and("phone", phone, MongoOper.IS); | |
161 | + } | |
162 | + if (StringUtils.isNotEmpty(cardNo)) { | |
163 | + condition = condition.and("cardNo", cardNo, MongoOper.IS); | |
164 | + } | |
165 | + if (StringUtils.isNotEmpty(hospitalId)) { | |
166 | + condition = condition.and("hospitalId", hospitalId, MongoOper.IS); | |
167 | + } | |
168 | + | |
169 | + Criteria c = null; | |
170 | + // 预约检查时间 | |
171 | + if (null != createDateStart) { | |
172 | + if (null != c) { | |
173 | + c = c.and("createDate").gte(createDateStart); | |
174 | + } else { | |
175 | + c = Criteria.where("createDate").gte(createDateStart); | |
176 | + } | |
177 | + } | |
178 | + if (null != createDateEnd) { | |
179 | + if (null != c) { | |
180 | + c = c.lte(createDateEnd); | |
181 | + } else { | |
182 | + c = Criteria.where("createDate").lte(createDateEnd); | |
183 | + } | |
184 | + } | |
185 | + | |
186 | + // 查询号 | |
187 | + if (StringUtils.isNotEmpty(queryNo)) { | |
188 | + MongoCondition c1 = MongoCondition.newInstance(); | |
189 | + MongoCondition con1 = MongoCondition.newInstance("username", queryNo, MongoOper.LIKE); | |
190 | + MongoCondition con2 = MongoCondition.newInstance("phone", queryNo, MongoOper.IS); | |
191 | + MongoCondition con3 = MongoCondition.newInstance("cardNo", queryNo, MongoOper.IS); | |
192 | + if (c != null) { | |
193 | + c1.orCondition(new MongoCondition[]{con1, con2, con3}).getCriteria(); | |
194 | + condition.andCondition(c1); | |
195 | + } else { | |
196 | + c = c1.orCondition(new MongoCondition[]{con1, con2, con3}).getCriteria(); | |
197 | + } | |
198 | + } | |
199 | + if (c != null) { | |
200 | + return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery(); | |
201 | + } | |
202 | + | |
203 | + return condition.toMongoQuery(); | |
204 | + } | |
205 | + | |
206 | + | |
207 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/EmotionalMiniTestController.java
View file @
0db77de
1 | +package com.lyms.platform.operate.web.controller; | |
2 | + | |
3 | + | |
4 | +import com.lyms.platform.common.annotation.TokenRequired; | |
5 | +import com.lyms.platform.common.base.BaseController; | |
6 | +import com.lyms.platform.common.result.BaseResponse; | |
7 | +import com.lyms.platform.operate.web.facade.EmotionalMiniTestFacade; | |
8 | +import com.lyms.platform.operate.web.request.EmotionalMiniTestRequest; | |
9 | +import com.lyms.platform.query.EmotionalMiniTestQuery; | |
10 | +import org.springframework.beans.factory.annotation.Autowired; | |
11 | +import org.springframework.stereotype.Controller; | |
12 | +import org.springframework.web.bind.annotation.*; | |
13 | + | |
14 | +import javax.servlet.http.HttpServletRequest; | |
15 | +import javax.validation.Valid; | |
16 | + | |
17 | + | |
18 | +/** | |
19 | + *情绪小测试 控制 | |
20 | + */ | |
21 | +@Controller | |
22 | +@RequestMapping("/emotionalMiniTest") | |
23 | +public class EmotionalMiniTestController extends BaseController { | |
24 | + | |
25 | + @Autowired | |
26 | + private EmotionalMiniTestFacade emotionalMiniTestFacade; | |
27 | + | |
28 | + | |
29 | + /** | |
30 | + * 添加或者修改 | |
31 | + * | |
32 | + * @param request | |
33 | + * @return | |
34 | + */ | |
35 | + @RequestMapping(method = RequestMethod.POST, value = "/addOrUp") | |
36 | + @ResponseBody | |
37 | + public BaseResponse addOrUp(@Valid @RequestBody EmotionalMiniTestRequest request) { | |
38 | + BaseResponse baseResponse = emotionalMiniTestFacade.addOrUp(request); | |
39 | + return baseResponse; | |
40 | + } | |
41 | + | |
42 | + /** | |
43 | + * 查看 显示 | |
44 | + * | |
45 | + * @param id | |
46 | + * @return | |
47 | + */ | |
48 | + @RequestMapping(value = "/queryByIdShow/{id}", method = RequestMethod.GET) | |
49 | + @ResponseBody | |
50 | + @TokenRequired | |
51 | + public BaseResponse queryByIdShow(@PathVariable("id") String id) { | |
52 | + return emotionalMiniTestFacade.queryByIdShow(id); | |
53 | + } | |
54 | + | |
55 | + /** | |
56 | + * 查询全部所有 记录 | |
57 | + * | |
58 | + * @param | |
59 | + */ | |
60 | + @RequestMapping(value = "/queryAll", method = RequestMethod.GET) | |
61 | + @ResponseBody | |
62 | + @TokenRequired | |
63 | + public BaseResponse queryAll(EmotionalMiniTestQuery emotionalMiniTestQuery, HttpServletRequest request) { | |
64 | + return emotionalMiniTestFacade.queryAll(emotionalMiniTestQuery,getUserId(request)); | |
65 | + } | |
66 | + | |
67 | + /** | |
68 | + * 删除 | |
69 | + * | |
70 | + * @param id | |
71 | + * @return | |
72 | + | |
73 | + @RequestMapping(value = "/deleteById/{id}", method = RequestMethod.DELETE) | |
74 | + @ResponseBody | |
75 | + @TokenRequired | |
76 | + public BaseResponse deleteById(@PathVariable("id") String id, HttpServletRequest request) { | |
77 | + babyStuntingFacade.deleteById(id, getUserId(request)); | |
78 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
79 | + } */ | |
80 | + | |
81 | + | |
82 | + | |
83 | + | |
84 | + | |
85 | + /** | |
86 | + *编辑 显示 | |
87 | + * | |
88 | + * @param id | |
89 | + * @return | |
90 | + @RequestMapping(value = "/queryByIdEdit/{id}", method = RequestMethod.GET) | |
91 | + @ResponseBody | |
92 | + @TokenRequired | |
93 | + public BaseResponse queryByIdEdit(@PathVariable("id") String id) { | |
94 | + return babyStuntingFacade.queryByIdEdit(id); | |
95 | + | |
96 | + } | |
97 | + */ | |
98 | + | |
99 | + /** | |
100 | + * 查询单人所有 历史记录 | |
101 | + * buildId | |
102 | + * @param | |
103 | + | |
104 | + @RequestMapping(value = "/queryOne", method = RequestMethod.GET) | |
105 | + @ResponseBody | |
106 | + @TokenRequired | |
107 | + public BaseResponse queryOne(BabyStuntingQuery babyStuntingQuery, HttpServletRequest request) { | |
108 | + return babyStuntingFacade.queryOne(babyStuntingQuery,getUserId(request)); | |
109 | + } | |
110 | + */ | |
111 | + | |
112 | + | |
113 | + | |
114 | + | |
115 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java
View file @
0db77de
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/EmotionalMiniTestFacade.java
View file @
0db77de
1 | +package com.lyms.platform.operate.web.facade; | |
2 | + | |
3 | +import com.lyms.platform.biz.service.BasicConfigService; | |
4 | +import com.lyms.platform.biz.service.EmotionalMiniTestService; | |
5 | +import com.lyms.platform.biz.service.YunBookbuildingService; | |
6 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
7 | +import com.lyms.platform.common.enums.YnEnums; | |
8 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
9 | +import com.lyms.platform.common.result.BaseResponse; | |
10 | +import com.lyms.platform.common.utils.DateUtil; | |
11 | +import com.lyms.platform.common.utils.StringUtils; | |
12 | +import com.lyms.platform.operate.web.request.EmotionalMiniTestRequest; | |
13 | +import com.lyms.platform.operate.web.result.EmotionalMiniTestResult; | |
14 | +import com.lyms.platform.operate.web.service.impl.BaseServiceImpl; | |
15 | +import com.lyms.platform.permission.service.OrganizationService; | |
16 | +import com.lyms.platform.permission.service.UsersService; | |
17 | +import com.lyms.platform.pojo.EmotionalMiniTestModel; | |
18 | +import com.lyms.platform.pojo.Patients; | |
19 | +import com.lyms.platform.query.EmotionalMiniTestQuery; | |
20 | +import org.springframework.beans.factory.annotation.Autowired; | |
21 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
22 | +import org.springframework.stereotype.Component; | |
23 | + | |
24 | +import java.util.ArrayList; | |
25 | +import java.util.Date; | |
26 | +import java.util.List; | |
27 | + | |
28 | +/** | |
29 | + * 逻辑处理 | |
30 | + * | |
31 | + * @Author: 武涛涛 | |
32 | + */ | |
33 | +@Component | |
34 | +public class EmotionalMiniTestFacade extends BaseServiceImpl { | |
35 | + | |
36 | + @Autowired | |
37 | + private EmotionalMiniTestService emotionalMiniTestService; | |
38 | + @Autowired | |
39 | + private AutoMatchFacade autoMatchFacade; | |
40 | + @Autowired | |
41 | + private OperateLogFacade operateLogFacade; | |
42 | + @Autowired | |
43 | + private OrganizationService organizationService; | |
44 | + @Autowired | |
45 | + private BasicConfigService basicConfigService; | |
46 | + @Autowired | |
47 | + private UsersService usersService; | |
48 | + @Autowired | |
49 | + private MongoTemplate mongoTemplate; | |
50 | + | |
51 | + @Autowired | |
52 | + private YunBookbuildingService yunBookbuildingService; | |
53 | + | |
54 | + /** | |
55 | + * 构造保存对象 | |
56 | + * | |
57 | + * @param request | |
58 | + * @return | |
59 | + */ | |
60 | + private EmotionalMiniTestModel getEmotionalMiniTestModel(EmotionalMiniTestRequest request) { | |
61 | + EmotionalMiniTestModel model = new EmotionalMiniTestModel(); | |
62 | + if (request != null && StringUtils.isNotEmpty(request.getPatientId())) { | |
63 | + Patients patients = yunBookbuildingService.findOneById(request.getPatientId()); | |
64 | + if (patients != null) { | |
65 | + model.setPatientId(patients.getId()); | |
66 | + model.setPid(patients.getPid()); | |
67 | + model.setCardNo(patients.getCardNo()); | |
68 | + model.setPhone(patients.getPhone()); | |
69 | + | |
70 | + } | |
71 | + } | |
72 | + model.setUsername(request.getUsername()); | |
73 | + model.setAge(request.getAge()); | |
74 | + model.setModifyDate(new Date()); | |
75 | + List <EmotionalMiniTestModel.TestQuestions> testQuestionsLists = new ArrayList <>(); | |
76 | + for (EmotionalMiniTestRequest.TestQuestions testQuestions : request.getTestQuestionsList()) { | |
77 | + testQuestionsLists.add(testQuestions.convertToDataModel()); | |
78 | + } | |
79 | + model.setTestQuestionsList(testQuestionsLists); | |
80 | + return model; | |
81 | + | |
82 | + } | |
83 | + | |
84 | + | |
85 | + /** | |
86 | + * 新增或更新 | |
87 | + * | |
88 | + * @param request | |
89 | + * @Author: 武涛涛 | |
90 | + */ | |
91 | + public BaseResponse addOrUp(EmotionalMiniTestRequest request) { | |
92 | + | |
93 | + EmotionalMiniTestModel model = getEmotionalMiniTestModel(request); | |
94 | + if (StringUtils.isNotEmpty(request.getId())) { | |
95 | + EmotionalMiniTestModel models = emotionalMiniTestService.queryById(request.getId()); | |
96 | + if (models != null && models.getId() != null) { | |
97 | + emotionalMiniTestService.update(model, request.getId()); | |
98 | + } | |
99 | + } else {//add | |
100 | + model.setCreateDate(new Date()); | |
101 | + model.setYn(YnEnums.YES.getId()); | |
102 | + /*if (StringUtils.isNotEmpty(request.getHospitalName())) { | |
103 | + OrganizationQuery query = new OrganizationQuery(); | |
104 | + query.setYn(YnEnums.YES.getId()); | |
105 | + query.setName(request.getHospitalName()); | |
106 | + List<Organization> list = organizationService.queryOrganization(query); | |
107 | + }*/ | |
108 | + model.setHospitalId(request.getHospitalId()); | |
109 | + model.setHospitalName(request.getHospitalName()); | |
110 | + model = emotionalMiniTestService.add(model); | |
111 | + } | |
112 | + | |
113 | + BaseObjectResponse br = new BaseObjectResponse(); | |
114 | + br.setErrorcode(ErrorCodeConstants.SUCCESS); | |
115 | + br.setErrormsg("成功"); | |
116 | + br.setData(model.getId()); | |
117 | + return br; | |
118 | + } | |
119 | + | |
120 | + | |
121 | + /** | |
122 | + * 根据专病id ,查看显示 | |
123 | + * | |
124 | + * @Author: 武涛涛 | |
125 | + */ | |
126 | + public BaseObjectResponse queryByIdShow(String id) { | |
127 | + BaseObjectResponse br = new BaseObjectResponse(); | |
128 | + | |
129 | + if (StringUtils.isNotEmpty(id)) { | |
130 | + EmotionalMiniTestModel emotionalMiniTestModel = emotionalMiniTestService.queryById(id); | |
131 | + EmotionalMiniTestResult emotionalMiniTestResult = new EmotionalMiniTestResult(); | |
132 | + br.setData(emotionalMiniTestResult.convertToResult(emotionalMiniTestModel)); | |
133 | + br.setErrorcode(ErrorCodeConstants.SUCCESS); | |
134 | + br.setErrormsg("成功"); | |
135 | + } | |
136 | + return br; | |
137 | + } | |
138 | + | |
139 | + /** | |
140 | + * 查询全部所有 记录 | |
141 | + * @param userId | |
142 | + * @Author: 武涛涛 | |
143 | + */ | |
144 | + public BaseObjectResponse queryAll(EmotionalMiniTestQuery query, Integer userId) { | |
145 | + | |
146 | + BaseObjectResponse br = new BaseObjectResponse(); | |
147 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
148 | + List <EmotionalMiniTestResult> emotionalMiniTestResultList = new ArrayList <>(); | |
149 | + //单人多条专病记录 | |
150 | + List <EmotionalMiniTestModel> miniTestModels = new ArrayList <>(); | |
151 | + if (StringUtils.isEmpty(query.getPatientId())) { | |
152 | + query.setNeed("true"); | |
153 | + query.setYn(YnEnums.YES.getId()); | |
154 | + query.setHospitalId(hospitalId); | |
155 | + query.setSort("createDate"); | |
156 | + if (query.getCreateDateEnd() != null) { | |
157 | + query.setCreateDateEnd(DateUtil.getDayLastSecond(query.getCreateDateEnd())); | |
158 | + } | |
159 | + miniTestModels = emotionalMiniTestService.queryAll(query); | |
160 | + System.out.println(query.convertToQuery().convertToMongoQuery()); | |
161 | + } | |
162 | + for (int i = 0; i < miniTestModels.size(); i++) { | |
163 | + EmotionalMiniTestModel miniTestModel = miniTestModels.get(i); | |
164 | + EmotionalMiniTestResult miniTestResult = new EmotionalMiniTestResult(); | |
165 | + if (miniTestModel != null) { | |
166 | + emotionalMiniTestResultList.add(miniTestResult.convertToResult(miniTestModel)); | |
167 | + } | |
168 | + } | |
169 | + br.setData(emotionalMiniTestResultList); | |
170 | + br.setPageInfo(query.getPageInfo()); | |
171 | + br.setErrorcode(ErrorCodeConstants.SUCCESS); | |
172 | + br.setErrormsg("成功"); | |
173 | + return br; | |
174 | + | |
175 | + } | |
176 | + | |
177 | + | |
178 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/EmotionalMiniTestRequest.java
View file @
0db77de
1 | +package com.lyms.platform.operate.web.request; | |
2 | + | |
3 | +import com.lyms.platform.common.base.IBasicRequestConvert; | |
4 | +import com.lyms.platform.common.core.annotation.form.FormParam; | |
5 | +import com.lyms.platform.pojo.EmotionalMiniTestModel; | |
6 | +import org.hibernate.validator.constraints.NotEmpty; | |
7 | + | |
8 | +import java.util.List; | |
9 | + | |
10 | +/** | |
11 | + 入参类 | |
12 | + * | |
13 | + * 时间是字符串类型 | |
14 | + * @Author: 武涛涛 | |
15 | + */ | |
16 | +public class EmotionalMiniTestRequest { | |
17 | + | |
18 | + private String id; | |
19 | + //档案id | |
20 | + @FormParam | |
21 | + @NotEmpty(message = "建档ID不能为空.") | |
22 | + private String patientId; | |
23 | + private String pid; | |
24 | + //患者姓名 | |
25 | + private String username; | |
26 | + //手机 | |
27 | + private String phone; | |
28 | + //身份证号 | |
29 | + private String cardNo; | |
30 | + //年龄 | |
31 | + private Integer age; | |
32 | + //登记时间 | |
33 | + private String createDate; | |
34 | + private String modifyDate; | |
35 | + //机构 | |
36 | + private String hospitalId; | |
37 | + private String hospitalName; | |
38 | + | |
39 | + private List<TestQuestions> testQuestionsList; | |
40 | + | |
41 | + public static class TestQuestions implements IBasicRequestConvert <EmotionalMiniTestModel.TestQuestions> { | |
42 | + //1. 我能笑的起来和看到事物有趣的一面:2.我看待事物的乐趣: | |
43 | + private String title; | |
44 | + | |
45 | + // A.像以前一样多 B.不那么多 C.肯定没那么多 D.根本没有了 | |
46 | + private String project; | |
47 | + | |
48 | + //0 A.像以前一样多, 0分 | |
49 | + private String fraction; | |
50 | + | |
51 | + public String getFraction() { | |
52 | + return fraction; | |
53 | + } | |
54 | + | |
55 | + public void setFraction(String fraction) { | |
56 | + this.fraction = fraction; | |
57 | + } | |
58 | + | |
59 | + public String getTitle() { | |
60 | + return title; | |
61 | + } | |
62 | + | |
63 | + public void setTitle(String title) { | |
64 | + this.title = title; | |
65 | + } | |
66 | + | |
67 | + public String getProject() { | |
68 | + return project; | |
69 | + } | |
70 | + | |
71 | + public void setProject(String project) { | |
72 | + this.project = project; | |
73 | + } | |
74 | + | |
75 | + @Override | |
76 | + public EmotionalMiniTestModel.TestQuestions convertToDataModel() { | |
77 | + EmotionalMiniTestModel.TestQuestions testQuestions = new EmotionalMiniTestModel.TestQuestions(); | |
78 | + testQuestions.setFraction(fraction); | |
79 | + testQuestions.setTitle(title); | |
80 | + testQuestions.setProject(project); | |
81 | + return testQuestions; | |
82 | + } | |
83 | + } | |
84 | + | |
85 | + | |
86 | + public List <TestQuestions> getTestQuestionsList() { | |
87 | + return testQuestionsList; | |
88 | + } | |
89 | + | |
90 | + public void setTestQuestionsList(List <TestQuestions> testQuestionsList) { | |
91 | + this.testQuestionsList = testQuestionsList; | |
92 | + } | |
93 | + | |
94 | + public String getPhone() { | |
95 | + return phone; | |
96 | + } | |
97 | + | |
98 | + public void setPhone(String phone) { | |
99 | + this.phone = phone; | |
100 | + } | |
101 | + | |
102 | + public String getId() { | |
103 | + return id; | |
104 | + } | |
105 | + | |
106 | + public void setId(String id) { | |
107 | + this.id = id; | |
108 | + } | |
109 | + | |
110 | + public String getPatientId() { | |
111 | + return patientId; | |
112 | + } | |
113 | + | |
114 | + public String getCardNo() { | |
115 | + return cardNo; | |
116 | + } | |
117 | + | |
118 | + public void setCardNo(String cardNo) { | |
119 | + this.cardNo = cardNo; | |
120 | + } | |
121 | + | |
122 | + public void setPatientId(String patientId) { | |
123 | + this.patientId = patientId; | |
124 | + } | |
125 | + | |
126 | + public String getPid() { | |
127 | + return pid; | |
128 | + } | |
129 | + | |
130 | + public void setPid(String pid) { | |
131 | + this.pid = pid; | |
132 | + } | |
133 | + | |
134 | + public String getUsername() { | |
135 | + return username; | |
136 | + } | |
137 | + | |
138 | + public void setUsername(String username) { | |
139 | + this.username = username; | |
140 | + } | |
141 | + | |
142 | + public Integer getAge() { | |
143 | + return age; | |
144 | + } | |
145 | + | |
146 | + public void setAge(Integer age) { | |
147 | + this.age = age; | |
148 | + } | |
149 | + | |
150 | + public String getCreateDate() { | |
151 | + return createDate; | |
152 | + } | |
153 | + | |
154 | + public void setCreateDate(String createDate) { | |
155 | + this.createDate = createDate; | |
156 | + } | |
157 | + | |
158 | + public String getModifyDate() { | |
159 | + return modifyDate; | |
160 | + } | |
161 | + | |
162 | + public void setModifyDate(String modifyDate) { | |
163 | + this.modifyDate = modifyDate; | |
164 | + } | |
165 | + | |
166 | + public String getHospitalId() { | |
167 | + return hospitalId; | |
168 | + } | |
169 | + | |
170 | + public void setHospitalId(String hospitalId) { | |
171 | + this.hospitalId = hospitalId; | |
172 | + } | |
173 | + | |
174 | + public String getHospitalName() { | |
175 | + return hospitalName; | |
176 | + } | |
177 | + | |
178 | + public void setHospitalName(String hospitalName) { | |
179 | + this.hospitalName = hospitalName; | |
180 | + } | |
181 | + | |
182 | + | |
183 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/EmotionalMiniTestResult.java
View file @
0db77de
1 | +package com.lyms.platform.operate.web.result; | |
2 | + | |
3 | + | |
4 | +import com.lyms.platform.common.base.IBasicResultConvert; | |
5 | +import com.lyms.platform.common.utils.DateUtil; | |
6 | +import com.lyms.platform.common.utils.StringUtils; | |
7 | +import com.lyms.platform.pojo.EmotionalMiniTestModel; | |
8 | + | |
9 | +import java.util.ArrayList; | |
10 | +import java.util.List; | |
11 | + | |
12 | +public class EmotionalMiniTestResult implements IBasicResultConvert <EmotionalMiniTestResult, EmotionalMiniTestModel> { | |
13 | + | |
14 | + | |
15 | + private String id; | |
16 | + //档案id | |
17 | + private String patientId; | |
18 | + private String pid; | |
19 | + //患者姓名 | |
20 | + private String username; | |
21 | + //手机 | |
22 | + private String phone; | |
23 | + //身份证号 | |
24 | + private String cardNo; | |
25 | + //年龄 | |
26 | + private Integer age; | |
27 | + //登记时间 | |
28 | + private String createDate; | |
29 | + private String modifyDate; | |
30 | + //机构 | |
31 | + private String hospitalId; | |
32 | + private String hospitalName; | |
33 | + | |
34 | + private List <TestQuestions> testQuestionsList; | |
35 | + //总分数 | |
36 | + private String fractionCount; | |
37 | + | |
38 | + public String getPhone() { | |
39 | + return phone; | |
40 | + } | |
41 | + | |
42 | + public void setPhone(String phone) { | |
43 | + this.phone = phone; | |
44 | + } | |
45 | + | |
46 | + public String getFractionCount() { | |
47 | + return fractionCount; | |
48 | + } | |
49 | + | |
50 | + public void setFractionCount(String fractionCount) { | |
51 | + this.fractionCount = fractionCount; | |
52 | + } | |
53 | + public String getId() { | |
54 | + return id; | |
55 | + } | |
56 | + | |
57 | + public void setId(String id) { | |
58 | + this.id = id; | |
59 | + } | |
60 | + | |
61 | + public String getPatientId() { | |
62 | + return patientId; | |
63 | + } | |
64 | + | |
65 | + public void setPatientId(String patientId) { | |
66 | + this.patientId = patientId; | |
67 | + } | |
68 | + | |
69 | + public String getPid() { | |
70 | + return pid; | |
71 | + } | |
72 | + | |
73 | + public void setPid(String pid) { | |
74 | + this.pid = pid; | |
75 | + } | |
76 | + | |
77 | + public String getUsername() { | |
78 | + return username; | |
79 | + } | |
80 | + | |
81 | + public void setUsername(String username) { | |
82 | + this.username = username; | |
83 | + } | |
84 | + | |
85 | + public String getCardNo() { | |
86 | + return cardNo; | |
87 | + } | |
88 | + | |
89 | + public void setCardNo(String cardNo) { | |
90 | + this.cardNo = cardNo; | |
91 | + } | |
92 | + | |
93 | + public Integer getAge() { | |
94 | + return age; | |
95 | + } | |
96 | + | |
97 | + public void setAge(Integer age) { | |
98 | + this.age = age; | |
99 | + } | |
100 | + | |
101 | + public String getCreateDate() { | |
102 | + return createDate; | |
103 | + } | |
104 | + | |
105 | + public void setCreateDate(String createDate) { | |
106 | + this.createDate = createDate; | |
107 | + } | |
108 | + | |
109 | + public String getModifyDate() { | |
110 | + return modifyDate; | |
111 | + } | |
112 | + | |
113 | + public void setModifyDate(String modifyDate) { | |
114 | + this.modifyDate = modifyDate; | |
115 | + } | |
116 | + | |
117 | + public String getHospitalId() { | |
118 | + return hospitalId; | |
119 | + } | |
120 | + | |
121 | + public void setHospitalId(String hospitalId) { | |
122 | + this.hospitalId = hospitalId; | |
123 | + } | |
124 | + | |
125 | + public String getHospitalName() { | |
126 | + return hospitalName; | |
127 | + } | |
128 | + | |
129 | + public void setHospitalName(String hospitalName) { | |
130 | + this.hospitalName = hospitalName; | |
131 | + } | |
132 | + | |
133 | + public List <TestQuestions> getTestQuestionsList() { | |
134 | + return testQuestionsList; | |
135 | + } | |
136 | + | |
137 | + public void setTestQuestionsList(List <TestQuestions> testQuestionsList) { | |
138 | + this.testQuestionsList = testQuestionsList; | |
139 | + } | |
140 | + | |
141 | + public static class TestQuestions { | |
142 | + //1. 我能笑的起来和看到事物有趣的一面:2.我看待事物的乐趣: | |
143 | + private String title; | |
144 | + | |
145 | + // A.像以前一样多 B.不那么多 C.肯定没那么多 D.根本没有了 | |
146 | + private String project; | |
147 | + | |
148 | + //0 A.像以前一样多, 0分 | |
149 | + private String fraction; | |
150 | + | |
151 | + | |
152 | + | |
153 | + public String getFraction() { | |
154 | + return fraction; | |
155 | + } | |
156 | + | |
157 | + public void setFraction(String fraction) { | |
158 | + this.fraction = fraction; | |
159 | + } | |
160 | + | |
161 | + public String getTitle() { | |
162 | + return title; | |
163 | + } | |
164 | + | |
165 | + public void setTitle(String title) { | |
166 | + this.title = title; | |
167 | + } | |
168 | + | |
169 | + public String getProject() { | |
170 | + return project; | |
171 | + } | |
172 | + | |
173 | + public void setProject(String project) { | |
174 | + this.project = project; | |
175 | + } | |
176 | + | |
177 | + | |
178 | + } | |
179 | + | |
180 | + @Override | |
181 | + public EmotionalMiniTestResult convertToResult(EmotionalMiniTestModel destModel) { | |
182 | + EmotionalMiniTestResult miniTestResult = new EmotionalMiniTestResult(); | |
183 | + miniTestResult.setId(destModel.getId()); | |
184 | + miniTestResult.setPatientId(destModel.getPatientId()); | |
185 | + miniTestResult.setPid(destModel.getPid()); | |
186 | + miniTestResult.setUsername(destModel.getUsername()); | |
187 | + miniTestResult.setPhone(destModel.getPhone()); | |
188 | + miniTestResult.setCardNo(destModel.getCardNo()); | |
189 | + miniTestResult.setAge(destModel.getAge()); | |
190 | + miniTestResult.setCreateDate(DateUtil.getYyyyMmDd(destModel.getCreateDate())); | |
191 | + miniTestResult.setModifyDate(DateUtil.getYyyyMmDd(destModel.getModifyDate())); | |
192 | + miniTestResult.setHospitalId(destModel.getHospitalId()); | |
193 | + miniTestResult.setHospitalName(destModel.getHospitalName()); | |
194 | + | |
195 | + Integer count = 0; | |
196 | + List <TestQuestions> testQuestionsList = new ArrayList <>(); | |
197 | + for (EmotionalMiniTestModel.TestQuestions testQuestions : destModel.getTestQuestionsList()) { | |
198 | + TestQuestions testQuestions1 = new TestQuestions(); | |
199 | + if (StringUtils.isNotEmpty(testQuestions.getFraction())) { | |
200 | + count += Integer.parseInt(testQuestions.getFraction()); | |
201 | + miniTestResult.setFractionCount(count.toString()); | |
202 | + } | |
203 | + testQuestions1.setFraction(testQuestions.getFraction()); | |
204 | + testQuestions1.setProject(testQuestions.getProject()); | |
205 | + testQuestions1.setTitle(testQuestions.getTitle()); | |
206 | + testQuestionsList.add(testQuestions1); | |
207 | + } | |
208 | + miniTestResult.setTestQuestionsList(testQuestionsList); | |
209 | + return miniTestResult; | |
210 | + | |
211 | + } | |
212 | + | |
213 | + | |
214 | +} |