Commit 839a4575c9d4ca5d6a256f5c2c4f11cefa5228fc
1 parent
3a89cd6065
Exists in
master
and in
6 other branches
基层辅助建档接口
Showing 14 changed files with 809 additions and 2 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ArchiveDataDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/ArchiveDataDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/ArchiveDataServicer.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/AssistBuildMapper.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/AssistBuildService.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/AssistBuildServiceImpl.java
- platform-biz-service/src/main/resources/mainOrm/master/AssistBuildMapper.xml
- platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
- platform-dal/src/main/java/com/lyms/platform/pojo/ArchiveData.java
- platform-dal/src/main/java/com/lyms/platform/pojo/AssistBuildUserModel.java
- platform-dal/src/main/java/com/lyms/platform/query/ArchiveDataQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AssistBuildController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RemoteController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AssistBuildFacade.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ArchiveDataDao.java
View file @
839a457
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/ArchiveDataDaoImpl.java
View file @
839a457
... | ... | @@ -35,5 +35,10 @@ |
35 | 35 | public void updatePatient(ArchiveData data, String id) { |
36 | 36 | update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), data); |
37 | 37 | } |
38 | + | |
39 | + @Override | |
40 | + public int ArchiveDataCount(MongoQuery mongoQuery) { | |
41 | + return (int) count(mongoQuery.convertToMongoQuery()); | |
42 | + } | |
38 | 43 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/ArchiveDataServicer.java
View file @
839a457
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 | import com.lyms.platform.common.dao.operator.MongoQuery; |
5 | 5 | import com.lyms.platform.pojo.ArchiveData; |
6 | 6 | import com.lyms.platform.query.ArchiveDataQuery; |
7 | +import org.apache.commons.lang.StringUtils; | |
7 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
8 | 9 | import org.springframework.stereotype.Service; |
9 | 10 | |
... | ... | @@ -19,6 +20,20 @@ |
19 | 20 | private ArchiveDataDao archiveDataDao; |
20 | 21 | |
21 | 22 | public List<ArchiveData> query(MongoQuery query) { |
23 | + return archiveDataDao.query(query); | |
24 | + } | |
25 | + | |
26 | + public int queryCount(ArchiveDataQuery query) { | |
27 | + return archiveDataDao.ArchiveDataCount(query.convertToQuery()); | |
28 | + } | |
29 | + | |
30 | + | |
31 | + public List<ArchiveData> query(ArchiveDataQuery archiveDataQuery) { | |
32 | + MongoQuery query = archiveDataQuery.convertToQuery(); | |
33 | + if (StringUtils.isNotEmpty(archiveDataQuery.getNeed())) { | |
34 | + archiveDataQuery.mysqlBuild(archiveDataDao.ArchiveDataCount(archiveDataQuery.convertToQuery())); | |
35 | + query.start(archiveDataQuery.getOffset()).end(archiveDataQuery.getLimit()); | |
36 | + } | |
22 | 37 | return archiveDataDao.query(query); |
23 | 38 | } |
24 | 39 |
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/AssistBuildMapper.java
View file @
839a457
1 | +package com.lyms.platform.permission.dao.master; | |
2 | + | |
3 | +import com.lyms.platform.pojo.AssistBuildUserModel; | |
4 | + | |
5 | +import java.util.List; | |
6 | +import java.util.Map; | |
7 | + | |
8 | +/** | |
9 | + * Created by Administrator on 2018-08-06. | |
10 | + */ | |
11 | +public interface AssistBuildMapper { | |
12 | + | |
13 | + | |
14 | + void addAssistBuildUser(AssistBuildUserModel userModel); | |
15 | + | |
16 | + List<AssistBuildUserModel> queryAssistBuildUsers(Map param); | |
17 | + | |
18 | + void updateAssistBuildUser(AssistBuildUserModel model); | |
19 | +} |
platform-biz-service/src/main/java/com/lyms/platform/permission/service/AssistBuildService.java
View file @
839a457
1 | +package com.lyms.platform.permission.service; | |
2 | + | |
3 | +import com.lyms.platform.pojo.AssistBuildUserModel; | |
4 | + | |
5 | +import java.util.List; | |
6 | +import java.util.Map; | |
7 | + | |
8 | +/** | |
9 | + * Created by Administrator on 2018-08-06. | |
10 | + */ | |
11 | +public interface AssistBuildService { | |
12 | + void addAssistBuildUser(AssistBuildUserModel userModel); | |
13 | + | |
14 | + List<AssistBuildUserModel> queryAssistBuildUsers(Map param); | |
15 | + | |
16 | + void updateAssistBuildUser(AssistBuildUserModel model); | |
17 | +} |
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/AssistBuildServiceImpl.java
View file @
839a457
1 | +package com.lyms.platform.permission.service.impl; | |
2 | + | |
3 | +import com.lyms.platform.permission.dao.master.AssistBuildMapper; | |
4 | +import com.lyms.platform.permission.service.AssistBuildService; | |
5 | +import com.lyms.platform.pojo.AssistBuildUserModel; | |
6 | +import org.springframework.beans.factory.annotation.Autowired; | |
7 | +import org.springframework.stereotype.Service; | |
8 | + | |
9 | +import java.util.Date; | |
10 | +import java.util.List; | |
11 | +import java.util.Map; | |
12 | + | |
13 | +/** | |
14 | + * Created by Administrator on 2018-08-06. | |
15 | + */ | |
16 | +@Service | |
17 | +public class AssistBuildServiceImpl implements AssistBuildService { | |
18 | + | |
19 | + @Autowired | |
20 | + private AssistBuildMapper assistBuildMapper; | |
21 | + | |
22 | + @Override | |
23 | + public void addAssistBuildUser(AssistBuildUserModel userModel) { | |
24 | + userModel.setCreated(new Date()); | |
25 | + userModel.setModified(new Date()); | |
26 | + assistBuildMapper.addAssistBuildUser(userModel); | |
27 | + } | |
28 | + | |
29 | + @Override | |
30 | + public List<AssistBuildUserModel> queryAssistBuildUsers(Map param) { | |
31 | + return assistBuildMapper.queryAssistBuildUsers(param); | |
32 | + } | |
33 | + | |
34 | + @Override | |
35 | + public void updateAssistBuildUser(AssistBuildUserModel model) { | |
36 | + assistBuildMapper.updateAssistBuildUser(model); | |
37 | + } | |
38 | +} |
platform-biz-service/src/main/resources/mainOrm/master/AssistBuildMapper.xml
View file @
839a457
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE mapper | |
3 | + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |
4 | + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
5 | +<mapper namespace="com.lyms.platform.permission.dao.master.AssistBuildMapper"> | |
6 | + | |
7 | + <insert id="addAssistBuildUser" parameterType="com.lyms.platform.pojo.AssistBuildUserModel" > | |
8 | + <selectKey order="AFTER" keyProperty="id" resultType="java.lang.Integer"> SELECT LAST_INSERT_ID() </selectKey> | |
9 | + INSERT INTO lyms_assist_user | |
10 | + (phone,card_no, user_name,password,qr_code,hospital_id, created,modified) | |
11 | + VALUES (#{phone},#{cardNo},#{userName},#{password},#{qrCode},#{hospitalId},#{created},#{modified}) | |
12 | + </insert> | |
13 | + | |
14 | + | |
15 | + <select id="queryAssistBuildUsers" parameterType="java.util.Map" resultType="com.lyms.platform.pojo.AssistBuildUserModel"> | |
16 | + SELECT | |
17 | + id,phone,card_no as cardNo, user_name as userName,password,qr_code as qrCode,hospital_id as hospitalId, created,modified | |
18 | + FROM lyms_assist_user | |
19 | + WHERE 1 = 1 | |
20 | + <if test="id != null"> | |
21 | + and id = #{id,jdbcType=INTEGER} | |
22 | + </if> | |
23 | + <if test="phone != null and phone != ''"> | |
24 | + and phone = #{phone,jdbcType=VARCHAR} | |
25 | + </if> | |
26 | + </select> | |
27 | + | |
28 | + <update id="updateAssistBuildUser" parameterType="com.lyms.platform.pojo.AssistBuildUserModel" > | |
29 | + UPDATE | |
30 | + lyms_assist_user | |
31 | + <set> | |
32 | + <if test="userName != null"> | |
33 | + user_name = #{userName,jdbcType=VARCHAR}, | |
34 | + </if> | |
35 | + <if test="password != null"> | |
36 | + password = #{password,jdbcType=VARCHAR}, | |
37 | + </if> | |
38 | + <if test="phone != null"> | |
39 | + phone = #{phone,jdbcType=VARCHAR}, | |
40 | + </if> | |
41 | + <if test="cardNo != null"> | |
42 | + card_no = #{cardNo,jdbcType=INTEGER}, | |
43 | + </if> | |
44 | + <if test="qrCode != null"> | |
45 | + qr_code = #{qrCode,jdbcType=VARCHAR}, | |
46 | + </if> | |
47 | + <if test="created != null"> | |
48 | + created = #{created}, | |
49 | + </if> | |
50 | + <if test="modified != null"> | |
51 | + modified = #{modified}, | |
52 | + </if> | |
53 | + | |
54 | + </set> | |
55 | + where id = #{id,jdbcType=INTEGER} | |
56 | + | |
57 | + </update> | |
58 | + | |
59 | +</mapper> |
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
839a457
... | ... | @@ -24,6 +24,8 @@ |
24 | 24 | public static String[] parsePatterns = {"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", |
25 | 25 | "yyyy/MM/dd HH:mm"}; |
26 | 26 | |
27 | + public static SimpleDateFormat yyyy_mm = new SimpleDateFormat("yyyy-MM"); | |
28 | + | |
27 | 29 | public static SimpleDateFormat y_m_d_h_m = new SimpleDateFormat("yyyyMMddHHmm"); |
28 | 30 | public static SimpleDateFormat yyyyMMddHHmmssSSS = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
29 | 31 | public static final int DAY_SECONDS = 86399; |
... | ... | @@ -336,6 +338,18 @@ |
336 | 338 | } |
337 | 339 | } |
338 | 340 | |
341 | + public static Date yyyyMMParse(String time) | |
342 | + { | |
343 | + Date date = null; | |
344 | + try { | |
345 | + date = yyyy_mm.parse(time); | |
346 | + } catch (ParseException e) { | |
347 | + | |
348 | + } | |
349 | + return date; | |
350 | + } | |
351 | + | |
352 | + | |
339 | 353 | public static Date getNextYearDate(String s) { |
340 | 354 | if (s == null) { |
341 | 355 | return null; |
... | ... | @@ -987,6 +1001,17 @@ |
987 | 1001 | public static Date formatDate(Date date) { |
988 | 1002 | String time = y_m_d.format(date); |
989 | 1003 | return parseYMD(time); |
1004 | + } | |
1005 | + | |
1006 | + public static Date formatDateYm(Date date) { | |
1007 | + Date date1 = null; | |
1008 | + try { | |
1009 | + String time = y_m.format(date); | |
1010 | + date1 = y_m.parse(time); | |
1011 | + } catch (ParseException e) { | |
1012 | + e.printStackTrace(); | |
1013 | + } | |
1014 | + return date1; | |
990 | 1015 | } |
991 | 1016 | |
992 | 1017 | public static String formatSimpleDate(Date date) { |
platform-dal/src/main/java/com/lyms/platform/pojo/ArchiveData.java
View file @
839a457
... | ... | @@ -21,6 +21,26 @@ |
21 | 21 | private String hospitalId; |
22 | 22 | private String jsonData; |
23 | 23 | private Date created; |
24 | + private String assistUserId; | |
25 | + | |
26 | + //建档成功时间 | |
27 | + private Date buildDate; | |
28 | + | |
29 | + public Date getBuildDate() { | |
30 | + return buildDate; | |
31 | + } | |
32 | + | |
33 | + public void setBuildDate(Date buildDate) { | |
34 | + this.buildDate = buildDate; | |
35 | + } | |
36 | + | |
37 | + public String getAssistUserId() { | |
38 | + return assistUserId; | |
39 | + } | |
40 | + | |
41 | + public void setAssistUserId(String assistUserId) { | |
42 | + this.assistUserId = assistUserId; | |
43 | + } | |
24 | 44 | |
25 | 45 | public Date getCreated() { |
26 | 46 | return created; |
platform-dal/src/main/java/com/lyms/platform/pojo/AssistBuildUserModel.java
View file @
839a457
1 | +package com.lyms.platform.pojo; | |
2 | + | |
3 | +import java.util.Date; | |
4 | + | |
5 | +/** | |
6 | + * Created by Administrator on 2018-08-06. | |
7 | + */ | |
8 | +public class AssistBuildUserModel { | |
9 | + private Integer id; | |
10 | + | |
11 | + private String phone; | |
12 | + | |
13 | + private String cardNo; | |
14 | + | |
15 | + private String userName; | |
16 | + | |
17 | + private String password; | |
18 | + | |
19 | + private String code; | |
20 | + | |
21 | + //二维码 | |
22 | + private String qrCode; | |
23 | + | |
24 | + private String hospitalId; | |
25 | + | |
26 | + private Date created; | |
27 | + | |
28 | + private Date modified; | |
29 | + | |
30 | + public Date getCreated() { | |
31 | + return created; | |
32 | + } | |
33 | + | |
34 | + public void setCreated(Date created) { | |
35 | + this.created = created; | |
36 | + } | |
37 | + | |
38 | + public Date getModified() { | |
39 | + return modified; | |
40 | + } | |
41 | + | |
42 | + public void setModified(Date modified) { | |
43 | + this.modified = modified; | |
44 | + } | |
45 | + | |
46 | + public Integer getId() { | |
47 | + return id; | |
48 | + } | |
49 | + | |
50 | + public void setId(Integer id) { | |
51 | + this.id = id; | |
52 | + } | |
53 | + | |
54 | + public String getPhone() { | |
55 | + return phone; | |
56 | + } | |
57 | + | |
58 | + public void setPhone(String phone) { | |
59 | + this.phone = phone; | |
60 | + } | |
61 | + | |
62 | + public String getCardNo() { | |
63 | + return cardNo; | |
64 | + } | |
65 | + | |
66 | + public void setCardNo(String cardNo) { | |
67 | + this.cardNo = cardNo; | |
68 | + } | |
69 | + | |
70 | + public String getCode() { | |
71 | + return code; | |
72 | + } | |
73 | + | |
74 | + public void setCode(String code) { | |
75 | + this.code = code; | |
76 | + } | |
77 | + | |
78 | + public String getUserName() { | |
79 | + return userName; | |
80 | + } | |
81 | + | |
82 | + public void setUserName(String userName) { | |
83 | + this.userName = userName; | |
84 | + } | |
85 | + | |
86 | + public String getPassword() { | |
87 | + return password; | |
88 | + } | |
89 | + | |
90 | + public void setPassword(String password) { | |
91 | + this.password = password; | |
92 | + } | |
93 | + | |
94 | + public String getQrCode() { | |
95 | + return qrCode; | |
96 | + } | |
97 | + | |
98 | + public void setQrCode(String qrCode) { | |
99 | + this.qrCode = qrCode; | |
100 | + } | |
101 | + | |
102 | + public String getHospitalId() { | |
103 | + return hospitalId; | |
104 | + } | |
105 | + | |
106 | + public void setHospitalId(String hospitalId) { | |
107 | + this.hospitalId = hospitalId; | |
108 | + } | |
109 | + | |
110 | + @Override | |
111 | + public String toString() { | |
112 | + return "AssistBuildUserModel{" + | |
113 | + "id=" + id + | |
114 | + ", phone='" + phone + '\'' + | |
115 | + ", cardNo='" + cardNo + '\'' + | |
116 | + ", userName='" + userName + '\'' + | |
117 | + ", password='" + password + '\'' + | |
118 | + ", code='" + code + '\'' + | |
119 | + ", qrCode='" + qrCode + '\'' + | |
120 | + ", hospitalId='" + hospitalId + '\'' + | |
121 | + '}'; | |
122 | + } | |
123 | +} |
platform-dal/src/main/java/com/lyms/platform/query/ArchiveDataQuery.java
View file @
839a457
... | ... | @@ -5,7 +5,10 @@ |
5 | 5 | import com.lyms.platform.common.dao.operator.MongoCondition; |
6 | 6 | import com.lyms.platform.common.dao.operator.MongoOper; |
7 | 7 | import com.lyms.platform.common.dao.operator.MongoQuery; |
8 | +import org.springframework.data.mongodb.core.query.Criteria; | |
8 | 9 | |
10 | +import java.util.Date; | |
11 | + | |
9 | 12 | /** |
10 | 13 | * Created by riecard on 2016/10/19. |
11 | 14 | */ |
... | ... | @@ -17,6 +20,24 @@ |
17 | 20 | private String cardNum; |
18 | 21 | private String phone; |
19 | 22 | |
23 | + private Date createdStart; | |
24 | + private Date createdEnd; | |
25 | + private String assistUserId; | |
26 | + | |
27 | + //建档成功时间 | |
28 | + private Date buildDateStart; | |
29 | + private Date buildDateEnd; | |
30 | + | |
31 | + private Boolean hasBuildDate; | |
32 | + | |
33 | + public Boolean isHasBuildDate() { | |
34 | + return hasBuildDate; | |
35 | + } | |
36 | + | |
37 | + public void setHasBuildDate(Boolean hasBuildDate) { | |
38 | + this.hasBuildDate = hasBuildDate; | |
39 | + } | |
40 | + | |
20 | 41 | public String getId() { |
21 | 42 | return id; |
22 | 43 | } |
23 | 44 | |
... | ... | @@ -57,7 +78,46 @@ |
57 | 78 | this.phone = phone; |
58 | 79 | } |
59 | 80 | |
81 | + public Date getCreatedStart() { | |
82 | + return createdStart; | |
83 | + } | |
60 | 84 | |
85 | + public void setCreatedStart(Date createdStart) { | |
86 | + this.createdStart = createdStart; | |
87 | + } | |
88 | + | |
89 | + public Date getCreatedEnd() { | |
90 | + return createdEnd; | |
91 | + } | |
92 | + | |
93 | + public void setCreatedEnd(Date createdEnd) { | |
94 | + this.createdEnd = createdEnd; | |
95 | + } | |
96 | + | |
97 | + public String getAssistUserId() { | |
98 | + return assistUserId; | |
99 | + } | |
100 | + | |
101 | + public void setAssistUserId(String assistUserId) { | |
102 | + this.assistUserId = assistUserId; | |
103 | + } | |
104 | + | |
105 | + public Date getBuildDateStart() { | |
106 | + return buildDateStart; | |
107 | + } | |
108 | + | |
109 | + public void setBuildDateStart(Date buildDateStart) { | |
110 | + this.buildDateStart = buildDateStart; | |
111 | + } | |
112 | + | |
113 | + public Date getBuildDateEnd() { | |
114 | + return buildDateEnd; | |
115 | + } | |
116 | + | |
117 | + public void setBuildDateEnd(Date buildDateEnd) { | |
118 | + this.buildDateEnd = buildDateEnd; | |
119 | + } | |
120 | + | |
61 | 121 | @Override |
62 | 122 | public MongoQuery convertToQuery() { |
63 | 123 | MongoCondition condition=MongoCondition.newInstance(); |
... | ... | @@ -67,6 +127,15 @@ |
67 | 127 | if(null!=idCard){ |
68 | 128 | condition= condition.and("idCard",idCard, MongoOper.IS); |
69 | 129 | } |
130 | + | |
131 | + if(hasBuildDate != null){ | |
132 | + condition= condition.and("buildDate",hasBuildDate, MongoOper.EXISTS); | |
133 | + } | |
134 | + | |
135 | + if(null != assistUserId){ | |
136 | + condition= condition.and("assistUserId",assistUserId, MongoOper.IS); | |
137 | + } | |
138 | + | |
70 | 139 | if(null!=id){ |
71 | 140 | condition= condition.and("id",id, MongoOper.IS); |
72 | 141 | } |
... | ... | @@ -76,6 +145,29 @@ |
76 | 145 | if(null!=phone){ |
77 | 146 | condition= condition.and("phone",phone, MongoOper.IS); |
78 | 147 | } |
148 | + | |
149 | + Criteria c = null; | |
150 | + | |
151 | + if(null != createdStart && createdEnd != null){ | |
152 | + if(null != c){ | |
153 | + c = c.where("created").gte(createdStart).lte(createdEnd); | |
154 | + }else{ | |
155 | + c = Criteria.where("created").gte(createdStart).lte(createdEnd); | |
156 | + } | |
157 | + } | |
158 | + | |
159 | + if(null != buildDateStart && buildDateEnd != null){ | |
160 | + if(null != c){ | |
161 | + c = c.where("buildDate").gte(buildDateStart).lte(buildDateEnd); | |
162 | + }else{ | |
163 | + c = Criteria.where("buildDate").gte(buildDateStart).lte(buildDateEnd); | |
164 | + } | |
165 | + } | |
166 | + | |
167 | + if (c != null) { | |
168 | + return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery(); | |
169 | + } | |
170 | + | |
79 | 171 | return condition.toMongoQuery(); |
80 | 172 | } |
81 | 173 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AssistBuildController.java
View file @
839a457
1 | +package com.lyms.platform.operate.web.controller; | |
2 | + | |
3 | +import com.lyms.platform.common.base.BaseController; | |
4 | +import com.lyms.platform.common.result.BaseResponse; | |
5 | +import com.lyms.platform.operate.web.facade.AssistBuildFacade; | |
6 | +import com.lyms.platform.pojo.AssistBuildUserModel; | |
7 | +import org.springframework.beans.factory.annotation.Autowired; | |
8 | +import org.springframework.stereotype.Controller; | |
9 | +import org.springframework.web.bind.annotation.*; | |
10 | + | |
11 | +import javax.servlet.http.HttpServletRequest; | |
12 | +import javax.validation.Valid; | |
13 | + | |
14 | +/** | |
15 | + * 辅助建档 | |
16 | + * Created by Administrator on 2018-08-06. | |
17 | + */ | |
18 | +@Controller | |
19 | +@RequestMapping("/assist") | |
20 | +public class AssistBuildController extends BaseController { | |
21 | + | |
22 | + @Autowired | |
23 | + private AssistBuildFacade assistBuildFacade; | |
24 | + | |
25 | + /** | |
26 | + * 注册 | |
27 | + * @param userModel | |
28 | + * @param httpServletRequest | |
29 | + * @return | |
30 | + */ | |
31 | + @RequestMapping(method = RequestMethod.POST, value = "/regAssistBuildUser") | |
32 | + @ResponseBody | |
33 | + public BaseResponse regAssistBuildUser(@Valid @RequestBody AssistBuildUserModel userModel, | |
34 | + HttpServletRequest httpServletRequest) { | |
35 | + return assistBuildFacade.regAssistBuildUser(userModel); | |
36 | + } | |
37 | + | |
38 | + | |
39 | + /** | |
40 | + * 查询数据 | |
41 | + * @param phone | |
42 | + * @param userId | |
43 | + * @param httpServletRequest | |
44 | + * @return | |
45 | + */ | |
46 | + @RequestMapping(method = RequestMethod.GET, value = "/queryAssistBuildUsers") | |
47 | + @ResponseBody | |
48 | + public BaseResponse queryAssistBuildUsers(@RequestParam(required = false) String phone, | |
49 | + @RequestParam(required = false) String userId, | |
50 | + HttpServletRequest httpServletRequest) { | |
51 | + return assistBuildFacade.queryAssistBuildUsers(phone, userId); | |
52 | + } | |
53 | + | |
54 | + /** | |
55 | + * 更新密码 | |
56 | + * @param oldPwd | |
57 | + * @param newPwd | |
58 | + * @param userId | |
59 | + * @param httpServletRequest | |
60 | + */ | |
61 | + @RequestMapping(value = "/updatePwd", method = RequestMethod.GET) | |
62 | + @ResponseBody | |
63 | + public BaseResponse updatePwd( | |
64 | + @RequestParam("oldPwd") String oldPwd, | |
65 | + @RequestParam("newPwd") String newPwd, | |
66 | + @RequestParam("userId") Integer userId, | |
67 | + HttpServletRequest httpServletRequest) { | |
68 | + return assistBuildFacade.updatePwd(userId, oldPwd, newPwd); | |
69 | + | |
70 | + } | |
71 | + | |
72 | + | |
73 | + /** | |
74 | + * 更新二维码 | |
75 | + * @param userId | |
76 | + * @param httpServletRequest | |
77 | + * @return | |
78 | + */ | |
79 | + @RequestMapping(value = "/updateQrCode", method = RequestMethod.GET) | |
80 | + @ResponseBody | |
81 | + public BaseResponse updateQrCode( | |
82 | + @RequestParam("qrCode") String qrCode, | |
83 | + @RequestParam("userId") Integer userId, | |
84 | + HttpServletRequest httpServletRequest) { | |
85 | + return assistBuildFacade.updateQrCode(userId, qrCode); | |
86 | + } | |
87 | + | |
88 | + | |
89 | + /** | |
90 | + * 基层辅助建档平台汇总数据接口 | |
91 | + * @param userId | |
92 | + * @param httpServletRequest | |
93 | + * @return | |
94 | + */ | |
95 | + @RequestMapping(value = "/getAssisBuildCountInfo", method = RequestMethod.GET) | |
96 | + @ResponseBody | |
97 | + public BaseResponse getAssisBuildCountInfo( | |
98 | + @RequestParam("userId") Integer userId, | |
99 | + HttpServletRequest httpServletRequest) { | |
100 | + return assistBuildFacade.getAssisBuildCountInfo(userId); | |
101 | + } | |
102 | + | |
103 | + /** | |
104 | + * 预约成功列表 | |
105 | + * @param userId | |
106 | + * @param month | |
107 | + * @param httpServletRequest | |
108 | + * @return | |
109 | + */ | |
110 | + @RequestMapping(value = "/getArchiveSuccessList", method = RequestMethod.GET) | |
111 | + @ResponseBody | |
112 | + public BaseResponse getAssisBuildCountInfo( | |
113 | + @RequestParam("userId") Integer userId, | |
114 | + @RequestParam("month") String month, | |
115 | + HttpServletRequest httpServletRequest) { | |
116 | + return assistBuildFacade.getArchiveSuccessList(userId, month); | |
117 | + } | |
118 | + | |
119 | + /** | |
120 | + * 预约建档列表 | |
121 | + * @param userId | |
122 | + * @param httpServletRequest | |
123 | + * @return | |
124 | + */ | |
125 | + @RequestMapping(value = "/getArchiveBuildList", method = RequestMethod.GET) | |
126 | + @ResponseBody | |
127 | + public BaseResponse getAssisBuildCountInfo( | |
128 | + @RequestParam("userId") Integer userId, | |
129 | + @RequestParam("page") Integer page, | |
130 | + @RequestParam("limit") Integer limit, | |
131 | + HttpServletRequest httpServletRequest) { | |
132 | + return assistBuildFacade.getArchiveBuildList(userId, page, limit); | |
133 | + } | |
134 | + | |
135 | + /** | |
136 | + * 预约建档用户id | |
137 | + * @param archiveId | |
138 | + * @param httpServletRequest | |
139 | + * @return | |
140 | + */ | |
141 | + @RequestMapping(value = "/getArchiveUserInfo", method = RequestMethod.GET) | |
142 | + @ResponseBody | |
143 | + public BaseResponse getArchiveUserInfo( | |
144 | + @RequestParam("archiveId") String archiveId, | |
145 | + HttpServletRequest httpServletRequest) { | |
146 | + return assistBuildFacade.getArchiveUserInfo(archiveId); | |
147 | + } | |
148 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RemoteController.java
View file @
839a457
... | ... | @@ -137,11 +137,12 @@ |
137 | 137 | @RequestMapping(value = "/bookArchive",method = RequestMethod.POST) |
138 | 138 | public void addBookArchive(HttpServletResponse response, |
139 | 139 | String idCard, |
140 | - String hospitalId, | |
140 | + @RequestParam(required = false)String hospitalId, | |
141 | 141 | String jsonData, |
142 | 142 | String name, |
143 | 143 | String cardNum, |
144 | - String phone) { | |
144 | + String phone, | |
145 | + @RequestParam(required = false)String assistUserId) { | |
145 | 146 | try { |
146 | 147 | ArchiveData data = new ArchiveData(); |
147 | 148 | data.setId(hospitalId + ":" + idCard); |
... | ... | @@ -152,6 +153,7 @@ |
152 | 153 | data.setPhone(phone); |
153 | 154 | data.setJsonData(jsonData); |
154 | 155 | data.setCreated(new Date()); |
156 | + data.setAssistUserId(assistUserId); | |
155 | 157 | archiveDataServicer.addOrUpdate(data); |
156 | 158 | } |
157 | 159 | catch (Exception e) |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AssistBuildFacade.java
View file @
839a457
1 | +package com.lyms.platform.operate.web.facade; | |
2 | + | |
3 | +import com.lyms.platform.biz.service.ArchiveDataServicer; | |
4 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
5 | +import com.lyms.platform.common.result.BaseListResponse; | |
6 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
7 | +import com.lyms.platform.common.result.BaseResponse; | |
8 | +import com.lyms.platform.common.utils.DateUtil; | |
9 | +import com.lyms.platform.common.utils.JsonUtil; | |
10 | +import com.lyms.platform.common.utils.StringUtils; | |
11 | +import com.lyms.platform.operate.web.utils.CollectionUtils; | |
12 | +import com.lyms.platform.permission.service.AssistBuildService; | |
13 | +import com.lyms.platform.pojo.ArchiveData; | |
14 | +import com.lyms.platform.pojo.AssistBuildUserModel; | |
15 | +import com.lyms.platform.query.ArchiveDataQuery; | |
16 | +import net.sf.json.JSONObject; | |
17 | +import org.springframework.beans.factory.annotation.Autowired; | |
18 | +import org.springframework.stereotype.Component; | |
19 | + | |
20 | +import java.text.ParseException; | |
21 | +import java.text.SimpleDateFormat; | |
22 | +import java.util.*; | |
23 | + | |
24 | +/** | |
25 | + * Created by Administrator on 2018-08-06. | |
26 | + */ | |
27 | +@Component | |
28 | +public class AssistBuildFacade { | |
29 | + | |
30 | + @Autowired | |
31 | + private AssistBuildService assistBuildService; | |
32 | + | |
33 | + @Autowired | |
34 | + private ArchiveDataServicer archiveDataServicer; | |
35 | + | |
36 | + public BaseResponse regAssistBuildUser(AssistBuildUserModel userModel) { | |
37 | + | |
38 | + try { | |
39 | + assistBuildService.addAssistBuildUser(userModel); | |
40 | + } | |
41 | + catch (Exception e) | |
42 | + { | |
43 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SYSTEM_ERROR).setErrormsg("失败"); | |
44 | + } | |
45 | + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(userModel.getId()); | |
46 | + } | |
47 | + | |
48 | + public BaseResponse queryAssistBuildUsers(String phone, String userId) { | |
49 | + Map param = new HashMap<>(); | |
50 | + param.put("phone",phone); | |
51 | + param.put("userId", userId); | |
52 | + | |
53 | + List<AssistBuildUserModel> userModels = assistBuildService.queryAssistBuildUsers(param); | |
54 | + | |
55 | + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(userModels); | |
56 | + } | |
57 | + | |
58 | + public BaseResponse updatePwd(Integer userId, String oldPwd, String newPwd) { | |
59 | + | |
60 | + Map param = new HashMap<>(); | |
61 | + param.put("id", userId); | |
62 | + | |
63 | + List<AssistBuildUserModel> userModels = assistBuildService.queryAssistBuildUsers(param); | |
64 | + if (CollectionUtils.isNotEmpty(userModels)) | |
65 | + { | |
66 | + AssistBuildUserModel model = userModels.get(0); | |
67 | + if (model == null || !oldPwd.equals(model.getPassword())) | |
68 | + { | |
69 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.USER_PASSWORD_ERROR).setErrormsg("旧密码不对"); | |
70 | + } | |
71 | + AssistBuildUserModel updateModel = new AssistBuildUserModel(); | |
72 | + updateModel.setId(model.getId()); | |
73 | + updateModel.setPassword(newPwd); | |
74 | + assistBuildService.updateAssistBuildUser(updateModel); | |
75 | + } | |
76 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
77 | + } | |
78 | + | |
79 | + | |
80 | + | |
81 | + public BaseResponse updateQrCode(Integer userId, String qrCode) { | |
82 | + Map param = new HashMap<>(); | |
83 | + param.put("id", userId); | |
84 | + | |
85 | + List<AssistBuildUserModel> userModels = assistBuildService.queryAssistBuildUsers(param); | |
86 | + if (CollectionUtils.isNotEmpty(userModels)) | |
87 | + { | |
88 | + AssistBuildUserModel model = userModels.get(0); | |
89 | + | |
90 | + AssistBuildUserModel updateModel = new AssistBuildUserModel(); | |
91 | + updateModel.setId(model.getId()); | |
92 | + updateModel.setQrCode(qrCode); | |
93 | + assistBuildService.updateAssistBuildUser(updateModel); | |
94 | + } | |
95 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
96 | + } | |
97 | + | |
98 | + | |
99 | + public BaseResponse getAssisBuildCountInfo(Integer userId) { | |
100 | + Map result = new HashMap(); | |
101 | + | |
102 | + try { | |
103 | + | |
104 | + Map param = new HashMap<>(); | |
105 | + param.put("id", userId); | |
106 | + List<AssistBuildUserModel> userModels = assistBuildService.queryAssistBuildUsers(param); | |
107 | + if (CollectionUtils.isNotEmpty(userModels)) { | |
108 | + AssistBuildUserModel model = userModels.get(0); | |
109 | + result.put("ticket", model.getQrCode()); | |
110 | + result.put("userName", model.getUserName()); | |
111 | + result.put("phone", model.getPhone()); | |
112 | + result.put("month", DateUtil.getyyyy_mm(new Date())); | |
113 | + | |
114 | + ArchiveDataQuery query = new ArchiveDataQuery(); | |
115 | + query.setAssistUserId(String.valueOf(userId)); | |
116 | + query.setHospitalId(model.getHospitalId()); | |
117 | + query.setBuildDateStart(DateUtil.parseYMD("2010-01-01")); | |
118 | + query.setBuildDateEnd(DateUtil.addDay(DateUtil.formatDate(new Date()), 1)); | |
119 | + | |
120 | + int count = archiveDataServicer.queryCount(query); | |
121 | + | |
122 | + //历史建档成功总人数 | |
123 | + result.put("allSuccessCount", count); | |
124 | + | |
125 | + query.setBuildDateStart(DateUtil.formatDateYm(new Date())); | |
126 | + query.setBuildDateEnd(DateUtil.addDay(DateUtil.formatDate(new Date()), 1)); | |
127 | + | |
128 | + count = archiveDataServicer.queryCount(query); | |
129 | + //本月建档成功总人数 | |
130 | + result.put("currentMonthSuccessCount", count); | |
131 | + | |
132 | + | |
133 | + query.setBuildDateStart(null); | |
134 | + query.setBuildDateEnd(null); | |
135 | + | |
136 | + query.setCreatedStart(DateUtil.parseYMD("2010-01-01")); | |
137 | + query.setCreatedEnd(DateUtil.addDay(DateUtil.formatDate(new Date()), 1)); | |
138 | + | |
139 | + | |
140 | + query.setHasBuildDate(false); | |
141 | + count = archiveDataServicer.queryCount(query); | |
142 | + | |
143 | + //预约建档待确认人数 | |
144 | + result.put("archiveSuccessCount", count); | |
145 | + | |
146 | + } | |
147 | + } | |
148 | + catch (Exception e) | |
149 | + { | |
150 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
151 | + } | |
152 | + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(result); | |
153 | + } | |
154 | + | |
155 | + public BaseResponse getArchiveBuildList(Integer userId,Integer page,Integer limit) { | |
156 | + | |
157 | + Map param = new HashMap<>(); | |
158 | + param.put("id", userId); | |
159 | + | |
160 | + List result = new ArrayList(); | |
161 | + ArchiveDataQuery query = new ArchiveDataQuery(); | |
162 | + List<AssistBuildUserModel> userModels = assistBuildService.queryAssistBuildUsers(param); | |
163 | + if (CollectionUtils.isNotEmpty(userModels)) { | |
164 | + AssistBuildUserModel model = userModels.get(0); | |
165 | + | |
166 | + | |
167 | + query.setHospitalId(model.getHospitalId()); | |
168 | + query.setAssistUserId(String.valueOf(userId)); | |
169 | + query.setCreatedStart(DateUtil.parseYMD("2010-01-01")); | |
170 | + query.setCreatedEnd(DateUtil.addDay(DateUtil.formatDate(new Date()), 1)); | |
171 | + query.setHasBuildDate(false); | |
172 | + query.setPage(page); | |
173 | + query.setNeed("true"); | |
174 | + query.setLimit(limit); | |
175 | + | |
176 | + List<ArchiveData> list = archiveDataServicer.query(query); | |
177 | + if (CollectionUtils.isNotEmpty(list)) | |
178 | + { | |
179 | + for (ArchiveData archiveData : list) | |
180 | + { | |
181 | + Map map = new HashMap(); | |
182 | + map.put("userName",archiveData.getName()); | |
183 | + map.put("archiveId",archiveData.getId()); | |
184 | + map.put("phone",archiveData.getPhone()); | |
185 | + map.put("cardNo",archiveData.getIdCard()); | |
186 | + map.put("date",DateUtil.getyyyy_MM_dd(archiveData.getCreated())); | |
187 | + result.add(map); | |
188 | + } | |
189 | + } | |
190 | + } | |
191 | + return new BaseListResponse().setData(result).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setPageInfo(query.getPageInfo()); | |
192 | + } | |
193 | + | |
194 | + public BaseResponse getArchiveSuccessList(Integer userId, String month) { | |
195 | + Map param = new HashMap<>(); | |
196 | + param.put("id", userId); | |
197 | + | |
198 | + List result = new ArrayList(); | |
199 | + ArchiveDataQuery query = new ArchiveDataQuery(); | |
200 | + List<AssistBuildUserModel> userModels = assistBuildService.queryAssistBuildUsers(param); | |
201 | + if (CollectionUtils.isNotEmpty(userModels)) { | |
202 | + AssistBuildUserModel model = userModels.get(0); | |
203 | + query.setHospitalId(model.getHospitalId()); | |
204 | + query.setAssistUserId(String.valueOf(userId)); | |
205 | + Date start = DateUtil.yyyyMMParse(month); | |
206 | + query.setBuildDateStart(start); | |
207 | + query.setBuildDateEnd(DateUtil.addMonth(start, 1)); | |
208 | + | |
209 | + List<ArchiveData> list = archiveDataServicer.query(query); | |
210 | + if (CollectionUtils.isNotEmpty(list)) | |
211 | + { | |
212 | + for (ArchiveData archiveData : list) | |
213 | + { | |
214 | + Map map = new HashMap(); | |
215 | + map.put("userName",archiveData.getName()); | |
216 | + map.put("archiveId",archiveData.getId()); | |
217 | + map.put("phone",archiveData.getPhone()); | |
218 | + map.put("cardNo",archiveData.getIdCard()); | |
219 | + map.put("date",DateUtil.getyyyy_MM_dd(archiveData.getCreated())); | |
220 | + result.add(map); | |
221 | + } | |
222 | + } | |
223 | + } | |
224 | + return new BaseListResponse().setData(result).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setPageInfo(query.getPageInfo()); | |
225 | + } | |
226 | + | |
227 | + public BaseResponse getArchiveUserInfo(String archiveId) { | |
228 | + ArchiveDataQuery query = new ArchiveDataQuery(); | |
229 | + query.setId(archiveId); | |
230 | + List<ArchiveData> list = archiveDataServicer.query(query); | |
231 | + String json = ""; | |
232 | + if (CollectionUtils.isNotEmpty(list)) | |
233 | + { | |
234 | + json = list.get(0).getJsonData(); | |
235 | + JSONObject jsonObject = JsonUtil.getObj(json); | |
236 | + jsonObject = jsonObject.element("userName",list.get(0).getName()); | |
237 | + jsonObject = jsonObject.element("idCard",list.get(0).getIdCard()); | |
238 | + json = jsonObject.toString(); | |
239 | + } | |
240 | + return new BaseObjectResponse().setData(json).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
241 | + } | |
242 | +} |