Commit 65fad7360f62cb610707c59ec7a4033bc44ca36d

Authored by liquanyu
1 parent 4d36781fc7
Exists in master and in 1 other branch dev

update

Showing 18 changed files with 592 additions and 155 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntenatalExaminationService.java View file @ 65fad73
... ... @@ -319,7 +319,7 @@
319 319 antExChuQuery.mysqlBuild(iAntExChuDao.count(query));
320 320 query.start(antExChuQuery.getOffset()).end(antExChuQuery.getLimit());
321 321 }
322   - return iAntExChuDao.query(antExChuQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created"));
  322 + return iAntExChuDao.query(query.addOrder(Sort.Direction.DESC, "created"));
323 323 }
324 324  
325 325 public List<AntExChuModel> queryAntExChu(AntExChuQuery antExChuQuery,Sort.Direction direction,String field) {
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java View file @ 65fad73
... ... @@ -15,6 +15,8 @@
15 15 import org.slf4j.LoggerFactory;
16 16 import org.springframework.beans.factory.annotation.Autowired;
17 17 import org.springframework.data.domain.Sort;
  18 +import org.springframework.data.mongodb.core.query.Criteria;
  19 +import org.springframework.data.mongodb.core.query.Query;
18 20 import org.springframework.stereotype.Service;
19 21  
20 22 import java.util.Arrays;
21 23  
22 24  
... ... @@ -42,14 +44,13 @@
42 44 private YunBookbuildingService yunBookbuildingService;
43 45 @Autowired
44 46 private ApplyScreeningService applyScreeningService;
45   -
46 47 @Autowired
  48 + private PatientWeightService2 patientWeightService2;
  49 + @Autowired
47 50 private PersonService personService;
48 51 @Autowired
49 52 private IAntExRecordDao iAntExRecordDao;
50 53 @Autowired
51   - private TrackDownService trackDownService;
52   - @Autowired
53 54 private TrackDownRecordService trackDownRecordService;
54 55  
55 56 public Patients addPatient(Patients obj) {
... ... @@ -502,6 +503,18 @@
502 503 PersonModel pm = list.get(0);
503 504 pm.setType(3);//基本信息更新成产妇
504 505 personService.updatePerson(pm, pm.getId());
  506 + }
  507 +
  508 +
  509 + //体重记录更新为产妇状态
  510 + List<PatientWeight> patientWeights = patientWeightService2.queryPatientWeight(Query.query(Criteria.where("pid").is(patients.getPid())));
  511 + if (CollectionUtils.isNotEmpty(patientWeights))
  512 + {
  513 + for (PatientWeight weight : patientWeights)
  514 + {
  515 + weight.setType(3);
  516 + patientWeightService2.update(Query.query(Criteria.where("id").is(weight.getId())), weight);
  517 + }
505 518 }
506 519 }
507 520 }
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/MasterMysqlAntexcMapper.java View file @ 65fad73
... ... @@ -68,5 +68,9 @@
68 68 void deleteMatdeliverToMysql(ReportMatdeliver reportMatdeliver);
69 69  
70 70 void saveMatdeliverToMysql(ReportMatdeliver reportMatdeliver);
  71 +
  72 + void deleteRiskLevelToMysql(ReportRiskLevel reportRiskLevel);
  73 +
  74 + void saveRiskLevelToMysql(ReportRiskLevel reportRiskLevel);
71 75 }
platform-biz-service/src/main/java/com/lyms/platform/permission/model/ReportPatients.java View file @ 65fad73
... ... @@ -41,6 +41,15 @@
41 41 private String enable;
42 42 private String riskLevelId;
43 43 private Integer buildType;
  44 + private Integer isAutoFm;
  45 +
  46 + public Integer getIsAutoFm() {
  47 + return isAutoFm;
  48 + }
  49 +
  50 + public void setIsAutoFm(Integer isAutoFm) {
  51 + this.isAutoFm = isAutoFm;
  52 + }
44 53  
45 54 public Integer getId() {
46 55 return id;
platform-biz-service/src/main/java/com/lyms/platform/permission/model/ReportRisk.java View file @ 65fad73
  1 +package com.lyms.platform.permission.model;
  2 +
  3 +/**
  4 + * Created by Administrator on 2021-03-23.
  5 + */
  6 +public class ReportRisk {
  7 + private Integer id;
  8 + private String riskId;
  9 + private Integer type;
  10 + private String foreignId;
  11 +
  12 + public Integer getId() {
  13 + return id;
  14 + }
  15 +
  16 + public void setId(Integer id) {
  17 + this.id = id;
  18 + }
  19 +
  20 + public String getRiskId() {
  21 + return riskId;
  22 + }
  23 +
  24 + public void setRiskId(String riskId) {
  25 + this.riskId = riskId;
  26 + }
  27 +
  28 + public Integer getType() {
  29 + return type;
  30 + }
  31 +
  32 + public void setType(Integer type) {
  33 + this.type = type;
  34 + }
  35 +
  36 + public String getForeignId() {
  37 + return foreignId;
  38 + }
  39 +
  40 + public void setForeignId(String foreignId) {
  41 + this.foreignId = foreignId;
  42 + }
  43 +}
platform-biz-service/src/main/java/com/lyms/platform/permission/model/ReportRiskLevel.java View file @ 65fad73
  1 +package com.lyms.platform.permission.model;
  2 +
  3 +/**
  4 + * Created by Administrator on 2021-03-23.
  5 + */
  6 +public class ReportRiskLevel {
  7 + private Integer id;
  8 + private String riskLevelId;
  9 + private Integer riskLevel;
  10 + private Integer type;//'1 档案 2 初诊 3 复诊',
  11 + private String foreignId;
  12 +
  13 + public Integer getId() {
  14 + return id;
  15 + }
  16 +
  17 + public void setId(Integer id) {
  18 + this.id = id;
  19 + }
  20 +
  21 + public String getRiskLevelId() {
  22 + return riskLevelId;
  23 + }
  24 +
  25 + public void setRiskLevelId(String riskLevelId) {
  26 + this.riskLevelId = riskLevelId;
  27 + }
  28 +
  29 + public Integer getRiskLevel() {
  30 + return riskLevel;
  31 + }
  32 +
  33 + public void setRiskLevel(Integer riskLevel) {
  34 + this.riskLevel = riskLevel;
  35 + }
  36 +
  37 + public Integer getType() {
  38 + return type;
  39 + }
  40 +
  41 + public void setType(Integer type) {
  42 + this.type = type;
  43 + }
  44 +
  45 + public String getForeignId() {
  46 + return foreignId;
  47 + }
  48 +
  49 + public void setForeignId(String foreignId) {
  50 + this.foreignId = foreignId;
  51 + }
  52 +}
platform-biz-service/src/main/java/com/lyms/platform/permission/service/MysqlAntexcService.java View file @ 65fad73
... ... @@ -65,5 +65,9 @@
65 65 void deleteMatdeliverToMysql(ReportMatdeliver reportMatdeliver);
66 66  
67 67 void saveMatdeliverToMysql(ReportMatdeliver reportMatdeliver);
  68 +
  69 + void deleteRiskLevelToMysql(ReportRiskLevel reportRiskLevel);
  70 +
  71 + void saveRiskLevelToMysql(ReportRiskLevel reportRiskLevel);
68 72 }
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/MysqlAntexcServiceImpl.java View file @ 65fad73
... ... @@ -151,6 +151,18 @@
151 151 }
152 152  
153 153 @Override
  154 + public void deleteRiskLevelToMysql(ReportRiskLevel reportRiskLevel)
  155 + {
  156 + masterMysqlAntexcMapper.deleteRiskLevelToMysql(reportRiskLevel);
  157 + }
  158 +
  159 + @Override
  160 + public void saveRiskLevelToMysql(ReportRiskLevel reportRiskLevel)
  161 + {
  162 + masterMysqlAntexcMapper.saveRiskLevelToMysql(reportRiskLevel);
  163 + }
  164 +
  165 + @Override
154 166 public void addRisk(MysqlRisk model) {
155 167 masterMysqlAntexcMapper.addRisk(model);
156 168 }
platform-biz-service/src/main/resources/mainOrm/master/MasterMysqlAntexc.xml View file @ 65fad73
... ... @@ -1092,75 +1092,77 @@
1092 1092  
1093 1093 <insert id="savePatientsToMysql" parameterType="com.lyms.platform.permission.model.ReportPatients">
1094 1094 INSERT INTO report_patients(
1095   - pid,
1096   - patientId,
1097   - cardNo,
1098   - type,
1099   - lastMenses,
1100   - address,
1101   - provinceId,
1102   - cityId,
1103   - areaId,
1104   - streetId,
1105   - addressPostRest,
1106   - provincePostRestId,
1107   - cityPostRestId,
1108   - areaPostRestId,
1109   - streetPostRestId,
1110   - addressRegister,
1111   - provinceRegisterId,
1112   - cityRegisterId,
1113   - areaRegisterId,
1114   - streetRegisterId,
1115   - hospitalId,
1116   - bookbuildingDate,
1117   - bookbuildingDoctor,
1118   - created,
1119   - modified,
1120   - birth,
1121   - username,
1122   - yn,
1123   - phone,
1124   - pcensusTypeId,
1125   - pliveTypeId,
1126   - enable,
1127   - riskLevelId,
1128   - buildType
  1095 + pid,
  1096 + patientId,
  1097 + cardNo,
  1098 + type,
  1099 + lastMenses,
  1100 + address,
  1101 + provinceId,
  1102 + cityId,
  1103 + areaId,
  1104 + streetId,
  1105 + addressPostRest,
  1106 + provincePostRestId,
  1107 + cityPostRestId,
  1108 + areaPostRestId,
  1109 + streetPostRestId,
  1110 + addressRegister,
  1111 + provinceRegisterId,
  1112 + cityRegisterId,
  1113 + areaRegisterId,
  1114 + streetRegisterId,
  1115 + hospitalId,
  1116 + bookbuildingDate,
  1117 + bookbuildingDoctor,
  1118 + created,
  1119 + modified,
  1120 + birth,
  1121 + username,
  1122 + yn,
  1123 + phone,
  1124 + pcensusTypeId,
  1125 + pliveTypeId,
  1126 + enable,
  1127 + riskLevelId,
  1128 + buildType,
  1129 + isAutoFm
1129 1130 ) VALUES (
1130   - #{pid},
1131   - #{patientId},
1132   - #{cardNo},
1133   - #{type},
1134   - #{lastMenses},
1135   - #{address},
1136   - #{provinceId},
1137   - #{cityId},
1138   - #{areaId},
1139   - #{streetId},
1140   - #{addressPostRest},
1141   - #{provincePostRestId},
1142   - #{cityPostRestId},
1143   - #{areaPostRestId},
1144   - #{streetPostRestId},
1145   - #{addressRegister},
1146   - #{provinceRegisterId},
1147   - #{cityRegisterId},
1148   - #{areaRegisterId},
1149   - #{streetRegisterId},
1150   - #{hospitalId},
1151   - #{bookbuildingDate},
1152   - #{bookbuildingDoctor},
1153   - #{created},
1154   - #{modified},
1155   - #{birth},
1156   - #{username},
1157   - #{yn},
1158   - #{phone},
1159   - #{pcensusTypeId},
1160   - #{pliveTypeId},
1161   - #{enable},
1162   - #{riskLevelId},
1163   - #{buildType}
  1131 + #{pid},
  1132 + #{patientId},
  1133 + #{cardNo},
  1134 + #{type},
  1135 + #{lastMenses},
  1136 + #{address},
  1137 + #{provinceId},
  1138 + #{cityId},
  1139 + #{areaId},
  1140 + #{streetId},
  1141 + #{addressPostRest},
  1142 + #{provincePostRestId},
  1143 + #{cityPostRestId},
  1144 + #{areaPostRestId},
  1145 + #{streetPostRestId},
  1146 + #{addressRegister},
  1147 + #{provinceRegisterId},
  1148 + #{cityRegisterId},
  1149 + #{areaRegisterId},
  1150 + #{streetRegisterId},
  1151 + #{hospitalId},
  1152 + #{bookbuildingDate},
  1153 + #{bookbuildingDoctor},
  1154 + #{created},
  1155 + #{modified},
  1156 + #{birth},
  1157 + #{username},
  1158 + #{yn},
  1159 + #{phone},
  1160 + #{pcensusTypeId},
  1161 + #{pliveTypeId},
  1162 + #{enable},
  1163 + #{riskLevelId},
  1164 + #{buildType},
  1165 + #{isAutoFm}
1164 1166 )
1165 1167  
1166 1168 </insert>
1167 1169  
... ... @@ -1174,21 +1176,21 @@
1174 1176  
1175 1177 <insert id="saveAntExChuToMysql" parameterType="com.lyms.platform.permission.model.ReportAntexchu">
1176 1178 INSERT INTO report_antexchu(
1177   - cid,
1178   - checkTime,
1179   - nextCheckTime,
1180   - hospitalId,
1181   - pid,
1182   - parentId,
1183   - created
  1179 + cid,
  1180 + checkTime,
  1181 + nextCheckTime,
  1182 + hospitalId,
  1183 + pid,
  1184 + parentId,
  1185 + created
1184 1186 ) VALUES (
1185   - #{cid},
1186   - #{checkTime},
1187   - #{nextCheckTime},
1188   - #{hospitalId},
1189   - #{pid},
1190   - #{parentId},
1191   - #{created}
  1187 + #{cid},
  1188 + #{checkTime},
  1189 + #{nextCheckTime},
  1190 + #{hospitalId},
  1191 + #{pid},
  1192 + #{parentId},
  1193 + #{created}
1192 1194 )
1193 1195  
1194 1196 </insert>
1195 1197  
... ... @@ -1201,21 +1203,21 @@
1201 1203  
1202 1204 <insert id="saveAntexToMysql" parameterType="com.lyms.platform.permission.model.ReportAntex">
1203 1205 INSERT INTO report_antex(
1204   - fid,
1205   - parentId,
1206   - pid,
1207   - checkDate,
1208   - nextCheckTime,
1209   - yn,
1210   - created
  1206 + fid,
  1207 + parentId,
  1208 + pid,
  1209 + checkDate,
  1210 + nextCheckTime,
  1211 + yn,
  1212 + created
1211 1213 ) VALUES (
1212   - #{fid},
1213   - #{parentId},
1214   - #{pid},
1215   - #{checkDate},
1216   - #{nextCheckTime},
1217   - #{yn},
1218   - #{created}
  1214 + #{fid},
  1215 + #{parentId},
  1216 + #{pid},
  1217 + #{checkDate},
  1218 + #{nextCheckTime},
  1219 + #{yn},
  1220 + #{created}
1219 1221 )
1220 1222  
1221 1223 </insert>
1222 1224  
... ... @@ -1228,21 +1230,21 @@
1228 1230  
1229 1231 <insert id="saveMatdeliverToMysql" parameterType="com.lyms.platform.permission.model.ReportMatdeliver">
1230 1232 INSERT INTO report_matdeliver(
1231   - mid,
1232   - parentId,
1233   - pid,
1234   - dueDate1,
1235   - created,
1236   - fmHospital,
1237   - hospitalId
  1233 + mid,
  1234 + parentId,
  1235 + pid,
  1236 + dueDate1,
  1237 + created,
  1238 + fmHospital,
  1239 + hospitalId
1238 1240 ) VALUES (
1239   - #{mid},
1240   - #{parentId},
1241   - #{pid},
1242   - #{dueDate1},
1243   - #{created},
1244   - #{fmHospital},
1245   - #{hospitalId}
  1241 + #{mid},
  1242 + #{parentId},
  1243 + #{pid},
  1244 + #{dueDate1},
  1245 + #{created},
  1246 + #{fmHospital},
  1247 + #{hospitalId}
1246 1248 )
1247 1249  
1248 1250 </insert>
... ... @@ -1250,6 +1252,27 @@
1250 1252  
1251 1253 <delete id="deleteMatdeliverToMysql" parameterType="com.lyms.platform.permission.model.ReportMatdeliver">
1252 1254 DELETE from report_matdeliver WHERE mid = #{mid}
  1255 + </delete>
  1256 +
  1257 +
  1258 + <insert id="saveRiskLevelToMysql" parameterType="com.lyms.platform.permission.model.ReportRiskLevel">
  1259 + INSERT INTO report_risk_level(
  1260 + riskLevelId,
  1261 + riskLevel,
  1262 + type,
  1263 + foreignId
  1264 + ) VALUES (
  1265 + #{riskLevelId},
  1266 + #{riskLevel},
  1267 + #{type},
  1268 + #{foreignId}
  1269 + )
  1270 +
  1271 + </insert>
  1272 +
  1273 +
  1274 + <delete id="deleteRiskLevelToMysql" parameterType="com.lyms.platform.permission.model.ReportRiskLevel">
  1275 + DELETE from report_risk_level WHERE foreignId = #{foreignId}
1253 1276 </delete>
1254 1277 </mapper>
platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java View file @ 65fad73
... ... @@ -141,6 +141,27 @@
141 141 //是否超过上线值
142 142 private String isNormal;
143 143  
  144 + //1孕妇 3产妇
  145 + private Integer type;
  146 + private Integer isUp;//是否增长过快 1和空为正常 2 过快
  147 +
  148 +
  149 + public Integer getIsUp() {
  150 + return isUp;
  151 + }
  152 +
  153 + public void setIsUp(Integer isUp) {
  154 + this.isUp = isUp;
  155 + }
  156 +
  157 + public Integer getType() {
  158 + return type;
  159 + }
  160 +
  161 + public void setType(Integer type) {
  162 + this.type = type;
  163 + }
  164 +
144 165 public String getIsNormal() {
145 166 return isNormal;
146 167 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java View file @ 65fad73
... ... @@ -58,8 +58,9 @@
58 58 @ResponseBody
59 59 @TokenRequired
60 60 @RequestMapping(value = "/query", method = RequestMethod.GET)
61   - public BaseResponse list(String key, String lastname,String vcCardNo, Integer currentWeekStart, Integer currentWeekEnd, Integer age, Integer page, Integer limit, HttpServletRequest request) {
62   - return patientWeightService.list(key, lastname, vcCardNo, currentWeekStart, currentWeekEnd, age, page, limit, getUserId(request));
  61 + public BaseResponse list(String key, String lastname,String vcCardNo, Integer currentWeekStart,
  62 + Integer currentWeekEnd, Integer age, Integer page, Integer limit, Integer type, Integer isUp, HttpServletRequest request) {
  63 + return patientWeightService.list(key, lastname, vcCardNo, currentWeekStart, currentWeekEnd, age, page, limit, getUserId(request),type,isUp);
63 64 }
64 65  
65 66 /**
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java View file @ 65fad73
... ... @@ -3959,7 +3959,7 @@
3959 3959 Patients patients = patientsService.findOnePatientById(weight.getPatientId());
3960 3960 if (patients != null)
3961 3961 {
3962   - String isNormal = patientWeightService.getWeightRangeIsNormal(patients,weight);
  3962 + String isNormal = patientWeightService.getWeightRangeIsNormal(patients,weight).get("isNormal");
3963 3963 weight.setIsNormal(isNormal);
3964 3964 patientWeightService2.update(Query.query(Criteria.where("id").is(weight.getId())), weight);
3965 3965 }
... ... @@ -3979,6 +3979,55 @@
3979 3979  
3980 3980  
3981 3981 @ResponseBody
  3982 + @RequestMapping(value = "/updateWeightIsUp", method = RequestMethod.GET)
  3983 + public String updateWeightIsUp(@RequestParam(required = false) String hospitalId, String startDate, String endDate) {
  3984 + List<PatientWeight> patientWeights = mongoTemplate.find(Query.query(Criteria.where("yn").
  3985 + is("1").and("_id").is("5f0bfd6199329c3fdf92ef28")), PatientWeight.class);
  3986 +
  3987 + System.out.println("本次读取了【" + patientWeights.size() + "】条数据");
  3988 + int batchSize = 1000;
  3989 + int end = 0;
  3990 + for (int i = 0; i < patientWeights.size(); i += batchSize) {
  3991 + end = (end + batchSize);
  3992 + if (end > patientWeights.size()) {
  3993 + end = patientWeights.size();
  3994 + }
  3995 + final List<PatientWeight> tempList = patientWeights.subList(i, end);
  3996 + commonThreadPool.execute(new Runnable() {
  3997 + @Override
  3998 + public void run() {
  3999 + if (CollectionUtils.isNotEmpty(tempList)) {
  4000 + for (PatientWeight weight : tempList) {
  4001 + try {
  4002 + if (weight != null && StringUtils.isNotEmpty(weight.getPatientId()))
  4003 + {
  4004 + Patients patients = patientsService.findOnePatientById(weight.getPatientId());
  4005 + if (patients != null)
  4006 + {
  4007 + Map<String,String> datas = patientWeightService.getWeightRangeIsNormal(patients,weight);
  4008 + String isNormal = datas.get("isNormal");
  4009 + String isUp = datas.get("isUp");
  4010 + weight.setIsNormal(isNormal);
  4011 + weight.setIsUp(Integer.parseInt(isUp));
  4012 + weight.setType(patients.getType());
  4013 + patientWeightService2.update(Query.query(Criteria.where("id").is(weight.getId())), weight);
  4014 + }
  4015 + }
  4016 + }catch (Exception e)
  4017 + {
  4018 + continue;
  4019 + }
  4020 + }
  4021 + }
  4022 + }
  4023 + });
  4024 + }
  4025 + return "updateWeightIsNormal start......";
  4026 + }
  4027 +
  4028 +
  4029 +
  4030 + @ResponseBody
3982 4031 @RequestMapping(value = "/updateBabyAfterVisitStatisticsModel", method = RequestMethod.GET)
3983 4032 public String updateBabyAfterVisitStatisticsModel(@RequestParam(required = false) String hospitalId) {
3984 4033 OrganizationQuery organizationQuery = new OrganizationQuery();
... ... @@ -4175,6 +4224,46 @@
4175 4224 patientSyncMysqlFacade.syncBabyCheck(startDate, endDate);
4176 4225 return "syncBabyCheck";
4177 4226 }
  4227 +
  4228 +
  4229 +
  4230 + @ResponseBody
  4231 + @RequestMapping(value = "/syncPatientsToMysql", method = RequestMethod.GET)
  4232 + public String syncPatientsToMysql(@RequestParam(required = false) Date startDate,@RequestParam(required = false) Date endDate) {
  4233 + patientSyncMysqlFacade.syncPatientsToMysql(startDate, endDate);
  4234 + return "syncPatientsToMysql";
  4235 + }
  4236 +
  4237 +
  4238 +
  4239 + @ResponseBody
  4240 + @RequestMapping(value = "/syncAntexchuToMysql", method = RequestMethod.GET)
  4241 + public String syncAntexchuToMysql(@RequestParam(required = false) Date startDate,@RequestParam(required = false) Date endDate) {
  4242 + patientSyncMysqlFacade.syncAntexchuToMysql(startDate, endDate);
  4243 + return "syncAntexchuToMysql";
  4244 + }
  4245 +
  4246 +
  4247 +
  4248 +
  4249 + @ResponseBody
  4250 + @RequestMapping(value = "/syncAntexToMysql", method = RequestMethod.GET)
  4251 + public String syncAntexToMysql(@RequestParam(required = false) Date startDate,@RequestParam(required = false) Date endDate) {
  4252 + patientSyncMysqlFacade.syncAntexToMysql(startDate, endDate);
  4253 + return "syncAntexToMysql";
  4254 + }
  4255 +
  4256 +
  4257 +
  4258 +
  4259 + @ResponseBody
  4260 + @RequestMapping(value = "/syncMatdeliverToMysql", method = RequestMethod.GET)
  4261 + public String syncMatdeliverToMysql(@RequestParam(required = false) Date startDate,@RequestParam(required = false) Date endDate) {
  4262 + patientSyncMysqlFacade.syncMatdeliverToMysql(startDate, endDate);
  4263 + return "syncMatdeliverToMysql";
  4264 + }
  4265 +
  4266 +
4178 4267  
4179 4268  
4180 4269 /**
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java View file @ 65fad73
... ... @@ -75,12 +75,11 @@
75 75 public class MatDeliverFacade {
76 76  
77 77 private Logger logger = LoggerFactory.getLogger(MatDeliverFacade.class);
78   -
79 78 @Autowired
  79 + private PatientWeightService2 patientWeightService2;
  80 + @Autowired
80 81 private MatDeliverService matDeliverService;
81 82 @Autowired
82   - private BabyAutoDiagnoseRiskFacade babyAutoDiagnoseRiskFacade;
83   - @Autowired
84 83 private MatDeliverFollowService matDeliverFollowService;
85 84 @Autowired
86 85 private AntenatalExaminationFacade antenatalExaminationFacade;
... ... @@ -628,6 +627,20 @@
628 627 new Thread(new Runnable() {
629 628 @Override
630 629 public void run() {
  630 +
  631 + // //体重记录更新为产妇状态
  632 + List<PatientWeight> patientWeights = patientWeightService2.queryPatientWeight(Query.query(Criteria.where("pid").is(pid)));
  633 +
  634 + if (CollectionUtils.isNotEmpty(patientWeights))
  635 + {
  636 + for (PatientWeight weight : patientWeights)
  637 + {
  638 + weight.setType(3);
  639 + patientWeightService2.update(Query.query(Criteria.where("id").is(weight.getId())), weight);
  640 + }
  641 + }
  642 +
  643 +
631 644 int limt = 1000;
632 645 int page = 1;
633 646 PersonModelQuery personModelQuery = new PersonModelQuery();
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java View file @ 65fad73
... ... @@ -768,7 +768,19 @@
768 768 public BaseResponse queryAbnormalWeight(RiskPatientsQueryRequest riskPatientsQueryRequest, Integer userId, String need) {
769 769  
770 770 String hospital = autoMatchFacade.getHospitalId(userId);
771   - Query query = Query.query(Criteria.where("hospitalId").is(hospital).and("yn").ne("0"));
  771 + Criteria criteria = Criteria.where("hospitalId").is(hospital).and("yn").is("1");
  772 +
  773 + if (riskPatientsQueryRequest.getIsUp() != null)
  774 + {
  775 + criteria.and("isUp").is(riskPatientsQueryRequest.getIsUp());
  776 + }
  777 +
  778 + if (riskPatientsQueryRequest.getType() != null)
  779 + {
  780 + criteria.and("type").is(riskPatientsQueryRequest.getType());
  781 + }
  782 +
  783 + Query query = Query.query(criteria);
772 784 String formatBmi = "";
773 785 if ("1".equals(riskPatientsQueryRequest.getBmi())) {
774 786 formatBmi = String.format("function () { return this.bmi >= %s && this.bmi < %s; }", "25", "28");
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientSyncMysqlFacade.java View file @ 65fad73
... ... @@ -32,6 +32,7 @@
32 32  
33 33 import java.lang.reflect.InvocationTargetException;
34 34 import java.util.Date;
  35 +import java.util.HashMap;
35 36 import java.util.List;
36 37 import java.util.Map;
37 38  
38 39  
... ... @@ -66,7 +67,17 @@
66 67 @Autowired
67 68 private OrganizationService organizationService;
68 69  
  70 + private static Map<String,Integer> levels = new HashMap<>();
  71 + {
  72 + levels.put("fb43fd5a-b153-4cb9-9180-c46f5612ba43",1);
  73 + levels.put("e637b361-99cf-41eb-84f2-f0dab596e928",1);
  74 + levels.put("315107bd-91fe-42a1-9237-752f3c046a40",2);
  75 + levels.put("49a36aea-c5b6-4162-87d2-9eb3c6ec00c2",3);
  76 + levels.put("eb146c03-b19f-4e28-b85f-fda574b2283b",4);
  77 + levels.put("224b2329-cb82-4da3-a071-8527f8283aab",5);
  78 + }
69 79  
  80 +
70 81 /**
71 82 * 档案
72 83 */
... ... @@ -1268,8 +1279,8 @@
1268 1279 {
1269 1280 PatientsQuery patientsQuery = new PatientsQuery();
1270 1281 patientsQuery.setYn(YnEnums.YES.getId());
1271   - patientsQuery.setCreatedTimeStart(start);
1272   - patientsQuery.setCreatedTimeEnd(end);
  1282 + patientsQuery.setModifiedStart(start);
  1283 + patientsQuery.setModifiedEnd(end);
1273 1284 patientsQuery.setNeed("true");
1274 1285 patientsQuery.setLimit(100);
1275 1286 int page = 1;
1276 1287  
1277 1288  
1278 1289  
... ... @@ -1277,17 +1288,18 @@
1277 1288 {
1278 1289 patientsQuery.setPage(page);
1279 1290 List<Patients> patientses = patientsService.queryPatient(patientsQuery);
1280   - if (CollectionUtils.isNotEmpty(patientses))
  1291 + if (CollectionUtils.isEmpty(patientses))
1281 1292 {
1282   - System.out.println("同步完成syncPatientsToMysql");
  1293 + System.out.println("同步完成syncPatientsToMysql"+page);
1283 1294 break;
1284 1295 }
1285 1296  
1286 1297 for(Patients patients : patientses)
1287 1298 {
1288 1299 ReportPatients reportPatients = new ReportPatients();
1289   -
  1300 + reportPatients.setPatientId(patients.getId());
1290 1301 try {
  1302 + ConvertUtils.register(new DateLocaleConverter(), Date.class);
1291 1303 BeanUtils.copyProperties(reportPatients,patients);
1292 1304 } catch (IllegalAccessException e) {
1293 1305 e.printStackTrace();
1294 1306  
1295 1307  
... ... @@ -1300,15 +1312,16 @@
1300 1312 page++;
1301 1313 }
1302 1314 }
  1315 + @Autowired
  1316 + private BasicConfigService basicConfigService;
1303 1317  
1304   -
1305 1318 public void syncAntexchuToMysql(Date start,Date end)
1306 1319 {
1307 1320 AntExChuQuery antExChuQuery = new AntExChuQuery();
1308 1321 antExChuQuery.setYn(YnEnums.YES.getId());
1309   - antExChuQuery.setCheckTimeStart(start);
1310   - antExChuQuery.setCheckTimeEnd(end);
1311   - antExChuQuery.setNext(true);
  1322 + antExChuQuery.setModifiedStart(start);
  1323 + antExChuQuery.setModifiedEnd(end);
  1324 + antExChuQuery.setNeed("true");
1312 1325  
1313 1326 antExChuQuery.setLimit(100);
1314 1327 int page = 1;
... ... @@ -1316,7 +1329,7 @@
1316 1329 {
1317 1330 antExChuQuery.setPage(page);
1318 1331 List <AntExChuModel> antExChus = antenatalExaminationService.queryAntExChu(antExChuQuery);
1319   - if (CollectionUtils.isNotEmpty(antExChus))
  1332 + if (CollectionUtils.isEmpty(antExChus))
1320 1333 {
1321 1334 System.out.println("同步完成syncAntexchuToMysql");
1322 1335 break;
1323 1336  
... ... @@ -1325,9 +1338,42 @@
1325 1338 for(AntExChuModel antExChu : antExChus)
1326 1339 {
1327 1340 ReportAntexchu reportAntexchu = new ReportAntexchu();
1328   -
  1341 + reportAntexchu.setCid(antExChu.getId());
1329 1342 try {
1330   - BeanUtils.copyProperties(reportAntexchu,antExChu);
  1343 +
  1344 + if (null != antExChu && org.apache.commons.lang.StringUtils.isNotEmpty(antExChu.getHighrisk()) && !"[]".equals(antExChu.getHighrisk())) {
  1345 + List list2 = JsonUtil.toList(antExChu.getHighrisk(), List.class);
  1346 + if (CollectionUtils.isNotEmpty(list2))
  1347 + {
  1348 + BasicConfigQuery
  1349 + basicConfigQuery = new BasicConfigQuery();
  1350 + ReportRiskLevel reportRiskLevel1 = new ReportRiskLevel();
  1351 + reportRiskLevel1.setForeignId(antExChu.getId());
  1352 + mysqlAntexcService.deleteRiskLevelToMysql(reportRiskLevel1);
  1353 + for (Object key : list2)
  1354 + {
  1355 + if (key != null && StringUtils.isNotEmpty(key.toString()))
  1356 + {
  1357 + basicConfigQuery.setId(key.toString());
  1358 + List<BasicConfig> basicConfigs = basicConfigService.queryBasicConfig(basicConfigQuery);
  1359 + if (CollectionUtils.isNotEmpty(basicConfigs)) {
  1360 + BasicConfig basicConfig = basicConfigs.get(0);
  1361 + String riskLevelId = basicConfig.getParentId();
  1362 + Integer level = levels.get(riskLevelId);
  1363 +
  1364 + ReportRiskLevel reportRiskLevel = new ReportRiskLevel();
  1365 + reportRiskLevel.setForeignId(antExChu.getId());
  1366 + reportRiskLevel.setRiskLevel(level);
  1367 + reportRiskLevel.setRiskLevelId(riskLevelId);
  1368 + reportRiskLevel.setType(2);
  1369 + mysqlAntexcService.saveRiskLevelToMysql(reportRiskLevel);
  1370 + }
  1371 + }
  1372 + }
  1373 + }
  1374 + }
  1375 + ConvertUtils.register(new DateLocaleConverter(), Date.class);
  1376 + BeanUtils.copyProperties(reportAntexchu, antExChu);
1331 1377 } catch (IllegalAccessException e) {
1332 1378 e.printStackTrace();
1333 1379 } catch (InvocationTargetException e) {
... ... @@ -1345,9 +1391,9 @@
1345 1391 {
1346 1392 AntExQuery antExQuery = new AntExQuery();
1347 1393 antExQuery.setYn(YnEnums.YES.getId());
1348   - antExQuery.setCreatedTimeStart(start);
1349   - antExQuery.setCreatedTimeEnd(end);
1350   - antExQuery.setNext(true);
  1394 + antExQuery.setModifiedStart(start);
  1395 + antExQuery.setModifiedEnd(end);
  1396 + antExQuery.setNeed("true");
1351 1397  
1352 1398 antExQuery.setLimit(100);
1353 1399 int page = 1;
... ... @@ -1355,7 +1401,7 @@
1355 1401 {
1356 1402 antExQuery.setPage(page);
1357 1403 List <AntenatalExaminationModel> antexs = antenatalExaminationService.queryLastAntenx(antExQuery);
1358   - if (CollectionUtils.isNotEmpty(antexs))
  1404 + if (CollectionUtils.isEmpty(antexs))
1359 1405 {
1360 1406 System.out.println("同步完成syncAntexToMysql");
1361 1407 break;
1362 1408  
... ... @@ -1364,9 +1410,42 @@
1364 1410 for(AntenatalExaminationModel antex : antexs)
1365 1411 {
1366 1412 ReportAntex reportAntex = new ReportAntex();
1367   -
  1413 + reportAntex.setFid(antex.getId());
1368 1414 try {
1369   - BeanUtils.copyProperties(reportAntex,antex);
  1415 +
  1416 + if (null != antex && org.apache.commons.lang.StringUtils.isNotEmpty(antex.getRiskFactor()) && !"[]".equals(antex.getRiskFactor())) {
  1417 + List list2 = JsonUtil.toList(antex.getRiskFactor(), List.class);
  1418 + if (CollectionUtils.isNotEmpty(list2))
  1419 + {
  1420 + BasicConfigQuery
  1421 + basicConfigQuery = new BasicConfigQuery();
  1422 + ReportRiskLevel reportRiskLevel1 = new ReportRiskLevel();
  1423 + reportRiskLevel1.setForeignId(antex.getId());
  1424 + mysqlAntexcService.deleteRiskLevelToMysql(reportRiskLevel1);
  1425 + for (Object key : list2)
  1426 + {
  1427 + if (key != null && StringUtils.isNotEmpty(key.toString())) {
  1428 + basicConfigQuery.setId(key.toString());
  1429 + List<BasicConfig> basicConfigs = basicConfigService.queryBasicConfig(basicConfigQuery);
  1430 + if (CollectionUtils.isNotEmpty(basicConfigs)) {
  1431 + BasicConfig basicConfig = basicConfigs.get(0);
  1432 + String riskLevelId = basicConfig.getParentId();
  1433 + Integer level = levels.get(riskLevelId);
  1434 +
  1435 + ReportRiskLevel reportRiskLevel = new ReportRiskLevel();
  1436 + reportRiskLevel.setForeignId(antex.getId());
  1437 + reportRiskLevel.setRiskLevel(level);
  1438 + reportRiskLevel.setRiskLevelId(riskLevelId);
  1439 + reportRiskLevel.setType(3);
  1440 +
  1441 + mysqlAntexcService.saveRiskLevelToMysql(reportRiskLevel);
  1442 + }
  1443 + }
  1444 + }
  1445 + }
  1446 + }
  1447 + ConvertUtils.register(new DateLocaleConverter(), Date.class);
  1448 + BeanUtils.copyProperties(reportAntex, antex);
1370 1449 } catch (IllegalAccessException e) {
1371 1450 e.printStackTrace();
1372 1451 } catch (InvocationTargetException e) {
1373 1452  
... ... @@ -1384,17 +1463,16 @@
1384 1463 {
1385 1464 MatDeliverQuery matDeliverQuery = new MatDeliverQuery();
1386 1465 matDeliverQuery.setYn(YnEnums.YES.getId());
1387   - matDeliverQuery.setCreatedTimeStart(start);
1388   - matDeliverQuery.setCreatedTimeEnd(end);
1389   - matDeliverQuery.setNext(true);
1390   -
  1466 + matDeliverQuery.setModifiedStart(start);
  1467 + matDeliverQuery.setModifiedEnd(end);
  1468 + matDeliverQuery.setNeed("true");
1391 1469 matDeliverQuery.setLimit(100);
1392 1470 int page = 1;
1393 1471 while (true)
1394 1472 {
1395 1473 matDeliverQuery.setPage(page);
1396   - List <MaternalDeliverModel> maternalDeliverModels = matDeliverService.query(matDeliverQuery);
1397   - if (CollectionUtils.isNotEmpty(maternalDeliverModels))
  1474 + List <MaternalDeliverModel> maternalDeliverModels = matDeliverService.pageQuery(matDeliverQuery);
  1475 + if (CollectionUtils.isEmpty(maternalDeliverModels))
1398 1476 {
1399 1477 System.out.println("同步完成syncMatdeliverToMysql");
1400 1478 break;
1401 1479  
... ... @@ -1403,8 +1481,9 @@
1403 1481 for(MaternalDeliverModel maternalDeliverModel : maternalDeliverModels)
1404 1482 {
1405 1483 ReportMatdeliver reportMatdeliver = new ReportMatdeliver();
1406   -
  1484 + reportMatdeliver.setMid(maternalDeliverModel.getId());
1407 1485 try {
  1486 + ConvertUtils.register(new DateLocaleConverter(), Date.class);
1408 1487 BeanUtils.copyProperties(reportMatdeliver,maternalDeliverModel);
1409 1488 } catch (IllegalAccessException e) {
1410 1489 e.printStackTrace();
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/RiskPatientsQueryRequest.java View file @ 65fad73
... ... @@ -186,6 +186,16 @@
186 186 private String firstCheckId;
187 187 //初诊时间
188 188 private String firstCheckTime;
  189 + // 0 全部 1 正常 2 异常
  190 + private Integer isUp;
  191 +
  192 + public Integer getIsUp() {
  193 + return isUp;
  194 + }
  195 +
  196 + public void setIsUp(Integer isUp) {
  197 + this.isUp = isUp;
  198 + }
189 199  
190 200 public String getFirstCheckId() {
191 201 return firstCheckId;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java View file @ 65fad73
... ... @@ -28,7 +28,7 @@
28 28  
29 29 BaseResponse addOrUpdate(Integer userId, PatientWeight patientWeight);
30 30  
31   - BaseResponse list(String key,String lastname, String vcCardNo, Integer currentWeekStart, Integer currentWeekEnd, Integer age, Integer page, Integer limit, Integer userId);
  31 + BaseResponse list(String key,String lastname, String vcCardNo, Integer currentWeekStart, Integer currentWeekEnd, Integer age, Integer page, Integer limit, Integer userId,Integer type, Integer isUp);
32 32  
33 33 BaseResponse info(String id);
34 34  
... ... @@ -77,7 +77,7 @@
77 77 void generateWeightMsg();
78 78  
79 79  
80   - public String getWeightRangeIsNormal(Patients patients,PatientWeight pw);
  80 + public Map<String,String> getWeightRangeIsNormal(Patients patients,PatientWeight pw);
81 81  
82 82  
83 83 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java View file @ 65fad73
... ... @@ -216,7 +216,9 @@
216 216 }
217 217 pw.setDayWeights2(dayWeights2);
218 218 pw.setModified(new Date());
219   - pw.setIsNormal(getWeightRangeIsNormal(patients,pw));
  219 + Map<String,String> result = getWeightRangeIsNormal(patients, pw);
  220 + pw.setIsNormal(result.get("isNormal"));
  221 + pw.setIsUp(Integer.parseInt(result.get("isUp")));
220 222 patientWeightService2.update(Query.query(Criteria.where("id").is(pw.getId())), pw);
221 223 return RespBuilder.buildSuccess(pw.getId());
222 224 }
... ... @@ -250,7 +252,10 @@
250 252 dayWeights2.add(m);
251 253 patientWeight.setDayWeights2(dayWeights2);
252 254 patientWeight.setModified(new Date());
253   - patientWeight.setIsNormal(getWeightRangeIsNormal(patients, patientWeight));
  255 + Map<String,String> result = getWeightRangeIsNormal(patients, patientWeight);
  256 + patientWeight.setIsNormal(result.get("isNormal"));
  257 + patientWeight.setIsUp(Integer.parseInt(result.get("isUp")));
  258 + patientWeight.setType(1);
254 259 patientWeightService2.add(patientWeight);
255 260  
256 261 operateLogFacade.addAddOptLog(userId, Integer.valueOf(hospitalId), patientWeight, OptActionEnums.ADD.getId(), "添加孕体重");
257 262  
258 263  
... ... @@ -274,10 +279,12 @@
274 279 }
275 280 }
276 281 /**
277   - * 计算当前测量的体重是否超过上线值
  282 + * 计算当前测量的体重是否超过上线值,同时计算增长率
278 283 */
279   - public String getWeightRangeIsNormal(Patients patients,PatientWeight pw) {
  284 + public Map<String,String> getWeightRangeIsNormal(Patients patients,PatientWeight pw) {
280 285  
  286 + Map<String,String> result = new HashMap<>();
  287 +
281 288 Map<String, Object> series = new LinkedHashMap<>();
282 289 String isNormal = "true";
283 290 if (pw != null)
284 291  
285 292  
286 293  
287 294  
... ... @@ -286,15 +293,22 @@
286 293 double bmiD = Double.parseDouble(pw.getBmi());
287 294 String bmiStr = pw.getBmi();
288 295 String bregmatic = pw.getBregmatic();
  296 +
  297 + double sp = 0;
  298 +
289 299 //空和1表示单胎
290 300 if (!StringUtils.isNotEmpty(bregmatic) || "1".equals(bregmatic)) {
291 301 if (bmiD < 18.5) {
  302 + sp = 0.51;
292 303 bmiStr = "BMI<18.5";
293 304 } else if (bmiD >= 18.5 && bmiD <= 24.9) {
294 305 bmiStr = "BMI=18.5-24.9";
  306 + sp = 0.42;
295 307 } else if (bmiD > 24.9 && bmiD < 30) {
  308 + sp = 0.28;
296 309 bmiStr = "BMI=25-29.9";
297 310 } else if (bmiD >= 30) {
  311 + sp = 0.22;
298 312 bmiStr = "BMI≥30";
299 313 }
300 314 } else {
... ... @@ -307,6 +321,31 @@
307 321 }
308 322 }
309 323  
  324 + String isUp = "1";
  325 + Map<String,String> dayweights = pw.getDayWeights();
  326 + if (dayweights != null && dayweights.size() > 1 && sp > 0)
  327 + {
  328 + int i = 1;
  329 + String lastKey = "";
  330 + String lastSecKey = "";
  331 + for (String key : dayweights.keySet())
  332 + {
  333 + if (i == dayweights.size() -1)
  334 + {
  335 + lastSecKey = key;
  336 + }
  337 + else if (i == dayweights.size())
  338 + {
  339 + lastKey = key;
  340 + }
  341 + i++;
  342 + }
  343 +
  344 + int startWeek = DateUtil.getWeek(patients.getLastMenses(),DateUtil.parseYMD(lastSecKey));
  345 + int endWeek = DateUtil.getWeek(patients.getLastMenses(),DateUtil.parseYMD(lastKey));
  346 + isUp = (Double.parseDouble(dayweights.get(lastKey)) - Double.parseDouble(dayweights.get(lastSecKey))) /(endWeek - startWeek) > sp ? "2" : isUp;
  347 + }
  348 + result.put("isUp",isUp);
310 349 getSeries(series, bmiStr, pw.getBregmatic());
311 350 if (series.get("highDataMap") != null)
312 351 {
... ... @@ -319,7 +358,9 @@
319 358 }
320 359 }
321 360 }
322   - return isNormal;
  361 +
  362 + result.put("isNormal",isNormal);
  363 + return result;
323 364 }
324 365  
325 366  
... ... @@ -449,7 +490,8 @@
449 490  
450 491  
451 492 @Override
452   - public BaseResponse list(String key, String lastname,String vcCardNo, Integer currentWeekStart, Integer currentWeekEnd, Integer age, Integer page, Integer limit, Integer userId) {
  493 + public BaseResponse list(String key, String lastname,String vcCardNo, Integer currentWeekStart, Integer currentWeekEnd,
  494 + Integer age, Integer page, Integer limit, Integer userId,Integer type, Integer isUp) {
453 495 boolean flag = false;
454 496 List<String> hospital = groupsFacade.findGroupHospital(userId, false);
455 497 Criteria criteria = Criteria.where("yn").ne("0").and("hospitalId").in(hospital);
... ... @@ -487,6 +529,16 @@
487 529 }
488 530 }
489 531 criteria.and("patientId").in(ids);
  532 + }
  533 +
  534 + if (isUp != null)
  535 + {
  536 + criteria.and("isUp").is(isUp);
  537 + }
  538 +
  539 + if (type != null)
  540 + {
  541 + criteria.and("type").is(type);
490 542 }
491 543  
492 544 PageResult pageResult = findMongoPage(PatientWeight.class, new Query(criteria).with(new Sort(Sort.Direction.DESC, "modified")), page, limit);