Commit 5342965e93e10989847ea70137469e33e996d256

Authored by yangfei

Merge remote-tracking branch 'origin/master'

Showing 5 changed files

platform-operate-api/src/main/java/com/lyms/hospitalapi/Nczxyy/NczxyyLisService.java View file @ 5342965
... ... @@ -2,12 +2,20 @@
2 2  
3 3 import com.alibaba.fastjson.JSONObject;
4 4 import com.lyms.hospitalapi.pojo.*;
  5 +import com.lyms.platform.common.enums.RiskDefaultTypeEnum;
  6 +import com.lyms.platform.common.enums.YnEnums;
5 7 import com.lyms.platform.common.utils.DateUtil;
  8 +import com.lyms.platform.common.utils.ExceptionUtils;
  9 +import com.lyms.platform.operate.web.result.RiskReportResult;
6 10 import com.lyms.platform.operate.web.utils.HttpClientUtil;
  11 +import com.lyms.platform.pojo.BasicConfig;
  12 +import com.lyms.platform.query.PatientsQuery;
7 13 import org.springframework.stereotype.Service;
8 14  
  15 +import java.text.DecimalFormat;
9 16 import java.text.SimpleDateFormat;
10 17 import java.util.*;
  18 +import java.util.concurrent.*;
11 19  
12 20 /**
13 21 * Created by Administrator on 2017/5/17.
... ... @@ -15,6 +23,9 @@
15 23 @Service("nczxyyLisService")
16 24 public class NczxyyLisService {
17 25  
  26 +
  27 + private static ExecutorService pool = Executors.newFixedThreadPool(3);
  28 +
18 29 public List<CheckByDate> queryCheckListupdate(String cardNo,int ftype){
19 30  
20 31 if(1==ftype){
... ... @@ -221,7 +232,6 @@
221 232 }
222 233  
223 234 public static List<CheckResponse> queryLisCheckList(String cardNo){
224   - SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd ");
225 235 List<CheckResponse> result = new ArrayList<>();
226 236 Calendar c = Calendar.getInstance();
227 237 SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
... ... @@ -230,7 +240,7 @@
230 240 c.add(Calendar.YEAR, -1);
231 241 Date date = c.getTime();
232 242 String StartDate=df.format(date);
233   - String url="http://mihp.nc120.cn/PlatformService/platform/api";
  243 + final String url="http://mihp.nc120.cn/PlatformService/platform/api";
234 244 String js="{\"api_id\":\"800010\",\"EndDate\":\""+EndDate+"\",\"active_key\":\"LYMS\",\"StartDate\":\""+StartDate+"\",\"user_token\":\"LYMS\",\"operator_id\":\"YD_WX\",\"CardNo\":\""+cardNo+"\"}";
235 245 Map<String,Object> map1=new HashMap<String,Object>();
236 246 map1.put("result", HttpClientUtil.doPostHTTP(url, js));
237 247  
238 248  
239 249  
240 250  
241 251  
242 252  
... ... @@ -238,50 +248,126 @@
238 248 Nczxyy2 nczxyy2=null;
239 249 nczxyy2=(Nczxyy2)json.getObject("result", Nczxyy2.class);
240 250 if(nczxyy2.getList()!=null && !nczxyy2.getList().isEmpty()) {
241   - for (int i = 0; i < nczxyy2.getList().size(); i++) {
242   - String DetailId = nczxyy2.getList().get(i).getId();
243   - String Str = "{\"api_id\":\"800020\",\"active_key\":\"LYMS\",\"user_token\":\"LYMS\",\"operator_id\":\"YD_WX\",\"DetailId\":\"" + DetailId + "\"}";
244   - map1.put("result1", HttpClientUtil.doPostHTTP(url, Str));
245   - JSONObject json1 = new JSONObject(map1);
246   - NczxyyXQ2 nczxyyxq2 = null;
247   - nczxyyxq2 = (NczxyyXQ2) json1.getObject("result1", NczxyyXQ2.class);
248   - if (nczxyyxq2 != null) {
249   - try {
250   - CheckResponse CheckResponse = new CheckResponse();
251   - CheckResponse.setHospitalName("四川省南充市中心医院");
252   - CheckResponse.setName(nczxyyxq2.getData().get姓名());
253   - CheckResponse.setModified(formatter.parse(nczxyyxq2.getData().get报告时间()));
254   - CheckResponse.setType(1);
255   - CheckResponse.setDoctor(nczxyyxq2.getData().get申请医师());
256   - CheckResponse.setTitle(nczxyyxq2.getData().get申请项目());
257   - CheckResponse.setAge(nczxyyxq2.getData().get年龄());
258   - CheckResponse.setApplyDate(formatter.parse(nczxyyxq2.getData().get申请时间()));
259   - CheckResponse.setApplyDateStr(nczxyyxq2.getData().get申请时间());
260   - CheckResponse.setCheckDept(nczxyyxq2.getData().get科室());
261   - CheckResponse.setSex(nczxyyxq2.getData().get性别());
262   - List<CheckItemResponse> itemlist = new ArrayList<CheckItemResponse>();
263   - CheckResponse.setItemList(itemlist);
264   - for (int j = 0; j < nczxyyxq2.getData().getLisPatResults().size(); j++) {
265   - CheckItemResponse item = new CheckItemResponse();
266   - item.setName(nczxyyxq2.getData().getLisPatResults().get(j).get名称());
267   - item.setCode(nczxyyxq2.getData().getLisPatResults().get(j).get项目号());
268   - item.setRefer(nczxyyxq2.getData().getLisPatResults().get(j).get临界值());
269   - item.setResult(nczxyyxq2.getData().getLisPatResults().get(j).get检验值());
270   - item.setUnit(nczxyyxq2.getData().getLisPatResults().get(j).get单位());
271   - item.setSpecial(nczxyyxq2.getData().getLisPatResults().get(j).get结论());
272   - itemlist.add(item);
  251 + int batchSize = 1;
  252 + int end = 0;
  253 + List<Future> futures = new ArrayList<>();
  254 + for (int i = 0; i < nczxyy2.getList().size(); i += batchSize) {
  255 + end = (end + batchSize);
  256 + if (end > nczxyy2.getList().size()) {
  257 + end = nczxyy2.getList().size();
  258 + }
  259 + final List<Nczxyy1> lises = nczxyy2.getList().subList(i, end);
  260 + Callable callable = new Callable() {
  261 + @Override
  262 + public List<CheckResponse> call() throws Exception {
  263 + List<CheckResponse> result = new ArrayList<>();
  264 + for (Nczxyy1 nc : lises) {
  265 +
  266 + Map<String,Object> map1=new HashMap<String,Object>();
  267 + String DetailId = nc.getId();
  268 + String Str = "{\"api_id\":\"800020\",\"active_key\":\"LYMS\",\"user_token\":\"LYMS\",\"operator_id\":\"YD_WX\",\"DetailId\":\"" + DetailId + "\"}";
  269 + map1.put("result1", HttpClientUtil.doPostHTTP(url, Str));
  270 + JSONObject json1 = new JSONObject(map1);
  271 + NczxyyXQ2 nczxyyxq2 = null;
  272 + nczxyyxq2 = (NczxyyXQ2) json1.getObject("result1", NczxyyXQ2.class);
  273 + if (nczxyyxq2 != null) {
  274 + try {
  275 + CheckResponse CheckResponse = new CheckResponse();
  276 + CheckResponse.setHospitalName("四川省南充市中心医院");
  277 + CheckResponse.setName(nczxyyxq2.getData().get姓名());
  278 + CheckResponse.setModified(DateUtil.parseYMD(nczxyyxq2.getData().get报告时间()));
  279 + CheckResponse.setType(1);
  280 + CheckResponse.setDoctor(nczxyyxq2.getData().get申请医师());
  281 + CheckResponse.setTitle(nczxyyxq2.getData().get申请项目());
  282 + CheckResponse.setAge(nczxyyxq2.getData().get年龄());
  283 + CheckResponse.setApplyDate(DateUtil.parseYMD(nczxyyxq2.getData().get申请时间()));
  284 + CheckResponse.setApplyDateStr(nczxyyxq2.getData().get申请时间());
  285 + CheckResponse.setCheckDept(nczxyyxq2.getData().get科室());
  286 + CheckResponse.setSex(nczxyyxq2.getData().get性别());
  287 + List<CheckItemResponse> itemlist = new ArrayList<CheckItemResponse>();
  288 + CheckResponse.setItemList(itemlist);
  289 + for (int j = 0; j < nczxyyxq2.getData().getLisPatResults().size(); j++) {
  290 + CheckItemResponse item = new CheckItemResponse();
  291 + item.setName(nczxyyxq2.getData().getLisPatResults().get(j).get名称());
  292 + item.setCode(nczxyyxq2.getData().getLisPatResults().get(j).get项目号());
  293 + item.setRefer(nczxyyxq2.getData().getLisPatResults().get(j).get临界值());
  294 + item.setResult(nczxyyxq2.getData().getLisPatResults().get(j).get检验值());
  295 + item.setUnit(nczxyyxq2.getData().getLisPatResults().get(j).get单位());
  296 + item.setSpecial(nczxyyxq2.getData().getLisPatResults().get(j).get结论());
  297 + itemlist.add(item);
  298 + }
  299 + result.add(CheckResponse);
  300 + } catch (Exception e) {
  301 + e.printStackTrace();
  302 + }
  303 + }
  304 +
273 305 }
274   - result.add(CheckResponse);
275   - } catch (Exception e) {
276   - e.printStackTrace();
277   - }
278 306  
  307 + return result;
  308 + }
  309 + };
  310 + Future f = pool.submit(callable);
  311 + futures.add(f);
  312 + }
  313 + for (Future f : futures) {
  314 + try {
  315 + result.addAll((List) f.get(30, TimeUnit.SECONDS));
  316 + } catch (Exception e) {
  317 + ExceptionUtils.catchException(e, "queryLisCheckList nc lis.");
279 318 }
280   -
281 319 }
  320 +
282 321 }
  322 +// for (int i = 0; i < nczxyy2.getList().size(); i++) {
  323 +// String DetailId = nczxyy2.getList().get(i).getId();
  324 +// String Str = "{\"api_id\":\"800020\",\"active_key\":\"LYMS\",\"user_token\":\"LYMS\",\"operator_id\":\"YD_WX\",\"DetailId\":\"" + DetailId + "\"}";
  325 +// map1.put("result1", HttpClientUtil.doPostHTTP(url, Str));
  326 +// JSONObject json1 = new JSONObject(map1);
  327 +// NczxyyXQ2 nczxyyxq2 = null;
  328 +// nczxyyxq2 = (NczxyyXQ2) json1.getObject("result1", NczxyyXQ2.class);
  329 +// if (nczxyyxq2 != null) {
  330 +// try {
  331 +// CheckResponse CheckResponse = new CheckResponse();
  332 +// CheckResponse.setHospitalName("四川省南充市中心医院");
  333 +// CheckResponse.setName(nczxyyxq2.getData().get姓名());
  334 +// CheckResponse.setModified(formatter.parse(nczxyyxq2.getData().get报告时间()));
  335 +// CheckResponse.setType(1);
  336 +// CheckResponse.setDoctor(nczxyyxq2.getData().get申请医师());
  337 +// CheckResponse.setTitle(nczxyyxq2.getData().get申请项目());
  338 +// CheckResponse.setAge(nczxyyxq2.getData().get年龄());
  339 +// CheckResponse.setApplyDate(formatter.parse(nczxyyxq2.getData().get申请时间()));
  340 +// CheckResponse.setApplyDateStr(nczxyyxq2.getData().get申请时间());
  341 +// CheckResponse.setCheckDept(nczxyyxq2.getData().get科室());
  342 +// CheckResponse.setSex(nczxyyxq2.getData().get性别());
  343 +// List<CheckItemResponse> itemlist = new ArrayList<CheckItemResponse>();
  344 +// CheckResponse.setItemList(itemlist);
  345 +// for (int j = 0; j < nczxyyxq2.getData().getLisPatResults().size(); j++) {
  346 +// CheckItemResponse item = new CheckItemResponse();
  347 +// item.setName(nczxyyxq2.getData().getLisPatResults().get(j).get名称());
  348 +// item.setCode(nczxyyxq2.getData().getLisPatResults().get(j).get项目号());
  349 +// item.setRefer(nczxyyxq2.getData().getLisPatResults().get(j).get临界值());
  350 +// item.setResult(nczxyyxq2.getData().getLisPatResults().get(j).get检验值());
  351 +// item.setUnit(nczxyyxq2.getData().getLisPatResults().get(j).get单位());
  352 +// item.setSpecial(nczxyyxq2.getData().getLisPatResults().get(j).get结论());
  353 +// itemlist.add(item);
  354 +// }
  355 +// result.add(CheckResponse);
  356 +// } catch (Exception e) {
  357 +// e.printStackTrace();
  358 +// }
  359 +//
  360 +// }
  361 +//
  362 +// }
283 363  
284 364 return result;
  365 + }
  366 +
  367 + public static void main(String[] args)
  368 + {
  369 + List<CheckResponse> list = queryLisCheckList("1002332625");
  370 + System.out.println(list.size());
285 371 }
286 372 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 5342965
... ... @@ -1109,7 +1109,7 @@
1109 1109 Date currentDate = DateUtil.formatDate(new Date());
1110 1110  
1111 1111  
1112   - if ((date.getTime() <= currentDate.getTime() || patients.getBuildType() == 2) || patients.getType() == 3 && patients.getFmDate() != null) {
  1112 + if ((date.getTime() <= currentDate.getTime() || patients.getBuildType() == 2||(patients.getIsAutoFm()!=null&& patients.getIsAutoFm() == 1)) || patients.getType() == 3 && patients.getFmDate() != null) {
1113 1113 //建档记录
1114 1114 if (null != patients.getHospitalId()) {
1115 1115 organization = organizationService.getOrganization(Integer.valueOf(patients.getHospitalId()));
... ... @@ -1170,8 +1170,7 @@
1170 1170 }
1171 1171 }
1172 1172  
1173   -
1174   - if (null != map) {
  1173 + /*if (null != map) {
1175 1174 Object obj = map.get(listDate.get(i).getId());
1176 1175 if (obj instanceof MaternalDeliverModel) {
1177 1176 MaternalDeliverModel model = (MaternalDeliverModel) obj;
... ... @@ -1180,6 +1179,29 @@
1180 1179 }
1181 1180  
1182 1181 listData.add(new AntData((MaternalDeliverModel) obj, patientses.get(0).getLastMenses(), null != organization ? organization.getName() : ""));
  1182 + }
  1183 + }*/
  1184 + if (null != map) {
  1185 + MatDeliverQuery matDeliverQuery = new MatDeliverQuery();
  1186 + matDeliverQuery.setYn(YnEnums.YES.getId());
  1187 + matDeliverQuery.setPid(pid);
  1188 + matDeliverQuery.setNeStart(true);
  1189 +// matDeliverQuery.setNeEnd(true);
  1190 + matDeliverQuery.setCreatedStart(dueDate);
  1191 + if (CollectionUtils.isNotEmpty(listDate)) {
  1192 + //下次建档记录前都是产后复查,如果没有下个产程的数据就直接显示
  1193 + if (listDate.size() > 1 && i > 1) {
  1194 + matDeliverQuery.setEndStart(listDate.get(i - 1).getDate());
  1195 + }
  1196 + }
  1197 + List<MaternalDeliverModel> l= matDeliverService.query(matDeliverQuery);
  1198 + if (CollectionUtils.isNotEmpty(l)) {
  1199 + MaternalDeliverModel model = l.get(0);
  1200 + if (null != model.getHospitalId()) {
  1201 + organization = organizationService.getOrganization(Integer.valueOf(model.getHospitalId()));
  1202 + }
  1203 +
  1204 + listData.add(new AntData((MaternalDeliverModel) model, patientses.get(0).getLastMenses(), null != organization ? organization.getName() : ""));
1183 1205 }
1184 1206 }
1185 1207  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java View file @ 5342965
... ... @@ -233,7 +233,7 @@
233 233 patientsService.updatePatient(patientsLocal);
234 234  
235 235 //修改分娩日期
236   - updatePatientFmDate(patients1.getPid(), fmDate, 1);
  236 + updatePatientFmDate(patients1.getPid(), fmDate, 1,patients1.getLastMenses());
237 237 //修改person表状态为产妇
238 238 if (StringUtils.isNotEmpty(patients1.getPid())) {
239 239 PersonModel personModel = new PersonModel();
... ... @@ -348,7 +348,7 @@
348 348 patientsService.updatePatient(patients1);
349 349  
350 350 //修改分娩日期
351   - updatePatientFmDate(patients.getPid(), fmDate, 3);
  351 + updatePatientFmDate(patients.getPid(), fmDate, 3,patients.getLastMenses());
352 352  
353 353 /** 填写分娩表分娩 >> 作废未使用的产检券 */
354 354 // remoteService.invalidCoupon(patients.getPid(), "2", RemoteUrlEnum.INVALID_COUPON_URL);
355 355  
... ... @@ -365,13 +365,15 @@
365 365 * @param pid
366 366 * @param fmDate
367 367 */
368   - private void updatePatientFmDate(String pid, Date fmDate, int type) {
  368 + private void updatePatientFmDate(String pid, Date fmDate, int type,Date lastMess) {
369 369 PatientsQuery patientsQuery = new PatientsQuery();
370 370 patientsQuery.setPid(pid);
371 371 patientsQuery.setYn(YnEnums.YES.getId());
372 372 patientsQuery.setType(type);
373 373 patientsQuery.setDueStatus(0);
374 374 patientsQuery.setBuildType(1);
  375 + patientsQuery.setLastMensesStart(lastMess);
  376 + patientsQuery.setLastMensesEnd(fmDate);
375 377 List<Patients> patientsList = patientsService.queryPatient(patientsQuery);
376 378 for (Patients patients : patientsList) {
377 379 //判断分娩日期是否大于24孕周
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SmsConfigFacade.java View file @ 5342965
... ... @@ -607,7 +607,7 @@
607 607 OrganizationQuery organizationQuery = new OrganizationQuery();
608 608  
609 609 organizationQuery.setYn(YnEnums.YES.getId());
610   - organizationQuery.setKeyword(hospitalName);
  610 + organizationQuery.setName(hospitalName);
611 611  
612 612 List<Organization> orgs = organizationService.queryHospitals(organizationQuery);
613 613 if (CollectionUtils.isNotEmpty(orgs))
... ... @@ -625,6 +625,15 @@
625 625 }
626 626 }
627 627 }
  628 + }
  629 + else
  630 + {
  631 + BaseListResponse objectResponse = new BaseListResponse();
  632 + objectResponse.setData(null);
  633 + objectResponse.setPageInfo(new PageInfo());
  634 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  635 + objectResponse.setErrormsg("成功");
  636 + return objectResponse;
628 637 }
629 638  
630 639 String planTimeStart = "";
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PostReviewServiceImpl.java View file @ 5342965
... ... @@ -45,7 +45,7 @@
45 45 @Override
46 46 public BaseObjectResponse postpartumReview(Integer userId, Date startDate, Date endDate, String doctorId, String key, Integer page, Integer limit) {
47 47 String hospitalId = autoMatchFacade.getHospitalId(userId);
48   - Query query = Query.query(Criteria.where("hospitalId").is(hospitalId).and("yn").is(1));
  48 + Query query = Query.query(Criteria.where("hospitalId").is(hospitalId).and("yn").ne("0"));
49 49 if(startDate != null && endDate != null) {
50 50 query.addCriteria(Criteria.where("checkTime").gte(startDate).lt(DateUtil.addDay(endDate, 1)));
51 51 }
... ... @@ -55,7 +55,7 @@
55 55  
56 56 if(StringUtils.isNotEmpty(key)) {
57 57 Criteria criteria = new Criteria();
58   - criteria.orOperator(Criteria.where("username").regex(key), Criteria.where("cardNo").is(key), Criteria.where("phone").is(key));
  58 + criteria.orOperator(Criteria.where("username").regex(key), Criteria.where("cardNo").is(key), Criteria.where("phone").is(key).and("yn").ne("0"));
59 59 List<Patients> patients = mongoUtil.findField(Patients.class, criteria, "id");
60 60 if(CollectionUtils.isEmpty(patients)) {
61 61 return RespBuilder.buildSuccess(new PageResult(0, page, limit, null));