Commit 8fe1e7f681ff00c186ef78514b351f0abb5206e5

Authored by jiangjiazhi
1 parent ccd7e8b204

修改新电子病历

Showing 6 changed files with 238 additions and 104 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntenatalExaminationService.java View file @ 8fe1e7f
... ... @@ -130,9 +130,12 @@
130 130 }
131 131  
132 132 public List<AntExChuModel> queryAntExChu(AntExChuQuery antExChuQuery){
133   - return iAntExChuDao.query(antExChuQuery.convertToQuery().addOrder(Sort.Direction.DESC,"created"));
  133 + return iAntExChuDao.query(antExChuQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created"));
134 134 }
135 135  
  136 + public List<AntExChuModel> queryAntExChu(MongoQuery mongoQuery){
  137 + return iAntExChuDao.query(mongoQuery);
  138 + }
136 139 public List<AntenatalExaminationModel> queryYuyueAntenatalExamination(Date yuYueDate,String hospitalId) {
137 140 return iAntenatalExaminationDao.queryYuyueAntenatalExamination(yuYueDate, hospitalId);
138 141 }
platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java View file @ 8fe1e7f
... ... @@ -225,6 +225,16 @@
225 225 private String pid;
226 226 //是否隐藏 0 隐藏 1 显示
227 227 private String enable;
  228 + //最后一次高危时间
  229 + private Date lastRhTime;
  230 +
  231 + public Date getLastRhTime() {
  232 + return lastRhTime;
  233 + }
  234 +
  235 + public void setLastRhTime(Date lastRhTime) {
  236 + this.lastRhTime = lastRhTime;
  237 + }
228 238  
229 239 public String getEnable() {
230 240 return enable;
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java View file @ 8fe1e7f
... ... @@ -76,8 +76,27 @@
76 76 private Date bookbuildingDateStart;
77 77 private Date bookbuildingDateEnd;
78 78  
  79 + private Date lastRhTimeStart;
  80 + private Date lastRhTimeEnd;
  81 +
79 82 private String pid;
80 83  
  84 + public Date getLastRhTimeEnd() {
  85 + return lastRhTimeEnd;
  86 + }
  87 +
  88 + public void setLastRhTimeEnd(Date lastRhTimeEnd) {
  89 + this.lastRhTimeEnd = lastRhTimeEnd;
  90 + }
  91 +
  92 + public Date getLastRhTimeStart() {
  93 + return lastRhTimeStart;
  94 + }
  95 +
  96 + public void setLastRhTimeStart(Date lastRhTimeStart) {
  97 + this.lastRhTimeStart = lastRhTimeStart;
  98 + }
  99 +
81 100 public Date getCreated() {
82 101 return created;
83 102 }
... ... @@ -636,6 +655,18 @@
636 655 isAddStart = Boolean.TRUE;
637 656 }
638 657  
  658 + if(null!=lastRhTimeStart){
  659 + c = Criteria.where("lastRhTime").gte(lastRhTimeStart);
  660 + isAddStart = Boolean.TRUE;
  661 + }
  662 + if (null != lastRhTimeEnd) {
  663 + if (isAddStart) {
  664 + c = c.lte(lastRhTimeEnd);
  665 + } else {
  666 + c = Criteria.where("lastRhTime").lte(lastRhTimeEnd);
  667 + }
  668 + isAddStart = Boolean.TRUE;
  669 + }
639 670  
640 671 if (null != hScoreStart) {
641 672 // condition = condition.and("riskScore", hScore, MongoOper.IS);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 8fe1e7f
... ... @@ -17,7 +17,6 @@
17 17 import com.lyms.platform.permission.service.UsersService;
18 18 import com.lyms.platform.pojo.*;
19 19 import com.lyms.platform.query.*;
20   -import com.sun.tools.corba.se.idl.constExpr.And;
21 20 import org.apache.commons.collections.CollectionUtils;
22 21 import org.apache.commons.lang.StringUtils;
23 22 import org.apache.commons.lang.math.NumberUtils;
24 23  
... ... @@ -65,9 +64,10 @@
65 64 * @return
66 65 */
67 66 public BaseResponse addOneAntEx(AntExAddRequest antExAddRequest, Integer userId) {
  67 + String hospitalId = autoMatchFacade.getHospitalId(userId);
68 68 if (StringUtils.isNotEmpty(antExAddRequest.getId())) {
69 69 AntenatalExaminationModel antenatalExamination = antExAddRequest.convertToDataModel();
70   - antenatalExamination.setHospitalId(autoMatchFacade.matchOrgId(userId).get(0) + "");
  70 + antenatalExamination.setHospitalId(hospitalId);
71 71 antenatalExaminationService.updateOneAnt(antenatalExamination, antExAddRequest.getId());
72 72 //修改申请单状态
73 73 updateApplyOrder(antenatalExamination, antExAddRequest.getParentId());
74 74  
75 75  
... ... @@ -76,14 +76,15 @@
76 76 patients.setLastCheckEmployeeId(antExAddRequest.getCheckDoctor());
77 77 // updatePatientRiskLevel(antenatalExamination, patients);
78 78 patientsService.updatePatient(patients);
  79 +
79 80 updateLastRisk(antExAddRequest.getParentId());
  81 +
  82 + //修改本院最后一次定义高危
  83 + updateLastRhTime(patients.getId(), hospitalId);
80 84 } else {
81 85 AntenatalExaminationModel model = antExAddRequest.convertToDataModel();
82 86 model.setYn(YnEnums.YES.getId());
83   - List list1 = autoMatchFacade.matchOrgId(userId);
84   - if (CollectionUtils.isNotEmpty(list1)) {
85   - model.setHospitalId(list1.get(0) + "");
86   - }
  87 + model.setHospitalId(hospitalId);
87 88 AntExQuery antExQuery = new AntExQuery();
88 89 antExQuery.setYn(YnEnums.YES.getId());
89 90 antExQuery.setParentId(antExAddRequest.getParentId());
... ... @@ -103,6 +104,9 @@
103 104 // updatePatientRiskLevel(model, patients);
104 105  
105 106 updateLastRisk(antExAddRequest.getParentId());
  107 +
  108 + //修改本院最后一次定义高危
  109 + updateLastRhTime(patients.getId(), hospitalId);
106 110 if (null != patients.getBuildType() && patients.getBuildType() == 3) {
107 111 ReferralApplyOrderQuery referralApplyOrderQuery = new ReferralApplyOrderQuery();
108 112 referralApplyOrderQuery.setParentId(patients.getId());
109 113  
... ... @@ -163,8 +167,9 @@
163 167 */
164 168 public BaseResponse addOneAnetExChu(AntExcAddRequest excAddRequest, Integer userId) {
165 169 AntExChuModel antExChuModel = excAddRequest.convertToDataModel();
  170 + String hospitalId = autoMatchFacade.getHospitalId(userId);
166 171 if (StringUtils.isNotEmpty(antExChuModel.getId()) && StringUtils.isNotEmpty(antExChuModel.getParentId())) {
167   - antExChuModel.setHospitalId(autoMatchFacade.getHospitalId(userId));
  172 + antExChuModel.setHospitalId(hospitalId);
168 173 antenatalExaminationService.updateAntExChu(antExChuModel, antExChuModel.getId());
169 174  
170 175 Patients patients = patientsService.findOnePatientById(excAddRequest.getParentId());
171 176  
172 177  
... ... @@ -172,10 +177,12 @@
172 177 //修改患者风险等级
173 178 // updatePatientRiskLevel(antExChuModel, patients);
174 179 patientsService.updatePatient(patients);
  180 + //修改本系统最后的高危
175 181 updateLastRisk(patients.getId());
  182 + //修改本院最后一次定义高危
  183 + updateLastRhTime(patients.getId(), hospitalId);
176 184  
177 185 } else {
178   - String hospitalId = autoMatchFacade.getHospitalId(userId);
179 186 AntExChuQuery antExChuQuery1 = new AntExChuQuery();
180 187 antExChuQuery1.setParentId(excAddRequest.getParentId());
181 188 antExChuQuery1.setYn(YnEnums.YES.getId());
182 189  
... ... @@ -209,9 +216,15 @@
209 216 // updatePatientRiskLevel(antExChuModel, patients);
210 217 patientsService.updatePatient(patients);
211 218 updateLastRisk(patients.getId());
  219 +
  220 + //修改本院最后一次定义高危
  221 + updateLastRhTime(patients.getId(), hospitalId);
  222 +
212 223 if (null != patients.getBuildType() && patients.getBuildType() == 3) {
213   - patients.setEnable("1");
214   - patientsService.updatePatient(patients);
  224 + Patients patients1 = new Patients();
  225 + patients1.setEnable("1");
  226 + patients1.setId(patients.getId());
  227 + patientsService.updatePatient(patients1);
215 228 ReferralApplyOrderQuery referralApplyOrderQuery = new ReferralApplyOrderQuery();
216 229 referralApplyOrderQuery.setParentId(patients.getId());
217 230 String hospital = autoMatchFacade.getHospitalId(userId);
218 231  
219 232  
... ... @@ -247,16 +260,74 @@
247 260 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
248 261 }
249 262  
  263 + /**
  264 + * 修改最后一次定义高危的时间
  265 + *
  266 + * @param parentId
  267 + * @param hospitalId
  268 + */
  269 + private void updateLastRhTime(String parentId, String hospitalId) {
  270 +
  271 + AntExQuery antExQuery = new AntExQuery();
  272 + antExQuery.setYn(YnEnums.YES.getId());
  273 + antExQuery.setHospitalId(hospitalId);
  274 + antExQuery.setParentId(parentId);
  275 +
  276 + List<AntenatalExaminationModel> antExList = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "modified"));
  277 +// Patients patients = patientsService.findOnePatientById(parentId);
  278 + boolean hasLast = false;
  279 + Patients patients = new Patients();
  280 + if (CollectionUtils.isNotEmpty(antExList)) {
  281 + for (AntenatalExaminationModel antEx : antExList) {
  282 + if (StringUtils.isNotEmpty(antEx.getRiskFactor()) && !"[]".equals(antEx.getRiskFactor())) {
  283 + patients.setLastRhTime(antEx.getCheckDate());
  284 + hasLast = true;
  285 + break;
  286 + } else if (StringUtils.isNotEmpty(antEx.getOtherRisk()) && !"{}".equals(antEx.getOtherRisk())) {
  287 + patients.setLastRhTime(antEx.getCheckDate());
  288 + hasLast = true;
  289 + break;
  290 + }
  291 + }
  292 + }
  293 +
  294 + //查询初诊
  295 + AntExChuQuery antExChuQuery = new AntExChuQuery();
  296 + antExChuQuery.setYn(YnEnums.YES.getId());
  297 + antExChuQuery.setParentId(parentId);
  298 + antExChuQuery.setHospitalId(hospitalId);
  299 +
  300 + List<AntExChuModel> antExChuList = antenatalExaminationService.queryAntExChu(antExChuQuery.convertToQuery().addOrder(Sort.Direction.DESC, "modified"));
  301 +
  302 + if (CollectionUtils.isNotEmpty(antExChuList)) {
  303 + for (AntExChuModel antExChuModel : antExChuList) {
  304 + if (StringUtils.isNotEmpty(antExChuModel.getHighrisk()) && !"[]".equals(antExChuModel.getHighrisk())) {
  305 + patients.setLastRhTime(antExChuModel.getCheckTime());
  306 + hasLast = true;
  307 + break;
  308 + } else if (StringUtils.isNotEmpty(antExChuModel.getOtherHighRisk()) && !"{}".equals(antExChuModel.getOtherHighRisk())) {
  309 + patients.setLastRhTime(antExChuModel.getCheckTime());
  310 + hasLast = true;
  311 + break;
  312 + }
  313 + }
  314 + }
  315 + if (hasLast) {
  316 + patients.setId(parentId);
  317 + patientsService.updatePatient(patients);
  318 + }
  319 + }
  320 +
250 321 //修改患者风险等级
251 322 private void updatePatientRiskLevel(AntExChuModel antExChuModel, Patients patients) {
252 323 List<String> list = new ArrayList<>();
253   - Integer score=0;
  324 + Integer score = 0;
254 325 try {
255 326 if (StringUtils.isNotEmpty(antExChuModel.getHighrisk()) && !"[]".equals(antExChuModel.getHighrisk())) {
256 327 List l = JsonUtil.toList(antExChuModel.getHighrisk(), List.class);
257 328 for (int i = 0; i < l.size(); i++) {
258 329 BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(l.get(i).toString());
259   - score+=basicConfig.getScore();
  330 + score += basicConfig.getScore();
260 331 basicConfig = basicConfigService.getOneBasicConfigById(basicConfig.getParentId());
261 332 if (null != basicConfig && !list.contains(basicConfig.getId())) {
262 333 list.add(basicConfig.getId());
... ... @@ -276,7 +347,7 @@
276 347 Object idObj = map.get("fxpf");
277 348 if (null != idObj && !"null".equals(idObj.toString()) && !"".equals(idObj.toString())) {
278 349 BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(idObj.toString());
279   - score +=NumberUtils.toInt(basicConfig.getName(), 0);
  350 + score += NumberUtils.toInt(basicConfig.getName(), 0);
280 351 }
281 352 }
282 353 } catch (Exception e) {
283 354  
... ... @@ -303,13 +374,13 @@
303 374 //修改患者风险等级
304 375 private void updatePatientRiskLevel(AntenatalExaminationModel antExChuModel, Patients patients) {
305 376 List<String> list = new ArrayList<>();
306   - Integer score=0;
  377 + Integer score = 0;
307 378 try {
308 379 if (StringUtils.isNotEmpty(antExChuModel.getRiskFactor()) && !"[]".equals(antExChuModel.getRiskFactor())) {
309 380 List l = JsonUtil.toList(antExChuModel.getRiskFactor(), List.class);
310 381 for (int i = 0; i < l.size(); i++) {
311 382 BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(l.get(i).toString());
312   - score+=basicConfig.getScore();
  383 + score += basicConfig.getScore();
313 384 basicConfig = basicConfigService.getOneBasicConfigById(basicConfig.getParentId());
314 385 if (null != basicConfig && !list.contains(basicConfig.getId())) {
315 386 list.add(basicConfig.getId());
... ... @@ -329,7 +400,7 @@
329 400 Object idObj = map.get("fxpf");
330 401 if (null != idObj && !"null".equals(idObj.toString()) && !"".equals(idObj.toString())) {
331 402 BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(idObj.toString());
332   - score +=NumberUtils.toInt(basicConfig.getName(),0);
  403 + score += NumberUtils.toInt(basicConfig.getName(), 0);
333 404 }
334 405 }
335 406 } catch (Exception e) {
... ... @@ -636,7 +707,7 @@
636 707 sortList(listDate);
637 708  
638 709 //需要过滤掉建档就分娩的情况
639   - Date dueDate =null;
  710 + Date dueDate = null;
640 711 if (CollectionUtils.isNotEmpty(listDate)) {
641 712 String pid = "";
642 713 int count = 0;
... ... @@ -659,7 +730,7 @@
659 730 if (CollectionUtils.isNotEmpty(patientses)) {
660 731 count = count + patientses.size();
661 732 //TODO 处理自动分娩的情况
662   - updateAutoMatdel(patientses,list,i,dueDate,sortList,listDate,map);
  733 + updateAutoMatdel(patientses, list, i, dueDate, sortList, listDate, map);
663 734 listData = new ArrayList();
664 735 }
665 736  
666 737  
... ... @@ -686,13 +757,13 @@
686 757 postReviewQuery.setPid(pid);
687 758 Object obj = map.get(listDate.get(i).getId());
688 759 if (obj instanceof MaternalDeliverModel) {
689   - MaternalDeliverModel model= (MaternalDeliverModel)obj;
  760 + MaternalDeliverModel model = (MaternalDeliverModel) obj;
690 761 if (null != model.getHospitalId()) {
691 762 organization = organizationService.getOrganization(Integer.valueOf(model.getHospitalId()));
692 763 }
693 764 listData.add(new AntData((MaternalDeliverModel) obj, patientses.get(0).getLastMenses(), null != organization ? organization.getName() : ""));
694 765 } else if (obj instanceof StopPregModel) {
695   - StopPregModel model= (StopPregModel)obj;
  766 + StopPregModel model = (StopPregModel) obj;
696 767 if (null != model.getHospitalId()) {
697 768 organization = organizationService.getOrganization(Integer.valueOf(model.getHospitalId()));
698 769 }
... ... @@ -703,7 +774,7 @@
703 774 List<PostReviewModel> reviewModels = postReviewService.findWithList(postReviewQuery);
704 775 if (CollectionUtils.isNotEmpty(reviewModels)) {
705 776 for (PostReviewModel postReviewModel : reviewModels) {
706   - if(postReviewModel.getYn()==YnEnums.YES.getId()){
  777 + if (postReviewModel.getYn() == YnEnums.YES.getId()) {
707 778 if (null != postReviewModel.getHospitalId()) {
708 779 organization = organizationService.getOrganization(Integer.valueOf(postReviewModel.getHospitalId()));
709 780 }
... ... @@ -742,7 +813,7 @@
742 813 List l = buildPatientList(new Date(), patientsList, list1, min, false);
743 814 if (!l.isEmpty()) {
744 815 sort(l);
745   - updateEditEnable(l,sortList);
  816 + updateEditEnable(l, sortList);
746 817 sortList.add(l);
747 818 }
748 819 }
... ... @@ -760,9 +831,9 @@
760 831 if (!tmp.isEmpty()) {
761 832 min = tmp.get(tmp.size() - 1).getDate();
762 833 }
763   - updateAutoMatdel(list,list,0,dueDate,sortList,null,null);
764   - if(size!=list.size()){
765   - list1 = new ArrayList();
  834 + updateAutoMatdel(list, list, 0, dueDate, sortList, null, null);
  835 + if (size != list.size()) {
  836 + list1 = new ArrayList();
766 837 }
767 838 /*if(null==dueDate){
768 839 dueDate= new Date();
... ... @@ -770,7 +841,7 @@
770 841 List l = buildPatientList(dueDate, list, list1, min, true);
771 842 if (!l.isEmpty()) {
772 843 sort(l);
773   - updateEditEnable(l,sortList);
  844 + updateEditEnable(l, sortList);
774 845 sortList.add(l);
775 846 }
776 847 }
777 848  
778 849  
... ... @@ -782,17 +853,17 @@
782 853 /**
783 854 * 处理自动分娩的情况
784 855 */
785   - private void updateAutoMatdel(List<Patients> patientses,List<Patients> list,int i,Date dueDate,List sortList,List<SortIn> listDate, Map map ){
  856 + private void updateAutoMatdel(List<Patients> patientses, List<Patients> list, int i, Date dueDate, List sortList, List<SortIn> listDate, Map map) {
786 857 Iterator<Patients> iterator = patientses.iterator();
787   - Organization organization=null;
788   - String pid="";
789   - List listData=new ArrayList();
  858 + Organization organization = null;
  859 + String pid = "";
  860 + List listData = new ArrayList();
790 861 while (iterator.hasNext()) {
791 862 Patients patients = iterator.next();
792 863 //处理建档就分娩的情况
793 864 Date date = DateUtil.addWeek(patients.getLastMenses(), 42);
794 865 Date currentDate = DateUtil.formatDate(patients.getCreated());
795   - if (date.getTime() <= currentDate.getTime()||patients.getBuildType()==2) {
  866 + if (date.getTime() <= currentDate.getTime() || patients.getBuildType() == 2) {
796 867 //建档记录
797 868 if (null != patients.getHospitalId()) {
798 869 organization = organizationService.getOrganization(Integer.valueOf(patients.getHospitalId()));
799 870  
800 871  
... ... @@ -801,14 +872,14 @@
801 872 listData.add(new AntData(patients, null != organization ? organization.getName() : ""));
802 873  
803 874  
804   - if(null==dueDate &&null!=patients.getFmDate()){
805   - dueDate=patients.getFmDate();
  875 + if (null == dueDate && null != patients.getFmDate()) {
  876 + dueDate = patients.getFmDate();
806 877 }
807 878  
808   - if(null!=map){
  879 + if (null != map) {
809 880 Object obj = map.get(listDate.get(i).getId());
810 881 if (obj instanceof MaternalDeliverModel) {
811   - MaternalDeliverModel model= (MaternalDeliverModel)obj;
  882 + MaternalDeliverModel model = (MaternalDeliverModel) obj;
812 883 if (null != model.getHospitalId()) {
813 884 organization = organizationService.getOrganization(Integer.valueOf(model.getHospitalId()));
814 885 }
... ... @@ -821,8 +892,8 @@
821 892 postReviewQuery.setStart(dueDate);
822 893 if (CollectionUtils.isNotEmpty(listDate)) {
823 894 //下次建档记录前都是产后复查,如果没有下个产程的数据就直接显示
824   - if(listDate.size()>1 && i >1){
825   - postReviewQuery.setEnd(listDate.get(i-1).getDate());
  895 + if (listDate.size() > 1 && i > 1) {
  896 + postReviewQuery.setEnd(listDate.get(i - 1).getDate());
826 897 }
827 898 }
828 899 }
... ... @@ -833,7 +904,7 @@
833 904 List<PostReviewModel> reviewModels = postReviewService.findWithList(postReviewQuery);
834 905 if (CollectionUtils.isNotEmpty(reviewModels)) {
835 906 for (PostReviewModel postReviewModel : reviewModels) {
836   - if(postReviewModel.getYn()==YnEnums.YES.getId()) {
  907 + if (postReviewModel.getYn() == YnEnums.YES.getId()) {
837 908 if (null != postReviewModel.getHospitalId()) {
838 909 organization = organizationService.getOrganization(Integer.valueOf(postReviewModel.getHospitalId()));
839 910 }
840 911  
841 912  
842 913  
843 914  
844 915  
... ... @@ -846,31 +917,29 @@
846 917 iterator.remove();
847 918 updateEditEnable(listData, sortList);
848 919 sortList.add(listData);
849   - listData=new ArrayList();
  920 + listData = new ArrayList();
850 921 }
851 922 }
852 923 }
853 924  
854 925  
855 926 /**
856   - *
857 927 * 修改按钮控制
858 928 *
859   - *
860   - * @param list 同一产程记录
  929 + * @param list 同一产程记录
861 930 * @param sortList 排序的结果
862 931 */
863   - private void updateEditEnable(List<AntData> list,List<List<AntData>> sortList){
  932 + private void updateEditEnable(List<AntData> list, List<List<AntData>> sortList) {
864 933 //如果上个产程有数据,并且本产程有记录就设置上个产程不可编辑
865   - if(CollectionUtils.isNotEmpty(sortList) &&CollectionUtils.isNotEmpty(list)){
866   - List<AntData> l = sortList.get(0);
867   - for(AntData antData:l){
  934 + if (CollectionUtils.isNotEmpty(sortList) && CollectionUtils.isNotEmpty(list)) {
  935 + List<AntData> l = sortList.get(0);
  936 + for (AntData antData : l) {
868 937 antData.setEnableEdit("0");
869 938 }
870 939 }
871 940 //如果最后一条是复查 4 5 6 分娩 复查 终止妊娠
872   - if("456".indexOf(list.get(list.size()-1).getType())>-1){
873   - for(int i=0;i<list.size()-1;i++){
  941 + if ("456".indexOf(list.get(list.size() - 1).getType()) > -1) {
  942 + for (int i = 0; i < list.size() - 1; i++) {
874 943 list.get(i).setEnableEdit("0");
875 944 }
876 945 }
877 946  
878 947  
879 948  
880 949  
881 950  
882 951  
883 952  
884 953  
885 954  
... ... @@ -917,53 +986,53 @@
917 986 }
918 987  
919 988  
920   - //初诊记录
921   - AntExChuQuery antExChuQuery = new AntExChuQuery();
922   - antExChuQuery.setYn(YnEnums.YES.getId());
923   - if (!f) {
924   - if (null == min) {
925   - antExChuQuery.setStart(patientses.get(0).getBookbuildingDate());
926   - antExChuQuery.setEnd(new Date(end.getTime() + 86398000));
927   - } else {
928   - antExChuQuery.setStart(min);
929   - antExChuQuery.setEnd(end);
930   - }
  989 + //初诊记录
  990 + AntExChuQuery antExChuQuery = new AntExChuQuery();
  991 + antExChuQuery.setYn(YnEnums.YES.getId());
  992 + if (!f) {
  993 + if (null == min) {
  994 + antExChuQuery.setStart(patientses.get(0).getBookbuildingDate());
  995 + antExChuQuery.setEnd(new Date(end.getTime() + 86398000));
  996 + } else {
  997 + antExChuQuery.setStart(min);
  998 + antExChuQuery.setEnd(end);
931 999 }
932   - antExChuQuery.setPid(pid);
  1000 + }
  1001 + antExChuQuery.setPid(pid);
933 1002  
934   - List<AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery);
935   - if (CollectionUtils.isNotEmpty(antExChuModels)) {
936   - for (AntExChuModel an : antExChuModels) {
937   - if (null != an.getHospitalId()) {
938   - organization = organizationService.getOrganization(Integer.valueOf(an.getHospitalId()));
939   - }
940   - listData.add(new AntData(an, null != organization ? organization.getName() : "", patientses.get(0).getLastMenses()));
  1003 + List<AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery);
  1004 + if (CollectionUtils.isNotEmpty(antExChuModels)) {
  1005 + for (AntExChuModel an : antExChuModels) {
  1006 + if (null != an.getHospitalId()) {
  1007 + organization = organizationService.getOrganization(Integer.valueOf(an.getHospitalId()));
941 1008 }
  1009 + listData.add(new AntData(an, null != organization ? organization.getName() : "", patientses.get(0).getLastMenses()));
942 1010 }
  1011 + }
943 1012  
944   - //复诊记录
945   - AntExQuery antExQuery = new AntExQuery();
946   - antExQuery.setYn(YnEnums.YES.getId());
947   - antExQuery.setPid(pid);
948   - if (!f) {
949   - if (null == min) {
950   - antExQuery.setStart(patientses.get(0).getBookbuildingDate());
951   - antExQuery.setEnd(new Date(end.getTime() + 86398000));
952   - } else {
953   - antExQuery.setStart(min);
954   - antExQuery.setEnd(end);
955   - }
  1013 + //复诊记录
  1014 + AntExQuery antExQuery = new AntExQuery();
  1015 + antExQuery.setYn(YnEnums.YES.getId());
  1016 + antExQuery.setPid(pid);
  1017 + if (!f) {
  1018 + if (null == min) {
  1019 + antExQuery.setStart(patientses.get(0).getBookbuildingDate());
  1020 + antExQuery.setEnd(new Date(end.getTime() + 86398000));
  1021 + } else {
  1022 + antExQuery.setStart(min);
  1023 + antExQuery.setEnd(end);
956 1024 }
  1025 + }
957 1026  
958   - List<AntenatalExaminationModel> list1 = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery());
959   - if (CollectionUtils.isNotEmpty(list1)) {
960   - for (AntenatalExaminationModel an : list1) {
961   - if (null != an.getHospitalId()) {
962   - organization = organizationService.getOrganization(Integer.valueOf(an.getHospitalId()));
963   - }
964   - listData.add(new AntData(an, null != organization ? organization.getName() : "", patientses.get(0).getLastMenses()));
  1027 + List<AntenatalExaminationModel> list1 = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery());
  1028 + if (CollectionUtils.isNotEmpty(list1)) {
  1029 + for (AntenatalExaminationModel an : list1) {
  1030 + if (null != an.getHospitalId()) {
  1031 + organization = organizationService.getOrganization(Integer.valueOf(an.getHospitalId()));
965 1032 }
  1033 + listData.add(new AntData(an, null != organization ? organization.getName() : "", patientses.get(0).getLastMenses()));
966 1034 }
  1035 + }
967 1036 return listData;
968 1037 }
969 1038  
... ... @@ -1193,9 +1262,9 @@
1193 1262 }
1194 1263 antExQuery.setId(null);
1195 1264 list = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery());
1196   - if(CollectionUtils.isNotEmpty(list)){
1197   - for(int i=0;i<list.size();i++){
1198   - if(list.get(i).getId().equals(antExQueryRequest.getId())){
  1265 + if (CollectionUtils.isNotEmpty(list)) {
  1266 + for (int i = 0; i < list.size(); i++) {
  1267 + if (list.get(i).getId().equals(antExQueryRequest.getId())) {
1199 1268 list.remove(i);
1200 1269 }
1201 1270 }
... ... @@ -1205,7 +1274,7 @@
1205 1274 antenatalExaminationService.updateOneAnt(antEx, antExQueryRequest.getId());
1206 1275  
1207 1276  
1208   - AntenatalExaminationModel antenatalExaminationModel= antenatalExaminationService.findOneById(antExQueryRequest.getId());
  1277 + AntenatalExaminationModel antenatalExaminationModel = antenatalExaminationService.findOneById(antExQueryRequest.getId());
1209 1278  
1210 1279 updateLastRisk(antenatalExaminationModel.getParentId());
1211 1280  
... ... @@ -1236,9 +1305,9 @@
1236 1305  
1237 1306 list = antenatalExaminationService.queryAntExChu(antExQuery);
1238 1307  
1239   - if(CollectionUtils.isNotEmpty(list)){
1240   - for(int i=0;i<list.size();i++){
1241   - if(list.get(i).getId().equals(antExQueryRequest.getId())){
  1308 + if (CollectionUtils.isNotEmpty(list)) {
  1309 + for (int i = 0; i < list.size(); i++) {
  1310 + if (list.get(i).getId().equals(antExQueryRequest.getId())) {
1242 1311 list.remove(i);
1243 1312 }
1244 1313 }
1245 1314  
... ... @@ -1247,11 +1316,11 @@
1247 1316 if (CollectionUtils.isEmpty(list)) {
1248 1317 antenatalExaminationService.updateAntExChu(antExChuModel, antExQueryRequest.getId());
1249 1318  
1250   - AntExChuModel antExChuModel1= antenatalExaminationService.findOne(antExQueryRequest.getId());
  1319 + AntExChuModel antExChuModel1 = antenatalExaminationService.findOne(antExQueryRequest.getId());
1251 1320  
1252 1321 updateLastRisk(antExChuModel1.getParentId());
1253 1322  
1254   - }else{
  1323 + } else {
1255 1324 return new BaseResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR).setErrormsg("当前产检记录不是本院最新的产检记录,不能删除");
1256 1325 }
1257 1326 }
1258 1327  
1259 1328  
1260 1329  
1261 1330  
1262 1331  
1263 1332  
1264 1333  
... ... @@ -1261,28 +1330,30 @@
1261 1330  
1262 1331 /**
1263 1332 * 删除的时候设置最新的高危
  1333 + *
1264 1334 * @param parentId
1265 1335 */
1266   - private void updateLastRisk(String parentId){
1267   - Patients patients= patientsService.findOnePatientById(parentId);
  1336 + private void updateLastRisk(String parentId) {
  1337 + Patients patients = patientsService.findOnePatientById(parentId);
1268 1338  
1269   - PatientsQuery patientsQuery1=new PatientsQuery();
  1339 + PatientsQuery patientsQuery1 = new PatientsQuery();
1270 1340 patientsQuery1.setPid(patients.getPid());
1271 1341 patientsQuery1.setYn(YnEnums.YES.getId());
1272 1342 patientsQuery1.setType(1);
1273   - Patients patients1=new Patients();
  1343 + Patients patients1 = new Patients();
1274 1344 patients1.setModified(new Date());
1275 1345  
1276   - HighScoreResult highScoreResult= findLastRisk(patients.getPid(),true);
  1346 + HighScoreResult highScoreResult = findLastRisk(patients.getPid(), true);
1277 1347 patients1.setRiskScore(highScoreResult.getScore());
1278   - if(CollectionUtils.isNotEmpty(highScoreResult.getHighId())) {
  1348 + if (CollectionUtils.isNotEmpty(highScoreResult.getHighId())) {
1279 1349 patients1.setRiskFactorId(highScoreResult.getHighId());
1280 1350 }
1281   - if(CollectionUtils.isNotEmpty(highScoreResult.getLevelId())){
  1351 + if (CollectionUtils.isNotEmpty(highScoreResult.getLevelId())) {
1282 1352 patients1.setRiskLevelId(JsonUtil.array2JsonString(highScoreResult.getLevelId()));
1283 1353 }
1284 1354 patientsService.findAndModify(patientsQuery1, patients1);
1285 1355 }
  1356 +
1286 1357 /**
1287 1358 * 根据身份证号或者就诊卡号查询产妇
1288 1359 *
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java View file @ 8fe1e7f
... ... @@ -219,6 +219,16 @@
219 219 String nextDateStr = riskPatientsQueryRequest.getBuildTime();
220 220 String[] dates = nextDateStr.split(" - ");
221 221  
  222 + patientsQuery.setLastRhTimeStart(DateUtil.parseYMD(dates[0]));
  223 + if(dates.length==2){
  224 + patientsQuery.setLastRhTimeEnd(DateUtil.parseYMD(dates[1]));
  225 + }
  226 + }
  227 +
  228 + if(StringUtils.isNotEmpty(riskPatientsQueryRequest.getLastRhTime())){
  229 + String nextDateStr = riskPatientsQueryRequest.getLastRhTime();
  230 + String[] dates = nextDateStr.split(" - ");
  231 +
222 232 patientsQuery.setBookbuildingDateStart(DateUtil.parseYMD(dates[0]));
223 233 if(dates.length==2){
224 234 patientsQuery.setBookbuildingDateEnd(DateUtil.parseYMD(dates[1]));
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/RiskPatientsQueryRequest.java View file @ 8fe1e7f
... ... @@ -63,10 +63,19 @@
63 63 private Integer expVip;
64 64 //建档时间
65 65 private String buildTime;
66   - //
  66 + //最后一次医院定义的高危
  67 + private String lastRhTime;
67 68  
68 69 // 0 高危孕妇 1 全部孕妇 2全部产妇
69 70 private Integer queryType;
  71 +
  72 + public String getLastRhTime() {
  73 + return lastRhTime;
  74 + }
  75 +
  76 + public void setLastRhTime(String lastRhTime) {
  77 + this.lastRhTime = lastRhTime;
  78 + }
70 79  
71 80 public String getBuildTime() {
72 81 return buildTime;