|
@@ -310,7 +310,7 @@ public class YBJServiceImpl implements YBJService {
|
|
|
"`care_object_address`, `care_object_longitude`, `care_object_latitude`, `within_the_week` , `care_start_time`, `care_end_time`, " +
|
|
|
"`execute_status`, `task_status`, `plan_id`, `care_object_id`, `certificate_type`, `is_choose`, `care_date_text` , `start_time_text` ," +
|
|
|
" `end_time_text` ,`form_inst_id`, `data_month`, `is_cogradient`, `start_time`, `end_time`, `is_delete`) " +
|
|
|
- "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);";
|
|
|
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ";
|
|
|
ps[0] = connection.prepareStatement(insertSql);
|
|
|
// for (int page = 1; page <= Math.ceil(totalCount / pageSize); page++) {
|
|
|
// ydParam.setCurrentPage(page);
|
|
@@ -419,7 +419,7 @@ public class YBJServiceImpl implements YBJService {
|
|
|
"`care_object_address`, `care_object_longitude`, `care_object_latitude`, `within_the_week` , `care_start_time`, `care_end_time`, " +
|
|
|
"`execute_status`, `task_status`, `plan_id`, `care_object_id`, `certificate_type`, `is_choose`, `care_date_text` , `start_time_text` ," +
|
|
|
" `end_time_text` ,`form_inst_id`, `data_month`, `is_cogradient`, `start_time`, `end_time`, `is_delete`) " +
|
|
|
- "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);";
|
|
|
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ";
|
|
|
ps[0] = connection.prepareStatement(insertSql);
|
|
|
//创建护理计划 1次获取50条
|
|
|
//根据实例ID 查询护理计划
|
|
@@ -517,7 +517,7 @@ public class YBJServiceImpl implements YBJService {
|
|
|
"`care_object_address`, `care_object_longitude`, `care_object_latitude`, `within_the_week` , `care_start_time`, `care_end_time`, " +
|
|
|
"`execute_status`, `task_status`, `plan_id`, `care_object_id`, `certificate_type`, `is_choose`, `care_date_text` , `start_time_text` ," +
|
|
|
" `end_time_text` ,`form_inst_id`, `data_month`, `is_cogradient`, `start_time`, `end_time`, `is_delete`) " +
|
|
|
- "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);";
|
|
|
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ";
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
dataList.forEach(dataItem -> {
|
|
|
// Map formMap = (Map) dataItem.get("formData");
|
|
@@ -913,6 +913,71 @@ public class YBJServiceImpl implements YBJService {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void testApi(String code) {
|
|
|
+ List<Map> from = ydService.queryFormData_all(YDParam.builder()
|
|
|
+ .appType("APP_HJJ3X3QN4WEWDHU2BJR2")
|
|
|
+ .systemToken("7X866C81QPIHJKBFFM1QW4S8BV1U3U4MFO5RLY1")
|
|
|
+ .formUuid("FORM-BB6F88F6B6C340948FD98160EB26A0726CQT")
|
|
|
+//
|
|
|
+ .build());
|
|
|
+ List<Map> maps = ydService.queryFormData_all(YDParam.builder()
|
|
|
+ .appType("APP_HJJ3X3QN4WEWDHU2BJR2")
|
|
|
+ .systemToken("7X866C81QPIHJKBFFM1QW4S8BV1U3U4MFO5RLY1")
|
|
|
+ .formUuid("FORM-E83C9E307FFB4A978E0CB8DE1B899E9DXTXB")
|
|
|
+ .build());
|
|
|
+ for (int i = 0; i < from.size(); i++) {
|
|
|
+ String formCode = from.get(i).get("textField_lu9l6otz").toString();
|
|
|
+ for (int j = 0; j < maps.size(); j++) {
|
|
|
+ if (formCode.equals(maps.get(j).get("textField_lu9l6otz"))){
|
|
|
+ List<Map> sonList = (List<Map>) maps.get(j).get("tableField_lvuku8m3");
|
|
|
+ if (ObjectUtil.isNotNull(sonList)){
|
|
|
+ List<Map> newList = new ArrayList<>();
|
|
|
+ newList.add(sonList.get(0));
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .appType("APP_HJJ3X3QN4WEWDHU2BJR2")
|
|
|
+ .systemToken("7X866C81QPIHJKBFFM1QW4S8BV1U3U4MFO5RLY1")
|
|
|
+ .formInstanceId(maps.get(j).get("formInstanceId").toString())
|
|
|
+ .useLatestVersion(true)
|
|
|
+// 目标修改字段
|
|
|
+ .updateFormDataJson(JSON.toJSONString(UtilMap.map("tableField_lvuku8m3",newList)))
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+// from.forEach(f->{
|
|
|
+// String formCode = f.get("textField_lu9l6otz").toString();
|
|
|
+// maps.forEach(e->{
|
|
|
+// if (formCode.equals(e.get("textField_lu9l6otz"))){
|
|
|
+// List<Map> sonList = (List<Map>) e.get("tableField_lvuku8m3");
|
|
|
+// if (ObjectUtil.isNotNull(sonList)){
|
|
|
+//// List<Map<String,Object>> arrayList = new ArrayList<>();
|
|
|
+//// HashMap<String, Object> s = new HashMap<>();
|
|
|
+//// sonList.forEach(s->{
|
|
|
+//// s.put("textField_m50e071h","");
|
|
|
+//// s.put("selectField_lw4jf0ys","");
|
|
|
+//// s.put("textField_m1ajkyj0","");
|
|
|
+//// });
|
|
|
+// List<Map> newList = new ArrayList<>();
|
|
|
+// newList.add(sonList.get(0));
|
|
|
+//// arrayList.add(s);
|
|
|
+// ydClient.operateData(YDParam.builder()
|
|
|
+// .appType("APP_HJJ3X3QN4WEWDHU2BJR2")
|
|
|
+// .systemToken("7X866C81QPIHJKBFFM1QW4S8BV1U3U4MFO5RLY1")
|
|
|
+// .formInstanceId(f.get("formInstanceId").toString())
|
|
|
+// .useLatestVersion(true)
|
|
|
+//// 目标修改字段
|
|
|
+// .updateFormDataJson(JSON.toJSONString(UtilMap.map("tableField_lvuku8m3",newList)))
|
|
|
+// .build(), YDConf.FORM_OPERATION.update);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//// String code = e.get("textField_lu9l6otz").toString();
|
|
|
+// });
|
|
|
+// });
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 定时任务同步数据库到宜搭
|
|
|
*/
|
|
@@ -1117,22 +1182,22 @@ public class YBJServiceImpl implements YBJService {
|
|
|
Map formData = ydClient.queryData(ydParam, YDConf.FORM_QUERY.retrieve_id).getFormData();
|
|
|
log.info("formData{}",formData);
|
|
|
List<Map> mapList = (List<Map>) formData.get("tableField_lo3pmohx");
|
|
|
-
|
|
|
+ Connection connection = null;
|
|
|
//获取当前日期是本月几号
|
|
|
int dayOfMonth = currentDate.getDayOfMonth();
|
|
|
//获取本月天数
|
|
|
int daysInMonth = currentDate.lengthOfMonth();
|
|
|
try {
|
|
|
Class.forName(driver);
|
|
|
- Connection connection = DriverManager.getConnection(url, username, password);
|
|
|
+ connection = DriverManager.getConnection(url, username, password);
|
|
|
final PreparedStatement[] ps = {null};
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
String insertSql = "INSERT INTO `yida_plan_details`( `caregiver_form`, `caregiver_name`, `caregiver_member`, `caregiver_department`, " +
|
|
|
"`caregiver_card`, `caregiver_phone`, `department`, `care_object_form`, `care_object_name`, `care_object_card`, `care_object_level`, " +
|
|
|
"`care_object_address`, `care_object_longitude`, `care_object_latitude`, `within_the_week` , `care_start_time`, `care_end_time`, " +
|
|
|
"`execute_status`, `task_status`, `plan_id`, `care_object_id`, `certificate_type`, `is_choose`, `care_date_text` , `start_time_text` ," +
|
|
|
- " `end_time_text` ,`form_inst_id`, `data_month`, `is_cogradient`, `start_time`, `end_time` ,`is_delete`) " +
|
|
|
- "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?);";
|
|
|
+ " `end_time_text` ,`form_inst_id`, `data_month`, `is_cogradient`, `start_time`, `end_time`, `is_delete`) " +
|
|
|
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ";
|
|
|
ps[0] = connection.prepareStatement(insertSql);
|
|
|
for (int i = 0; i <= daysInMonth - dayOfMonth; i++) {
|
|
|
//获取当前日期是本月几号
|
|
@@ -1143,16 +1208,23 @@ public class YBJServiceImpl implements YBJService {
|
|
|
List<Map> maps = mapList.stream().filter(item -> item.get("selectField_lo3pmohy").equals(dayOfWeek.replace("星期", "周"))).collect(Collectors.toList());
|
|
|
for (Map map : maps) {
|
|
|
// 创建Statement对象,用于执行SQL语句
|
|
|
+ JSONArray jsonArray = JSON.parseArray(JSON.parse(map.get("associationFormField_lo3pmohz_id").toString()).toString());
|
|
|
+ JSONObject jsonObject = (JSONObject) jsonArray.get(0);
|
|
|
+ log.info("护理人员名称(关联表单):{}",map.get("associationFormField_lo3pmohz_id").toString());
|
|
|
+
|
|
|
ps[0].setObject(1, map.get("associationFormField_lo3pmohz_id").toString()); //护理人员名称(关联表单)
|
|
|
- ps[0].setObject(2, JSONObject.parseObject(map.get("associationFormField_lo3pmohz_id").toString()).get("title")); //护理人员名称
|
|
|
- ps[0].setObject(3, map.get("employeeField_lo3pmoi6_id")); //护理人员姓名-成员
|
|
|
+ ps[0].setObject(2, jsonObject.get("title")); //护理人员名称
|
|
|
+ ps[0].setObject(3, map.get("employeeField_lo3pmoi6_id").toString()); //护理人员姓名-成员
|
|
|
ps[0].setObject(4, map.get("textField_lo3pmoi0")); //护理人员所属机构
|
|
|
ps[0].setObject(5, map.get("textField_lomchzi3")); //护理人员身份证
|
|
|
ps[0].setObject(6, map.get("textField_lo3pmoi3")); //护理人员手机号
|
|
|
if (formData.get("departmentSelectField_lxztlnnx_id") != null) {
|
|
|
ps[0].setObject(7, String.valueOf(formData.get("departmentSelectField_lxztlnnx_id"))); //部门
|
|
|
+ }else {
|
|
|
+ ps[0].setObject(7,null);
|
|
|
}
|
|
|
- ps[0].setObject(8, map.get("associationFormField_lo3pmohw_id").toString()); //护理对象姓名(关联表单)
|
|
|
+ log.info("护理对象姓名(关联表单):{}",formData.get("associationFormField_lo3pmohw_id").toString());
|
|
|
+ ps[0].setObject(8, formData.get("associationFormField_lo3pmohw_id").toString()); //护理对象姓名(关联表单)
|
|
|
ps[0].setObject(9, formData.get("textField_lo55rupj")); //护理对象姓名-文本
|
|
|
ps[0].setObject(10, formData.get("textField_lnyhv5tn")); //护理对象身份证
|
|
|
ps[0].setObject(11, formData.get("selectField_lnyhv5tp")); //护理对象等级
|
|
@@ -1173,7 +1245,7 @@ public class YBJServiceImpl implements YBJService {
|
|
|
ps[0].setObject(24, String.valueOf(nextDay)); //护理日期-文本
|
|
|
ps[0].setObject(25, String.valueOf(nextDay) + " " + map.get("selectField_lr1uxpu3")); //护理开始时间。 用当前日期+护理计划的 时分
|
|
|
ps[0].setObject(26, String.valueOf(nextDay) + " " + map.get("selectField_lr1uxpu4")); //护理结束时间。 用当前日期+护理计划的 时分
|
|
|
- ps[0].setObject(27, map.get("formInstanceId").toString()); //护理结束时间。 用当前日期+护理计划的 时分
|
|
|
+ ps[0].setObject(27, formInstId); //护理结束时间。 用当前日期+护理计划的 时分
|
|
|
ps[0].setObject(28, dataMonth); //当月数据日期
|
|
|
ps[0].setObject(29, "否"); //是否已同步宜搭
|
|
|
ps[0].setObject(30,map.get("selectField_lr1uxpu3"));
|
|
@@ -1181,8 +1253,12 @@ public class YBJServiceImpl implements YBJService {
|
|
|
ps[0].setObject(32,0);
|
|
|
// 执行SQL查询
|
|
|
ps[0].addBatch();
|
|
|
+ log.info("sql:{}", ps[0].toString());
|
|
|
}
|
|
|
}
|
|
|
+ ps[0].executeBatch();
|
|
|
+ ps[0].close();
|
|
|
+ connection.close();
|
|
|
} catch (SQLException e) {
|
|
|
throw new RuntimeException(e);
|
|
|
} catch (ClassNotFoundException e) {
|
|
@@ -1286,14 +1362,14 @@ public class YBJServiceImpl implements YBJService {
|
|
|
public void updateFromClock(Map<String, Object> data) {
|
|
|
Plan plan = new Plan();
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- String id = data.get("id").toString();
|
|
|
+ String id = data.get("planInstId").toString();
|
|
|
UpdateWrapper<Plan> updateWrapper = new UpdateWrapper<>();
|
|
|
- updateWrapper.eq("id",id);
|
|
|
+ updateWrapper.eq("plan_inst_id",id);
|
|
|
|
|
|
List<Map<String,Object>> image = (List<Map<String, Object>>) data.get("imageField_lp7obkee");
|
|
|
- String remoteUrl = "https://xvuk8m.aliwork.com" + image.get(0).get("previewUrl");
|
|
|
+ String remoteUrl = "https://xvuk8m.aliwork.com" + image.get(0).get("imgUrl");
|
|
|
String fileName = image.get(0).get("name").toString();
|
|
|
- String downLoad = image.get(0).get("downloadUrl").toString();
|
|
|
+ String downLoad = image.get(0).get("downloadURL").toString();
|
|
|
// downloadFile(remoteUrl,localUrl+fileName);
|
|
|
Date date = new Date(Long.parseLong(data.get("dateField_lp7obkef").toString()));
|
|
|
Map<String, Object> updateMap = new HashMap<>();
|
|
@@ -1323,8 +1399,8 @@ public class YBJServiceImpl implements YBJService {
|
|
|
plan.setExecuteStatus("已完成");
|
|
|
plan.setClockOutDate(dateFormat.format(date));//打卡时间文本
|
|
|
plan.setSignOutPhoto(remoteUrl);
|
|
|
- plan.setSignInPhotoName(fileName);
|
|
|
- plan.setSignInPhotoDown(downLoad);
|
|
|
+ plan.setSignOutPhotoName(fileName);
|
|
|
+ plan.setSignOutPhotoDown(downLoad);
|
|
|
plan.setSignOutDistance(data.get("numberField_luw22bp4").toString());
|
|
|
updateMap.put("textField_lr36z6h6",data.get("textField_lu2ewbl7"));
|
|
|
updateMap.put("textField_lr36z6h8",data.get("textField_lu2ewbl8"));
|