Commit 4e6ec4af700341d582d2e20bfcdc98f03f3f50f6

Authored by liquanyu
1 parent 3663e4c701

code update

Showing 3 changed files with 131 additions and 35 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/JdbcUtil.java View file @ 4e6ec4a
1 1 package com.lyms.platform.biz;
2 2  
3 3 import com.lyms.platform.common.enums.*;
  4 +import com.lyms.platform.common.utils.DateUtil;
4 5 import com.lyms.platform.common.utils.JsonUtil;
  6 +import com.lyms.platform.common.utils.StringUtils;
5 7 import com.lyms.platform.common.utils.SystemConfig;
6 8 import com.lyms.platform.pojo.*;
  9 +import org.apache.commons.collections.CollectionUtils;
7 10 import org.apache.velocity.anakia.Escape;
8 11 import org.bson.types.ObjectId;
9 12 import org.springframework.context.ApplicationContext;
10 13  
11 14  
12 15  
13 16  
14 17  
15 18  
16 19  
17 20  
18 21  
19 22  
20 23  
... ... @@ -169,38 +172,86 @@
169 172 public static void syncPatientData(String hospitalId)
170 173 {
171 174 List<Map<String,Object>> list = getListDataBySql(" SELECT * FROM ( SELECT A.*, ROWNUM RN FROM " +
172   - "(select replace(mp.P_NO,'-','') as PID,mp.*,p_birthday from MOMMY_PATIENT mp left join Plat_Patient pp" +
173   - " on mp.p_platpatientid=pp.p_id where mp.p_hospitalid = '"+hospitalId+"') A WHERE ROWNUM <= 10 ) WHERE RN >= 0 ");
  175 + "(select replace(mp.P_NO,'-','') as PID,mp.*,p_birthday,p_name,floor((trunc(sysdate) - trunc(mp.P_LASTMENSTRUALPERIOD)+1) /7) as weeks from MOMMY_PATIENT mp left join Plat_Patient pp" +
  176 + " on mp.p_platpatientid=pp.p_id where mp.p_hospitalid = '"+hospitalId+"') A WHERE ROWNUM <= 30 and weeks < 42) WHERE RN >= 0 ");
174 177  
175 178  
176 179 MongoTemplate mongoTemplate = getMongoTemplate();
177 180  
178 181 for(Map<String,Object> map : list)
179 182 {
  183 + Patients patients = new Patients();
180 184 PersonModel person = new PersonModel();
  185 +
  186 +
  187 + int type = 1;
  188 + Integer weeks = getInteger(map.get("WEEKS"));
  189 + List<Map<String,Object>> chanList = null;
  190 + if (StringUtils.isNotEmpty(getString(map.get("P_ID"))))
  191 + {
  192 + chanList = getListDataBySql("select * from MOMMY_PREGDELIVERYRECORD p where p.pdr_patientid = '"+getString(map.get("p_id"))+"' order by p.PDR_CHILDBIRTHDAY desc ");
  193 + }
  194 + if (weeks >= 42 || CollectionUtils.isNotEmpty(chanList))
  195 + {
  196 + Date fmDate = null;
  197 + if (CollectionUtils.isNotEmpty(chanList))
  198 + {
  199 + fmDate = getDate(chanList.get(0).get("PDR_CHILDBIRTHDAY"));
  200 + }
  201 + else
  202 + {
  203 + fmDate = DateUtil.addDay(getDate(map.get("P_LASTMENSTRUALPERIOD")),42*7);
  204 + }
  205 + patients.setFmDate(fmDate);
  206 +
  207 + type = 3;
  208 + }
  209 +
  210 + patients.setDueDate(DateUtil.addDay(getDate(map.get("P_LASTMENSTRUALPERIOD")), 42 * 7));
181 211 person.setCreated(new Date());
182   - person.setType(getInteger(map.get("P_PATIENTTYPE")));
  212 +
  213 +
  214 + person.setType(type);
183 215 person.setYn(YnEnums.YES.getId());
184   - person.setBirth(map.get("P_BIRTHDAY") == null ? new Date() : getDate(map.get("P_BIRTHDAY")));
  216 + person.setBirth(getDate(map.get("P_BIRTHDAY")));
185 217 person.setCardNo(getString(map.get("P_CARDNO")));
186   - person.setName(getString(map.get("P_MOTHERNAME")));
  218 + person.setName(getString(map.get("P_NAME")));
187 219 person.setPhone(getString(map.get("P_MOBILEPHONE")));
188   -
  220 + person.setCreated(getDate(map.get("P_FILINGTIME")));
  221 + person.setModified(getDate(map.get("P_OPERTIME")));
189 222 mongoTemplate.save(person);
190 223  
191   - Patients patients = new Patients();
  224 +
192 225 patients.setPid(person.getId());
193 226 patients.setId(String.valueOf(map.get("PID")));
194 227 patients.setYn(getInteger(map.get("P_ISVALID"))); //是否有效
  228 + patients.setBuildType(0);
  229 + patients.setBirth(getDate(map.get("P_BIRTHDAY")));
  230 + patients.setCreated(getDate(map.get("P_FILINGTIME")));
  231 + patients.setModified(getDate(map.get("P_OPERTIME")));
  232 + patients.setDueStatus(0);
195 233  
196   - String cardType = getString(map.get("P_CARDTYPE")); //证件类型
197   - String cardTypeName = getString(getOralceSingleObjBySql("select dc_name from plat_datacontent where dc_id='" + cardType + "'"));
198   - if (cardTypeName != null && !"".equals(cardTypeName))
  234 +
  235 +
  236 +
  237 +
  238 + if (StringUtils.isNotEmpty(getString(map.get("P_CARDNO"))))
199 239 {
200   - String id = getMongoBasicConfig(cardTypeName, SystemConfig.CERTE_TYPE_ID);
201   - patients.setPcerteTypeId(id);
  240 + String cardType = getString(map.get("P_CARDTYPE")); //证件类型
  241 + String cardTypeName = getString(getOralceSingleObjBySql("select dc_name from plat_datacontent where dc_id='" + cardType + "'"));
  242 + if (cardTypeName != null && !"".equals(cardTypeName))
  243 + {
  244 + String id = getMongoBasicConfig(cardTypeName, SystemConfig.CERTE_TYPE_ID);
  245 + patients.setPcerteTypeId(id);
  246 + }
  247 +
  248 + patients.setCardNo(getString(map.get("P_CARDNO"))); //证件号码
202 249 }
203   - patients.setCardNo(getString(map.get("P_CARDNO"))); //证件号码
  250 + else
  251 + {
  252 + patients.setCardNo(getString(map.get("P_MOBILEPHONE"))); //证件号码
  253 + patients.setPcerteTypeId("57e0a21c0cf209b410a82cda");
  254 + }
204 255  
205 256 //---------------------居住地址
206 257 String proviceId = getString(map.get("P_ADDRESSPROVINCE"));
... ... @@ -247,7 +298,7 @@
247 298 }
248 299  
249 300 patients.setPhone(getString(map.get("P_MOBILEPHONE"))); //孕妇手机号码
250   - patients.setUsername(getString(map.get("P_MOTHERNAME"))); //孕妇姓名
  301 + patients.setUsername(getString(map.get("P_NAME"))); //孕妇姓名
251 302 patients.setBookbuildingDate(getDate(map.get("P_FILINGTIME"))); //建档日期
252 303 patients.setLastMenses(getDate(map.get("P_LASTMENSTRUALPERIOD"))); //末次月经
253 304  
254 305  
255 306  
... ... @@ -282,14 +333,14 @@
282 333 patients.setHospitalId(id);
283 334 }
284 335  
285   - patients.setType(getInteger(map.get("P_PATIENTTYPE"))); //患者类型
  336 + patients.setType(type); //患者类型
286 337  
287   - String doctorId = getString(map.get("P_DOCID"));
  338 + String doctorId = getString(map.get("P_FILINGOPER"));
288 339 if (doctorId != null && !"".equals(doctorId))
289 340 {
290 341 String hname = getString(getOralceSingleObjBySql("select e.e_name from mommy_employee e where e.e_id = '" + doctorId + "'"));
291 342 String id = getString(getMysqlSingleObjBySql("select id from users where name = '" + hname + "'"));
292   - patients.setBookbuildingDoctor(id); //建档医生
  343 + patients.setBookbuildingDoctor(id); //建档医生(创建者)
293 344 }
294 345  
295 346 Integer isvip = getInteger(map.get("P_ISVIP")); //vip
... ... @@ -562,6 +613,8 @@
562 613 chuModel.setUterus(getString(map.get("FE_UTERUS")));
563 614 chuModel.setFujian(getString(map.get("FE_ATTACHMENT")));
564 615 chuModel.setCreated(getDate(map.get("FE_CREATETIME")));
  616 + chuModel.setNextCheckTime(getDate(map.get("FE_ORDERNEXT")));
  617 + chuModel.setCheckTime(getDate(map.get("FE_ROCTORTIME")));
565 618  
566 619 String hid = getString(map.get("FE_HOSPITALID"));
567 620 if (hid != null && !"".equals(hid))
568 621  
... ... @@ -718,9 +771,17 @@
718 771 antxModel.setUrineProtein(getString(map.get("URINEPROTEIN")));
719 772 antxModel.setbChao(getString(map.get("BCHAO")));
720 773 antxModel.setBloodSugar(getString(map.get("BLOODSUGAR")));
721   - antxModel.setRiskFactor(getString(map.get("RISKFACTOR")));
  774 + if (StringUtils.isNotEmpty(getString(map.get("RISKFACTOR"))))
  775 + {
  776 + antxModel.setRiskFactor(getString(map.get("RISKFACTOR")));
  777 + }
  778 + else
  779 + {
  780 + antxModel.setRiskFactor("[]");
  781 + }
  782 +
722 783 antxModel.setRiskScore(getString(map.get("RISKSCORE")));
723   - antxModel.setOtherRisk(getString(map.get("")));
  784 + antxModel.setOtherRisk("{}");
724 785 antxModel.setDiagnosis(getString(map.get("")));
725 786 antxModel.setType(getString(map.get("")));
726 787 antxModel.setTypeYc(getString(map.get("")));
... ... @@ -739,7 +800,14 @@
739 800 antxModel.setYn(getInteger(map.get("YN")));
740 801 antxModel.setCreated(getDate(map.get("CREATED")));
741 802 antxModel.setModified(getDate(map.get("MODIFIED")));
742   - antxModel.setHospitalId(getString(map.get("HOSPITALID")));
  803 +
  804 + String hid = getString(map.get("HOSPITALID"));
  805 + if (hid != null && !"".equals(hid))
  806 + {
  807 + String hname = getString(getOralceSingleObjBySql("select h_name from plat_hospital h where h.h_isvalid=1 and h_id = '" + hid + "'"));
  808 + String id = getString(getMysqlSingleObjBySql("select id from organization where name = '" + hname + "'"));
  809 + antxModel.setHospitalId(id);
  810 + }
743 811 antxModel.setcDueWeek(getString(map.get("CDUEWEEK")));
744 812  
745 813  
... ... @@ -778,7 +846,7 @@
778 846 model.setAddress(getString(map.get("PI_ADDRESS")));
779 847  
780 848 model.setFname(getString(map.get("PI_FATHERNAME")));
781   - model.setFphone(getString(map.get("PI_FATHERPROFESSION")));
  849 + model.setFphone(getString(map.get("PI_FATHERPHONE")));
782 850 model.setFbirth(getDate(map.get("")));
783 851  
784 852  
785 853  
786 854  
... ... @@ -843,16 +911,21 @@
843 911 Integer yn = getInteger(map.get("PI_ISDELETE"));
844 912 model.setYn(yn);
845 913  
846   - model.setDueType(getString(map.get("")));
847   - model.setFetusCount(getString(map.get("")));
848   - model.setDueCount(getString(map.get("")));
  914 + String dueTypeId = getString(map.get("PI_FENMIAN"));
  915 + if (dueTypeId != null && !"".equals(dueTypeId))
  916 + {
  917 + String name = getString(getOralceSingleObjBySql("select pd.dc_name from Plat_Datacontent pd where pd.dc_id='"+dueTypeId+"'"));
  918 + model.setDueType(FmTypeEnums.getIdByName(name));
  919 + }
  920 +
  921 + model.setFetusCount(getString(map.get("PI_FOETUSCOUNT")));
  922 + model.setDueCount(getString(map.get("PI_BIRTHCOUNT")));
849 923 model.setBabyWeight(getString(map.get("PI_WEIGHT")));
850 924 model.setBabyHeight(getString(map.get("PI_HEIGHT")));
851 925 model.setBabyHead(getString(map.get("PI_HEADSIZE")));
852   - model.setMalformation(getInteger(map.get("")));
  926 + model.setMalformation(getInteger(map.get("PI_BIRTHDEFORMED")));
853 927  
854   -
855   - String doctorId = getString(map.get("PI_DOCTORID"));
  928 + String doctorId = getString(map.get("PI_CREATEOPER"));
856 929 if (doctorId != null && !"".equals(doctorId)) {
857 930 String hname = getString(getOralceSingleObjBySql("select e.e_name from mommy_employee e where e.e_id = '" + doctorId + "'"));
858 931 String id = getString(getMysqlSingleObjBySql("select id from users where name = '" + hname + "'"));
859 932  
... ... @@ -906,9 +979,18 @@
906 979 }
907 980  
908 981 model.setVcCardNo(getString(map.get("PI_CARDNO")));
909   - model.setApgarScore(getString(map.get("")));
  982 +// String apgar = getString(map.get("PI_APGAR"));
  983 +// if (StringUtils.isNotEmpty(apgar))
  984 +// {
  985 +// String[] apgars = apgar.split("-");
  986 +// if (apgars)
  987 +// {
  988 +//
  989 +// }
  990 +// }
  991 +// model.setApgarScore();
910 992 model.setAsphyxiaM(getString(map.get("")));
911   - model.setPregnancyOut(getString(map.get("PI_BIRTHASPHYXIA")));
  993 + model.setPregnancyOut(getString(map.get("")));
912 994 model.setBabyHealthy(getString(map.get("")));
913 995 model.setContactStartM(getString(map.get("")));
914 996 model.setContactM(getString(map.get("")));
915 997  
... ... @@ -937,9 +1019,9 @@
937 1019 {
938 1020 BabyCheckModel checkModel = new BabyCheckModel();
939 1021  
940   - checkModel.setId(getString(map.get("CER_ID")));
  1022 + checkModel.setId(getString(map.get("CER_ID")).replace("-",""));
941 1023 checkModel.setYn(YnEnums.YES.getId());
942   - checkModel.setBuildId(getString(map.get("CER_PATIENTID")));
  1024 + checkModel.setBuildId(parentId);
943 1025 checkModel.setCheckDate(getDate(map.get("CER_EXAMINDATE")));
944 1026  
945 1027 String hname = getString(map.get("CER_EXAMINHOSPITAL"));
... ... @@ -1016,7 +1098,9 @@
1016 1098 }
1017 1099 else if ("体格发育评价".equals(itemName))
1018 1100 {
1019   - checkModel.setGrowthEvaluate(result);
  1101 + List<String> growthEvaluate = new ArrayList<>();
  1102 + growthEvaluate.add(result);
  1103 + checkModel.setGrowthEvaluate(JsonUtil.array2JsonString(growthEvaluate));
1020 1104 }
1021 1105 else if ("经皮胆红素".equals(itemName))
1022 1106 {
... ... @@ -1042,7 +1126,7 @@
1042 1126 else if ("前囟".equals(itemName))
1043 1127 {
1044 1128 //{"yeaOrNo":"no","wbhcc1":"5","wbhcc2":"5"}
1045   - //未闭合|1*1 未闭合|1.5×1.5
  1129 + //未闭合|1*1 未闭合|1.5×1.5 未闭合|1×1
1046 1130 Map bregma = new HashMap();
1047 1131 if ("闭合".equals(result))
1048 1132 {
... ... @@ -1236,7 +1320,7 @@
1236 1320 // DBCollection conn = template.getCollection("lyms_patient_test");
1237 1321 // conn.up
1238 1322  
1239   - syncBabyData("62");
  1323 + syncPatientData("62");
1240 1324 }
1241 1325 }
platform-common/src/main/java/com/lyms/platform/common/enums/FmTypeEnums.java View file @ 4e6ec4a
... ... @@ -18,6 +18,18 @@
18 18 this.name = name;
19 19 }
20 20  
  21 +
  22 + public static String getIdByName(String name)
  23 + {
  24 + for (FmTypeEnums e : FmTypeEnums.values()) {
  25 + if (e.getName().equals(name))
  26 + {
  27 + return e.getId();
  28 + }
  29 + }
  30 + return null;
  31 + }
  32 +
21 33 public static List<Map> getFmTypeEnums() {
22 34 List<Map> list = new ArrayList<>();
23 35 for (FmTypeEnums e : FmTypeEnums.values()) {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 4e6ec4a
... ... @@ -1753,7 +1753,7 @@
1753 1753 if (CollectionUtils.isNotEmpty(basicConfigs2)) {
1754 1754 for (BasicConfig bc : basicConfigs2) {
1755 1755 String name = bc.getName();
1756   - if (name.indexOf("预警") > -1) {
  1756 + if (name != null && name.indexOf("预警") > -1) {
1757 1757 name = name.replace("预警", "");
1758 1758 }
1759 1759 map.put("color", "risk_" + RiskDefaultTypeEnum.getColor(name));