Commit e802064ec88bf6f6ef9fbf8e8d1eb9bec50d8691
1 parent
30d6ec578a
Exists in
master
and in
6 other branches
民生工程数据接口-妇女档案-C101
Showing 2 changed files with 342 additions and 0 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/LivelihoodProjectsController.java
View file @
e802064
1 | +package com.lyms.platform.operate.web.controller; | |
2 | + | |
3 | +import com.lyms.platform.biz.service.AntenatalExaminationService; | |
4 | +import com.lyms.platform.biz.service.BasicConfigService; | |
5 | +import com.lyms.platform.biz.service.CommonService; | |
6 | +import com.lyms.platform.biz.service.PatientsService; | |
7 | +import com.lyms.platform.common.annotation.TokenRequired; | |
8 | +import com.lyms.platform.common.base.BaseController; | |
9 | +import com.lyms.platform.common.base.LoginContext; | |
10 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
11 | +import com.lyms.platform.common.result.BaseListResponse; | |
12 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
13 | +import com.lyms.platform.common.result.BaseResponse; | |
14 | +import com.lyms.platform.common.utils.BeanUtils; | |
15 | +import com.lyms.platform.common.utils.ExcelUtil; | |
16 | +import com.lyms.platform.common.utils.ExceptionUtils; | |
17 | +import com.lyms.platform.common.utils.JsonUtil; | |
18 | +import com.lyms.platform.operate.web.facade.AntenatalExaminationFacade; | |
19 | +import com.lyms.platform.operate.web.facade.AutoMatchFacade; | |
20 | +import com.lyms.platform.operate.web.facade.LivelihoodProjectsFacade; | |
21 | +import com.lyms.platform.operate.web.facade.MatDeliverFacade; | |
22 | +import com.lyms.platform.operate.web.request.*; | |
23 | +import com.lyms.platform.operate.web.result.*; | |
24 | +import com.lyms.platform.operate.web.utils.CollectionUtils; | |
25 | +import com.lyms.platform.operate.web.utils.CommonsHelper; | |
26 | +import com.lyms.platform.permission.model.Organization; | |
27 | +import com.lyms.platform.permission.service.CouponService; | |
28 | +import com.lyms.platform.permission.service.OrganizationService; | |
29 | +import com.lyms.platform.pojo.Patients; | |
30 | +import org.apache.commons.lang.StringUtils; | |
31 | +import org.springframework.beans.factory.annotation.Autowired; | |
32 | +import org.springframework.stereotype.Controller; | |
33 | +import org.springframework.web.bind.annotation.*; | |
34 | + | |
35 | +import javax.servlet.http.HttpServletRequest; | |
36 | +import javax.servlet.http.HttpServletResponse; | |
37 | +import javax.validation.Valid; | |
38 | +import java.util.*; | |
39 | + | |
40 | +/** | |
41 | + * 民生工程数据接口 | |
42 | + * <p> | |
43 | + * Created by shy on 2022/6/6 | |
44 | + */ | |
45 | +@Controller | |
46 | +@RequestMapping("/live") | |
47 | +public class LivelihoodProjectsController extends BaseController { | |
48 | + | |
49 | + @Autowired | |
50 | + private LivelihoodProjectsFacade livelihoodProjectsFacade; | |
51 | + | |
52 | + | |
53 | + /** | |
54 | + * 妇女档案-C101 | |
55 | + * @param startDate | |
56 | + * @param endDate | |
57 | + * @return | |
58 | + */ | |
59 | + @RequestMapping(value = "/getMsgcC101", method = RequestMethod.GET) | |
60 | + @ResponseBody | |
61 | + public BaseObjectResponse getMsgcC101(@RequestParam(required = false) String startDate, | |
62 | + @RequestParam(required = false) String endDate) { | |
63 | + return livelihoodProjectsFacade.getMsgcC101(startDate,endDate); | |
64 | + } | |
65 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/LivelihoodProjectsFacade.java
View file @
e802064
1 | +package com.lyms.platform.operate.web.facade; | |
2 | + | |
3 | +import com.lyms.hospitalapi.lhxfy.model.enums.NationEnums; | |
4 | +import com.lyms.platform.biz.service.BasicConfigService; | |
5 | +import com.lyms.platform.biz.service.ResidentsArchiveService; | |
6 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
7 | +import com.lyms.platform.common.enums.CdGwNationEnums; | |
8 | +import com.lyms.platform.common.enums.YnEnums; | |
9 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
10 | +import com.lyms.platform.common.utils.DateUtil; | |
11 | +import com.lyms.platform.common.utils.SystemConfig; | |
12 | +import com.lyms.platform.operate.web.result.BasicConfigResult; | |
13 | +import com.lyms.platform.operate.web.utils.CommonsHelper; | |
14 | +import com.lyms.platform.permission.model.Users; | |
15 | +import com.lyms.platform.permission.service.OrganizationService; | |
16 | +import com.lyms.platform.permission.service.UsersService; | |
17 | +import com.lyms.platform.pojo.BasicConfig; | |
18 | +import com.lyms.platform.pojo.MaternalDeliverModel; | |
19 | +import com.lyms.platform.pojo.ResidentsArchiveModel; | |
20 | +import com.lyms.platform.query.ResidentsArchiveQuery; | |
21 | +import org.apache.commons.lang.StringUtils; | |
22 | +import org.slf4j.Logger; | |
23 | +import org.slf4j.LoggerFactory; | |
24 | +import org.springframework.beans.factory.annotation.Autowired; | |
25 | +import org.springframework.data.mongodb.core.query.Criteria; | |
26 | +import org.springframework.data.mongodb.core.query.Query; | |
27 | +import org.springframework.stereotype.Component; | |
28 | + | |
29 | +import java.util.*; | |
30 | + | |
31 | +/** | |
32 | + * 分娩记录信息 | |
33 | + * <p> | |
34 | + * Created by Administrator on 2016/6/17 0017. | |
35 | + */ | |
36 | +@Component | |
37 | +public class LivelihoodProjectsFacade { | |
38 | + | |
39 | + private Logger logger = LoggerFactory.getLogger(LivelihoodProjectsFacade.class); | |
40 | + @Autowired | |
41 | + private ResidentsArchiveService residentsArchiveService; | |
42 | + @Autowired | |
43 | + private BasicConfigService basicConfigService; | |
44 | + @Autowired | |
45 | + private UsersService usersService; | |
46 | + @Autowired | |
47 | + private OrganizationService organizationService; | |
48 | + | |
49 | + | |
50 | + public BaseObjectResponse getMsgcC101(String startDate, String endDate) { | |
51 | + //查询条件 | |
52 | + ResidentsArchiveQuery query = new ResidentsArchiveQuery(); | |
53 | + query.setYn(YnEnums.YES.getId()); | |
54 | + if (StringUtils.isNotEmpty(startDate) && StringUtils.isNotEmpty(endDate)) { | |
55 | + query.setBuildDateStart(DateUtil.getDayFirstSecond(DateUtil.parseYMD(startDate))); | |
56 | + query.setBuildDateEnd(DateUtil.getDayLastSecond(DateUtil.parseYMD(endDate))); | |
57 | + } | |
58 | + //只查询女性 | |
59 | + query.setSex(SystemConfig.WOMAN_ID); | |
60 | + | |
61 | + List<ResidentsArchiveModel> modelList = residentsArchiveService.queryResident(query); | |
62 | + List<Map> data = new ArrayList<>(); | |
63 | + for (ResidentsArchiveModel model : modelList) { | |
64 | + Map<String, Object> map = new HashMap<>(); | |
65 | + //档案编号 | |
66 | + map.put("file_number",""); | |
67 | + //纸质档案编号 | |
68 | + map.put("file_number_paper",""); | |
69 | + //证件类型(lyms_basicconfig表中查"parentId": "c914bb2e-1825-4036-8a41-fe617c90d405") | |
70 | + Integer credentials_type_code=99; | |
71 | + if(StringUtils.isNotEmpty(model.getCertificateTypeId())){ | |
72 | + switch (model.getCertificateTypeId()){ | |
73 | + case "70ae1d93-2964-46bc-83fa-bec9ff605b1c": | |
74 | + //身份证 | |
75 | + credentials_type_code=1; | |
76 | + break; | |
77 | + case "5797135b0cf2dd415ca09fe1": | |
78 | + //护照 | |
79 | + credentials_type_code=3; | |
80 | + break; | |
81 | + case "efa9ede5-bd40-42bb-8966-a0bf4c20d8fb": | |
82 | + //军官证 | |
83 | + credentials_type_code=1; | |
84 | + break; | |
85 | + } | |
86 | + } | |
87 | + map.put("credentials_type_code",credentials_type_code); | |
88 | + //其他身份证件名称 | |
89 | + map.put("other_credentials_type",""); | |
90 | + //证件号码 | |
91 | + map.put("credentials_number",StringUtils.isNotEmpty(model.getCertificateNum())?model.getCertificateNum():""); | |
92 | + //出生日期 | |
93 | + map.put("birthday",null!=model.getBirthday()?model.getBirthday():""); | |
94 | + //姓名 | |
95 | + map.put("name",StringUtils.isNotEmpty(model.getUsername())?model.getUsername():""); | |
96 | + //姓名简拼 | |
97 | + map.put("en_name",""); | |
98 | + //所属民族 | |
99 | + String nation_code= CdGwNationEnums.getId(getBasicConfig(model.getNationId())); | |
100 | + map.put("nation_code",StringUtils.isNotEmpty(nation_code)?Integer.parseInt(nation_code):99); | |
101 | + //性别 | |
102 | + map.put("gender_code",2); | |
103 | + //工作单位 | |
104 | + map.put("work_unit",StringUtils.isNotEmpty(model.getWorkUnit())?model.getWorkUnit():""); | |
105 | + //固定电话 | |
106 | + map.put("tel",""); | |
107 | + //手机号 | |
108 | + map.put("phone",StringUtils.isNotEmpty(model.getPhone())?model.getPhone():""); | |
109 | + //联系人姓名 | |
110 | + map.put("contact_name",""); | |
111 | + //联系人电话 | |
112 | + map.put("contact_phone",""); | |
113 | + //是否常驻 | |
114 | + map.put("is_permanent_code",null); | |
115 | + //流动情况 | |
116 | + map.put("permanent_type_code",null); | |
117 | + | |
118 | + //户籍类型(lyms_basicconfig表中查"parentId": "57624ba30cf23d4631523e9d") | |
119 | + Integer address_type_code=1; | |
120 | + if(StringUtils.isNotEmpty(model.getCensusTypeId())){ | |
121 | + switch (model.getCensusTypeId()){ | |
122 | + case "57624bf90cf23d4631523e9e": | |
123 | + //非农业户口 | |
124 | + address_type_code=2; | |
125 | + break; | |
126 | + case "57624c090cf23d4631523e9f": | |
127 | + //农业户口 | |
128 | + address_type_code=1; | |
129 | + break; | |
130 | + } | |
131 | + } | |
132 | + map.put("census_register_type_code",address_type_code); | |
133 | + //居住类型 | |
134 | + map.put("address_type_code",null); | |
135 | + //户籍区划编码 | |
136 | + map.put("residence_district_id",""); | |
137 | + //户籍地址区划详情 | |
138 | + map.put("residence_district_detail",""); | |
139 | + //户籍地址 | |
140 | + map.put("residence_address",""); | |
141 | + //身份证住址 | |
142 | + map.put("id_card_address",""); | |
143 | + //年龄 | |
144 | + map.put("age",null!=model.getAge()?model.getAge():0); | |
145 | + //身高(cm)?????? | |
146 | + map.put("height",""); | |
147 | + //血型 | |
148 | + map.put("blood_type_code",null); | |
149 | + //RH阴性 | |
150 | + map.put("blood_type_rh_code",null); | |
151 | + //文化程度(lyms_basicconfig表中查"parentId": "8046934b-ebe8-4037-98b6-a9ec47996700") | |
152 | + Integer edu_attainment_code=10; | |
153 | + if(StringUtils.isNotEmpty(model.getLevelTypeId())){ | |
154 | + switch (model.getLevelTypeId()){ | |
155 | + case "b819b01b-fc48-4ce7-b623-c2a3b56ffc91": | |
156 | + //研究生(博士后) | |
157 | + edu_attainment_code=1; | |
158 | + break; | |
159 | + case "15555f3c-4f11-4473-b289-ba20b2e37161": | |
160 | + //研究生(博士) | |
161 | + edu_attainment_code=1; | |
162 | + break; | |
163 | + case "c88bb1f0-9a75-4ad4-9ac8-0b04fa2701c7": | |
164 | + //研究生(硕士) | |
165 | + edu_attainment_code=1; | |
166 | + break; | |
167 | + case "11b87441-c63c-419b-b2d0-d968a002f4ce": | |
168 | + //大学本科 | |
169 | + edu_attainment_code=2; | |
170 | + break; | |
171 | + case "7e49120b-ec92-44c4-b77c-5fb151a7bdd4": | |
172 | + //大学专科和专科学校 | |
173 | + edu_attainment_code=3; | |
174 | + break; | |
175 | + case "ec0fd0b3-f404-4c50-887f-28baa31b3870": | |
176 | + //中等专业学校 | |
177 | + edu_attainment_code=4; | |
178 | + break; | |
179 | + case "6c95f456-3e9e-45f4-bdef-04fd0ce4daf7": | |
180 | + //技工学校 | |
181 | + edu_attainment_code=5; | |
182 | + break; | |
183 | + case "baa86f20-535a-4874-b09d-9f5ae8d89a5d": | |
184 | + //高中 | |
185 | + edu_attainment_code=6; | |
186 | + break; | |
187 | + case "7a8f2edf-ef69-494f-95a3-c98149c35978": | |
188 | + //初中 | |
189 | + edu_attainment_code=7; | |
190 | + break; | |
191 | + case "4250cdba-2d25-41ef-acf8-ebbde48156b2": | |
192 | + //小学 | |
193 | + edu_attainment_code=8; | |
194 | + break; | |
195 | + case "b4157251-2fbc-4d70-b32f-d78e1b4f9251": | |
196 | + //文盲或半文盲 | |
197 | + edu_attainment_code=9; | |
198 | + break; | |
199 | + } | |
200 | + } | |
201 | + map.put("edu_attainment_code",edu_attainment_code); | |
202 | + //职业 | |
203 | + map.put("profession_code",null); | |
204 | + //婚姻状况(lyms_basicconfig表中查"parentId": "0ab3e86b-dfdb-47eb-a58b-a2f2d978b69f") | |
205 | + Integer marital_status_code=5; | |
206 | + if(StringUtils.isNotEmpty(model.getMarriageId())){ | |
207 | + switch (model.getMarriageId()){ | |
208 | + case "d049eaaa-7265-4cdb-879f-992ab6320a3a": | |
209 | + //未婚 | |
210 | + marital_status_code=1; | |
211 | + break; | |
212 | + case "d75d1902-61a5-4a17-a68a-5b8a9826537b": | |
213 | + //已婚 | |
214 | + marital_status_code=2; | |
215 | + break; | |
216 | + } | |
217 | + } | |
218 | + map.put("marital_status_code",marital_status_code); | |
219 | + //责任医生 | |
220 | + map.put("doctor_name",""); | |
221 | + //建档人 | |
222 | + String create_doctor=""; | |
223 | + if(StringUtils.isNotEmpty(model.getBuildDoctor())) { | |
224 | + Users user = usersService.getUsers(Integer.parseInt(model.getBuildDoctor())); | |
225 | + if (null!=user && StringUtils.isNotEmpty(user.getName())) { | |
226 | + create_doctor=user.getName(); | |
227 | + } | |
228 | + } | |
229 | + map.put("create_doctor",create_doctor); | |
230 | + | |
231 | + map.put("this_date",null!=model.getBuildDay()?model.getBuildDay():null); | |
232 | + //出生人口编码 | |
233 | + map.put("childbirth_code",""); | |
234 | + //是否孕妇 | |
235 | + map.put("is_gravida",null); | |
236 | + //是否产妇 | |
237 | + map.put("is_puerpera",null); | |
238 | + //系统录入时间 | |
239 | + map.put("entering_time",null!=model.getCreated()?model.getCreated():new Date()); | |
240 | + //所属机构编码 | |
241 | + String organ_id=""; | |
242 | + if(StringUtils.isNotEmpty(model.getHospitalId())){ | |
243 | + organ_id =organizationService.getPlatHosNewCode(model.getHospitalId()); | |
244 | + } | |
245 | + map.put("organ_id",organ_id); | |
246 | + //现住址国家区划编码(现住址国家区划编码(村/居委会)??????? | |
247 | + map.put("district_nation_code",""); | |
248 | + //母亲姓名简拼 | |
249 | + map.put("mother_en_name",""); | |
250 | + //数据上传时间 | |
251 | +// map.put("import_time",""); | |
252 | + //修改时间 | |
253 | +// map.put("last_modified_time",""); | |
254 | + //删除状态,0正常,1删除 | |
255 | + map.put("is_deleted",null!=model.getYn()?(model.getYn()==1?0:1):1); | |
256 | + map.put("deleted_time",null); | |
257 | + data.add(map); | |
258 | + } | |
259 | + | |
260 | + BaseObjectResponse objectResponse = new BaseObjectResponse(); | |
261 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
262 | + objectResponse.setErrormsg("成功"); | |
263 | + objectResponse.setData(data); | |
264 | + return objectResponse; | |
265 | + } | |
266 | + | |
267 | + private String getBasicConfig(String id) { | |
268 | + if (com.lyms.platform.common.utils.StringUtils.isEmpty(id)) { | |
269 | + return ""; | |
270 | + } | |
271 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(id); | |
272 | + if (null != basicConfig) { | |
273 | + return basicConfig.getName(); | |
274 | + } | |
275 | + return ""; | |
276 | + } | |
277 | +} |