Commit 1211c2cfb6e69810d592f8e9818e911423e72e35

Authored by hanshaofeng

Merge remote-tracking branch 'origin/master'

Showing 38 changed files

platform-biz-service/src/main/resources/mainOrm/master/MasterRoles.xml View file @ 1211c2c
... ... @@ -22,7 +22,7 @@
22 22 insert into roles (type,name,publish_id,publish_name,yn,enable,modified,created,remarks,shortCode,orgid
23 23 <if test="id != null and id >= 0">
24 24 ,id
25   - </if>) values (#{type},#{name},#{publishId},#{publishName},#{yn},#{enable},#{modified},#{created},#{remarks},#{shortCode},#{orgid}
  25 + </if>) values (#{type},#{name},#{publishId},#{publishName},#{yn},#{enable},#{modified},#{created},#{remarks},#{shortCode},#{orgId}
26 26 <if test="id != null and id >= 0">
27 27 ,#{id}
28 28 </if>
... ... @@ -66,8 +66,8 @@
66 66 <if test="shortCode != null">
67 67 shortCode = #{shortCode,jdbcType=VARCHAR},
68 68 </if>
69   - <if test="orgid != null">
70   - orgid =#{orgid,jdbcType=INTEGER},
  69 + <if test="orgId != null">
  70 + orgid =#{orgId,jdbcType=INTEGER},
71 71 </if>
72 72 </set>
73 73 where id = #{id,jdbcType=INTEGER}
platform-biz-service/src/main/resources/mainOrm/slave/Roles.xml View file @ 1211c2c
... ... @@ -22,7 +22,7 @@
22 22 insert into roles (type,name,publish_id,publish_name,yn,enable,modified,created,remarks,shortCode,orgid
23 23 <if test="id != null and id >= 0">
24 24 ,id
25   - </if>) values (#{type},#{name},#{publishId},#{publishName},#{yn},#{enable},#{modified},#{created},#{remarks},#{shortCode},#{orgid}
  25 + </if>) values (#{type},#{name},#{publishId},#{publishName},#{yn},#{enable},#{modified},#{created},#{remarks},#{shortCode},#{orgId}
26 26 <if test="id != null and id >= 0">
27 27 ,#{id}
28 28 </if>
... ... @@ -66,8 +66,8 @@
66 66 <if test="shortCode != null">
67 67 shortCode = #{shortCode,jdbcType=VARCHAR},
68 68 </if>
69   - <if test="orgid != null">
70   - orgid =#{orgid,jdbcType=INTEGER},
  69 + <if test="orgId != null">
  70 + orgid =#{orgId,jdbcType=INTEGER},
71 71 </if>
72 72 </set>
73 73 where id = #{id,jdbcType=INTEGER}
platform-common/src/main/java/com/lyms/platform/common/utils/CacheHelper.java View file @ 1211c2c
... ... @@ -15,12 +15,6 @@
15 15 .newBuilder()
16 16 .maximumSize(size)
17 17 .expireAfterAccess(minutes, TimeUnit.MINUTES)
18   - .removalListener(new RemovalListener<K, V>() {
19   - @Override
20   - public void onRemoval(RemovalNotification<K, V> rn) {
21   - System.out.println(rn.getKey() + "被移除");
22   - }
23   - })
24 18 .build(cacheLoader);
25 19 return cache;
26 20 }
platform-dal/src/main/java/com/lyms/platform/pojo/AntExChuModel.java View file @ 1211c2c
... ... @@ -301,8 +301,16 @@
301 301 private String ydqjd;
302 302  
303 303 private Date modified;
  304 + //操作人
  305 + private Integer operator;
304 306  
  307 + public Integer getOperator() {
  308 + return operator;
  309 + }
305 310  
  311 + public void setOperator(Integer operator) {
  312 + this.operator = operator;
  313 + }
306 314  
307 315 public String getCestationInfo() {
308 316 return cestationInfo;
platform-dal/src/main/java/com/lyms/platform/pojo/AntenatalExaminationModel.java View file @ 1211c2c
... ... @@ -92,6 +92,16 @@
92 92 private Date modified;
93 93 private String hospitalId;
94 94 private String cDueWeek;
  95 + //操作人
  96 + private Integer operator;
  97 +
  98 + public Integer getOperator() {
  99 + return operator;
  100 + }
  101 +
  102 + public void setOperator(Integer operator) {
  103 + this.operator = operator;
  104 + }
95 105  
96 106 public String getPid() {
97 107 return pid;
platform-dal/src/main/java/com/lyms/platform/pojo/BabyModel.java View file @ 1211c2c
... ... @@ -207,6 +207,16 @@
207 207 //分娩孕周
208 208 private Integer dueWeek;
209 209 private String enable;
  210 + //操作人
  211 + private Integer operator;
  212 +
  213 + public Integer getOperator() {
  214 + return operator;
  215 + }
  216 +
  217 + public void setOperator(Integer operator) {
  218 + this.operator = operator;
  219 + }
210 220  
211 221 public String getEnable() {
212 222 return enable;
platform-dal/src/main/java/com/lyms/platform/pojo/MaternalDeliverModel.java View file @ 1211c2c
... ... @@ -30,14 +30,25 @@
30 30 //胎盘
31 31 private String placenta;
32 32 private String deathCauseText;
  33 + //操作人
  34 + private Integer operator;
  35 +
  36 + public Integer getOperator() {
  37 + return operator;
  38 + }
  39 +
  40 + public void setOperator(Integer operator) {
  41 + this.operator = operator;
  42 + }
  43 +
33 44 /*//心率
34   - private double heartRate;
35   - //胎方位
36   - private String fetalPosition;
37   - //胎先露
38   - private String fetalPresentation;
39   - // 衔接
40   - private String join;*/
  45 + private double heartRate;
  46 + //胎方位
  47 + private String fetalPosition;
  48 + //胎先露
  49 + private String fetalPresentation;
  50 + // 衔接
  51 + private String join;*/
41 52 //存放胎盘信息
42 53 private List placentas;
43 54 //分娩方式
platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java View file @ 1211c2c
... ... @@ -227,6 +227,37 @@
227 227 private String enable;
228 228 //最后一次高危时间
229 229 private Date lastRhTime;
  230 + //本院最后一次产检时间
  231 + private Date lastCTime;
  232 + //本院产后复查次数
  233 + private Integer postViewTimes;
  234 + //操作人
  235 + private Integer operator;
  236 +
  237 +
  238 + public Date getLastCTime() {
  239 + return lastCTime;
  240 + }
  241 +
  242 + public void setLastCTime(Date lastCTime) {
  243 + this.lastCTime = lastCTime;
  244 + }
  245 +
  246 + public Integer getPostViewTimes() {
  247 + return postViewTimes;
  248 + }
  249 +
  250 + public void setPostViewTimes(Integer postViewTimes) {
  251 + this.postViewTimes = postViewTimes;
  252 + }
  253 +
  254 + public Integer getOperator() {
  255 + return operator;
  256 + }
  257 +
  258 + public void setOperator(Integer operator) {
  259 + this.operator = operator;
  260 + }
230 261  
231 262 public Date getLastRhTime() {
232 263 return lastRhTime;
platform-dal/src/main/java/com/lyms/platform/pojo/PostReviewModel.java View file @ 1211c2c
... ... @@ -93,7 +93,16 @@
93 93 private Date modified;
94 94 private String hospitalId;
95 95  
  96 + //操作人
  97 + private Integer operator;
96 98  
  99 + public Integer getOperator() {
  100 + return operator;
  101 + }
  102 +
  103 + public void setOperator(Integer operator) {
  104 + this.operator = operator;
  105 + }
97 106  
98 107 public String getPid() {
99 108 return pid;
platform-dal/src/main/java/com/lyms/platform/pojo/ReferralApplyOrderModel.java View file @ 1211c2c
... ... @@ -83,6 +83,16 @@
83 83 private Integer type;
84 84  
85 85 private Integer serviceType;
  86 + //操作人
  87 + private String operator;
  88 +
  89 + public String getOperator() {
  90 + return operator;
  91 + }
  92 +
  93 + public void setOperator(String operator) {
  94 + this.operator = operator;
  95 + }
86 96  
87 97 public Integer getDays() {
88 98 return days;
platform-dal/src/main/java/com/lyms/platform/pojo/SieveApplyOrderModel.java View file @ 1211c2c
... ... @@ -26,7 +26,16 @@
26 26 private Integer status;
27 27 private String hospitalId;
28 28 private Integer yn;
  29 + //操作人
  30 + private String operator;
29 31  
  32 + public String getOperator() {
  33 + return operator;
  34 + }
  35 +
  36 + public void setOperator(String operator) {
  37 + this.operator = operator;
  38 + }
30 39 private Date modified;
31 40  
32 41 public String getHospitalId() {
platform-dal/src/main/java/com/lyms/platform/query/AntExChuQuery.java View file @ 1211c2c
... ... @@ -153,19 +153,10 @@
153 153 }
154 154 }
155 155  
156   - if(null!=gteModified){
157   - if (null != c) {
158   - c = c.where("modified").gte(gteModified);
159   - } else {
160   - c = Criteria.where("modified").gte(gteModified);
161   - }
162   - }
163   - if(null!=gteCreated){
164   - if (null != c) {
165   - c = c.where("created").gte(gteCreated);
166   - } else {
167   - c = Criteria.where("created").gte(gteCreated);
168   - }
  156 + if (null != gteModified && null != gteCreated) {
  157 + MongoCondition mongoCondition = new MongoCondition("modified", gteModified, MongoOper.GTE);
  158 + MongoCondition condition2 = new MongoCondition("created", gteCreated, MongoOper.GTE);
  159 + condition = condition.orCondition(new MongoCondition[]{mongoCondition, condition2});
169 160 }
170 161  
171 162 if (null != c) {
platform-dal/src/main/java/com/lyms/platform/query/AntExQuery.java View file @ 1211c2c
... ... @@ -135,19 +135,10 @@
135 135 }
136 136 isAddStart = Boolean.TRUE;
137 137 }
138   - if(null!=gteModified){
139   - if (null != c) {
140   - c = c.where("modified").gte(gteModified);
141   - } else {
142   - c = Criteria.where("modified").gte(gteModified);
143   - }
144   - }
145   - if(null!=gteCreated){
146   - if (null != c) {
147   - c = c.where("created").gte(gteCreated);
148   - } else {
149   - c = Criteria.where("created").gte(gteCreated);
150   - }
  138 + if (null != gteModified && null != gteCreated) {
  139 + MongoCondition mongoCondition = new MongoCondition("modified", gteModified, MongoOper.GTE);
  140 + MongoCondition condition2 = new MongoCondition("created", gteCreated, MongoOper.GTE);
  141 + condition = condition.orCondition(new MongoCondition[]{mongoCondition, condition2});
151 142 }
152 143  
153 144  
platform-dal/src/main/java/com/lyms/platform/query/BabyCheckModelQuery.java View file @ 1211c2c
... ... @@ -29,6 +29,8 @@
29 29 //建档IDs
30 30 private String[] buildIds;
31 31  
  32 + private String hospitalId;
  33 +
32 34 @Override
33 35 public MongoQuery convertToQuery() {
34 36 MongoCondition condition = MongoCondition.newInstance();
35 37  
... ... @@ -42,11 +44,22 @@
42 44 if(null!=buildId){
43 45 condition=condition.and("buildId", buildId, MongoOper.IS);
44 46 }
  47 + if(null!=hospitalId){
  48 + condition=condition.and("hospitalId",hospitalId,MongoOper.IS);
  49 + }
45 50 if(null!=buildIds && buildIds.length > 0){
46 51 Criteria c = Criteria.where("buildId").in(Arrays.asList(buildIds));
47 52 condition.andCondition( new MongoCondition(c));
48 53 }
49 54 return condition.toMongoQuery();
  55 + }
  56 +
  57 + public String getHospitalId() {
  58 + return hospitalId;
  59 + }
  60 +
  61 + public void setHospitalId(String hospitalId) {
  62 + this.hospitalId = hospitalId;
50 63 }
51 64  
52 65 public String getId() {
platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java View file @ 1211c2c
... ... @@ -35,6 +35,28 @@
35 35  
36 36 private Integer[] orServiceStatus;
37 37  
  38 + //大于修改时间
  39 + private Date gteModified;
  40 + //大于创建时间
  41 + //大于创建时间
  42 + private Date gteCreated;
  43 +
  44 + public Date getGteModified() {
  45 + return gteModified;
  46 + }
  47 +
  48 + public void setGteModified(Date gteModified) {
  49 + this.gteModified = gteModified;
  50 + }
  51 +
  52 + public Date getGteCreated() {
  53 + return gteCreated;
  54 + }
  55 +
  56 + public void setGteCreated(Date gteCreated) {
  57 + this.gteCreated = gteCreated;
  58 + }
  59 +
38 60 public Integer getBuildType() {
39 61 return buildType;
40 62 }
... ... @@ -458,6 +480,12 @@
458 480 Criteria cr = Criteria.where("nextDate").gte(nextDateStart).lte(nextDateEnd);
459 481 condition.andCondition(new MongoCondition(cr));
460 482  
  483 + }
  484 +
  485 + if (null != gteModified && null != gteCreated) {
  486 + MongoCondition mongoCondition = new MongoCondition("modified", gteModified, MongoOper.GTE);
  487 + MongoCondition condition2 = new MongoCondition("created", gteCreated, MongoOper.GTE);
  488 + condition = condition.orCondition(new MongoCondition[]{mongoCondition, condition2});
461 489 }
462 490  
463 491 if (null != birthEnd) {
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java View file @ 1211c2c
... ... @@ -57,7 +57,14 @@
57 57 this.dueStatus = dueStatus;
58 58 }
59 59  
  60 + public boolean isGtePostTimes() {
  61 + return gtePostTimes;
  62 + }
60 63  
  64 + public void setGtePostTimes(boolean gtePostTimes) {
  65 + this.gtePostTimes = gtePostTimes;
  66 + }
  67 +
61 68 /**
62 69 * 访视状态
63 70 */
... ... @@ -80,6 +87,20 @@
80 87 private Date lastRhTimeEnd;
81 88 private Date lastMensesNeEnd;
82 89  
  90 + //本院最后一次产检时间
  91 + private Date lastCTimeStart;
  92 + private Date lastCTimeEnd;
  93 + private Integer postViewTimes;
  94 + private boolean gtePostTimes=false;
  95 +
  96 + public Integer getPostViewTimes() {
  97 + return postViewTimes;
  98 + }
  99 +
  100 + public void setPostViewTimes(Integer postViewTimes) {
  101 + this.postViewTimes = postViewTimes;
  102 + }
  103 +
83 104 public Date getLastMensesNeEnd() {
84 105 return lastMensesNeEnd;
85 106 }
... ... @@ -127,7 +148,7 @@
127 148 */
128 149 private String phone;
129 150 /**
130   - * 产妇分娩日
  151 + * 预产
131 152 */
132 153 private Date dueDateStart;
133 154  
... ... @@ -227,6 +248,23 @@
227 248 //大于创建时间
228 249 private Date gteCreated;
229 250  
  251 +
  252 + public Date getLastCTimeStart() {
  253 + return lastCTimeStart;
  254 + }
  255 +
  256 + public void setLastCTimeStart(Date lastCTimeStart) {
  257 + this.lastCTimeStart = lastCTimeStart;
  258 + }
  259 +
  260 + public Date getLastCTimeEnd() {
  261 + return lastCTimeEnd;
  262 + }
  263 +
  264 + public void setLastCTimeEnd(Date lastCTimeEnd) {
  265 + this.lastCTimeEnd = lastCTimeEnd;
  266 + }
  267 +
230 268 public Date getGteCreated() {
231 269 return gteCreated;
232 270 }
... ... @@ -608,7 +646,7 @@
608 646 }
609 647 Criteria c1 = null;
610 648 if (fmDateStart != null && fmDateEnd != null) {
611   - c1 = Criteria.where("fmDate").gte(fmDateStart).lte(fmDateEnd);
  649 + c1 = Criteria.where("fmDate").gte(fmDateStart).lte(fmDateEnd);
612 650 }
613 651  
614 652 if (null != serviceType) {
615 653  
616 654  
617 655  
618 656  
... ... @@ -649,16 +687,24 @@
649 687 if (-1 != type) {
650 688 condition = condition.and("type", type, MongoOper.IS);
651 689 }
  690 + if(null!=postViewTimes){
  691 + if(gtePostTimes){
  692 + condition = condition.and("postViewTimes", postViewTimes, MongoOper.GTE);
  693 + }else{
  694 + condition = condition.and("postViewTimes", postViewTimes, MongoOper.IS);
  695 + }
  696 + }
652 697  
653 698 if (null != lastRhTimeStart) {
654   - if(null!=c1){
  699 + if (null != c1) {
655 700 c1 = c1.and("lastRhTime").gte(lastRhTimeStart);
656   - }else {
  701 + } else {
657 702 c1 = Criteria.where("lastRhTime").gte(lastRhTimeStart);
658 703 }
659 704 }
  705 +
660 706 if (null != lastRhTimeEnd) {
661   - if (null!=c1) {
  707 + if (null != c1) {
662 708 c1 = c1.lte(lastRhTimeEnd);
663 709 } else {
664 710 c1 = Criteria.where("lastRhTime").lte(lastRhTimeEnd);
665 711  
666 712  
... ... @@ -666,14 +712,14 @@
666 712 }
667 713 if (null != hScoreStart) {
668 714 if (null != hScoreStart) {
669   - if(null!=c1){
  715 + if (null != c1) {
670 716 c1 = c1.and("riskScore").gte(hScoreStart);
671   - }else{
  717 + } else {
672 718 c1 = Criteria.where("riskScore").gte(hScoreStart);
673 719 }
674 720 }
675 721 if (null != hScoreEnd) {
676   - if (null!=c1) {
  722 + if (null != c1) {
677 723 c1 = c1.lte(hScoreEnd);
678 724 } else {
679 725 c1 = Criteria.where("riskScore").lte(hScoreEnd);
680 726  
681 727  
682 728  
683 729  
684 730  
685 731  
686 732  
687 733  
688 734  
689 735  
690 736  
... ... @@ -684,53 +730,49 @@
684 730 }
685 731  
686 732 if (null != bookbuildingDateStart) {
687   - if(c1!=null){
  733 + if (c1 != null) {
688 734 c1 = c1.and("bookbuildingDate").gte(bookbuildingDateStart);
689   - }else{
  735 + } else {
690 736 c1 = Criteria.where("bookbuildingDate").gte(bookbuildingDateStart);
691 737 }
692 738 }
693 739 if (null != bookbuildingDateEnd) {
694   - if (null!=c1) {
  740 + if (null != c1) {
695 741 c1 = c1.lte(bookbuildingDateEnd);
696 742 } else {
697 743 c1 = Criteria.where("bookbuildingDate").lte(bookbuildingDateEnd);
698 744 }
699 745 }
  746 + if (null != gteModified && null != gteCreated) {
  747 + MongoCondition mongoCondition = new MongoCondition("modified", gteModified, MongoOper.GTE);
  748 + MongoCondition condition2 = new MongoCondition("created", gteCreated, MongoOper.GTE);
  749 + condition = condition.orCondition(new MongoCondition[]{mongoCondition, condition2});
  750 + }
700 751  
701   - if (null != gteModified) {
702   - if (null!=c1) {
703   - c1 = c1.where("modified").gte(gteModified);
  752 + if(null != lastCTimeStart){
  753 + if (null != c1) {
  754 + c1 = c1.and("lastCTime").gte(lastCTimeStart);
704 755 } else {
705   - c1 = Criteria.where("modified").gte(gteModified);
  756 + c1 = Criteria.where("lastCTime").gte(lastCTimeStart);
706 757 }
707 758 }
708   -
709   - if(null!=gteCreated){
710   - if (null != c1) {
711   - c1 = c1.where("created").gte(gteCreated);
  759 + if (null != lastCTimeEnd) {
  760 + if (c1 != null) {
  761 + c1 = c1.lte(lastCTimeEnd);
712 762 } else {
713   - c1 = Criteria.where("created").gte(gteCreated);
  763 + c1 = Criteria.where("lastCTime").lte(lastCTimeEnd);
714 764 }
715 765 }
716 766  
717   -// Criteria cr1 = Criteria.where("bookbuildingDate").gte(bookbuildingDateStart).lte(bookbuildingDateEnd);
718   -// Criteria cr = cr1.where("lastMenses").gte(lastMensesStart).lte(lastMensesEnd);
719   -
720   - /*if(null!=c1){
721   - return new MongoCondition(condition.getCriteria().andOperator(new Criteria[]{c1})).toMongoQuery();
722   - }*/
723   - /**/
724   -// Criteria c = null;
725 767 if (null != lastMensesStart) {
726   - if(null!=c1){
  768 + if (null != c1) {
727 769 c1 = c1.and("lastMenses").gte(lastMensesStart);
728   - }else{
  770 + } else {
729 771 c1 = Criteria.where("lastMenses").gte(lastMensesStart);
730 772 }
731 773 }
732 774 if (null != lastMensesEnd) {
733   - if (c1!=null) {
  775 + if (c1 != null) {
734 776 c1 = c1.lte(lastMensesEnd);
735 777 } else {
736 778 c1 = Criteria.where("lastMenses").lte(lastMensesEnd);
... ... @@ -738,7 +780,7 @@
738 780 }
739 781  
740 782 if (null != lastMensesNeEnd) {
741   - if (c1!=null) {
  783 + if (c1 != null) {
742 784 c1 = c1.lt(lastMensesNeEnd);
743 785 } else {
744 786 c1 = Criteria.where("lastMenses").lt(lastMensesNeEnd);
745 787  
746 788  
747 789  
748 790  
749 791  
... ... @@ -746,29 +788,29 @@
746 788 }
747 789  
748 790 if (null != dueDateStart) {
749   - if(null!=c1){
  791 + if (null != c1) {
750 792 c1 = c1.and("dueDate").gte(dueDateStart);
751   - }else{
  793 + } else {
752 794 c1 = Criteria.where("dueDate").gte(dueDateStart);
753 795 }
754 796 }
755 797 if (null != dueDateEnd) {
756   - if (null!=c1) {
  798 + if (null != c1) {
757 799 c1 = c1.lte(dueDateEnd);
758 800 } else {
759 801 c1 = Criteria.where("dueDate").lte(dueDateEnd);
760 802 }
761 803 }
762 804 if (null != birthStart) {
763   - if (null!=c1) {
  805 + if (null != c1) {
764 806 c1 = c1.and("birth").gte(birthStart);
765   - }else {
  807 + } else {
766 808 c1 = Criteria.where("birth").gte(birthStart);
767 809 }
768 810 }
769 811  
770 812 if (null != birthEnd) {
771   - if (null!=c1) {
  813 + if (null != c1) {
772 814 c1 = c1.lte(birthEnd);
773 815 } else {
774 816 c1 = Criteria.where("birth").lte(birthEnd);
platform-data-api/src/main/resources/spring/spring-mongodb.xml View file @ 1211c2c
... ... @@ -10,7 +10,7 @@
10 10 <bean name="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
11 11 <constructor-arg name="mongo" ref="mongo"/>
12 12 <constructor-arg name="userCredentials" ref="userCredentials"/>
13   - <constructor-arg name="databaseName" value="sync-platform-data"/>
  13 + <constructor-arg name="databaseName" value="${mongo.db.dbname}"/>
14 14 </bean>
15 15  
16 16  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBookbuildingController.java View file @ 1211c2c
... ... @@ -42,11 +42,13 @@
42 42 */
43 43 @RequestMapping(method = RequestMethod.POST, value = "/addOrUpBabyBuild")
44 44 @ResponseBody
45   - public BaseResponse addOrUpBabyBuild(@Valid @RequestBody BabyBookbuildingAddRequest request) {
  45 + @TokenRequired
  46 + public BaseResponse addOrUpBabyBuild(@Valid @RequestBody BabyBookbuildingAddRequest request,HttpServletRequest httpServletRequest) {
  47 + LoginContext loginState = (LoginContext) httpServletRequest.getAttribute("loginContext");
46 48 if (request != null && !StringUtils.isEmpty(request.getId())) {
47   - return babyBookbuildingFacade.updateBabyBookbuilding(request);
  49 + return babyBookbuildingFacade.updateBabyBookbuilding(request,loginState.getId());
48 50 }
49   - return babyBookbuildingFacade.addBabyBookbuilding(request);
  51 + return babyBookbuildingFacade.addBabyBookbuilding(request,loginState.getId());
50 52 }
51 53  
52 54  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BookbuildingController.java View file @ 1211c2c
... ... @@ -58,13 +58,15 @@
58 58 */
59 59 @RequestMapping(method = RequestMethod.POST, value = "/addOrUpdateYunBuild")
60 60 @ResponseBody
61   - public BaseResponse addOrUpdateYunBuild(@RequestBody YunBookbuildingAddRequest yunBookbuildingAddRequest) {
  61 + @TokenRequired
  62 + public BaseResponse addOrUpdateYunBuild(@RequestBody YunBookbuildingAddRequest yunBookbuildingAddRequest,HttpServletRequest request) {
  63 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
62 64 if (yunBookbuildingAddRequest != null && !StringUtils.isEmpty(yunBookbuildingAddRequest.getId()) )
63 65 {
64   - return bookbuildingFacade.updatePregnantById(yunBookbuildingAddRequest.getId(), yunBookbuildingAddRequest);
  66 + return bookbuildingFacade.updatePregnantById(yunBookbuildingAddRequest.getId(), yunBookbuildingAddRequest,loginState.getId());
65 67  
66 68 }
67   - BaseObjectResponse p = bookbuildingFacade.addPregnantBookbuilding(yunBookbuildingAddRequest);
  69 + BaseObjectResponse p = bookbuildingFacade.addPregnantBookbuilding(yunBookbuildingAddRequest,loginState.getId());
68 70 return p;
69 71 }
70 72  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UpdateController.java View file @ 1211c2c
  1 +package com.lyms.platform.operate.web.controller;
  2 +
  3 +import com.lyms.platform.common.base.BaseController;
  4 +import com.lyms.platform.common.constants.ErrorCodeConstants;
  5 +import com.lyms.platform.common.utils.ExceptionUtils;
  6 +import com.lyms.platform.common.utils.StringUtils;
  7 +import com.lyms.platform.operate.web.facade.CorrectDataFacade;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Controller;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.RequestParam;
  13 +import org.springframework.web.bind.annotation.ResponseBody;
  14 +
  15 +import javax.servlet.http.HttpServletResponse;
  16 +import java.util.HashMap;
  17 +import java.util.Map;
  18 +
  19 +/**
  20 + * 数据处理接口
  21 + * <p/>
  22 + * Created by Administrator on 2016/10/25 0025.
  23 + */
  24 +@Controller
  25 +public class UpdateController extends BaseController {
  26 +
  27 + @Autowired
  28 + private CorrectDataFacade correctDataFacade;
  29 +
  30 + @RequestMapping(value = "/updateData", method = RequestMethod.GET)
  31 + @ResponseBody
  32 + private Map<String, String> updateCorrectData(@RequestParam("hId") String hId) {
  33 + Map result = new HashMap<>();
  34 + try {
  35 + if (StringUtils.isNotEmpty(hId)) {
  36 + correctDataFacade.correctPatient(hId);
  37 + result.put("msg", "成功.");
  38 + result.put("code", ErrorCodeConstants.SUCCESS);
  39 + } else {
  40 + result.put("msg", "参数不能为空.");
  41 + result.put("code", ErrorCodeConstants.PARAMETER_ERROR);
  42 + }
  43 + } catch (Exception e) {
  44 + ExceptionUtils.catchException(e, "updateCorrectData Error. hospitalId:" + hId);
  45 + }
  46 + return result;
  47 + }
  48 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 1211c2c
... ... @@ -58,7 +58,59 @@
58 58 @Autowired
59 59 private DeleteProcessHandler deleteProcessHandler;
60 60  
  61 + /**
  62 + * 修改最后一次产检时间
  63 + * @param hospitalId
  64 + * @param id
  65 + * @param type 1 初诊 2 复诊
  66 + */
  67 + private void setLashCTimes(String hospitalId,String id,int type){
61 68  
  69 + Patients patients = patientsService.findOnePatientById(id);
  70 + List<Date> list = new ArrayList<>();
  71 + if(type==2){
  72 + AntExQuery antExQuery=new AntExQuery();
  73 + antExQuery.setYn(YnEnums.YES.getId());
  74 + antExQuery.setHospitalId(hospitalId);
  75 + antExQuery.setParentId(id);
  76 + List<AntenatalExaminationModel> antExList= antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery());
  77 + if(CollectionUtils.isNotEmpty(antExList)){
  78 + for (AntenatalExaminationModel antEx : antExList) {
  79 + list.add(antEx.getCheckDate());
  80 + }
  81 + }
  82 + }else if(type==1) {
  83 + AntExChuQuery antExChuQuery=new AntExChuQuery();
  84 + antExChuQuery.setYn(YnEnums.YES.getId());
  85 + antExChuQuery.setHospitalId(hospitalId);
  86 + antExChuQuery.setParentId(id);
  87 + List<AntExChuModel> antExChu = antenatalExaminationService.queryAntExChu(antExChuQuery.convertToQuery());
  88 + if(CollectionUtils.isNotEmpty(antExChu)){
  89 + for (AntExChuModel antEx : antExChu) {
  90 + list.add(antEx.getCheckTime());
  91 + }
  92 + }
  93 + }
  94 +
  95 + if(CollectionUtils.isNotEmpty(list)){
  96 + Collections.sort(list, new Comparator<Date>() {
  97 + @Override
  98 + public int compare(Date o1, Date o2) {
  99 + if (o1 != null && o1.after(o2)) {
  100 + return -1;
  101 + }
  102 + if (o1 != null && o1.before(o2)) {
  103 + return 1;
  104 + }
  105 + return 0;
  106 + }
  107 + });
  108 + Patients patients1=new Patients();
  109 + patients1.setLastCTime(list.get(0));
  110 + patients1.setId(patients.getId());
  111 + patientsService.updatePatient(patients1);
  112 + }
  113 + }
62 114 /**
63 115 * 增加一条产前检查
64 116 *
65 117  
66 118  
67 119  
68 120  
69 121  
... ... @@ -70,22 +122,27 @@
70 122 if (StringUtils.isNotEmpty(antExAddRequest.getId())) {
71 123 AntenatalExaminationModel antenatalExamination = antExAddRequest.convertToDataModel();
72 124 antenatalExamination.setHospitalId(hospitalId);
  125 + antenatalExamination.setOperator(userId);
73 126 antenatalExaminationService.updateOneAnt(antenatalExamination, antExAddRequest.getId());
74 127 //修改申请单状态
75 128 updateApplyOrder(antenatalExamination, antExAddRequest.getParentId());
76   - //修改孕妇高危等级
  129 +
77 130 Patients patients = patientsService.findOnePatientById(antExAddRequest.getParentId());
  131 +
  132 + //修改最后一次检查时间
  133 + setLashCTimes(hospitalId,antExAddRequest.getParentId(),2);
  134 +
78 135 patients.setLastCheckEmployeeId(antExAddRequest.getCheckDoctor());
79 136  
80   -// updatePatientRiskLevel(antenatalExamination, patients);
81 137 patientsService.updatePatient(patients);
82   -
  138 + //修改孕妇高危等级
83 139 updateLastRisk(antExAddRequest.getParentId());
84 140  
85 141 //修改本院最后一次定义高危
86 142 updateLastRhTime(patients.getId(), hospitalId);
87 143 } else {
88 144 AntenatalExaminationModel model = antExAddRequest.convertToDataModel();
  145 + model.setOperator(userId);
89 146 model.setYn(YnEnums.YES.getId());
90 147 model.setHospitalId(hospitalId);
91 148 AntExQuery antExQuery = new AntExQuery();
... ... @@ -104,6 +161,9 @@
104 161 }
105 162 patientsService.updatePatient(patients);
106 163 antenatalExaminationService.addOneBabyAnt(model);
  164 +
  165 + //修改最后一次检查时间
  166 + setLashCTimes(hospitalId, antExAddRequest.getParentId(),2);
107 167 //修改申请单状态
108 168 updateApplyOrder(model, antExAddRequest.getParentId());
109 169 //修改孕妇高危等级
... ... @@ -111,6 +171,7 @@
111 171  
112 172 updateLastRisk(antExAddRequest.getParentId());
113 173  
  174 +
114 175 //修改本院最后一次定义高危
115 176 updateLastRhTime(patients.getId(), hospitalId);
116 177 if (null != patients.getBuildType() && patients.getBuildType() == 3) {
... ... @@ -174,6 +235,7 @@
174 235 public BaseResponse addOneAnetExChu(AntExcAddRequest excAddRequest, Integer userId) {
175 236 AntExChuModel antExChuModel = excAddRequest.convertToDataModel();
176 237 String hospitalId = autoMatchFacade.getHospitalId(userId);
  238 + antExChuModel.setOperator(userId);
177 239 if (StringUtils.isNotEmpty(antExChuModel.getId()) && StringUtils.isNotEmpty(antExChuModel.getParentId())) {
178 240 antExChuModel.setHospitalId(hospitalId);
179 241 antenatalExaminationService.updateAntExChu(antExChuModel, antExChuModel.getId());
... ... @@ -192,6 +254,8 @@
192 254 //修改本院最后一次定义高危
193 255 updateLastRhTime(patients.getId(), hospitalId);
194 256  
  257 + setLashCTimes(hospitalId,antExChuModel.getParentId(),1);
  258 +
195 259 } else {
196 260 AntExChuQuery antExChuQuery1 = new AntExChuQuery();
197 261 antExChuQuery1.setParentId(excAddRequest.getParentId());
... ... @@ -229,7 +293,7 @@
229 293  
230 294 //修改本院最后一次定义高危
231 295 updateLastRhTime(patients.getId(), hospitalId);
232   -
  296 + setLashCTimes(hospitalId,antExChuModel.getParentId(),1);
233 297 if (null != patients.getBuildType() && patients.getBuildType() == 3) {
234 298 Patients patients1 = new Patients();
235 299 patients1.setEnable("1");
... ... @@ -276,7 +340,7 @@
276 340 * @param parentId
277 341 * @param hospitalId
278 342 */
279   - private void updateLastRhTime(String parentId, String hospitalId) {
  343 + public void updateLastRhTime(String parentId, String hospitalId) {
280 344  
281 345 AntExQuery antExQuery = new AntExQuery();
282 346 antExQuery.setYn(YnEnums.YES.getId());
283 347  
... ... @@ -1057,10 +1121,10 @@
1057 1121 Collections.sort(listDate, new Comparator<SortIn>() {
1058 1122 @Override
1059 1123 public int compare(SortIn o1, SortIn o2) {
1060   - if (o1.getDate() != null && o1.getDate().after(o2.getDate())) {
  1124 + if (o1.getDate() != null &&null != o2.getDate()&& o1.getDate().after(o2.getDate())) {
1061 1125 return -1;
1062 1126 }
1063   - if (o1.getDate() != null && o1.getDate().before(o2.getDate())) {
  1127 + if (o1.getDate() != null &&null != o2.getDate()&& o1.getDate().before(o2.getDate())) {
1064 1128 return 1;
1065 1129 }
1066 1130 return 0;
1067 1131  
... ... @@ -1294,9 +1358,11 @@
1294 1358 if (deleteProcessHandler.deleteAntEx(localAntModel.getPid(), localAntModel.getCheckDate(), hospital, true)) {
1295 1359 antenatalExaminationService.updateOneAnt(antEx, antExQueryRequest.getId());
1296 1360  
1297   -
  1361 + //修改最后一次检查时间
1298 1362 AntenatalExaminationModel antenatalExaminationModel = antenatalExaminationService.findOneById(antExQueryRequest.getId());
1299 1363  
  1364 + setLashCTimes(hospital,antenatalExaminationModel.getParentId(),2);
  1365 +
1300 1366 updateLastRisk(antenatalExaminationModel.getParentId());
1301 1367  
1302 1368 } else {
1303 1369  
... ... @@ -1340,11 +1406,11 @@
1340 1406 }*/
1341 1407  
1342 1408 // if (CollectionUtils.isEmpty(list)) {
1343   - if (deleteProcessHandler.deleteAntExChu(antExChuModel11.getPid(), antExChuModel11.getCheckTime(), hospital, true)) {
  1409 + if (deleteProcessHandler.deleteAntExChu(antExChuModel11.getPid(), antExChuModel11.getCheckTime(), hospital, true,antExQueryRequest.getId())) {
1344 1410 antenatalExaminationService.updateAntExChu(antExChuModel, antExQueryRequest.getId());
1345 1411  
1346 1412 AntExChuModel antExChuModel1 = antenatalExaminationService.findOne(antExQueryRequest.getId());
1347   -
  1413 + setLashCTimes(hospital,antExChuModel1.getParentId(),1);
1348 1414 updateLastRisk(antExChuModel1.getParentId());
1349 1415  
1350 1416 } else {
... ... @@ -1360,7 +1426,7 @@
1360 1426 *
1361 1427 * @param parentId
1362 1428 */
1363   - private void updateLastRisk(String parentId) {
  1429 + public void updateLastRisk(String parentId) {
1364 1430 Patients patients = patientsService.findOnePatientById(parentId);
1365 1431  
1366 1432 PatientsQuery patientsQuery1 = new PatientsQuery();
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AutoMatchFacade.java View file @ 1211c2c
... ... @@ -88,8 +88,7 @@
88 88 }
89 89 public String getHospitalId(Integer userId){
90 90 List<Integer> list = matchOrgId(userId);
91   - if(null==list
92   - ){
  91 + if(null==list||CollectionUtils.isEmpty(list)){
93 92 return null;
94 93 }
95 94 return list.get(0)+"";
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java View file @ 1211c2c
... ... @@ -177,10 +177,10 @@
177 177 * @param request
178 178 * @return
179 179 */
180   - public BaseResponse updateBabyBookbuilding(BabyBookbuildingAddRequest request) {
  180 + public BaseResponse updateBabyBookbuilding(BabyBookbuildingAddRequest request,Integer userId) {
181 181 BabyModel model = getBabyModel(request);
182 182 model.setModified(new Date());
183   -
  183 + model.setOperator(userId);
184 184 if (StringUtils.isNotEmpty(request.getMommyCertificateNum())) {
185 185  
186 186 String cardId = request.getMommyCertificateNum() +
... ... @@ -265,7 +265,7 @@
265 265 * @param request
266 266 * @return
267 267 */
268   - public BaseObjectResponse addBabyBookbuilding(BabyBookbuildingAddRequest request) {
  268 + public BaseObjectResponse addBabyBookbuilding(BabyBookbuildingAddRequest request,Integer userId) {
269 269 BaseObjectResponse br = new BaseObjectResponse();
270 270  
271 271 //判断儿童是否建档在该医院
... ... @@ -456,7 +456,7 @@
456 456  
457 457 BabyModel model = getBabyModel(request);
458 458 model.setPid(babyPersonId);
459   -
  459 + model.setOperator(userId);
460 460 if (StringUtils.isNotEmpty(request.getMommyCertificateNum())) {
461 461  
462 462 String cardId = request.getMommyCertificateNum() +
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java View file @ 1211c2c
... ... @@ -104,7 +104,7 @@
104 104 * @return
105 105 */
106 106 public BaseObjectResponse addPregnantBookbuilding(
107   - YunBookbuildingAddRequest yunRequest) {
  107 + YunBookbuildingAddRequest yunRequest,Integer userId) {
108 108  
109 109 BaseObjectResponse br = new BaseObjectResponse();
110 110 PatientsQuery patientsQuery = new PatientsQuery();
... ... @@ -226,6 +226,7 @@
226 226  
227 227 patient.setCreated(new Date());
228 228 patient.setModified(new Date());
  229 + patient.setOperator(userId);
229 230 Patients p = yunBookbuildingService.addPregnantBookbuilding(patient);
230 231  
231 232 if (p == null || p.getId() == null)
... ... @@ -397,7 +398,7 @@
397 398 * @param id
398 399 * @param yunRequest
399 400 */
400   - public BaseResponse updatePregnantById(String id, YunBookbuildingAddRequest yunRequest) {
  401 + public BaseResponse updatePregnantById(String id, YunBookbuildingAddRequest yunRequest,Integer userId) {
401 402  
402 403  
403 404 BaseResponse br = new BaseResponse();
... ... @@ -509,7 +510,7 @@
509 510 }
510 511 }
511 512  
512   -
  513 + patient.setOperator(userId);
513 514 yunBookbuildingService.updatePregnant(patient, id);
514 515  
515 516 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CorrectDataFacade.java View file @ 1211c2c
  1 +package com.lyms.platform.operate.web.facade;
  2 +
  3 +import com.lyms.platform.biz.service.AntenatalExaminationService;
  4 +import com.lyms.platform.biz.service.PatientsService;
  5 +import com.lyms.platform.biz.service.PostReviewService;
  6 +import com.lyms.platform.common.enums.YnEnums;
  7 +import com.lyms.platform.operate.web.worker.CorrectDataWorker;
  8 +import com.lyms.platform.operate.web.worker.WorkHR;
  9 +import com.lyms.platform.pojo.Patients;
  10 +import com.lyms.platform.query.PatientsQuery;
  11 +import org.apache.commons.collections.CollectionUtils;
  12 +import org.slf4j.Logger;
  13 +import org.slf4j.LoggerFactory;
  14 +import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.stereotype.Component;
  16 +
  17 +import java.util.ArrayList;
  18 +import java.util.List;
  19 +import java.util.concurrent.*;
  20 +import java.util.concurrent.atomic.AtomicLong;
  21 +
  22 +/**
  23 + * 纠正数据门面
  24 + *
  25 + * Created by Administrator on 2016/10/25 0025.
  26 + */
  27 +@Component
  28 +public class CorrectDataFacade {
  29 +
  30 + private Logger logger = LoggerFactory.getLogger(CorrectDataFacade.class);
  31 + @Autowired
  32 + private PatientsService patientsService;
  33 + @Autowired
  34 + private PostReviewService postReviewService;
  35 + @Autowired
  36 + private AntenatalExaminationFacade antExFacade;
  37 + @Autowired
  38 + private AntenatalExaminationService anExService;
  39 +
  40 + private ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(5, 10, 1, TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>(5000));
  41 +
  42 + /**
  43 + *
  44 + * 纠正数据
  45 + *
  46 + * @param hospitalId
  47 + */
  48 + public void correctPatient(String hospitalId) throws InterruptedException {
  49 + PatientsQuery patientsQuery1=new PatientsQuery();
  50 + patientsQuery1.setYn(YnEnums.YES.getId());
  51 + patientsQuery1.setHospitalId(hospitalId);
  52 + List<Patients> patientses = patientsService.queryPatient(patientsQuery1);
  53 +
  54 + if(CollectionUtils.isNotEmpty(patientses)){
  55 + int batchSize = 400;
  56 + int end = 0;
  57 + CountDownLatch countDownLatch=new CountDownLatch(patientses.size());
  58 + java.util.concurrent.atomic.AtomicLong counter=new AtomicLong();
  59 + for (int i = 0; i < patientses.size(); i += batchSize) {
  60 + end = (end + batchSize);
  61 + if (end > patientses.size()) {
  62 + end = patientses.size();
  63 + }
  64 + threadPoolExecutor.submit(new CorrectDataWorker(patientses.subList(i, end),postReviewService,patientsService,anExService,antExFacade,countDownLatch,counter));
  65 + }
  66 + countDownLatch.await();
  67 + logger.info("hand hospitalId :" +hospitalId+", update count "+counter.get());
  68 + }
  69 + }
  70 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/DeleteProcessHandler.java View file @ 1211c2c
... ... @@ -5,11 +5,15 @@
5 5 import com.lyms.platform.biz.service.PostReviewService;
6 6 import com.lyms.platform.biz.service.StopPregnancyService;
7 7 import com.lyms.platform.common.enums.YnEnums;
  8 +import com.lyms.platform.common.utils.StringUtils;
  9 +import com.lyms.platform.pojo.AntExChuModel;
8 10 import com.lyms.platform.query.*;
  11 +import org.apache.commons.collections.CollectionUtils;
9 12 import org.springframework.beans.factory.annotation.Autowired;
10 13 import org.springframework.stereotype.Component;
11 14  
12 15 import java.util.Date;
  16 +import java.util.List;
13 17  
14 18 /**
15 19 * 产后复查删除
... ... @@ -31,7 +35,6 @@
31 35 /**
32 36 * 删除产后复查记录,查询有没有大于检查时间的本院数据
33 37 *
34   - * @param lastMenses 末次月经
35 38 * @param pid
36 39 * @param checkTime
37 40 * @param hospitalId
... ... @@ -83,7 +86,7 @@
83 86 */
84 87 public boolean deleteAntEx( String pid, Date checkTime, String hospitalId,boolean qufenHospital) {
85 88 //先判断是否有复查记录
86   - if (doBiz(pid, checkTime, hospitalId,false)) {
  89 + if (doBiz(pid, checkTime, hospitalId, false)) {
87 90 StopPregQuery stopPregQuery = new StopPregQuery();
88 91 stopPregQuery.setPid(pid);
89 92 stopPregQuery.setYn(YnEnums.YES.getId());
... ... @@ -110,7 +113,7 @@
110 113 return false;
111 114 }
112 115  
113   - public boolean deleteAntExChu( String pid, Date checkTime, String hospitalId,boolean qufenHospital) {
  116 + public boolean deleteAntExChu( String pid, Date checkTime, String hospitalId,boolean qufenHospital,String antExChuId) {
114 117 if (deleteAntEx(pid, checkTime, hospitalId, false)) {
115 118 AntExChuQuery antExChuQuery=new AntExChuQuery();
116 119 antExChuQuery.setPid(pid);
117 120  
... ... @@ -119,13 +122,22 @@
119 122 if(qufenHospital){
120 123 antExChuQuery.setHospitalId(hospitalId);
121 124 }
122   - return antenatalExaminationService.queryAntExChuCount(antExChuQuery.convertToQuery()) ==0;
  125 + List<AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery.convertToQuery());
  126 + if(StringUtils.isNotEmpty(antExChuId) && CollectionUtils.isNotEmpty(antExChuModels)){
  127 + for(int i=0;i<antExChuModels.size();i++){
  128 + if(antExChuModels.get(i).getId().equals(antExChuId)){
  129 + antExChuModels.remove(i);
  130 + break;
  131 + }
  132 + }
  133 + }
  134 + return antExChuModels.size()==0;
123 135 }
124 136 return false;
125 137 }
126 138  
127 139 public boolean deleteBookBuild(String pid, Date checkTime, String hospitalId){
128   - if(deleteAntExChu(pid,checkTime,hospitalId,false)){
  140 + if(deleteAntExChu(pid,checkTime,hospitalId,false,null)){
129 141 return true;
130 142 }
131 143 return false;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java View file @ 1211c2c
... ... @@ -136,6 +136,7 @@
136 136 }
137 137 MaternalDeliverModel maternalDeliverModel = deliverAddRequest.convertToDataModel();
138 138 //获取到小孩信息
  139 + maternalDeliverModel.setOperator(userId);
139 140 List<MatDeliverAddRequest.Baby> list = deliverAddRequest.getBabies();
140 141 List<String> babyIds = new ArrayList<>();
141 142 String parentId = maternalDeliverModel.getParentId();
... ... @@ -205,7 +206,7 @@
205 206 } else if (StringUtils.isNotEmpty(deliverAddRequest.getId()) && StringUtils.isNotEmpty(deliverAddRequest.getParentId())) {
206 207 MaternalDeliverModel maternalDeliverModel = deliverAddRequest.convertToDataModel();
207 208 MatDeliverQuery matDeliverQuery = new MatDeliverQuery();
208   -
  209 + maternalDeliverModel.setOperator(userId);
209 210 Patients patients2 = patientsService.findOnePatientById(deliverAddRequest.getParentId());
210 211 matDeliverQuery.setPid(patients2.getPid());
211 212 matDeliverQuery.setYn(YnEnums.YES.getId());
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java View file @ 1211c2c
... ... @@ -200,15 +200,7 @@
200 200 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
201 201 }
202 202  
203   - /**
204   - * 查询高危孕妇
205   - *
206   - * @param riskPatientsQueryRequest
207   - * @param isHighRisk 控制是否是高危
208   - * @param type 控制类型 1孕妇 3产妇
209   - * @return
210   - */
211   - public BaseResponse queryHighRisk(RiskPatientsQueryRequest riskPatientsQueryRequest, Boolean isHighRisk, int type, Integer userId, String needPage) {
  203 + private PatientsQuery complayRequest(RiskPatientsQueryRequest riskPatientsQueryRequest, Boolean isHighRisk, int type, Integer userId, String needPage) {
212 204 PatientsQuery patientsQuery = new PatientsQuery();
213 205 patientsQuery.setPhone(riskPatientsQueryRequest.getPhone());
214 206 patientsQuery.setCardNo(riskPatientsQueryRequest.getCardNo());
... ... @@ -220,6 +212,11 @@
220 212 patientsQuery.setrFactor(riskPatientsQueryRequest.getrFacotr());
221 213 Date currentDate = DateUtil.formatDate(new Date());
222 214  
  215 + patientsQuery.setPostViewTimes(riskPatientsQueryRequest.getPostViewTimes());
  216 + if(null!=riskPatientsQueryRequest.getPostViewTimes() &&riskPatientsQueryRequest.getPostViewTimes()>=4){
  217 + patientsQuery.setGtePostTimes(true);
  218 + }
  219 +
223 220 //服务类型
224 221 if (null != riskPatientsQueryRequest.getServiceType() && ServiceTypeEnums.ALL_SERVICE.getId() != Integer.valueOf(riskPatientsQueryRequest.getServiceType())) {
225 222 patientsQuery.setServiceType(Integer.valueOf(riskPatientsQueryRequest.getServiceType()));
226 223  
227 224  
... ... @@ -230,8 +227,27 @@
230 227 if (ServiceStatusEnums.STANDARD_ALL.getId() != Integer.valueOf(riskPatientsQueryRequest.getServiceStatus()) && ServiceStatusEnums.ADD_ALL.getId() != Integer.valueOf(riskPatientsQueryRequest.getServiceStatus())) {
231 228 patientsQuery.setServiceStatus(Integer.valueOf(riskPatientsQueryRequest.getServiceStatus()));
232 229 }
  230 + }
233 231  
  232 + //最后一次检查时间
  233 + if (StringUtils.isNotEmpty(riskPatientsQueryRequest.getLastCTime())) {
  234 + String nextDateStr = riskPatientsQueryRequest.getLastCTime();
  235 + String[] dates = nextDateStr.split(" - ");
  236 +
  237 + patientsQuery.setLastCTimeStart(DateUtil.parseYMD(dates[0]));
  238 + if (dates.length == 2) {
  239 + patientsQuery.setLastCTimeEnd(DateUtil.parseYMD(dates[1]));
  240 + }
234 241 }
  242 + //预产期
  243 + if (StringUtils.isNotEmpty(riskPatientsQueryRequest.getDueDate())) {
  244 + String nextDateStr = riskPatientsQueryRequest.getDueDate();
  245 + String[] dates = nextDateStr.split(" - ");
  246 + patientsQuery.setDueDateStart(DateUtil.parseYMD(dates[0]));
  247 + if (dates.length == 2) {
  248 + patientsQuery.setDueDateEnd(DateUtil.parseYMD(dates[1]));
  249 + }
  250 + }
235 251  
236 252 patientsQuery.setrLevel(riskPatientsQueryRequest.getrLevel());
237 253 patientsQuery.setLastMensesStart(riskPatientsQueryRequest.capEnd());
... ... @@ -290,6 +306,23 @@
290 306 String hospital = autoMatchFacade.getHospitalId(userId);
291 307 patientsQuery.setHospitalId(hospital);
292 308 patientsQuery.setNeed(needPage);
  309 + return patientsQuery;
  310 + }
  311 +
  312 +
  313 + /**
  314 + * 查询高危孕妇
  315 + *
  316 + * @param riskPatientsQueryRequest
  317 + * @param isHighRisk 控制是否是高危
  318 + * @param type 控制类型 1孕妇 3产妇
  319 + * @return
  320 + */
  321 + public BaseResponse queryHighRisk(RiskPatientsQueryRequest riskPatientsQueryRequest, Boolean isHighRisk, int type, Integer userId, String needPage) {
  322 + //组合请求
  323 + PatientsQuery patientsQuery = complayRequest(riskPatientsQueryRequest, isHighRisk, type, userId, needPage);
  324 +
  325 + String hospital = autoMatchFacade.getHospitalId(userId);
293 326 //查询符合条件的孕妇
294 327 StopWatch stopWatch = new StopWatch("queryPatient1 -" + hospital);
295 328 stopWatch.start();
... ... @@ -352,7 +385,7 @@
352 385 if (end > patientses.size()) {
353 386 end = patientses.size();
354 387 }
355   - listFuture.add(threadPoolExecutor.submit(new QuanChanPatientWorker(patientses.subList(i, end), hospital, usersService, postReviewService, matDeliverService)));
  388 + listFuture.add(threadPoolExecutor.submit(new QuanChanPatientWorker(patientses.subList(i, end), hospital, usersService, postReviewService, matDeliverService,patientsService)));
356 389 }
357 390 for (Future f : listFuture) {
358 391 try {
... ... @@ -375,7 +408,7 @@
375 408 if (end > patientses.size()) {
376 409 end = patientses.size();
377 410 }
378   - listFuture.add(threadPoolExecutor.submit(new QuanPatientWorker(patientses.subList(i, end), usersService, hospital, antExService, basicConfigService)));
  411 + listFuture.add(threadPoolExecutor.submit(new QuanPatientWorker(patientses.subList(i, end), usersService, hospital, antExService, basicConfigService,patientsService)));
379 412 }
380 413 for (Future f : listFuture) {
381 414 try {
... ... @@ -403,7 +436,7 @@
403 436 if (end > patientses.size()) {
404 437 end = patientses.size();
405 438 }
406   - listFuture.add(threadPoolExecutor.submit(new WorkHR(patientses.subList(i, end), usersService, hospital, basicConfigService, antExService)));
  439 + listFuture.add(threadPoolExecutor.submit(new WorkHR(patientses.subList(i, end), usersService, hospital, basicConfigService, antExService,patientsService)));
407 440 }
408 441 for (Future f : listFuture) {
409 442 try {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PostReviewFacade.java View file @ 1211c2c
... ... @@ -79,6 +79,7 @@
79 79 Patients patients1 = patientsService.findOnePatientById(postReviewRequest.getParentId());
80 80 String hospital= autoMatchFacade.getHospitalId(userId);
81 81 PostReviewModel postReviewModel = postReviewRequest.convertToDataModel();
  82 + postReviewModel.setOperator(userId);
82 83 //判断是否是同一个医院
83 84 if(!patients1.getHospitalId().equals(hospital)){
84 85 patients1.setId(null);
85 86  
86 87  
... ... @@ -105,9 +106,23 @@
105 106 patientsService.updatePatient(patients);
106 107 }
107 108 postReviewModel.setPid(patients.getPid());
  109 +
108 110 postReviewService.addPostReview(postReviewModel);
109 111  
  112 + if(null!=patients1.getPostViewTimes()){
  113 + Patients patients2=new Patients();
  114 + patients2.setPostViewTimes(patients1.getPostViewTimes()+1);
  115 + patients2.setId(patients1.getId());
  116 + patientsService.updatePatient(patients2);
  117 + }else{
  118 + Patients patients2=new Patients();
  119 + patients2.setPostViewTimes(1);
  120 + patients2.setId(patients1.getId());
  121 + patientsService.updatePatient(patients2);
  122 + }
110 123  
  124 +
  125 +
111 126 if (null != patients.getBuildType() && patients.getBuildType() == 3) {
112 127 ReferralApplyOrderQuery referralApplyOrderQuery = new ReferralApplyOrderQuery();
113 128 referralApplyOrderQuery.setParentId(patients.getId());
... ... @@ -295,7 +310,27 @@
295 310 PostReviewModel postReviewModel=new PostReviewModel();
296 311 postReviewModel.setYn(YnEnums.NO.getId());
297 312 postReviewModel.setId(id);
298   - postReviewService.updatePostById(postReviewModel,id);
  313 + postReviewModel.setOperator(userId);
  314 + postReviewService.updatePostById(postReviewModel, id);
  315 +
  316 +
  317 + PostReviewModel postReviewModel1 = postReviewService.findOneById(id);
  318 + if(null!=postReviewModel1){
  319 + Patients patients=patientsService.findOnePatientById(postReviewModel1.getParentId());
  320 + if(null!=patients){
  321 + if(null!=patients.getPostViewTimes()){
  322 + Patients patients2=new Patients();
  323 + patients2.setPostViewTimes(patients.getPostViewTimes()+1);
  324 + patients2.setId(patients.getId());
  325 + patientsService.updatePatient(patients2);
  326 + }else{
  327 + Patients patients2=new Patients();
  328 + patients2.setPostViewTimes(list.size());
  329 + patients2.setId(patients.getId());
  330 + patientsService.updatePatient(patients2);
  331 + }
  332 + }
  333 + }
299 334 return new BaseResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS);
300 335 }else{
301 336 return new BaseResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR).setErrormsg("当前复查记录不是本院最新的复查记录,不能删除");
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SmsConfigFacade.java View file @ 1211c2c
... ... @@ -666,7 +666,11 @@
666 666 if (StringUtils.isNotEmpty(obj.getExt1()))
667 667 {
668 668 Organization org= organizationService.getOrganization(Integer.parseInt(obj.getExt1()));
669   - map.put("hospitalName",org.getName());
  669 + if(null!=org){
  670 + map.put("hospitalName",org.getName());
  671 + }else{
  672 + map.put("hospitalName","");
  673 + }
670 674 }
671 675 else
672 676 {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/RiskPatientsQueryRequest.java View file @ 1211c2c
... ... @@ -65,9 +65,39 @@
65 65 private String buildTime;
66 66 //最后一次医院定义的高危
67 67 private String lastRhTime;
  68 + //本院最后一次产检时间
  69 + private String lastCTime;
  70 + //预产期
  71 + private String dueDate;
  72 + //复查次数
  73 + private Integer postViewTimes;
68 74  
69 75 // 0 高危孕妇 1 全部孕妇 2全部产妇
70 76 private Integer queryType;
  77 +
  78 + public Integer getPostViewTimes() {
  79 + return postViewTimes;
  80 + }
  81 +
  82 + public void setPostViewTimes(Integer postViewTimes) {
  83 + this.postViewTimes = postViewTimes;
  84 + }
  85 +
  86 + public String getLastCTime() {
  87 + return lastCTime;
  88 + }
  89 +
  90 + public void setLastCTime(String lastCTime) {
  91 + this.lastCTime = lastCTime;
  92 + }
  93 +
  94 + public String getDueDate() {
  95 + return dueDate;
  96 + }
  97 +
  98 + public void setDueDate(String dueDate) {
  99 + this.dueDate = dueDate;
  100 + }
71 101  
72 102 public String getLastRhTime() {
73 103 return lastRhTime;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/QuanChanResult.java View file @ 1211c2c
... ... @@ -45,6 +45,16 @@
45 45  
46 46 //服务状态
47 47 private String serviceStatus;
  48 + //操纵者
  49 + private String operator;
  50 +
  51 + public String getOperator() {
  52 + return operator;
  53 + }
  54 +
  55 + public void setOperator(String operator) {
  56 + this.operator = operator;
  57 + }
48 58  
49 59 public String getServiceType() {
50 60 return serviceType;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/QuanPatientsResult.java View file @ 1211c2c
... ... @@ -55,6 +55,18 @@
55 55  
56 56 private String pid;
57 57  
  58 +
  59 + //操纵者
  60 + private String operator;
  61 +
  62 + public String getOperator() {
  63 + return operator;
  64 + }
  65 +
  66 + public void setOperator(String operator) {
  67 + this.operator = operator;
  68 + }
  69 +
58 70 public String getServiceStatus() {
59 71 return serviceStatus;
60 72 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/CorrectDataWorker.java View file @ 1211c2c
  1 +package com.lyms.platform.operate.web.worker;
  2 +
  3 +import com.lyms.platform.biz.service.AntenatalExaminationService;
  4 +import com.lyms.platform.biz.service.PatientsService;
  5 +import com.lyms.platform.biz.service.PostReviewService;
  6 +import com.lyms.platform.common.enums.YnEnums;
  7 +import com.lyms.platform.common.utils.ExceptionUtils;
  8 +import com.lyms.platform.operate.web.facade.AntenatalExaminationFacade;
  9 +import com.lyms.platform.pojo.AntExChuModel;
  10 +import com.lyms.platform.pojo.AntenatalExaminationModel;
  11 +import com.lyms.platform.pojo.Patients;
  12 +import com.lyms.platform.query.AntExChuQuery;
  13 +import com.lyms.platform.query.AntExQuery;
  14 +import com.lyms.platform.query.PostReviewQuery;
  15 +import org.apache.commons.collections.CollectionUtils;
  16 +import org.springframework.data.domain.Sort;
  17 +
  18 +import java.util.Date;
  19 +import java.util.List;
  20 +import java.util.concurrent.CountDownLatch;
  21 +import java.util.concurrent.atomic.AtomicLong;
  22 +
  23 +/**
  24 + * 纠正数据线程
  25 + * <p/>
  26 + * Created by Administrator on 2016/10/25 0025.
  27 + */
  28 +public class CorrectDataWorker extends Thread {
  29 +
  30 + private PostReviewService postReviewService;
  31 +
  32 + private PatientsService patientsService;
  33 +
  34 + private AntenatalExaminationService antExService;
  35 +
  36 + private AntenatalExaminationFacade antExFacade;
  37 +
  38 + private List<Patients> patientses;
  39 +
  40 + private CountDownLatch countDownLatch;
  41 +
  42 + private java.util.concurrent.atomic.AtomicLong counter;
  43 +
  44 + public CorrectDataWorker(List<Patients> patientses,
  45 + PostReviewService postReviewService,
  46 + PatientsService patientsService,
  47 + AntenatalExaminationService antExService,
  48 + AntenatalExaminationFacade antExFacade,
  49 + CountDownLatch countDownLatch,
  50 + java.util.concurrent.atomic.AtomicLong counter) {
  51 + this.patientses = patientses;
  52 + this.patientsService = patientsService;
  53 + this.postReviewService = postReviewService;
  54 + this.antExService=antExService;
  55 + this.antExFacade=antExFacade;
  56 + this.countDownLatch=countDownLatch;
  57 + this.counter=counter;
  58 + }
  59 +
  60 + @Override
  61 + public void run() {
  62 + //最后一次高危时间
  63 + // Date lastRhTime;
  64 + //本院最后一次产检时间
  65 + //Date lastCTime;
  66 + //本院产后复查次数
  67 + //Integer postViewTimes;
  68 + try {
  69 + for(Patients patients:patientses){
  70 + Patients patients1=new Patients();
  71 + patients1.setId(patients.getId());
  72 + //产后复查次数
  73 + PostReviewQuery postReviewQuery=new PostReviewQuery();
  74 + postReviewQuery.setHospitalId(patients.getHospitalId());
  75 + postReviewQuery.setYn(YnEnums.YES.getId());
  76 + postReviewQuery.setParentId(patients.getId());
  77 + //产后复查次数
  78 + patients1.setPostViewTimes(postReviewService.count(postReviewQuery));
  79 + //最后产检时间
  80 + patients1.setLastCTime(findLastCTime(patients.getId()));
  81 +
  82 + patientsService.updatePatient(patients1);
  83 + //修改最后一次定义高危时间
  84 + antExFacade.updateLastRhTime(patients.getId(),patients.getHospitalId());
  85 + //修改高危
  86 + antExFacade.updateLastRisk(patients.getId());
  87 +
  88 + counter.incrementAndGet();
  89 + }
  90 + }catch (Exception e){
  91 + ExceptionUtils.catchException(e,"CorrectDataWorker Error.");
  92 + }finally {
  93 + countDownLatch.countDown();
  94 + }
  95 + }
  96 +
  97 +
  98 + private Date findLastCTime(String id){
  99 + AntExQuery antExQuery=new AntExQuery();
  100 + antExQuery.setParentId(id);
  101 + antExQuery.setYn(YnEnums.YES.getId());
  102 +
  103 + List<AntenatalExaminationModel> antEx= antExService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "checkDate"));
  104 + if(CollectionUtils.isNotEmpty(antEx)){
  105 + return antEx.get(0).getCheckDate();
  106 + }else{
  107 + AntExChuQuery antExChuQuery=new AntExChuQuery();
  108 + antExChuQuery.setParentId(id);
  109 + antExChuQuery.setYn(YnEnums.YES.getId());
  110 + List<AntExChuModel> antExChu= antExService.queryAntExChu(antExChuQuery);
  111 + if(CollectionUtils.isNotEmpty(antExChu)){
  112 + return antExChu.get(0).getCheckTime();
  113 + }
  114 + }
  115 + return null;
  116 + }
  117 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/QuanChanPatientWorker.java View file @ 1211c2c
1 1 package com.lyms.platform.operate.web.worker;
2 2  
3   -import com.lyms.platform.biz.service.AntenatalExaminationService;
4   -import com.lyms.platform.biz.service.BasicConfigService;
5   -import com.lyms.platform.biz.service.MatDeliverService;
6   -import com.lyms.platform.biz.service.PostReviewService;
  3 +import com.lyms.platform.biz.service.*;
7 4 import com.lyms.platform.common.enums.ServiceStatusEnums;
8 5 import com.lyms.platform.common.enums.ServiceTypeEnums;
9 6 import com.lyms.platform.common.enums.YnEnums;
... ... @@ -42,6 +39,8 @@
42 39 private static final Logger logger = LoggerFactory.getLogger(PatientFacade.class);
43 40 private List<Patients> patientses;
44 41  
  42 + private PatientsService patientsService;
  43 +
45 44 private UsersService usersService;
46 45 private PostReviewService postReviewService;
47 46  
48 47  
... ... @@ -52,10 +51,11 @@
52 51 String hospital,
53 52 UsersService usersService,
54 53 PostReviewService postReviewService,
55   - MatDeliverService matDeliverService) {
  54 + MatDeliverService matDeliverService,PatientsService patientsService) {
56 55 this.patientses = patientses;
57 56 this.matDeliverService = matDeliverService;
58 57 this.postReviewService = postReviewService;
  58 + this.patientsService=patientsService;
59 59 this.hospital = hospital;
60 60 this.usersService = usersService;
61 61 }
... ... @@ -110,7 +110,12 @@
110 110  
111 111 withList = postReviewService.findWithList(postReviewQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created"));
112 112 if (CollectionUtils.isNotEmpty(withList)) {
113   - chanResult.setcHTimes(withList.size());
  113 + //本院产后复查次数不为空
  114 + if(null!=patients.getPostViewTimes()){
  115 + chanResult.setcHTimes(patients.getPostViewTimes());
  116 + }else{
  117 + chanResult.setcHTimes(withList.size());
  118 + }
114 119 if (StringUtils.isNotEmpty(withList.get(0).getProdDoctor())) {
115 120 Users users = usersService.getUsers(NumberUtils.toInt(withList.get(0).getProdDoctor()));
116 121 if (null != users) {
117 122  
... ... @@ -118,11 +123,20 @@
118 123 }
119 124 }
120 125 }
  126 + }else{
  127 + if(null==patients.getPostViewTimes()){
  128 + Patients patients1=new Patients();
  129 + patients1.setPostViewTimes(0);
  130 + patients1.setId(patients.getId());
  131 + patientsService.updatePatient(patients1);
  132 + }
121 133 }
122 134 stopWatch.stop();
123 135 chanResult.setServiceType(ServiceTypeEnums.getTitleById(patients.getServiceType()));
124 136 chanResult.setServiceStatus(ServiceStatusEnums.getNameById(patients.getServiceStatus()));
125 137 chanResult.setNextCheckTime(nextCheckTime);
  138 + //操作者
  139 +// chanResult.setOperator();
126 140 data.add(chanResult);
127 141 logger.debug(stopWatch.toString());
128 142 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/QuanPatientWorker.java View file @ 1211c2c
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import com.lyms.platform.biz.service.AntenatalExaminationService;
4 4 import com.lyms.platform.biz.service.BasicConfigService;
  5 +import com.lyms.platform.biz.service.PatientsService;
5 6 import com.lyms.platform.common.enums.RiskDefaultTypeEnum;
6 7 import com.lyms.platform.common.enums.ServiceStatusEnums;
7 8 import com.lyms.platform.common.enums.ServiceTypeEnums;
... ... @@ -28,10 +29,7 @@
28 29 import org.springframework.data.domain.Sort;
29 30 import org.springframework.util.StopWatch;
30 31  
31   -import java.util.ArrayList;
32   -import java.util.HashMap;
33   -import java.util.List;
34   -import java.util.Map;
  32 +import java.util.*;
35 33 import java.util.concurrent.Callable;
36 34  
37 35 /**
38 36  
39 37  
... ... @@ -47,17 +45,19 @@
47 45 private UsersService usersService;
48 46 private AntenatalExaminationService antExService;
49 47 private BasicConfigService basicConfigService;
  48 + private PatientsService patientsService;
50 49  
51 50 public QuanPatientWorker(List<Patients> patientses,
52 51 UsersService usersService,
53 52 String hospital,
54 53 AntenatalExaminationService antExService,
55   - BasicConfigService basicConfigService) {
  54 + BasicConfigService basicConfigService,PatientsService patientsService) {
56 55 this.patientses = patientses;
57 56 this.usersService = usersService;
58 57 this.antExService = antExService;
59 58 this.hospital = hospital;
60 59 this.basicConfigService = basicConfigService;
  60 + this.patientsService=patientsService;
61 61 }
62 62  
63 63 @Override
... ... @@ -110,6 +110,31 @@
110 110 stopWatch.start("query antex list");
111 111 List<AntenatalExaminationModel> examinationModels = antExService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created"));
112 112 if (CollectionUtils.isNotEmpty(examinationModels)) {
  113 + //设置最后一次检查时间
  114 + if (null == patients.getLastCTime()) {
  115 + List<Date> list = new ArrayList<>();
  116 + for (AntenatalExaminationModel antEx : examinationModels) {
  117 + list.add(antEx.getCheckDate());
  118 + }
  119 +
  120 + Collections.sort(list, new Comparator<Date>() {
  121 + @Override
  122 + public int compare(Date o1, Date o2) {
  123 + if (o1 != null && o1.after(o2)) {
  124 + return -1;
  125 + }
  126 + if (o1 != null && o1.before(o2)) {
  127 + return 1;
  128 + }
  129 + return 0;
  130 + }
  131 + });
  132 + Patients patients1=new Patients();
  133 + patients1.setId(patients.getId());
  134 + patients1.setLastCTime(list.get(0));
  135 + patientsService.updatePatient(patients1);
  136 + }
  137 +
113 138 nextCheckTime = DateUtil.getyyyy_MM_dd(examinationModels.get(0).getNextCheckTime());
114 139  
115 140 if (StringUtils.isNotEmpty(examinationModels.get(0).getCheckDoctor())) {
... ... @@ -141,6 +166,10 @@
141 166 quanPatientsResult.setCheckDoctor(list.get(0).getProdDoctor());
142 167 }
143 168 }
  169 + Patients patients1=new Patients();
  170 + patients1.setId(patients.getId());
  171 + patients1.setLastCTime(list.get(0).getNextCheckTime());
  172 + patientsService.updatePatient(patients1);
144 173 }
145 174 }
146 175 stopWatch.stop();
... ... @@ -162,7 +191,7 @@
162 191 if (name.indexOf("预警") > -1) {
163 192 name = name.replace("预警", "");
164 193 }
165   - map.put("name",name);
  194 + map.put("name", name);
166 195 map.put("color", "risk_" + RiskDefaultTypeEnum.getColor(name));
167 196 level.add(map);
168 197 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/WorkHR.java View file @ 1211c2c
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import com.lyms.platform.biz.service.AntenatalExaminationService;
4 4 import com.lyms.platform.biz.service.BasicConfigService;
  5 +import com.lyms.platform.biz.service.PatientsService;
5 6 import com.lyms.platform.common.enums.RiskDefaultTypeEnum;
6 7 import com.lyms.platform.common.enums.ServiceStatusEnums;
7 8 import com.lyms.platform.common.enums.ServiceTypeEnums;
... ... @@ -28,10 +29,7 @@
28 29 import org.springframework.data.domain.Sort;
29 30 import org.springframework.util.StopWatch;
30 31  
31   -import java.util.ArrayList;
32   -import java.util.HashMap;
33   -import java.util.List;
34   -import java.util.Map;
  32 +import java.util.*;
35 33 import java.util.concurrent.Callable;
36 34  
37 35 /**
38 36  
39 37  
... ... @@ -48,15 +46,17 @@
48 46 private AntenatalExaminationService antExService;
49 47 private UsersService usersService;
50 48 private String hospital;
  49 + private PatientsService patientsService;
51 50  
52 51 public WorkHR(List<Patients> patientses, UsersService usersService, String hospital,
53 52 BasicConfigService basicConfigService,
54   - AntenatalExaminationService antExService) {
  53 + AntenatalExaminationService antExService,PatientsService patientsService) {
55 54 this.patientses = patientses;
56 55 this.usersService = usersService;
57 56 this.hospital = hospital;
58 57 this.basicConfigService = basicConfigService;
59 58 this.antExService = antExService;
  59 + this.patientsService=patientsService;
60 60 }
61 61  
62 62 public List<RiskPatientsResult> call() {
... ... @@ -106,6 +106,32 @@
106 106  
107 107 List<AntenatalExaminationModel> examinationModels = antExService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created"));
108 108 if (CollectionUtils.isNotEmpty(examinationModels)) {
  109 +
  110 + //设置最后一次检查时间
  111 + if (null == patients.getLastCTime()) {
  112 + List<Date> list = new ArrayList<>();
  113 + for (AntenatalExaminationModel antEx : examinationModels) {
  114 + list.add(antEx.getCheckDate());
  115 + }
  116 +
  117 + Collections.sort(list, new Comparator<Date>() {
  118 + @Override
  119 + public int compare(Date o1, Date o2) {
  120 + if (o1 != null && o1.after(o2)) {
  121 + return -1;
  122 + }
  123 + if (o1 != null && o1.before(o2)) {
  124 + return 1;
  125 + }
  126 + return 0;
  127 + }
  128 + });
  129 + Patients patients1=new Patients();
  130 + patients1.setId(patients.getId());
  131 + patients1.setLastCTime(list.get(0));
  132 + patientsService.updatePatient(patients1);
  133 + }
  134 +
109 135 if (NumberUtils.isNumber(examinationModels.get(0).getCheckDoctor())) {
110 136 Users users = usersService.getUsers(NumberUtils.toInt(examinationModels.get(0).getCheckDoctor()));
111 137 if (null != users) {
... ... @@ -127,6 +153,10 @@
127 153 riskPatientsResult.setCheckDoctor(list.get(0).getProdDoctor());
128 154 }
129 155 }
  156 + Patients patients1=new Patients();
  157 + patients1.setId(patients.getId());
  158 + patients1.setLastCTime(list.get(0).getNextCheckTime());
  159 + patientsService.updatePatient(patients1);
130 160 }
131 161 }
132 162 stopWatch.stop();
platform-operate-api/src/main/resources/spring/spring-mongodb.xml View file @ 1211c2c
... ... @@ -10,7 +10,8 @@
10 10 <bean name="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
11 11 <constructor-arg name="mongo" ref="mongo"/>
12 12 <constructor-arg name="userCredentials" ref="userCredentials"/>
13   - <constructor-arg name="databaseName" value="sync-platform-data"/>
  13 + <constructor-arg name="databaseName" value="${mongo.db.dbname}"/>
  14 + <!--<constructor-arg name="databaseName" value="sync-platform-data"/>-->
14 15 </bean>
15 16  
16 17