Commit 67daa80996bae58085a7609679fc25e8077dd7cc
1 parent
51997a8445
Exists in
master
and in
1 other branch
update
Showing 1 changed file with 175 additions and 129 deletions
platform-operate-api/src/main/java/com/lyms/hospitalapi/linchengfy/LcfyFmService.java
View file @
67daa80
| ... | ... | @@ -3,6 +3,8 @@ |
| 3 | 3 | import com.lyms.hospitalapi.dzfy.Fm; |
| 4 | 4 | import com.lyms.hospitalapi.qhdfy.FmItem; |
| 5 | 5 | import com.lyms.platform.biz.service.PatientsService; |
| 6 | +import com.lyms.platform.biz.service.PersonService; | |
| 7 | +import com.lyms.platform.biz.service.YunBookbuildingService; | |
| 6 | 8 | import com.lyms.platform.common.enums.FmTypeEnums; |
| 7 | 9 | import com.lyms.platform.common.enums.RenShenJieJuEnums; |
| 8 | 10 | import com.lyms.platform.common.enums.TpmcTypeEnums; |
| ... | ... | @@ -20,6 +22,7 @@ |
| 20 | 22 | import com.lyms.platform.permission.service.UsersService; |
| 21 | 23 | import com.lyms.platform.pojo.MaternalDeliverModel; |
| 22 | 24 | import com.lyms.platform.pojo.Patients; |
| 25 | +import com.lyms.platform.pojo.PersonModel; | |
| 23 | 26 | import com.lyms.platform.query.PatientsQuery; |
| 24 | 27 | import org.apache.commons.collections.CollectionUtils; |
| 25 | 28 | import org.springframework.beans.factory.annotation.Autowired; |
| 26 | 29 | |
| ... | ... | @@ -39,8 +42,11 @@ |
| 39 | 42 | |
| 40 | 43 | @Autowired |
| 41 | 44 | private PatientsService patientsService; |
| 42 | - | |
| 43 | 45 | @Autowired |
| 46 | + private YunBookbuildingService yunBookbuildingService; | |
| 47 | + @Autowired | |
| 48 | + private PersonService personService; | |
| 49 | + @Autowired | |
| 44 | 50 | private MatDeliverFacade matDeliverFacade; |
| 45 | 51 | |
| 46 | 52 | @Autowired |
| 47 | 53 | |
| 48 | 54 | |
| ... | ... | @@ -52,11 +58,13 @@ |
| 52 | 58 | @Autowired |
| 53 | 59 | private PatientServiceFacade patientServiceFacade; |
| 54 | 60 | |
| 55 | - private static Map<Integer, String> ONE_ENUMS = new HashMap<>(); | |
| 61 | + private static Map <Integer, String> ONE_ENUMS = new HashMap <>(); | |
| 56 | 62 | |
| 57 | - private static Map<String, List> babyMap = new HashMap<>(); | |
| 63 | + private static Map <String, List> babyMap = new HashMap <>(); | |
| 58 | 64 | |
| 59 | - private static final String HOSPITALID = "2100001296"; | |
| 65 | + private static final String HOSPITALID = "216"; | |
| 66 | +// private static final String HOSPITALID = "2100001296"; | |
| 67 | + | |
| 60 | 68 | static { |
| 61 | 69 | ONE_ENUMS.put(0, "长"); |
| 62 | 70 | ONE_ENUMS.put(1, "次"); |
| 63 | 71 | |
| 64 | 72 | |
| 65 | 73 | |
| 66 | 74 | |
| 67 | 75 | |
| 68 | 76 | |
| 69 | 77 | |
| 70 | 78 | |
| 71 | 79 | |
| 72 | 80 | |
| 73 | 81 | |
| 74 | 82 | |
| ... | ... | @@ -67,64 +75,63 @@ |
| 67 | 75 | ONE_ENUMS.put(6, "七"); |
| 68 | 76 | |
| 69 | 77 | |
| 70 | - List<String> b1 = new ArrayList<>(); | |
| 78 | + List <String> b1 = new ArrayList <>(); | |
| 71 | 79 | b1.add("长女"); |
| 72 | 80 | b1.add("次女"); |
| 73 | 81 | babyMap.put("00", b1); |
| 74 | 82 | |
| 75 | - List<String> b2 = new ArrayList<>(); | |
| 83 | + List <String> b2 = new ArrayList <>(); | |
| 76 | 84 | b2.add("长子"); |
| 77 | 85 | b2.add("次子"); |
| 78 | 86 | babyMap.put("11", b2); |
| 79 | 87 | |
| 80 | - List<String> b3 = new ArrayList<>(); | |
| 88 | + List <String> b3 = new ArrayList <>(); | |
| 81 | 89 | b3.add("之子"); |
| 82 | 90 | b3.add("之女"); |
| 83 | 91 | |
| 84 | - List<String> b4 = new ArrayList<>(); | |
| 92 | + List <String> b4 = new ArrayList <>(); | |
| 85 | 93 | b4.add("之女"); |
| 86 | 94 | b4.add("之子"); |
| 87 | 95 | babyMap.put("01", b4); |
| 88 | 96 | babyMap.put("10", b3); |
| 89 | - List<String> b5 = new ArrayList<>(); | |
| 97 | + List <String> b5 = new ArrayList <>(); | |
| 90 | 98 | b5.add("之子"); |
| 91 | - List<String> b6 = new ArrayList<>(); | |
| 99 | + List <String> b6 = new ArrayList <>(); | |
| 92 | 100 | b6.add("之女"); |
| 93 | 101 | |
| 94 | 102 | babyMap.put("1", b5); |
| 95 | 103 | babyMap.put("0", b6); |
| 96 | 104 | } |
| 97 | 105 | |
| 98 | - public void fmTimerWork() { | |
| 106 | + public void fmTimerWork() { | |
| 99 | 107 | SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 100 | - Date end = new Date(new Date().getTime()-1000*60*60); | |
| 101 | - Date start = new Date(end.getTime()-1000*60*60*2); | |
| 108 | + Date end = new Date(new Date().getTime() - 1000 * 60 * 60); | |
| 109 | + Date start = new Date(end.getTime() - 1000 * 60 * 60 * 2); | |
| 102 | 110 | String startStr = fmt.format(start); |
| 103 | 111 | String endStr = fmt.format(end); |
| 104 | 112 | System.out.println("start=" + startStr + "end=" + endStr); |
| 105 | 113 | // queryFmPatient(startStr, endStr, null); |
| 106 | 114 | } |
| 107 | 115 | |
| 108 | - public void syncByPhone(List<Fm> list) { | |
| 116 | + public void syncByPhone(List <Fm> list) { | |
| 109 | 117 | queryFmPatient(list); |
| 110 | 118 | } |
| 111 | 119 | |
| 112 | 120 | |
| 121 | + public void queryFmPatient(List <Fm> allList) { | |
| 113 | 122 | |
| 114 | - public void queryFmPatient(List<Fm> allList) { | |
| 115 | - | |
| 116 | 123 | saveFm sfm = new saveFm(allList); |
| 117 | 124 | Thread t = new Thread(sfm); |
| 118 | 125 | t.start(); |
| 119 | 126 | |
| 120 | 127 | } |
| 121 | 128 | |
| 122 | - private List buildBabyName(List<Fm> items) { | |
| 129 | + private List buildBabyName(List <Fm> items) { | |
| 123 | 130 | String id = ""; |
| 124 | 131 | if (items.size() > 2) { |
| 125 | 132 | int boyCount = 0; |
| 126 | 133 | int girlCount = 0; |
| 127 | - List<String> l = new ArrayList<>(); | |
| 134 | + List <String> l = new ArrayList <>(); | |
| 128 | 135 | for (int i = 0; i < items.size(); i++) { |
| 129 | 136 | Fm item = items.get(i); |
| 130 | 137 | if (org.apache.commons.lang.StringUtils.isNotEmpty(item.getBABY_SEX())) { |
| 131 | 138 | |
| ... | ... | @@ -142,12 +149,9 @@ |
| 142 | 149 | for (int i = 0; i < items.size(); i++) { |
| 143 | 150 | Fm item = items.get(i); |
| 144 | 151 | if (org.apache.commons.lang.StringUtils.isNotEmpty(item.getBABY_SEX())) { |
| 145 | - if ("男".equals(item.getBABY_SEX())) | |
| 146 | - { | |
| 152 | + if ("男".equals(item.getBABY_SEX())) { | |
| 147 | 153 | id += "1"; |
| 148 | - } | |
| 149 | - else if ("女".equals(item.getBABY_SEX())) | |
| 150 | - { | |
| 154 | + } else if ("女".equals(item.getBABY_SEX())) { | |
| 151 | 155 | id += "0"; |
| 152 | 156 | } |
| 153 | 157 | |
| 154 | 158 | |
| ... | ... | @@ -157,14 +161,12 @@ |
| 157 | 161 | } |
| 158 | 162 | } |
| 159 | 163 | |
| 160 | - public void buildBaby(FmItem item,Patients patInfo,Fm fm, Date dueDate, String babyName) | |
| 161 | - { | |
| 162 | - try{ | |
| 164 | + public void buildBaby(FmItem item, Patients patInfo, Fm fm, Date dueDate, String babyName) { | |
| 165 | + try { | |
| 163 | 166 | |
| 164 | 167 | ExceptionUtils.catchException("buildBaby===="); |
| 165 | 168 | |
| 166 | - if ("死产".equals(fm.getBABY_PREGNANCY_OUT())) | |
| 167 | - { | |
| 169 | + if ("死产".equals(fm.getBABY_PREGNANCY_OUT())) { | |
| 168 | 170 | return; |
| 169 | 171 | } |
| 170 | 172 | |
| 171 | 173 | |
| 172 | 174 | |
| 173 | 175 | |
| 174 | 176 | |
| ... | ... | @@ -172,32 +174,28 @@ |
| 172 | 174 | usersQuery.setYn(YnEnums.YES.getId()); |
| 173 | 175 | usersQuery.setName("产科"); |
| 174 | 176 | usersQuery.setOrgId(new Integer(Integer.parseInt(HOSPITALID))); |
| 175 | - List<Users> users = usersService.queryUsers(usersQuery); | |
| 177 | + List <Users> users = usersService.queryUsers(usersQuery); | |
| 176 | 178 | |
| 177 | 179 | BabyBookbuildingAddRequest request = new BabyBookbuildingAddRequest(); |
| 178 | 180 | request.setHospitalId(HOSPITALID); |
| 179 | 181 | |
| 180 | 182 | request.setMommyName(fm.getNAME()); //母亲姓名 |
| 181 | 183 | Date bir = patInfo.getBirth(); |
| 182 | - if(bir!=null){ | |
| 184 | + if (bir != null) { | |
| 183 | 185 | try { |
| 184 | 186 | SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); |
| 185 | 187 | Date birth = format.parse(bir.toString()); |
| 186 | 188 | format = new SimpleDateFormat("yyyy-MM-dd"); |
| 187 | 189 | request.setMommyBirthday(format.format(birth)); |
| 188 | - }catch (ParseException e) | |
| 189 | - { | |
| 190 | - ExceptionUtils.catchException(e,"孕妇生日解析异常"); | |
| 190 | + } catch (ParseException e) { | |
| 191 | + ExceptionUtils.catchException(e, "孕妇生日解析异常"); | |
| 191 | 192 | } |
| 192 | 193 | } |
| 193 | 194 | |
| 194 | - if (org.apache.commons.lang.StringUtils.isNotEmpty(fm.getIDCARD())) | |
| 195 | - { | |
| 195 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(fm.getIDCARD())) { | |
| 196 | 196 | request.setMommyCertificateTypeId("70ae1d93-2964-46bc-83fa-bec9ff605b1c"); //证件类型 (身份证号码) |
| 197 | 197 | request.setMommyCertificateNum(fm.getIDCARD()); //证件号 |
| 198 | - } | |
| 199 | - else if (StringUtils.isNotEmpty(fm.getPHONE())) | |
| 200 | - { | |
| 198 | + } else if (StringUtils.isNotEmpty(fm.getPHONE())) { | |
| 201 | 199 | request.setMommyCertificateTypeId("57e1dcd3f0f02e7ca519d6c6"); //证件类型 (手机号码) |
| 202 | 200 | request.setMommyCertificateNum(fm.getPHONE()); //证件号 |
| 203 | 201 | } |
| 204 | 202 | |
| 205 | 203 | |
| ... | ... | @@ -214,19 +212,15 @@ |
| 214 | 212 | |
| 215 | 213 | try { |
| 216 | 214 | request.setDueWeek(Integer.parseInt(week)); //分娩孕周 |
| 217 | - }catch (Exception e) | |
| 218 | - { | |
| 215 | + } catch (Exception e) { | |
| 219 | 216 | |
| 220 | 217 | } |
| 221 | 218 | } |
| 222 | 219 | |
| 223 | 220 | String fmfs = ""; |
| 224 | - if (fm.getDELIVERY_MODE() != null && "剖宫产".equals(fm.getDELIVERY_MODE())) | |
| 225 | - { | |
| 221 | + if (fm.getDELIVERY_MODE() != null && "剖宫产".equals(fm.getDELIVERY_MODE())) { | |
| 226 | 222 | fmfs = FmTypeEnums.O1.getId(); |
| 227 | - } | |
| 228 | - else | |
| 229 | - { | |
| 223 | + } else { | |
| 230 | 224 | fmfs = FmTypeEnums.O.getId(); |
| 231 | 225 | } |
| 232 | 226 | |
| 233 | 227 | |
| 234 | 228 | |
| 235 | 229 | |
| 236 | 230 | |
| 237 | 231 | |
| 238 | 232 | |
| ... | ... | @@ -235,26 +229,26 @@ |
| 235 | 229 | //request.setDueCount(item.getCjc());//第几产 |
| 236 | 230 | String weight = fm.getSBABY_WEIGHT(); |
| 237 | 231 | String height = fm.getSBABY_HEIGHT(); |
| 238 | - if(weight!=null){ | |
| 232 | + if (weight != null) { | |
| 239 | 233 | DecimalFormat df = new DecimalFormat("#.00"); |
| 240 | 234 | double w = Double.parseDouble(weight); |
| 241 | - request.setBabyWeight(df.format(w/1000)); //体重 | |
| 235 | + request.setBabyWeight(df.format(w / 1000)); //体重 | |
| 242 | 236 | } |
| 243 | - if(height!=null){ | |
| 237 | + if (height != null) { | |
| 244 | 238 | request.setBabyHeight(height); //身长 |
| 245 | 239 | } |
| 246 | 240 | |
| 247 | - Map<String,String> map = new HashMap<>(); | |
| 241 | + Map <String, String> map = new HashMap <>(); | |
| 248 | 242 | String pf1 = fm.getSBABY_APGAR_SCORE_ONE(); |
| 249 | 243 | String pf5 = fm.getSBABY_APGAR_SCORE_FIVE(); |
| 250 | 244 | String pf10 = fm.getSBABY_APGAR_SCORE_TEN(); |
| 251 | - if(pf1!=null){ | |
| 245 | + if (pf1 != null) { | |
| 252 | 246 | map.put("pf1", pf1); |
| 253 | 247 | } |
| 254 | - if(pf5!=null){ | |
| 248 | + if (pf5 != null) { | |
| 255 | 249 | map.put("pf5", pf5); |
| 256 | 250 | } |
| 257 | - if(pf10!=null){ | |
| 251 | + if (pf10 != null) { | |
| 258 | 252 | map.put("pf10", pf10); |
| 259 | 253 | } |
| 260 | 254 | |
| 261 | 255 | |
| 262 | 256 | |
| 263 | 257 | |
| 264 | 258 | |
| 265 | 259 | |
| 266 | 260 | |
| 267 | 261 | |
| 268 | 262 | |
| 269 | 263 | |
| 270 | 264 | |
| 271 | 265 | |
| 272 | 266 | |
| 273 | 267 | |
| 274 | 268 | |
| 275 | 269 | |
| 276 | 270 | |
| 277 | 271 | |
| 278 | 272 | |
| 279 | 273 | |
| 280 | 274 | |
| 281 | 275 | |
| 282 | 276 | |
| 283 | 277 | |
| 284 | 278 | |
| 285 | 279 | |
| ... | ... | @@ -285,106 +279,116 @@ |
| 285 | 279 | |
| 286 | 280 | babyBookbuildingFacade.addBabyBookbuilding(request, users.get(0).getId()); |
| 287 | 281 | |
| 288 | - }catch (Exception e) | |
| 289 | - { | |
| 282 | + } catch (Exception e) { | |
| 290 | 283 | ExceptionUtils.catchException(e, "buildBaby exception"); |
| 291 | 284 | e.printStackTrace(); |
| 292 | 285 | } |
| 293 | 286 | } |
| 294 | 287 | |
| 295 | - public class saveFm implements Runnable{ | |
| 288 | + public class saveFm implements Runnable { | |
| 296 | 289 | |
| 297 | - private List<Fm> allList; | |
| 290 | + private List <Fm> allList; | |
| 298 | 291 | |
| 299 | - public saveFm(List<Fm> list){ | |
| 300 | - this.allList=list; | |
| 292 | + public saveFm(List <Fm> list) { | |
| 293 | + this.allList = list; | |
| 301 | 294 | } |
| 302 | 295 | |
| 303 | - public void run(){ | |
| 296 | + public void run() { | |
| 304 | 297 | |
| 305 | 298 | SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 306 | 299 | try { |
| 307 | - | |
| 308 | 300 | System.out.println("fm=" + allList.toString()); |
| 309 | - int a =0;//用来判断是否建了儿童档案,如果建了儿童档案就不保存分娩记录 | |
| 310 | - int count = 0; | |
| 311 | - List<Users> users = new ArrayList<Users>(); | |
| 312 | 301 | |
| 302 | + List <Users> users = new ArrayList <Users>(); | |
| 313 | 303 | Date dueDate = null; |
| 314 | - List<MatDeliverAddRequest.Baby> babies = new ArrayList<>(); | |
| 304 | + List <MatDeliverAddRequest.Baby> babies = new ArrayList <>(); | |
| 315 | 305 | MatDeliverAddRequest deliverAddRequest = new MatDeliverAddRequest(); |
| 316 | - for(Fm allFm:allList){ | |
| 317 | - a=0; | |
| 318 | - count=0; | |
| 319 | - System.out.println("0-------------"+allFm.getBABY_PREGNANCY_OUT()); | |
| 320 | - if (!"1".equals(allFm.getBABY_PREGNANCY_OUT())) | |
| 321 | - { | |
| 306 | + Patients patient =null; | |
| 307 | + for (Fm allFm : allList) { | |
| 308 | + System.out.println("0-------------" + allFm.getBABY_PREGNANCY_OUT()); | |
| 309 | + if (!"1".equals(allFm.getBABY_PREGNANCY_OUT())) { | |
| 322 | 310 | continue; |
| 323 | 311 | } |
| 324 | - if (StringUtils.isEmpty(allFm.getPHONE()) && StringUtils.isEmpty(allFm.getIDCARD())) | |
| 325 | - { | |
| 312 | + if (StringUtils.isEmpty(allFm.getPHONE()) && StringUtils.isEmpty(allFm.getIDCARD())) { | |
| 326 | 313 | continue; |
| 327 | 314 | } |
| 328 | - | |
| 329 | 315 | PatientsQuery query = new PatientsQuery(); |
| 330 | 316 | query.setYn(YnEnums.YES.getId()); |
| 331 | 317 | query.setType(1); //孕妇 |
| 332 | 318 | query.setDueStatus(0); //未终止妊娠 |
| 333 | - String[] strs = new String[]{allFm.getPHONE(),allFm.getIDCARD()}; | |
| 334 | - System.out.println("1----------"+strs); | |
| 319 | + String[] strs = new String[]{allFm.getPHONE(), allFm.getIDCARD()}; | |
| 335 | 320 | query.setPc(strs); |
| 336 | - | |
| 337 | 321 | //查询该孕妇是否在孕产婴系统中建档 |
| 338 | - List<Patients> patientses = patientsService.queryPatient(query); | |
| 339 | - System.out.println("2----------"+patientses.size()); | |
| 322 | + System.out.println("1----query--" + query.convertToQuery().convertToMongoQuery()); | |
| 323 | + List <Patients> patientses = patientsService.queryPatient(query); | |
| 324 | + System.out.println("2----patientses--" + ( CollectionUtils.isNotEmpty(patientses)?patientses.size():null)); | |
| 340 | 325 | |
| 341 | - Patients patient = new Patients(); | |
| 342 | - if(CollectionUtils.isNotEmpty(patientses)){ | |
| 343 | - ExceptionUtils.catchException("patientses"+patientses); | |
| 344 | - patient = patientses.get(0); | |
| 326 | + //获取指定医生id | |
| 327 | + try { | |
| 345 | 328 | UsersQuery usersQuery = new UsersQuery(); |
| 346 | 329 | usersQuery.setYn(YnEnums.YES.getId()); |
| 347 | 330 | usersQuery.setOrgId(new Integer(Integer.parseInt(HOSPITALID))); |
| 348 | - usersQuery.setName("产科"); | |
| 331 | + usersQuery.setName("qing"); | |
| 332 | +// usersQuery.setName("产科"); | |
| 349 | 333 | users = usersService.queryUsers(usersQuery); |
| 350 | - System.out.println("3----------"+users.size()); | |
| 334 | + } catch (NumberFormatException e) { | |
| 335 | + e.printStackTrace(); | |
| 336 | + } | |
| 337 | + System.out.println("3----users--" +( CollectionUtils.isNotEmpty(users)?users.size():null)); | |
| 351 | 338 | |
| 339 | + if (CollectionUtils.isNotEmpty(patientses)) { | |
| 340 | + patient = patientses.get(0); | |
| 341 | + System.out.println("4----patient.getId()--" +patient.getId()); | |
| 342 | + | |
| 343 | + } else if (StringUtils.isNotEmpty(allFm.getNAME()) | |
| 344 | + && StringUtils.isNotEmpty(allFm.getBABY_DELIVERY_TIME()) | |
| 345 | + && StringUtils.isNotEmpty(allFm.getPHONE()) | |
| 346 | + && StringUtils.isNotEmpty(allFm.getIDCARD()) | |
| 347 | + && StringUtils.isNotEmpty(allFm.getNAME()) | |
| 348 | + && CollectionUtils.isNotEmpty(users) | |
| 349 | + ) { | |
| 350 | + patient = addPatients(users, allFm); | |
| 351 | + System.out.println("4.1----patient.getId()--" +patient.getId()); | |
| 352 | + } | |
| 353 | + | |
| 354 | + if (patient != null) { | |
| 355 | + System.out.println("5-----------"); | |
| 352 | 356 | if (CollectionUtils.isNotEmpty(users) && users.get(0).getId() != null) { |
| 353 | 357 | |
| 354 | 358 | Date dateTime = fmt.parse(allFm.getBABY_DELIVERY_TIME()); |
| 355 | - if(dateTime!=null){ | |
| 359 | + if (dateTime != null) { | |
| 356 | 360 | if (!StringUtils.isNotEmpty(allFm.getBABY_DELIVERY_TIME().toString())) { |
| 357 | 361 | continue; |
| 358 | - }else{ | |
| 362 | + } else { | |
| 359 | 363 | dueDate = dateTime; |
| 360 | 364 | } |
| 361 | - }else{ | |
| 365 | + } else { | |
| 362 | 366 | continue; |
| 363 | 367 | } |
| 364 | 368 | |
| 365 | - Map<String, Map<String,String>> map = new HashMap<>(); | |
| 366 | - Map<String, String> map1 = new HashMap<>(); | |
| 367 | - Map<String, String> map2 = new HashMap<>(); | |
| 368 | - Map<String, String> map3 = new HashMap<>(); | |
| 369 | - Map<String, String> totalMap = new HashMap<>(); | |
| 369 | + Map <String, Map <String, String>> map = new HashMap <>(); | |
| 370 | + Map <String, String> map1 = new HashMap <>(); | |
| 371 | + Map <String, String> map2 = new HashMap <>(); | |
| 372 | + Map <String, String> map3 = new HashMap <>(); | |
| 373 | + Map <String, String> totalMap = new HashMap <>(); | |
| 370 | 374 | |
| 371 | 375 | Integer prod_Process_One = allFm.getPROD_PROCESS_ONE(); |
| 372 | 376 | Integer prod_Process_Two = allFm.getPROD_PROCESS_TWO(); |
| 373 | 377 | Integer prod_Process_Three = allFm.getPROD_PROCESS_THREE(); |
| 374 | - if(prod_Process_One!=null){ | |
| 375 | - map1.put("h",String.valueOf(prod_Process_One.intValue()/60)); | |
| 376 | - map1.put("m",String.valueOf(prod_Process_One.intValue()%60)); | |
| 378 | + if (prod_Process_One != null) { | |
| 379 | + map1.put("h", String.valueOf(prod_Process_One.intValue() / 60)); | |
| 380 | + map1.put("m", String.valueOf(prod_Process_One.intValue() % 60)); | |
| 377 | 381 | map.put("one", map1); |
| 378 | 382 | } |
| 379 | - if(prod_Process_Two!=null){ | |
| 380 | - map2.put("h",String.valueOf(prod_Process_Two.intValue()/60)); | |
| 381 | - map2.put("m",String.valueOf(prod_Process_Two.intValue()%60)); | |
| 382 | - map.put("two",map2); | |
| 383 | + if (prod_Process_Two != null) { | |
| 384 | + map2.put("h", String.valueOf(prod_Process_Two.intValue() / 60)); | |
| 385 | + map2.put("m", String.valueOf(prod_Process_Two.intValue() % 60)); | |
| 386 | + map.put("two", map2); | |
| 383 | 387 | } |
| 384 | - if(prod_Process_Three!=null){ | |
| 385 | - map3.put("h",String.valueOf(prod_Process_Three.intValue()/60)); | |
| 386 | - map3.put("m",String.valueOf(prod_Process_Three.intValue()%60)); | |
| 387 | - map.put("three",map3); | |
| 388 | + if (prod_Process_Three != null) { | |
| 389 | + map3.put("h", String.valueOf(prod_Process_Three.intValue() / 60)); | |
| 390 | + map3.put("m", String.valueOf(prod_Process_Three.intValue() % 60)); | |
| 391 | + map.put("three", map3); | |
| 388 | 392 | } |
| 389 | 393 | |
| 390 | 394 | /* int hProcess = Integer.parseInt(allFm.getTOTAL_PROCESS())/60;//总产程小时数 |
| ... | ... | @@ -394,7 +398,7 @@ |
| 394 | 398 | |
| 395 | 399 | deliverAddRequest.setProdprocess(map); |
| 396 | 400 | deliverAddRequest.setTotalprocess(totalMap); |
| 397 | - System.out.println("4----------"+allFm.getDELIVER_DOCTOR()); | |
| 401 | + System.out.println("6----------" + allFm.getDELIVER_DOCTOR()); | |
| 398 | 402 | |
| 399 | 403 | deliverAddRequest.setDeliverDoctor(allFm.getDELIVER_DOCTOR()); |
| 400 | 404 | deliverAddRequest.setDueDate(DateUtil.getyyyy_MM_dd(dueDate)); |
| ... | ... | @@ -405,8 +409,7 @@ |
| 405 | 409 | if (StringUtils.isNotEmpty(allFm.getDUE_WEEK())) { |
| 406 | 410 | |
| 407 | 411 | week = allFm.getDUE_WEEK() + "周"; |
| 408 | - if (StringUtils.isNotEmpty(allFm.getDUE_WEEK()) && StringUtils.isNotEmpty(allFm.getDUE_DAY())) | |
| 409 | - { | |
| 412 | + if (StringUtils.isNotEmpty(allFm.getDUE_WEEK()) && StringUtils.isNotEmpty(allFm.getDUE_DAY())) { | |
| 410 | 413 | week += allFm.getDUE_DAY() + "天"; |
| 411 | 414 | } |
| 412 | 415 | |
| ... | ... | @@ -415,7 +418,7 @@ |
| 415 | 418 | |
| 416 | 419 | deliverAddRequest.setTireNumber(allFm.getFETUS_NUM());// 胎数(之前赋值为死值1) |
| 417 | 420 | Integer placenta_Num = allFm.getPLACENTA_NUM(); |
| 418 | - if(placenta_Num!=null){ | |
| 421 | + if (placenta_Num != null) { | |
| 419 | 422 | deliverAddRequest.setPlacenta(allFm.getPLACENTA_NUM().toString());// 胎盘(之前赋值为死值1) |
| 420 | 423 | } |
| 421 | 424 | if ("完好".equals(allFm.getPERINEAL_CONDITION()) || "".equals(allFm.getPERINEAL_CONDITION())) { |
| ... | ... | @@ -433,7 +436,7 @@ |
| 433 | 436 | } |
| 434 | 437 | |
| 435 | 438 | Integer th_Lose = allFm.getTH_LOSE_BLOOD(); |
| 436 | - if(th_Lose!=null){ | |
| 439 | + if (th_Lose != null) { | |
| 437 | 440 | if (StringUtils.isNotEmpty(allFm.getTH_LOSE_BLOOD().toString())) { |
| 438 | 441 | deliverAddRequest.settHloseBloodL(Double.parseDouble(allFm.getTH_LOSE_BLOOD().toString())); |
| 439 | 442 | } |
| 440 | 443 | |
| 441 | 444 | |
| 442 | 445 | |
| ... | ... | @@ -442,18 +445,15 @@ |
| 442 | 445 | Map deliveryMode = new HashMap(); //分娩方式 |
| 443 | 446 | |
| 444 | 447 | String fmfs = ""; |
| 445 | - if (allFm.getDELIVERY_MODE() != null && "手术产".equals(allFm.getDELIVERY_MODE())) | |
| 446 | - { | |
| 448 | + if (allFm.getDELIVERY_MODE() != null && "手术产".equals(allFm.getDELIVERY_MODE())) { | |
| 447 | 449 | fmfs = FmTypeEnums.O1.getId(); |
| 448 | - } | |
| 449 | - else | |
| 450 | - { | |
| 450 | + } else { | |
| 451 | 451 | fmfs = FmTypeEnums.O.getId(); |
| 452 | 452 | } |
| 453 | - deliveryMode.put("fmfs",fmfs); | |
| 453 | + deliveryMode.put("fmfs", fmfs); | |
| 454 | 454 | deliverAddRequest.setDeliveryMode(deliveryMode); |
| 455 | 455 | //胎盘信息 |
| 456 | - List<MaternalDeliverModel.ExtPlacenta> extPlacentas = new ArrayList<>(); | |
| 456 | + List <MaternalDeliverModel.ExtPlacenta> extPlacentas = new ArrayList <>(); | |
| 457 | 457 | MaternalDeliverModel.ExtPlacenta extPlacenta = new MaternalDeliverModel.ExtPlacenta(); |
| 458 | 458 | String tpmcType = ""; //胎盘娩出方式 |
| 459 | 459 | if ("手术产".equals(allFm.getTMCTYPE()) || "手取胎盘".equals(allFm.getTMCTYPE())) { |
| 460 | 460 | |
| 461 | 461 | |
| 462 | 462 | |
| ... | ... | @@ -468,18 +468,18 @@ |
| 468 | 468 | |
| 469 | 469 | //儿童 |
| 470 | 470 | MatDeliverAddRequest.Baby baby = new MatDeliverAddRequest.Baby(); |
| 471 | - baby.setBabyWeight(allFm.getBABY_WEIGHT()==null?null:allFm.getBABY_WEIGHT().toString()); | |
| 472 | - Map<String, String> as = new HashMap<>(); | |
| 471 | + baby.setBabyWeight(allFm.getBABY_WEIGHT() == null ? null : allFm.getBABY_WEIGHT().toString()); | |
| 472 | + Map <String, String> as = new HashMap <>(); | |
| 473 | 473 | String pf1 = allFm.getSBABY_APGAR_SCORE_ONE(); |
| 474 | 474 | String pf5 = allFm.getSBABY_APGAR_SCORE_FIVE(); |
| 475 | 475 | String pf10 = allFm.getSBABY_APGAR_SCORE_TEN(); |
| 476 | - if(pf1!=null){ | |
| 476 | + if (pf1 != null) { | |
| 477 | 477 | as.put("pf1", allFm.getSBABY_APGAR_SCORE_ONE()); |
| 478 | 478 | } |
| 479 | - if(pf5!=null){ | |
| 479 | + if (pf5 != null) { | |
| 480 | 480 | as.put("pf5", allFm.getSBABY_APGAR_SCORE_FIVE()); |
| 481 | 481 | } |
| 482 | - if(pf10!=null){ | |
| 482 | + if (pf10 != null) { | |
| 483 | 483 | as.put("pf10", allFm.getSBABY_APGAR_SCORE_TEN()); |
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | |
| 487 | 487 | |
| 488 | 488 | |
| 489 | 489 | |
| ... | ... | @@ -489,24 +489,24 @@ |
| 489 | 489 | String babyHeight = allFm.getSBABY_HEIGHT(); |
| 490 | 490 | String babyWeight = allFm.getSBABY_WEIGHT(); |
| 491 | 491 | Integer baby_Asphyxiam = allFm.getBABY_ASPHYXIAM(); |
| 492 | - if(babyHeight!=null){ | |
| 492 | + if (babyHeight != null) { | |
| 493 | 493 | baby.setBabyHeight(allFm.getSBABY_HEIGHT());//新生儿生长 |
| 494 | 494 | } |
| 495 | - if(babyWeight!=null){ | |
| 495 | + if (babyWeight != null) { | |
| 496 | 496 | baby.setBabyWeight(allFm.getSBABY_WEIGHT());//新生儿重量 |
| 497 | 497 | } |
| 498 | - if(baby_Asphyxiam!=null){ | |
| 498 | + if (baby_Asphyxiam != null) { | |
| 499 | 499 | baby.setAsphyxiaM(allFm.getBABY_ASPHYXIAM().toString()); //窒息分钟 |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - baby.setDeformity((allFm.getBABY_DEFORMITY()==null?0:1)); //畸形 0非畸形 1畸形 | |
| 502 | + baby.setDeformity((allFm.getBABY_DEFORMITY() == null ? 0 : 1)); //畸形 0非畸形 1畸形 | |
| 503 | 503 | |
| 504 | 504 | /* String baby_Pregnancy_Out = allFm.getBABY_PREGNANCY_OUT()=="1"?"活产":""; |
| 505 | 505 | if(baby_Pregnancy_Out!=null && StringUtils.isNotEmpty(baby_Pregnancy_Out)){ |
| 506 | 506 | baby.setPregnancyOut(RenShenJieJuEnums.getIdByName("活产")); // 妊娠结局 |
| 507 | 507 | }*/ |
| 508 | 508 | |
| 509 | - System.out.println("5-------------"+allFm.getBABY_PREGNANCY_OUT()=="1"?"活产":""); | |
| 509 | + System.out.println("7-------------" + allFm.getBABY_PREGNANCY_OUT() == "1" ? "活产" : ""); | |
| 510 | 510 | baby.setPregnancyOut(RenShenJieJuEnums.getIdByName("活产")); // 妊娠结局 |
| 511 | 511 | |
| 512 | 512 | baby.setDueTime(fmt.format(dueDate));//分娩时间 |
| 513 | 513 | |
| 514 | 514 | |
| 515 | 515 | |
| 516 | 516 | |
| ... | ... | @@ -516,23 +516,69 @@ |
| 516 | 516 | } |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | - if(a==0){ | |
| 519 | + if (patient != null && CollectionUtils.isNotEmpty(babies)) { | |
| 520 | 520 | deliverAddRequest.setBabies(babies); |
| 521 | 521 | deliverAddRequest.setFmHospital(HOSPITALID); //设置为临城 |
| 522 | 522 | ExceptionUtils.catchException("deliverAddRequest===" + deliverAddRequest); |
| 523 | - if(users!=null && users.size()>0){ | |
| 523 | + if (users != null && users.size() > 0) { | |
| 524 | 524 | matDeliverFacade.addOrUpdateMatDeliver(deliverAddRequest, users.get(0).getId()); |
| 525 | 525 | } |
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | } catch (Exception e) { |
| 529 | - ExceptionUtils.catchException(e, "sql执行异常"); | |
| 529 | + ExceptionUtils.catchException(e, "执行异常"); | |
| 530 | 530 | e.printStackTrace(); |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | } |
| 534 | - } | |
| 535 | 534 | |
| 535 | + private Patients addPatients(List <Users> users, Fm allFm) { | |
| 536 | + Patients patient=new Patients();//添加产妇基本信息 | |
| 537 | + try { | |
| 538 | + PersonModel pmodel = new PersonModel(); | |
| 539 | + pmodel.setName(allFm.getNAME()); | |
| 540 | + pmodel.setBirth(DateUtil.parseYMD(allFm.getBABY_DELIVERY_TIME())); | |
| 541 | + pmodel.setPhone(allFm.getPHONE()); | |
| 542 | + pmodel.setCardNo(allFm.getIDCARD()); | |
| 543 | + pmodel.setType(3); | |
| 544 | + pmodel.setYn(YnEnums.YES.getId()); | |
| 545 | + pmodel.setModified(new Date()); | |
| 546 | + pmodel.setCreated(new Date()); | |
| 547 | + PersonModel yunModel = personService.addPerson(pmodel); | |
| 548 | + //添加产妇建档 | |
| 549 | + | |
| 550 | + Patients pat1 = new Patients(); | |
| 551 | + pat1.setUsername(allFm.getNAME()); | |
| 552 | + pat1.setPcerteTypeId(""); | |
| 553 | + pat1.setCardNo(allFm.getIDCARD()); | |
| 554 | + pat1.setBirth(DateUtil.parseYMD(allFm.getBABY_DELIVERY_TIME())); | |
| 555 | + pat1.setPhone(allFm.getPHONE()); | |
| 556 | + pat1.setFmDate(DateUtil.parseYMD(allFm.getBABY_DELIVERY_TIME())); | |
| 557 | +// pat1.setServiceStatus(request.getServiceStatus()); | |
| 558 | +// pat1.setServiceType(request.getServiceType()); | |
| 559 | + pat1.setHospitalId(HOSPITALID); | |
| 560 | + pat1.setBookbuildingDate(new Date()); | |
| 561 | + pat1.setYn(YnEnums.YES.getId()); | |
| 562 | + pat1.setBuildType(0); | |
| 563 | + pat1.setDueStatus(0); | |
| 564 | + pat1.setType(3); //1孕妇 3 产妇 | |
| 565 | + pat1.setPid(yunModel.getId()); | |
| 566 | + if (users.get(0).getId() != null) { | |
| 567 | + pat1.setBookbuildingDoctor(users.get(0).getId().toString()); | |
| 568 | + } | |
| 569 | + Date lastM = DateUtil.addDay(DateUtil.parseYMD(allFm.getBABY_DELIVERY_TIME()), -280); | |
| 570 | + pat1.setLastMenses(lastM); | |
| 571 | + pat1.setDueDate(DateUtil.parseYMD(allFm.getBABY_DELIVERY_TIME())); | |
| 572 | + pat1.setCreated(new Date()); | |
| 573 | + patient = yunBookbuildingService.addPregnantBookbuilding(pat1); | |
| 574 | + | |
| 575 | + } catch (Exception e) { | |
| 576 | + e.printStackTrace(); | |
| 577 | + } | |
| 578 | + return patient; | |
| 579 | + } | |
| 580 | + | |
| 581 | + } | |
| 536 | 582 | |
| 537 | 583 | |
| 538 | 584 | } |