Commit fddc135795daddcf59d1e9028dd3112d2b27a040
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'origin/master'
Showing 2 changed files
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/JdbcUtil.java
View file @
fddc135
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 |
... | ... | @@ -542,6 +593,17 @@ |
542 | 593 | chuModel.setGonggao(getString(map.get("FE_UTERUSHEIGHT"))); |
543 | 594 | chuModel.setFuwei(getString(map.get("FE_ABGIRTH"))); |
544 | 595 | |
596 | + | |
597 | + String doctorId = getString(map.get("FE_DOCTOR")); | |
598 | + if (doctorId != null && !"".equals(doctorId)) | |
599 | + { | |
600 | + String dname = getString(getOralceSingleObjBySql("select e.e_name from mommy_employee e where e.e_id = '" + doctorId + "'")); | |
601 | + String id = getString(getMysqlSingleObjBySql("select id from users where name = '" + dname + "'")); | |
602 | + chuModel.setProdDoctor(id);//产检医生 | |
603 | + } | |
604 | + | |
605 | + | |
606 | + | |
545 | 607 | Integer tireNum = 1; |
546 | 608 | if (map.get("FE_ISSECOND") !=null ) |
547 | 609 | { |
... | ... | @@ -562,7 +624,9 @@ |
562 | 624 | chuModel.setUterus(getString(map.get("FE_UTERUS"))); |
563 | 625 | chuModel.setFujian(getString(map.get("FE_ATTACHMENT"))); |
564 | 626 | chuModel.setCreated(getDate(map.get("FE_CREATETIME"))); |
565 | - | |
627 | + chuModel.setNextCheckTime(getDate(map.get("FE_ORDERNEXT"))); | |
628 | + chuModel.setCheckTime(getDate(map.get("FE_ROCTORTIME"))); | |
629 | + chuModel.setOtherHighRisk("{}"); | |
566 | 630 | String hid = getString(map.get("FE_HOSPITALID")); |
567 | 631 | if (hid != null && !"".equals(hid)) |
568 | 632 | { |
... | ... | @@ -683,7 +747,7 @@ |
683 | 747 | " --高危风险关系表\n" + |
684 | 748 | " MOMMY_EXAMINWARNING J\n" + |
685 | 749 | " --高危内容\n" + |
686 | - " INNER JOIN PLAT_DATACONTENT K ON J.ME_WORNINGID = K.DC_ID AND K.DC_ISVALID=1 AND K.DC_DATATYPEID='fb43fd5a-b153-4cb9-9180-c46f5612ba43'\n" + | |
750 | + " INNER JOIN PLAT_DATACONTENT K ON J.ME_WORNINGID = K.DC_ID AND K.DC_ISVALID=1 AND K.DC_DATATYPEID='fb43fd5a-b153-4cb9-9180-c46f5612ba43' AND K.DC_NAME<>'其他' \n" + | |
687 | 751 | " --高危等级\n" + |
688 | 752 | " INNER JOIN PLAT_DATACONTENT L ON K.DC_PARENTID=L.DC_ID AND L.DC_ISVALID=1\n" + |
689 | 753 | " INNER JOIN LYMS_BASICCONFIG LL ON K.DC_NAME=LL.NAME\n" + |
690 | 754 | |
... | ... | @@ -718,9 +782,17 @@ |
718 | 782 | antxModel.setUrineProtein(getString(map.get("URINEPROTEIN"))); |
719 | 783 | antxModel.setbChao(getString(map.get("BCHAO"))); |
720 | 784 | antxModel.setBloodSugar(getString(map.get("BLOODSUGAR"))); |
721 | - antxModel.setRiskFactor(getString(map.get("RISKFACTOR"))); | |
785 | + if (StringUtils.isNotEmpty(getString(map.get("RISKFACTOR")))) | |
786 | + { | |
787 | + antxModel.setRiskFactor(getString(map.get("RISKFACTOR"))); | |
788 | + } | |
789 | + else | |
790 | + { | |
791 | + antxModel.setRiskFactor("[]"); | |
792 | + } | |
793 | + | |
722 | 794 | antxModel.setRiskScore(getString(map.get("RISKSCORE"))); |
723 | - antxModel.setOtherRisk(getString(map.get(""))); | |
795 | + antxModel.setOtherRisk("{}"); | |
724 | 796 | antxModel.setDiagnosis(getString(map.get(""))); |
725 | 797 | antxModel.setType(getString(map.get(""))); |
726 | 798 | antxModel.setTypeYc(getString(map.get(""))); |
... | ... | @@ -739,7 +811,14 @@ |
739 | 811 | antxModel.setYn(getInteger(map.get("YN"))); |
740 | 812 | antxModel.setCreated(getDate(map.get("CREATED"))); |
741 | 813 | antxModel.setModified(getDate(map.get("MODIFIED"))); |
742 | - antxModel.setHospitalId(getString(map.get("HOSPITALID"))); | |
814 | + | |
815 | + String hid = getString(map.get("HOSPITALID")); | |
816 | + if (hid != null && !"".equals(hid)) | |
817 | + { | |
818 | + String hname = getString(getOralceSingleObjBySql("select h_name from plat_hospital h where h.h_isvalid=1 and h_id = '" + hid + "'")); | |
819 | + String id = getString(getMysqlSingleObjBySql("select id from organization where name = '" + hname + "'")); | |
820 | + antxModel.setHospitalId(id); | |
821 | + } | |
743 | 822 | antxModel.setcDueWeek(getString(map.get("CDUEWEEK"))); |
744 | 823 | |
745 | 824 | |
... | ... | @@ -778,7 +857,7 @@ |
778 | 857 | model.setAddress(getString(map.get("PI_ADDRESS"))); |
779 | 858 | |
780 | 859 | model.setFname(getString(map.get("PI_FATHERNAME"))); |
781 | - model.setFphone(getString(map.get("PI_FATHERPROFESSION"))); | |
860 | + model.setFphone(getString(map.get("PI_FATHERPHONE"))); | |
782 | 861 | model.setFbirth(getDate(map.get(""))); |
783 | 862 | |
784 | 863 | |
785 | 864 | |
786 | 865 | |
... | ... | @@ -843,16 +922,21 @@ |
843 | 922 | Integer yn = getInteger(map.get("PI_ISDELETE")); |
844 | 923 | model.setYn(yn); |
845 | 924 | |
846 | - model.setDueType(getString(map.get(""))); | |
847 | - model.setFetusCount(getString(map.get(""))); | |
848 | - model.setDueCount(getString(map.get(""))); | |
925 | + String dueTypeId = getString(map.get("PI_FENMIAN")); | |
926 | + if (dueTypeId != null && !"".equals(dueTypeId)) | |
927 | + { | |
928 | + String name = getString(getOralceSingleObjBySql("select pd.dc_name from Plat_Datacontent pd where pd.dc_id='"+dueTypeId+"'")); | |
929 | + model.setDueType(FmTypeEnums.getIdByName(name)); | |
930 | + } | |
931 | + | |
932 | + model.setFetusCount(getString(map.get("PI_FOETUSCOUNT"))); | |
933 | + model.setDueCount(getString(map.get("PI_BIRTHCOUNT"))); | |
849 | 934 | model.setBabyWeight(getString(map.get("PI_WEIGHT"))); |
850 | 935 | model.setBabyHeight(getString(map.get("PI_HEIGHT"))); |
851 | 936 | model.setBabyHead(getString(map.get("PI_HEADSIZE"))); |
852 | - model.setMalformation(getInteger(map.get(""))); | |
937 | + model.setMalformation(getInteger(map.get("PI_BIRTHDEFORMED"))); | |
853 | 938 | |
854 | - | |
855 | - String doctorId = getString(map.get("PI_DOCTORID")); | |
939 | + String doctorId = getString(map.get("PI_CREATEOPER")); | |
856 | 940 | if (doctorId != null && !"".equals(doctorId)) { |
857 | 941 | String hname = getString(getOralceSingleObjBySql("select e.e_name from mommy_employee e where e.e_id = '" + doctorId + "'")); |
858 | 942 | String id = getString(getMysqlSingleObjBySql("select id from users where name = '" + hname + "'")); |
859 | 943 | |
... | ... | @@ -906,9 +990,18 @@ |
906 | 990 | } |
907 | 991 | |
908 | 992 | model.setVcCardNo(getString(map.get("PI_CARDNO"))); |
909 | - model.setApgarScore(getString(map.get(""))); | |
993 | +// String apgar = getString(map.get("PI_APGAR")); | |
994 | +// if (StringUtils.isNotEmpty(apgar)) | |
995 | +// { | |
996 | +// String[] apgars = apgar.split("-"); | |
997 | +// if (apgars) | |
998 | +// { | |
999 | +// | |
1000 | +// } | |
1001 | +// } | |
1002 | +// model.setApgarScore(); | |
910 | 1003 | model.setAsphyxiaM(getString(map.get(""))); |
911 | - model.setPregnancyOut(getString(map.get("PI_BIRTHASPHYXIA"))); | |
1004 | + model.setPregnancyOut(getString(map.get(""))); | |
912 | 1005 | model.setBabyHealthy(getString(map.get(""))); |
913 | 1006 | model.setContactStartM(getString(map.get(""))); |
914 | 1007 | model.setContactM(getString(map.get(""))); |
915 | 1008 | |
... | ... | @@ -937,9 +1030,9 @@ |
937 | 1030 | { |
938 | 1031 | BabyCheckModel checkModel = new BabyCheckModel(); |
939 | 1032 | |
940 | - checkModel.setId(getString(map.get("CER_ID"))); | |
1033 | + checkModel.setId(getString(map.get("CER_ID")).replace("-","")); | |
941 | 1034 | checkModel.setYn(YnEnums.YES.getId()); |
942 | - checkModel.setBuildId(getString(map.get("CER_PATIENTID"))); | |
1035 | + checkModel.setBuildId(parentId); | |
943 | 1036 | checkModel.setCheckDate(getDate(map.get("CER_EXAMINDATE"))); |
944 | 1037 | |
945 | 1038 | String hname = getString(map.get("CER_EXAMINHOSPITAL")); |
... | ... | @@ -1016,7 +1109,9 @@ |
1016 | 1109 | } |
1017 | 1110 | else if ("体格发育评价".equals(itemName)) |
1018 | 1111 | { |
1019 | - checkModel.setGrowthEvaluate(result); | |
1112 | + List<String> growthEvaluate = new ArrayList<>(); | |
1113 | + growthEvaluate.add(result); | |
1114 | + checkModel.setGrowthEvaluate(JsonUtil.array2JsonString(growthEvaluate)); | |
1020 | 1115 | } |
1021 | 1116 | else if ("经皮胆红素".equals(itemName)) |
1022 | 1117 | { |
... | ... | @@ -1042,7 +1137,7 @@ |
1042 | 1137 | else if ("前囟".equals(itemName)) |
1043 | 1138 | { |
1044 | 1139 | //{"yeaOrNo":"no","wbhcc1":"5","wbhcc2":"5"} |
1045 | - //未闭合|1*1 未闭合|1.5×1.5 | |
1140 | + //未闭合|1*1 未闭合|1.5×1.5 未闭合|1×1 | |
1046 | 1141 | Map bregma = new HashMap(); |
1047 | 1142 | if ("闭合".equals(result)) |
1048 | 1143 | { |
... | ... | @@ -1236,7 +1331,7 @@ |
1236 | 1331 | // DBCollection conn = template.getCollection("lyms_patient_test"); |
1237 | 1332 | // conn.up |
1238 | 1333 | |
1239 | - syncBabyData("62"); | |
1334 | + syncPatientData("62"); | |
1240 | 1335 | } |
1241 | 1336 | } |
platform-common/src/main/java/com/lyms/platform/common/enums/FmTypeEnums.java
View file @
fddc135
... | ... | @@ -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()) { |