Commit 3ce3154a926acbbbb11840f4ec6c00ac1cb7f232

Authored by liquanyu
1 parent b203f27103

update

Showing 1 changed file with 81 additions and 76 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 3ce3154
... ... @@ -1210,97 +1210,102 @@
1210 1210 });
1211 1211 }
1212 1212  
1213   - private void qhdCouponUse(String hospitalId,String code,Integer userId)
  1213 + private void qhdCouponUse(final String hospitalId,final String code,final Integer userId)
1214 1214 {
1215 1215  
1216   - try {
1217   - //获取优惠劵类型
1218   - Map<String,String> param = new HashMap<>();
1219   - param.put("hospitalId",hospitalId);
1220   - param.put("code", code);
1221   - Map<String,String> couponInfo = couponService.findCouponByCode(param);
  1216 + commonThreadPool.execute(new Runnable() {
  1217 + @Override
  1218 + public void run() {
  1219 + try {
  1220 + //获取优惠劵类型
  1221 + Map<String,String> param = new HashMap<>();
  1222 + param.put("hospitalId",hospitalId);
  1223 + param.put("code", code);
  1224 + Map<String,String> couponInfo = couponService.findCouponByCode(param);
1222 1225  
1223   - if (couponInfo == null || couponInfo.size() == 0)
1224   - {
1225   - return ;
1226   - }
  1226 + if (couponInfo == null || couponInfo.size() == 0)
  1227 + {
  1228 + return ;
  1229 + }
1227 1230  
1228   - PatientsQuery patientsQuery = new PatientsQuery();
1229   - patientsQuery.setPid(couponInfo.get("pId"));
1230   - patientsQuery.setYn(YnEnums.YES.getId());
  1231 + PatientsQuery patientsQuery = new PatientsQuery();
  1232 + patientsQuery.setPid(couponInfo.get("pId"));
  1233 + patientsQuery.setYn(YnEnums.YES.getId());
1231 1234  
1232   - List<Patients> list = patientsService.queryPatient1(patientsQuery, "created");
1233   - QhdDjq model = new QhdDjq();
1234   - if (CollectionUtils.isNotEmpty(list))
1235   - {
1236   - Patients patient = list.get(0);
1237   - model.setPatName(patient.getUsername());
1238   - model.setPatIdCardNo(patient.getCardNo());
1239   - model.setPatCardNo(patient.getVcCardNo());
1240   - model.setPatPhoneNumber(patient.getPhone());
1241   - model.setTokenCardNo(code);
1242   - model.setCardStatus("1");//1 正常 9作废 默认1(必须填写)
1243   - model.setLmpDate(DateUtil.getyyyy_MM_dd_hms(patient.getLastMenses()));
1244   -
1245   - AntExChuQuery antExChuQuery1 = new AntExChuQuery();
1246   - antExChuQuery1.setParentId(patient.getId());
1247   - antExChuQuery1.setYn(YnEnums.YES.getId());
1248   - List<AntExChuModel> data = antenatalExaminationService.queryAntExChu(antExChuQuery1);
1249   - Integer gravidity = 1; //孕次
1250   - if (CollectionUtils.isNotEmpty(data))
1251   - {
1252   - AntExChuModel chuModel = data.get(0);
1253   - if (chuModel != null && chuModel.getPregnancyTimes() != null)
  1235 + List<Patients> list = patientsService.queryPatient1(patientsQuery, "created");
  1236 + QhdDjq model = new QhdDjq();
  1237 + if (CollectionUtils.isNotEmpty(list))
1254 1238 {
1255   - gravidity = chuModel.getPregnancyTimes();
1256   - }
1257   - }
  1239 + Patients patient = list.get(0);
  1240 + model.setPatName(patient.getUsername());
  1241 + model.setPatIdCardNo(patient.getCardNo());
  1242 + model.setPatCardNo(patient.getVcCardNo());
  1243 + model.setPatPhoneNumber(patient.getPhone());
  1244 + model.setTokenCardNo(code);
  1245 + model.setCardStatus("1");//1 正常 9作废 默认1(必须填写)
  1246 + model.setLmpDate(DateUtil.getyyyy_MM_dd_hms(patient.getLastMenses()));
1258 1247  
1259   - model.setGravidity(String.valueOf(gravidity));
1260   - Object order = couponInfo.get("couponOrder");
1261   - model.setSerialNumber(order == null ? "0" : order.toString());
  1248 + AntExChuQuery antExChuQuery1 = new AntExChuQuery();
  1249 + antExChuQuery1.setParentId(patient.getId());
  1250 + antExChuQuery1.setYn(YnEnums.YES.getId());
  1251 + List<AntExChuModel> data = antenatalExaminationService.queryAntExChu(antExChuQuery1);
  1252 + Integer gravidity = 1; //孕次
  1253 + if (CollectionUtils.isNotEmpty(data))
  1254 + {
  1255 + AntExChuModel chuModel = data.get(0);
  1256 + if (chuModel != null && chuModel.getPregnancyTimes() != null)
  1257 + {
  1258 + gravidity = chuModel.getPregnancyTimes();
  1259 + }
  1260 + }
1262 1261  
1263   - String hospital = "";
1264   - if (org.apache.commons.lang.StringUtils.isNotEmpty(couponInfo.get("createHospitalId"))) {
1265   - Organization organization = organizationService.getOrganization(Integer.parseInt(couponInfo.get("createHospitalId")));
1266   - if (organization != null && organization.getYn() == YnEnums.YES.getId()) {
1267   - hospital = organization.getName();
1268   - String areaId = organization.getAreaId();
1269   - BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(areaId);
1270   - String areaName = basicConfig.getName();
1271   - model.setAreaFrom(areaName);
1272   - }
1273   - }
1274   - model.setPostHos(hospital);
  1262 + model.setGravidity(String.valueOf(gravidity));
  1263 + Object order = couponInfo.get("couponOrder");
  1264 + model.setSerialNumber(order == null ? "0" : order.toString());
1275 1265  
1276   - String checkDoctor = CommonsHelper.getUserName(patient.getBookbuildingDoctor(), usersService);
  1266 + String hospital = "";
  1267 + if (org.apache.commons.lang.StringUtils.isNotEmpty(couponInfo.get("createHospitalId"))) {
  1268 + Organization organization = organizationService.getOrganization(Integer.parseInt(couponInfo.get("createHospitalId")));
  1269 + if (organization != null && organization.getYn() == YnEnums.YES.getId()) {
  1270 + hospital = organization.getName();
  1271 + String areaId = organization.getAreaId();
  1272 + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(areaId);
  1273 + String areaName = basicConfig.getName();
  1274 + model.setAreaFrom(areaName);
  1275 + }
  1276 + }
  1277 + model.setPostHos(hospital);
1277 1278  
1278   - model.setPostDoc(checkDoctor);
1279   - model.setApplyInfo("产检");
1280   - model.setApplyTime(DateUtil.getyyyy_MM_dd_hms(new Date()));
1281   - model.setRemark("");
1282   - Users users = usersService.getUsers(userId);
1283   - if (users != null) {
1284   - model.setWorkerId(users.getAccount());
  1279 + String checkDoctor = CommonsHelper.getUserName(patient.getBookbuildingDoctor(), usersService);
  1280 +
  1281 + model.setPostDoc(checkDoctor);
  1282 + model.setApplyInfo("产检");
  1283 + model.setApplyTime(DateUtil.getyyyy_MM_dd_hms(new Date()));
  1284 + model.setRemark("");
  1285 + Users users = usersService.getUsers(userId);
  1286 + if (users != null) {
  1287 + model.setWorkerId(users.getAccount());
  1288 + }
  1289 + else
  1290 + {
  1291 + model.setWorkerId("");
  1292 + }
  1293 + }
  1294 +
  1295 + System.out.println(model.toString());
  1296 + String result = HospitalCouponPrintUtils.qhdCouponUse(model);
  1297 + if("0".equals(result)){
  1298 + int count = couponService.updateCouponStatus(param);
  1299 + System.out.println("update coupon count " + count);
  1300 + }
1285 1301 }
1286   - else
  1302 + catch (Exception e)
1287 1303 {
1288   - model.setWorkerId("");
  1304 + System.out.println("秦皇岛优惠劵传入his失败"+e.toString());
1289 1305 }
1290   - }
1291 1306  
1292   - System.out.println(model.toString());
1293   - String result = HospitalCouponPrintUtils.qhdCouponUse(model);
1294   - if("0".equals(result)){
1295   - int count = couponService.updateCouponStatus(param);
1296   - System.out.println("update coupon count " + count);
1297 1307 }
1298   - }
1299   - catch (Exception e)
1300   - {
1301   - System.out.println("秦皇岛优惠劵传入his失败"+e.toString());
1302   - }
1303   -
  1308 + });
1304 1309 }
1305 1310  
1306 1311 public void saveTrackCount(Date nextCheckTime,Patients patients)