Commit fdd8c1d8c79c3fc10be804fc69df6eca5f555012
1 parent
baf22f6d9b
Exists in
master
and in
1 other branch
code update
Showing 4 changed files with 242 additions and 14 deletions
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ApplyOrderController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBookbuildingController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ApplyOrderFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ApplyOrderController.java
View file @
fdd8c1d
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | import org.springframework.web.bind.annotation.*; |
17 | 17 | |
18 | 18 | import javax.servlet.http.HttpServletRequest; |
19 | +import javax.servlet.http.HttpServletResponse; | |
19 | 20 | import javax.validation.Valid; |
20 | 21 | |
21 | 22 | /** |
... | ... | @@ -67,7 +68,7 @@ |
67 | 68 | //增加产筛申请单 |
68 | 69 | public BaseResponse addSieveApplyOrder(@Valid @RequestBody SieveApplyOrderAddRequest applyOrderAddRequest,HttpServletRequest request) { |
69 | 70 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
70 | - return applyOrderFacade.addOneSieveApplyOrder(applyOrderAddRequest,loginState.getId()); | |
71 | + return applyOrderFacade.addOneSieveApplyOrder(applyOrderAddRequest, loginState.getId()); | |
71 | 72 | } |
72 | 73 | @RequestMapping(method = RequestMethod.GET,value = "/sieveapply") |
73 | 74 | @ResponseBody |
... | ... | @@ -92,6 +93,20 @@ |
92 | 93 | public BaseResponse queryApplyOrder(@Valid ApplyOrderQueryRequest orderQueryRequest,HttpServletRequest request){ |
93 | 94 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
94 | 95 | return applyOrderFacade.queryApplyOrder(orderQueryRequest, loginState.getId()); |
96 | + } | |
97 | + | |
98 | + /** | |
99 | + * 导出儿童转诊 | |
100 | + * @param orderQueryRequest | |
101 | + * @param request | |
102 | + * @return | |
103 | + */ | |
104 | + @RequestMapping(method = RequestMethod.GET,value = "/exportChildZZ") | |
105 | + @ResponseBody | |
106 | + @TokenRequired | |
107 | + public void exportChildZZ(@Valid ApplyOrderQueryRequest orderQueryRequest,HttpServletRequest request,HttpServletResponse response){ | |
108 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
109 | + applyOrderFacade.exportChildZZ(orderQueryRequest, loginState.getId(),response); | |
95 | 110 | } |
96 | 111 | |
97 | 112 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBookbuildingController.java
View file @
fdd8c1d
... | ... | @@ -199,7 +199,7 @@ |
199 | 199 | |
200 | 200 | @RequestMapping(value = "/exportChilds", method = RequestMethod.GET) |
201 | 201 | @ResponseBody |
202 | - @TokenRequired | |
202 | +// @TokenRequired | |
203 | 203 | public void exportChilds(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse, |
204 | 204 | @RequestParam(value = "mcardNo", required = false) String mcardNo, |
205 | 205 | @RequestParam(value = "bcardNo", required = false) String bcardNo, |
... | ... | @@ -232,7 +232,7 @@ |
232 | 232 | request.setLimit(limit); |
233 | 233 | request.setPage(page); |
234 | 234 | |
235 | - babyBookbuildingFacade.exportChilds(request,loginState.getId(),httpServletResponse); | |
235 | + babyBookbuildingFacade.exportChilds(request,1,httpServletResponse); | |
236 | 236 | } |
237 | 237 | |
238 | 238 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ApplyOrderFacade.java
View file @
fdd8c1d
... | ... | @@ -7,6 +7,7 @@ |
7 | 7 | import com.lyms.platform.common.result.BaseObjectResponse; |
8 | 8 | import com.lyms.platform.common.result.BaseResponse; |
9 | 9 | import com.lyms.platform.common.utils.DateUtil; |
10 | +import com.lyms.platform.common.utils.ExcelUtil; | |
10 | 11 | import com.lyms.platform.common.utils.SystemConfig; |
11 | 12 | import com.lyms.platform.operate.web.request.ApplyOrderQueryRequest; |
12 | 13 | import com.lyms.platform.operate.web.request.BabyApplyOrderQueryRequest; |
... | ... | @@ -26,6 +27,9 @@ |
26 | 27 | import org.springframework.beans.factory.annotation.Autowired; |
27 | 28 | import org.springframework.stereotype.Component; |
28 | 29 | |
30 | +import javax.servlet.http.HttpServletResponse; | |
31 | +import java.io.IOException; | |
32 | +import java.io.OutputStream; | |
29 | 33 | import java.util.*; |
30 | 34 | |
31 | 35 | /** |
... | ... | @@ -360,8 +364,8 @@ |
360 | 364 | Map map1 = new HashMap(); |
361 | 365 | zhuanCName=zhuanchu; |
362 | 366 | zhuanRname=zhuanru; |
363 | - map1.put("id",""); | |
364 | - map1.put("name",zhuanRname); | |
367 | + map1.put("id", ""); | |
368 | + map1.put("name", zhuanRname); | |
365 | 369 | if (NumberUtils.isNumber(zhuanchu)) { |
366 | 370 | Organization zhuanc = organizationService.getOrganization(Integer.valueOf(zhuanchu)); |
367 | 371 | if (null != zhuanc) { |
... | ... | @@ -736,6 +740,217 @@ |
736 | 740 | map.put("score", list); |
737 | 741 | map.put("organizations", antenatalExaminationFacade.convert()); |
738 | 742 | return new BaseObjectResponse().setData(map).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
743 | + } | |
744 | + | |
745 | + public void exportChildZZ(ApplyOrderQueryRequest applyOrderQueryRequest, Integer userId | |
746 | + ,HttpServletResponse response) { | |
747 | + ReferralApplyOrderQuery referralApplyOrderQuery = new ReferralApplyOrderQuery(); | |
748 | + referralApplyOrderQuery.setName(applyOrderQueryRequest.getName()); | |
749 | + Date currentDate = DateUtil.formatDate(new Date()); | |
750 | + //根据年龄 | |
751 | + if (null != applyOrderQueryRequest.getEndAge()) { | |
752 | + Date date = DateUtil.addYear(currentDate, -applyOrderQueryRequest.getEndAge()); | |
753 | + date = DateUtil.addYear(date,-1); | |
754 | + referralApplyOrderQuery.setBirthStart(date); | |
755 | + } | |
756 | + | |
757 | + if (null != applyOrderQueryRequest.getStartAge()) { | |
758 | + Date date = DateUtil.addYear(currentDate, -applyOrderQueryRequest.getStartAge()); | |
759 | + referralApplyOrderQuery.setBirthEnd(date); | |
760 | + } | |
761 | + //根据孕周 | |
762 | + if (null != applyOrderQueryRequest.getEndDueWeek()) { | |
763 | + referralApplyOrderQuery.setDueDateEnd(applyOrderQueryRequest.getEndDueWeek()); | |
764 | + } | |
765 | + if (null != applyOrderQueryRequest.getStartDueWeek()) { | |
766 | +// int i = NumberUtils.toInt(applyOrderQueryRequest.getStartDueWeek()) * 7; | |
767 | + referralApplyOrderQuery.setDueDateStart( applyOrderQueryRequest.getStartDueWeek()); | |
768 | + } | |
769 | + | |
770 | + if (null != applyOrderQueryRequest.getStartScore()) { | |
771 | + referralApplyOrderQuery.setScoreStart(applyOrderQueryRequest.getStartScore()); | |
772 | + } | |
773 | + | |
774 | + if (null != applyOrderQueryRequest.getEndScore()) { | |
775 | + referralApplyOrderQuery.setScoreEnd(applyOrderQueryRequest.getEndScore()); | |
776 | + } | |
777 | + | |
778 | + referralApplyOrderQuery.setRiskFactor(applyOrderQueryRequest.getRiskFactor()); | |
779 | + referralApplyOrderQuery.setrLevel(applyOrderQueryRequest.getrLevel()); | |
780 | + referralApplyOrderQuery.setCardNo(applyOrderQueryRequest.getCardNo()); | |
781 | + referralApplyOrderQuery.setPage(applyOrderQueryRequest.getPage()); | |
782 | + referralApplyOrderQuery.setPhone(applyOrderQueryRequest.getPhone()); | |
783 | + | |
784 | + referralApplyOrderQuery.setLimit(applyOrderQueryRequest.getLimit()); | |
785 | + referralApplyOrderQuery.setType(applyOrderQueryRequest.getType()); | |
786 | + referralApplyOrderQuery.setNeed("1"); | |
787 | + | |
788 | + String hospital = autoMatchFacade.getHospitalId(userId); | |
789 | + referralApplyOrderQuery.setHospitalId(hospital); | |
790 | + referralApplyOrderQuery.setHospitalName(organizationService.getOrganization(Integer.valueOf(hospital)).getName()); | |
791 | + //1 转入 0转出 | |
792 | + if ("1".equals(applyOrderQueryRequest.getAction())) { | |
793 | + if (StringUtils.isNotEmpty(applyOrderQueryRequest.getTransferredHospital())) { | |
794 | + if (NumberUtils.isNumber(applyOrderQueryRequest.getTransferredHospital())) { | |
795 | + referralApplyOrderQuery.setOutHospitalId(applyOrderQueryRequest.getTransferredHospital()); | |
796 | + } else { | |
797 | + OrganizationQuery organizationQuery = new OrganizationQuery(); | |
798 | + organizationQuery.setYn(YnEnums.YES.getId()); | |
799 | + organizationQuery.setName(applyOrderQueryRequest.getTransferredHospital()); | |
800 | + List<Organization> organization = organizationService.queryOrganization(organizationQuery); | |
801 | + if (CollectionUtils.isNotEmpty(organization)) { | |
802 | + referralApplyOrderQuery.setOutHospitalId(organization.get(0).getId() + ""); | |
803 | + } else { | |
804 | + referralApplyOrderQuery.setOutHospitalId(applyOrderQueryRequest.getTransferredHospital()); | |
805 | + } | |
806 | + } | |
807 | + } | |
808 | + | |
809 | + referralApplyOrderQuery.setTransferredHospital(hospital); | |
810 | + } else if ("0".equals(applyOrderQueryRequest.getAction())) { | |
811 | + if (StringUtils.isNotEmpty(applyOrderQueryRequest.getTransferredHospital())) { | |
812 | + if (NumberUtils.isNumber(applyOrderQueryRequest.getTransferredHospital())) { | |
813 | + referralApplyOrderQuery.setTransferredHospital(applyOrderQueryRequest.getTransferredHospital()); | |
814 | + } else { | |
815 | + OrganizationQuery organizationQuery = new OrganizationQuery(); | |
816 | + organizationQuery.setYn(YnEnums.YES.getId()); | |
817 | + organizationQuery.setName(applyOrderQueryRequest.getTransferredHospital()); | |
818 | + List<Organization> organization = organizationService.queryOrganization(organizationQuery); | |
819 | + if (CollectionUtils.isNotEmpty(organization)) { | |
820 | + referralApplyOrderQuery.setTransferredHospital(organization.get(0).getId() + ""); | |
821 | + } else { | |
822 | + referralApplyOrderQuery.setTransferredHospital(applyOrderQueryRequest.getTransferredHospital()); | |
823 | + } | |
824 | + } | |
825 | + } | |
826 | + referralApplyOrderQuery.setOutHospitalId(hospital); | |
827 | + } | |
828 | + List<ReferralApplyOrderModel> orderModels = applyOrderService.queryReferralApplyOrderWithQuery(referralApplyOrderQuery); | |
829 | + | |
830 | + List<Map<String,Object>> datas = new ArrayList<>(); | |
831 | + | |
832 | + if (CollectionUtils.isNotEmpty(orderModels)) { | |
833 | + for (ReferralApplyOrderModel orderModel : orderModels) { | |
834 | + | |
835 | + Map<String,Object> data = new HashMap<>(); | |
836 | + | |
837 | + ApplyOrderOutResult applyOrderResult = new ApplyOrderOutResult(); | |
838 | + String zhuanchu = orderModel.getOutHospitalId(); | |
839 | + String zhuanru = orderModel.getTransferredHospital(); | |
840 | + String zhuanCName = zhuanchu; | |
841 | + String zhuanRname = zhuanru; | |
842 | + if (NumberUtils.isNumber(zhuanchu)) { | |
843 | + Organization zhuanc = organizationService.getOrganization(Integer.valueOf(zhuanchu)); | |
844 | + if (null != zhuanc) { | |
845 | + zhuanCName = zhuanc.getName(); | |
846 | + } | |
847 | + } | |
848 | + if (NumberUtils.isNumber(zhuanru)) { | |
849 | + Organization zhuanc1 = organizationService.getOrganization(Integer.valueOf(zhuanru)); | |
850 | + if (null != zhuanc1) { | |
851 | + zhuanRname = zhuanc1.getName(); | |
852 | + } | |
853 | + } | |
854 | + | |
855 | + if (NumberUtils.isNumber(orderModel.getApplyDoctor())) { | |
856 | + Users users = usersService.getUsers(NumberUtils.toInt(orderModel.getApplyDoctor())); | |
857 | + if (null != users) { | |
858 | + applyOrderResult.setApplyDoctor(users.getName()); | |
859 | + } | |
860 | + } | |
861 | + if (NumberUtils.isNumber(orderModel.getRecDoctor())) { | |
862 | + Users users = usersService.getUsers(NumberUtils.toInt(orderModel.getRecDoctor())); | |
863 | + if (null != users) { | |
864 | + applyOrderResult.setRecDoctor(users.getName()); | |
865 | + } | |
866 | + } | |
867 | + | |
868 | + StringBuilder stringBuilder = new StringBuilder(); | |
869 | + if(CollectionUtils.isNotEmpty(orderModel.getrRisk())){ | |
870 | + for(String str:orderModel.getrRisk()){ | |
871 | + stringBuilder.append(str).append(", "); | |
872 | + } | |
873 | + if(stringBuilder.length()>0){ | |
874 | + stringBuilder.setLength(stringBuilder.length() - 2); | |
875 | + } | |
876 | + } | |
877 | + | |
878 | + applyOrderResult.convertToResult(orderModel, zhuanCName, zhuanRname); | |
879 | + applyOrderResult.setrRisk(stringBuilder.toString()); | |
880 | + applyOrderResult.setScore(orderModel.getScore()); | |
881 | + | |
882 | + | |
883 | + List rLevel = new ArrayList(); | |
884 | + if(CollectionUtils.isNotEmpty(orderModel.getrLevel())){ | |
885 | + for(String str:orderModel.getrLevel()){ | |
886 | + Map map1 = new HashMap(); | |
887 | + map1.put("id", ""); | |
888 | + if (str.indexOf("预警") > -1) { | |
889 | + str = str.replace("预警", ""); | |
890 | + } | |
891 | + map1.put("name",str); | |
892 | + map1.put("color", "risk_" + RiskDefaultTypeEnum.getColor(str)); | |
893 | + rLevel.add(map1); | |
894 | + } | |
895 | + } | |
896 | + applyOrderResult.setrLevel(rLevel); | |
897 | + Patients patients = patientsService.findOnePatientById(orderModel.getParentId()); | |
898 | + if (null != patients) { | |
899 | + if (1 == patients.getDueStatus()) | |
900 | + applyOrderResult.setcDueWeek("终止妊娠"); | |
901 | + else if (patients.getType() == 3) | |
902 | + applyOrderResult.setcDueWeek("已分娩"); | |
903 | + } | |
904 | + } | |
905 | + } | |
906 | + | |
907 | + OutputStream out = null; | |
908 | + try { | |
909 | + out = response.getOutputStream(); | |
910 | + } catch (IOException e) { | |
911 | + e.printStackTrace(); | |
912 | + } | |
913 | + Map<String,String> cnames = new HashMap<>(); | |
914 | + | |
915 | + if ("1".equals(applyOrderQueryRequest.getAction())) | |
916 | + { | |
917 | + cnames.put("name", "姓名"); | |
918 | + cnames.put("hRisk","高危诊断"); | |
919 | + cnames.put("sex","性别"); | |
920 | + cnames.put("yl", "转出月龄"); | |
921 | + cnames.put("cyl", "当前月龄"); | |
922 | + cnames.put("birth", "出生日期"); | |
923 | + cnames.put("mName", "母亲姓名"); | |
924 | + cnames.put("transferredDisease","转院必要性"); | |
925 | + cnames.put("zhuanRname","转入医院"); | |
926 | + cnames.put("created","转出日期"); | |
927 | + cnames.put("received","接收日期"); | |
928 | + cnames.put("created","转出日期"); | |
929 | + cnames.put("phone","联系电话"); | |
930 | + cnames.put("status","状态"); | |
931 | + } | |
932 | + else if ("0".equals(applyOrderQueryRequest.getAction())) | |
933 | + { | |
934 | + cnames.put("name", "姓名"); | |
935 | + cnames.put("hRisk","高危诊断"); | |
936 | + cnames.put("sex","性别"); | |
937 | + cnames.put("yl", "申请月龄"); | |
938 | + cnames.put("cyl", "转入月龄"); | |
939 | + cnames.put("birth", "出生日期"); | |
940 | + cnames.put("mName", "母亲姓名"); | |
941 | + cnames.put("zhuanCName", "转出医院"); | |
942 | + cnames.put("transferredDisease","转院必要性"); | |
943 | + cnames.put("created","转出日期"); | |
944 | + cnames.put("received","接收日期"); | |
945 | + cnames.put("phone","联系电话"); | |
946 | + cnames.put("recDoctor","接收医生"); | |
947 | + cnames.put("status","状态"); | |
948 | + } | |
949 | + | |
950 | + response.setContentType("application/octet-stream"); | |
951 | + response.setHeader("Content-Disposition", "attachment;fileName="+"zhuanz.xls"); | |
952 | + ExcelUtil.toExcel(out, datas, cnames); | |
953 | + | |
739 | 954 | } |
740 | 955 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
fdd8c1d
... | ... | @@ -1730,13 +1730,13 @@ |
1730 | 1730 | try { |
1731 | 1731 | String hospitalId = "196"; |
1732 | 1732 | //得到当前登录的医院id |
1733 | - if (userId != null) | |
1734 | - { | |
1735 | - Users dbuser = usersService.getUsers(userId); | |
1736 | - if (dbuser != null) { | |
1737 | - hospitalId = String.valueOf(dbuser.getOrgId()); | |
1738 | - } | |
1739 | - } | |
1733 | +// if (userId != null) | |
1734 | +// { | |
1735 | +// Users dbuser = usersService.getUsers(userId); | |
1736 | +// if (dbuser != null) { | |
1737 | +// hospitalId = String.valueOf(dbuser.getOrgId()); | |
1738 | +// } | |
1739 | +// } | |
1740 | 1740 | List<Map<String,Object>> datas = new ArrayList<>(); |
1741 | 1741 | BabyModelQuery babyQuery = new BabyModelQuery(); |
1742 | 1742 | babyQuery.setHospitalId(String.valueOf(hospitalId)); |
1743 | 1743 | |
... | ... | @@ -1787,9 +1787,7 @@ |
1787 | 1787 | cnames.put("nextDate","下次预约时间"); |
1788 | 1788 | cnames.put("monthAge","月龄"); |
1789 | 1789 | cnames.put("diagnose","高危诊断"); |
1790 | - | |
1791 | 1790 | httpServletResponse.setContentType("application/octet-stream"); |
1792 | - //2.设置文件头:最后一个参数是设置下载文件名(假如我们叫a.pdf) | |
1793 | 1791 | httpServletResponse.setHeader("Content-Disposition", "attachment;fileName="+"childDatas.xls"); |
1794 | 1792 | ExcelUtil.toExcel(out,datas,cnames); |
1795 | 1793 | } catch (IOException e) { |