Commit 85da9d87ddb32cf7e4bd32ad0b85d4c7d25fe898
1 parent
44fcb7d8ae
Exists in
master
and in
8 other branches
查询婚检的时候返回历史婚检记录
Showing 5 changed files with 222 additions and 29 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IFolicAcidDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/FolicAcidDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/FolicAcidService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PremaritalCheckupFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/PremaritalCheckupHistoryResult.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IFolicAcidDao.java
View file @
85da9d8
1 | +package com.lyms.platform.biz.dal; | |
2 | + | |
3 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
4 | +import com.lyms.platform.pojo.FolicAcid; | |
5 | + | |
6 | +import java.util.List; | |
7 | + | |
8 | +/** | |
9 | + * Created by Administrator on 2016/12/1 0001. | |
10 | + */ | |
11 | +public interface IFolicAcidDao { | |
12 | + | |
13 | + public FolicAcid addFolicAcid(FolicAcid obj); | |
14 | + | |
15 | + public void updateFolicAcid(FolicAcid obj, String id); | |
16 | + | |
17 | + public void deleteFolicAcid(String id); | |
18 | + | |
19 | + public FolicAcid getFolicAcid(String id); | |
20 | + | |
21 | + public int queryFolicAcidCount(MongoQuery query); | |
22 | + | |
23 | + public List<FolicAcid> queryFolicAcid(MongoQuery query); | |
24 | + | |
25 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/FolicAcidDaoImpl.java
View file @
85da9d8
1 | +package com.lyms.platform.biz.dal.impl; | |
2 | + | |
3 | +import com.lyms.platform.biz.dal.IFolicAcidDao; | |
4 | +import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
5 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
6 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
7 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
8 | +import com.lyms.platform.pojo.FolicAcid; | |
9 | +import org.bson.types.ObjectId; | |
10 | +import org.springframework.stereotype.Repository; | |
11 | + | |
12 | +import java.util.List; | |
13 | + | |
14 | +/** | |
15 | + * Created by Administrator on 2016/12/1 0001. | |
16 | + */ | |
17 | +@Repository("folicAcidDao") | |
18 | +public class FolicAcidDaoImpl extends BaseMongoDAOImpl<FolicAcid> implements IFolicAcidDao{ | |
19 | + @Override | |
20 | + public FolicAcid addFolicAcid(FolicAcid obj) { | |
21 | + return save(obj); | |
22 | + } | |
23 | + | |
24 | + @Override | |
25 | + public void updateFolicAcid(FolicAcid obj, String id) { | |
26 | + update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), obj); | |
27 | + } | |
28 | + | |
29 | + @Override | |
30 | + public void deleteFolicAcid(String id) { | |
31 | + boolean check = ObjectId.isValid(id); | |
32 | + if (check) { | |
33 | + delete(new MongoQuery(new MongoCondition("id", new ObjectId(id), MongoOper.IS)).convertToMongoQuery()); | |
34 | + } | |
35 | + } | |
36 | + | |
37 | + @Override | |
38 | + public FolicAcid getFolicAcid(String id) { | |
39 | + return findById(id); | |
40 | + } | |
41 | + | |
42 | + @Override | |
43 | + public int queryFolicAcidCount(MongoQuery query) { | |
44 | + return (int) count(query.convertToMongoQuery()); | |
45 | + } | |
46 | + | |
47 | + @Override | |
48 | + public List<FolicAcid> queryFolicAcid(MongoQuery query) { | |
49 | + return find(query.convertToMongoQuery()); | |
50 | + } | |
51 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/FolicAcidService.java
View file @
85da9d8
1 | +package com.lyms.platform.biz.service; | |
2 | + | |
3 | +import com.lyms.platform.biz.dal.IFolicAcidDao; | |
4 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
5 | +import com.lyms.platform.common.utils.StringUtils; | |
6 | +import com.lyms.platform.pojo.FolicAcid; | |
7 | +import com.lyms.platform.query.FolicAcidQuery; | |
8 | +import org.springframework.beans.factory.annotation.Autowired; | |
9 | +import org.springframework.data.domain.Sort; | |
10 | +import org.springframework.stereotype.Service; | |
11 | + | |
12 | +import java.util.List; | |
13 | + | |
14 | +/** | |
15 | + * Created by Administrator on 2016/12/1 0001. | |
16 | + */ | |
17 | +@Service("folicAcidService") | |
18 | +public class FolicAcidService { | |
19 | + | |
20 | + @Autowired | |
21 | + private IFolicAcidDao folicAcidDao; | |
22 | + | |
23 | + public FolicAcid addFolicAcid(FolicAcid obj){ | |
24 | + return folicAcidDao.addFolicAcid(obj); | |
25 | + } | |
26 | + | |
27 | + public void updateFolicAcid(FolicAcid obj, String id){ | |
28 | + folicAcidDao.updateFolicAcid(obj, id); | |
29 | + } | |
30 | + | |
31 | + public FolicAcid getFolicAcid(String id){ | |
32 | + return folicAcidDao.getFolicAcid(id); | |
33 | + } | |
34 | + | |
35 | + public int queryFolicAcidCount(MongoQuery query){ | |
36 | + return folicAcidDao.queryFolicAcidCount(query); | |
37 | + } | |
38 | + | |
39 | + public List<FolicAcid> queryFolicAcid(FolicAcidQuery query){ | |
40 | + MongoQuery mongoQuery = query.convertToQuery(); | |
41 | + if (StringUtils.isNotEmpty(query.getNeed())) { | |
42 | + query.mysqlBuild(folicAcidDao.queryFolicAcidCount(mongoQuery)); | |
43 | + mongoQuery.start(query.getOffset()).end(query.getLimit()); | |
44 | + } | |
45 | + return folicAcidDao.queryFolicAcid(mongoQuery.addOrder(Sort.Direction.DESC, "created")); | |
46 | + } | |
47 | + | |
48 | + public List<FolicAcid> queryFolicAcidWithSort(FolicAcidQuery query,String sortkey,Sort.Direction sort){ | |
49 | + MongoQuery mongoQuery = query.convertToQuery(); | |
50 | + return folicAcidDao.queryFolicAcid(mongoQuery.addOrder(sort, sortkey)); | |
51 | + } | |
52 | + | |
53 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PremaritalCheckupFacade.java
View file @
85da9d8
... | ... | @@ -13,7 +13,10 @@ |
13 | 13 | import com.lyms.platform.common.utils.DateUtil; |
14 | 14 | import com.lyms.platform.operate.web.request.PremaritalCheckupAddRequest; |
15 | 15 | import com.lyms.platform.operate.web.request.PremaritalCheckupQueryRequest; |
16 | +import com.lyms.platform.operate.web.result.PremaritalCheckupHistoryResult; | |
16 | 17 | import com.lyms.platform.operate.web.utils.CommonsHelper; |
18 | +import com.lyms.platform.permission.model.Organization; | |
19 | +import com.lyms.platform.permission.service.OrganizationService; | |
17 | 20 | import com.lyms.platform.pojo.PremaritalCheckup; |
18 | 21 | import com.lyms.platform.pojo.ResidentsArchiveModel; |
19 | 22 | import com.lyms.platform.query.PremaritalCheckupQuery; |
20 | 23 | |
21 | 24 | |
22 | 25 | |
23 | 26 | |
24 | 27 | |
25 | 28 | |
26 | 29 | |
27 | 30 | |
28 | 31 | |
29 | 32 | |
30 | 33 | |
31 | 34 | |
32 | 35 | |
33 | 36 | |
34 | 37 | |
35 | 38 | |
36 | 39 | |
37 | 40 | |
... | ... | @@ -40,78 +43,91 @@ |
40 | 43 | private ResidentsArchiveService residentsArchiveService; |
41 | 44 | @Autowired |
42 | 45 | private BasicConfigService basicConfigService; |
46 | + @Autowired | |
47 | + private OrganizationService organizationService; | |
43 | 48 | |
44 | - | |
45 | 49 | /** |
46 | 50 | * 查询单个(男/女)婚前检查 |
47 | 51 | * @param requestParam |
48 | 52 | * @param id |
49 | 53 | * @return |
50 | 54 | */ |
51 | - public BaseObjectResponse getPremaritalCheckup(PremaritalCheckupQueryRequest requestParam,Integer id){ | |
55 | + public BaseObjectResponse getPremaritalCheckup(PremaritalCheckupQueryRequest requestParam,Integer id) { | |
52 | 56 | |
53 | - PremaritalCheckup result = new PremaritalCheckup(); | |
57 | + PremaritalCheckup result = null; | |
58 | + Map<String, Object> resultMap = new HashMap<>(); | |
59 | + Map<String, Object> archiveMap = new HashMap<>(); | |
54 | 60 | |
55 | - Map<String,Object> resultMap = new HashMap<>(); | |
56 | - Map<String,Object> archiveMap = new HashMap<>(); | |
61 | + ResidentsArchiveModel archiveModel = null; | |
57 | 62 | |
58 | - ResidentsArchiveModel archiveModel = new ResidentsArchiveModel(); | |
59 | - | |
60 | 63 | //婚检ID不为空 |
61 | - if (StringUtils.isNotEmpty(requestParam.getId())){ | |
64 | + if (StringUtils.isNotEmpty(requestParam.getId())) { | |
62 | 65 | //婚检数据 |
63 | 66 | result = premaritalCheckupService.getPremaritalCheckup(requestParam.getId()); |
64 | - if (StringUtils.isNotEmpty(result.getParentId())){ | |
67 | + if (StringUtils.isNotEmpty(result.getParentId())) { | |
65 | 68 | //居民数据 |
66 | 69 | archiveModel = residentsArchiveService.getResident(result.getParentId()); |
67 | 70 | } |
68 | - }else { | |
71 | + } else { | |
69 | 72 | |
70 | 73 | ResidentsArchiveQuery archiveQuery = new ResidentsArchiveQuery(); |
71 | 74 | |
72 | 75 | //当婚检ID为空,用证件号或者就诊卡去查询居民建档的信息 |
73 | - if (StringUtils.isNotEmpty(requestParam.getCertificateNum())){ | |
76 | + if (StringUtils.isNotEmpty(requestParam.getCertificateNum())) { | |
74 | 77 | archiveQuery.setYn(YnEnums.YES.getId()); |
75 | 78 | archiveQuery.setHospitalId(requestParam.getHospitalId()); |
76 | 79 | archiveQuery.setCertificateNum(requestParam.getCertificateNum()); |
77 | 80 | List<ResidentsArchiveModel> modelList = residentsArchiveService.queryResident(archiveQuery); |
78 | - if (CollectionUtils.isNotEmpty(modelList)){ | |
81 | + if (CollectionUtils.isNotEmpty(modelList)) { | |
79 | 82 | archiveModel = modelList.get(0); |
80 | 83 | } |
81 | - }else if (StringUtils.isNotEmpty(requestParam.getVcCardNo())){ | |
84 | + } else if (StringUtils.isNotEmpty(requestParam.getVcCardNo())) { | |
82 | 85 | archiveQuery.setYn(YnEnums.YES.getId()); |
83 | 86 | archiveQuery.setHospitalId(requestParam.getHospitalId()); |
84 | 87 | archiveQuery.setVcCardNo(requestParam.getVcCardNo()); |
85 | - List<ResidentsArchiveModel> modelList = residentsArchiveService.queryResident(archiveQuery); | |
86 | - if (CollectionUtils.isNotEmpty(modelList)){ | |
88 | + List<ResidentsArchiveModel> modelList = residentsArchiveService.queryResident(archiveQuery); | |
89 | + if (CollectionUtils.isNotEmpty(modelList)) { | |
87 | 90 | archiveModel = modelList.get(0); |
88 | 91 | } |
89 | 92 | } |
90 | 93 | |
91 | - if (archiveModel!=null){ | |
94 | + if (archiveModel != null) { | |
92 | 95 | PremaritalCheckupQuery query = new PremaritalCheckupQuery(); |
93 | 96 | query.setYn(YnEnums.YES.getId()); |
94 | 97 | query.setHospitalId(requestParam.getHospitalId()); |
95 | 98 | query.setParentId(archiveModel.getId()); |
96 | 99 | List<PremaritalCheckup> checkupList = premaritalCheckupService.queryPremaritalCheckup(query); |
97 | - if (CollectionUtils.isNotEmpty(checkupList)){ | |
100 | + if (CollectionUtils.isNotEmpty(checkupList)) { | |
98 | 101 | result = checkupList.get(0); |
102 | + //历史婚检记录 | |
103 | + for (PremaritalCheckup data : checkupList){ | |
104 | + PremaritalCheckupHistoryResult historyResult = new PremaritalCheckupHistoryResult(); | |
105 | + historyResult.setId(data.getId()); | |
106 | + historyResult.setPremaritalUpTime(data.getPremaritalUpTime()); | |
107 | + Organization org = organizationService.getOrganization(Integer.valueOf(data.getHospitalId())); | |
108 | + if (org!=null){ | |
109 | + historyResult.setPremaritalUpHospital(org.getName()); | |
110 | + historyResult.setHospitalId(data.getHospitalId()); | |
111 | + } | |
112 | + resultMap.put("premaritalCheckupHistory",historyResult); | |
113 | + } | |
99 | 114 | } |
100 | 115 | } |
101 | 116 | } |
102 | - archiveMap.put("certificateNum",archiveModel.getCertificateNum()); | |
103 | - archiveMap.put("certificateTypeId",archiveModel.getCertificateTypeId()); | |
104 | - archiveMap.put("username",archiveModel.getUsername()); | |
117 | + | |
118 | + archiveMap.put("certificateNum", archiveModel.getCertificateNum()); | |
119 | + archiveMap.put("certificateTypeId", archiveModel.getCertificateTypeId()); | |
120 | + archiveMap.put("username", archiveModel.getUsername()); | |
105 | 121 | archiveMap.put("age", archiveModel.getAge()); |
106 | - archiveMap.put("sex",archiveModel.getSex()); | |
107 | - archiveMap.put("birthday",getBirthday(archiveModel.getBirthday())); | |
108 | - archiveMap.put("phone",archiveModel.getPhone()); | |
109 | - archiveMap.put("residence", CommonsHelper.getResidence(archiveModel.getProvinceId(),archiveModel.getCityId(), | |
110 | - archiveModel.getAreaId(),archiveModel.getStreetId(),archiveModel.getAddress(),basicConfigService)); | |
111 | - archiveMap.put("workUnit",archiveModel.getWorkUnit()); | |
122 | + archiveMap.put("sex", archiveModel.getSex()); | |
123 | + archiveMap.put("birthday", getBirthday(archiveModel.getBirthday())); | |
124 | + archiveMap.put("phone", archiveModel.getPhone()); | |
125 | + archiveMap.put("residence", CommonsHelper.getResidence(archiveModel.getProvinceId(), archiveModel.getCityId(), | |
126 | + archiveModel.getAreaId(), archiveModel.getStreetId(), archiveModel.getAddress(), basicConfigService)); | |
127 | + archiveMap.put("workUnit", archiveModel.getWorkUnit()); | |
112 | 128 | |
113 | - resultMap.put("archiveResult",archiveMap); | |
114 | - resultMap.put("checkupResult",result); | |
129 | + resultMap.put("archiveResult", archiveMap); | |
130 | + resultMap.put("checkupResult", result); | |
115 | 131 | |
116 | 132 | BaseObjectResponse response = new BaseObjectResponse(); |
117 | 133 | response.setData(resultMap); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/PremaritalCheckupHistoryResult.java
View file @
85da9d8
1 | +package com.lyms.platform.operate.web.result; | |
2 | + | |
3 | +/** | |
4 | + * Created by Administrator on 2016/12/5 0005. | |
5 | + */ | |
6 | +public class PremaritalCheckupHistoryResult { | |
7 | + | |
8 | + //建档ID | |
9 | + private String id; | |
10 | + //建档时间 | |
11 | + private String premaritalUpTime; | |
12 | + //建档医院 | |
13 | + private String premaritalUpHospital; | |
14 | + //医院ID | |
15 | + private String hospitalId; | |
16 | + | |
17 | + public String getId() { | |
18 | + return id; | |
19 | + } | |
20 | + | |
21 | + public void setId(String id) { | |
22 | + this.id = id; | |
23 | + } | |
24 | + | |
25 | + public String getPremaritalUpHospital() { | |
26 | + return premaritalUpHospital; | |
27 | + } | |
28 | + | |
29 | + public void setPremaritalUpHospital(String premaritalUpHospital) { | |
30 | + this.premaritalUpHospital = premaritalUpHospital; | |
31 | + } | |
32 | + | |
33 | + public String getPremaritalUpTime() { | |
34 | + return premaritalUpTime; | |
35 | + } | |
36 | + | |
37 | + public void setPremaritalUpTime(String premaritalUpTime) { | |
38 | + this.premaritalUpTime = premaritalUpTime; | |
39 | + } | |
40 | + | |
41 | + public String getHospitalId() { | |
42 | + return hospitalId; | |
43 | + } | |
44 | + | |
45 | + public void setHospitalId(String hospitalId) { | |
46 | + this.hospitalId = hospitalId; | |
47 | + } | |
48 | +} |