Commit ee398561cfb05e1ef95766a945ae0291c82d3e5d
1 parent
6b03da1d69
Exists in
master
and in
1 other branch
调用华大接口
Showing 1 changed file with 131 additions and 4 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ApplyOrderFacade.java
View file @
ee39856
... | ... | @@ -7,13 +7,18 @@ |
7 | 7 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
8 | 8 | import com.lyms.platform.common.enums.*; |
9 | 9 | import com.lyms.platform.common.exception.BusinessException; |
10 | -import com.lyms.platform.common.result.*; | |
10 | +import com.lyms.platform.common.result.BaseListResponse; | |
11 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
12 | +import com.lyms.platform.common.result.BaseResponse; | |
11 | 13 | import com.lyms.platform.common.utils.*; |
12 | 14 | import com.lyms.platform.operate.web.request.*; |
13 | 15 | import com.lyms.platform.operate.web.result.*; |
14 | 16 | import com.lyms.platform.operate.web.utils.CommonsHelper; |
15 | 17 | import com.lyms.platform.operate.web.utils.FunvCommonUtil; |
16 | -import com.lyms.platform.permission.model.*; | |
18 | +import com.lyms.platform.permission.model.Organization; | |
19 | +import com.lyms.platform.permission.model.OrganizationQuery; | |
20 | +import com.lyms.platform.permission.model.PatientService; | |
21 | +import com.lyms.platform.permission.model.Users; | |
17 | 22 | import com.lyms.platform.permission.service.CouponService; |
18 | 23 | import com.lyms.platform.permission.service.OrganizationService; |
19 | 24 | import com.lyms.platform.permission.service.UsersService; |
... | ... | @@ -22,7 +27,8 @@ |
22 | 27 | import org.apache.commons.collections.CollectionUtils; |
23 | 28 | import org.apache.commons.lang.StringUtils; |
24 | 29 | import org.apache.commons.lang.math.NumberUtils; |
25 | -import org.apache.http.HttpResponse; | |
30 | +import org.slf4j.Logger; | |
31 | +import org.slf4j.LoggerFactory; | |
26 | 32 | import org.springframework.beans.factory.annotation.Autowired; |
27 | 33 | import org.springframework.data.mongodb.core.MongoTemplate; |
28 | 34 | import org.springframework.data.mongodb.core.query.Criteria; |
... | ... | @@ -31,7 +37,6 @@ |
31 | 37 | import org.springframework.stereotype.Component; |
32 | 38 | |
33 | 39 | import javax.servlet.ServletOutputStream; |
34 | -import javax.servlet.http.HttpServletRequest; | |
35 | 40 | import javax.servlet.http.HttpServletResponse; |
36 | 41 | import java.io.*; |
37 | 42 | import java.text.SimpleDateFormat; |
... | ... | @@ -47,6 +52,7 @@ |
47 | 52 | public static final String HUADA_URL = PropertiesUtils.getPropertyValue("huada_url"); |
48 | 53 | public static final String SYSCODE = PropertiesUtils.getPropertyValue("huada_syscode"); |
49 | 54 | public static final String SECRET = PropertiesUtils.getPropertyValue("huada_secret"); |
55 | + public static final String HIS_VERSION = PropertiesUtils.getPropertyValue("his_version"); | |
50 | 56 | |
51 | 57 | @Autowired |
52 | 58 | private ApplyOrderService applyOrderService; |
... | ... | @@ -86,6 +92,8 @@ |
86 | 92 | @Autowired |
87 | 93 | private MongoTemplate mongoTemplate; |
88 | 94 | |
95 | + Logger logger = LoggerFactory.getLogger(ApplyOrderFacade.class); | |
96 | + | |
89 | 97 | //添加回执单 |
90 | 98 | public BaseResponse addReferralReceipt(ReferralReceiptRequest referralReceipt) { |
91 | 99 | ReferralApplyOrderModel referralApplyOrderModel = new ReferralApplyOrderModel(); |
92 | 100 | |
93 | 101 | |
... | ... | @@ -506,10 +514,129 @@ |
506 | 514 | sieveService.updateOneChanQianDiaSieve(sieveModel); |
507 | 515 | operateLogFacade.addModifyOptLog(userId, Integer.parseInt(hospitalId), sieveModels.get(0), sieveModel, OptActionEnums.UPDATE.getId(), "增加产前筛查"); |
508 | 516 | } |
517 | + // 调用华大接口 | |
518 | + callHuaDa(sieveApplyOrderModel, hospitalId); | |
509 | 519 | } else { |
510 | 520 | return new BaseResponse().setErrorcode(ErrorCodeConstants.DATA_EXIST).setErrormsg("已申请过产筛"); |
511 | 521 | } |
522 | + | |
523 | + | |
524 | + | |
512 | 525 | return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
526 | + } | |
527 | + | |
528 | + /** | |
529 | + * 调用华大接口 | |
530 | + * | |
531 | + * @param sieveApplyOrderModel | |
532 | + * @param hospitalId | |
533 | + */ | |
534 | + private void callHuaDa(SieveApplyOrderModel sieveApplyOrderModel, String hospitalId) { | |
535 | + try{ | |
536 | + String sieveType = sieveApplyOrderModel.getSieveType(); | |
537 | + if ("6".equals(HIS_VERSION)) { | |
538 | + if (StringUtils.isNotEmpty(sieveType) && "2".equals(sieveType)) { | |
539 | + final String productCode = "DX1331"; | |
540 | + HuadaSieveApplyOrderAddRequest request = new HuadaSieveApplyOrderAddRequest(); | |
541 | + // 产品编号 | |
542 | + request.setProductCode(productCode); | |
543 | + // 客户编号 | |
544 | + Organization organization = organizationService.getOrganization(Integer.parseInt(hospitalId)); | |
545 | + String shortCode = organization.getShortCode(); | |
546 | + request.setCustomerCode(shortCode); | |
547 | + // 孕妇姓名 | |
548 | + Patients patients = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(sieveApplyOrderModel.getParentId())), Patients.class); | |
549 | + String username = patients.getUsername(); | |
550 | + request.setSampleName(username); | |
551 | + // 样品编号(如果是正常双胎的情况:样本编号后要加+D;如果是减胎的情况:样本编号后要加+V;如果是重抽血的情况:样本编号后要加+R;) | |
552 | + request.setSampleNum(sieveApplyOrderModel.getNumber()); | |
553 | + // 采样日期 | |
554 | + request.setBloodDate(DateUtil.getYmd(sieveApplyOrderModel.getCollectionDate())); | |
555 | + // 送检单唯一标识 | |
556 | + request.setExtBaseInfoId(sieveApplyOrderModel.getId()); | |
557 | + // 样品管类型 STRECK:STRECK | |
558 | + // EDTA:EDTA | |
559 | + // K牌采血管:K牌采血管 | |
560 | + // G牌采血管:G牌采血管 | |
561 | + request.setTubeType(sieveApplyOrderModel.getYpglx()); | |
562 | + // 孕周(格式:18w+1)注:“w”必须小写,“+”号后面的天数必须是0~6 | |
563 | + request.setGestationalWeeks(sieveApplyOrderModel.getYunSize()); | |
564 | + // 证件类型(01:身份证、02:护照) | |
565 | + request.setZidcardType("01"); | |
566 | + // 孕妇联系电话 | |
567 | + request.setMotherPhoneNum(patients.getPhone()); | |
568 | + // 收费类型(样本用途)(工作量,只有收费、免费) | |
569 | + // | |
570 | + //{ | |
571 | + //1:科研收费 | |
572 | + // 2:科研免费 | |
573 | + // 3:临床收费 | |
574 | + // 4:临床免费 | |
575 | + // 咱们页面可以支持医生填写免费和收费,并且能统计。最终给华大传数据,所有用户默认成【临床收费】 | |
576 | + // | |
577 | + // 后台固定传参:3 | |
578 | + request.setChargeType("3"); | |
579 | + // 孕妇年龄 | |
580 | + request.setAge(DateUtil.getAge(patients.getBirth()).toString()); | |
581 | + // 末次月经,就诊末次月经 | |
582 | + request.setLmp(DateUtil.getyyyy_MM_dd(patients.getLastMenses())); | |
583 | + // 是否是否体外受精-胚胎移植(IVF) | |
584 | + // { | |
585 | + // 0:是否IVF-否 | |
586 | + // 1:是否IVF-是 | |
587 | + request.setAdosculation(sieveApplyOrderModel.getIvf()); | |
588 | + // 既往史: 一年内异体输血 | |
589 | + // { | |
590 | + // 0:既往史: 一年内异体输血-无 | |
591 | + // 1:既往史: 一年内异体输血-有(不接受) | |
592 | + // } | |
593 | + request.setAllogeneticTransfusion(sieveApplyOrderModel.getYtsx()); | |
594 | + // 四周内异体细胞免疫 | |
595 | + // { | |
596 | + // 0:四周内异体细胞免疫-无 | |
597 | + // 1:四周内异体细胞免疫-有(不接受) | |
598 | + // } | |
599 | + request.setCellularImmunity(sieveApplyOrderModel.getYtxbzl()); | |
600 | + // 干细胞治疗 | |
601 | + // { | |
602 | + // 0:干细胞治疗-无 | |
603 | + // 1:干细胞治疗-有(不接受) | |
604 | + // } | |
605 | + request.setStemCell(sieveApplyOrderModel.getGxbzl()); | |
606 | + // 样本类型 | |
607 | + // | |
608 | + // { | |
609 | + //S051:样本类型-全血 | |
610 | + // } | |
611 | + request.setSampleType("S051"); | |
612 | + // 辅助检查(B超结果),页面传入什么输入 | |
613 | + // { | |
614 | + // 0:辅助检查(重要)-正常(单胎活) | |
615 | + // 1:辅助检查(重要)-正常(双胎活) | |
616 | + // 2:辅助检查(重要)-正常(多胎活) | |
617 | + // 3:辅助检查(重要)-异常(单胎) | |
618 | + // 4:辅助检查(重要)-异常(双胎) | |
619 | + // 5:辅助检查(重要)-异常(多胎) | |
620 | + // 6:辅助检查(重要)-减胎 | |
621 | + // } | |
622 | + request.setBtypeUltrasonic(sieveApplyOrderModel.getFetusNum()); | |
623 | + // 其他辅助筛查,页面传入什么输入 | |
624 | + // { | |
625 | + // 0:筛查模式-未做 | |
626 | + // 1:筛查模式-nt筛查 | |
627 | + // 2:筛查模式-早孕期筛查 | |
628 | + // 3:筛查模式-中孕期筛查 | |
629 | + // 4:筛查模式-早中孕期联合筛查 | |
630 | + // } | |
631 | + request.setScreeningModel(sieveApplyOrderModel.getSieveModel()); | |
632 | + | |
633 | + huadaSaveSampleInfo(request); | |
634 | + } | |
635 | + } | |
636 | + }catch (Exception e){ | |
637 | + e.printStackTrace(); | |
638 | + logger.error("调用华大接口失败", e); | |
639 | + } | |
513 | 640 | } |
514 | 641 | |
515 | 642 | /** |