|
@@ -12,7 +12,6 @@ import com.malk.service.aliwork.YDClient;
|
|
|
import com.malk.service.aliwork.YDService;
|
|
|
import com.malk.utils.UtilDateTime;
|
|
|
import com.malk.utils.UtilMap;
|
|
|
-import com.malk.yibaoju.entity.ObjectInfo;
|
|
|
import com.malk.yibaoju.entity.Plan;
|
|
|
import com.malk.yibaoju.mapper.PlanMapper;
|
|
|
import com.malk.yibaoju.service.PlanService;
|
|
@@ -306,7 +305,7 @@ public class YBJServiceImpl implements YBJService {
|
|
|
Class.forName(driver);
|
|
|
Connection connection = DriverManager.getConnection(url, username, password);
|
|
|
final PreparedStatement[] ps = {null};
|
|
|
- String insertSql = "INSERT INTO `yida_plan_details_c`( `caregiver_form`, `caregiver_name`, `caregiver_member`, `caregiver_department`, " +
|
|
|
+ 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` ," +
|
|
@@ -498,107 +497,6 @@ public class YBJServiceImpl implements YBJService {
|
|
|
}
|
|
|
log.info("创建下月护理计划定时任务end:{}", new Date());
|
|
|
}
|
|
|
-
|
|
|
- @Override
|
|
|
- public void insertYiDaNextMonth() {
|
|
|
-
|
|
|
- LocalDate NNMonth = currentDate.plusMonths(2).with(TemporalAdjusters.firstDayOfMonth());
|
|
|
- // 数据库下月数据日期
|
|
|
- String NNDMonth = NNMonth.getYear() +"-"+ String.format("%02d",NNMonth.getMonthValue());
|
|
|
-
|
|
|
- YDParam ydParam = new YDParam();
|
|
|
- log.info("创建下月护理计划定时任务Start:{}", new Date());
|
|
|
-
|
|
|
- String formId = getFormId(NNDMonth);
|
|
|
- ydParam = YDParam.builder()
|
|
|
- .formUuid("FORM-RK966E7105DFD27FA7EQHAOH9IFS2RN6MP3OL2") //获取护理计划
|
|
|
- .searchFieldJson(JSON.toJSONString(UtilMap.map("selectField_lo2b6bvf", "正常")))//护理对象暂停和正常、月度计划创建只查询正常的护理计划
|
|
|
- .build();
|
|
|
- //pagesize设为1获取总数
|
|
|
- ydParam.setPageSize(1);
|
|
|
- long totalCount = ydClient.queryData(ydParam, YDConf.FORM_QUERY.retrieve_search_form).getTotalCount();
|
|
|
- float pageSize = 50;
|
|
|
- ydParam.setCurrentPage(1);
|
|
|
- ydParam.setPageSize((int) pageSize);
|
|
|
- List<Map> dataList = new ArrayList<>();
|
|
|
-
|
|
|
-// LocalDate currentDate = LocalDate.now();
|
|
|
- //获取下月1号的日期
|
|
|
-// LocalDate firstDayOfNextMonth = currentDate.plusMonths(2).with(TemporalAdjusters.firstDayOfMonth());
|
|
|
- //获取日期是几号
|
|
|
- int dayOfMonth = NNMonth.getDayOfMonth();
|
|
|
- //获取月天数
|
|
|
- int daysInMonth = NNMonth.lengthOfMonth();
|
|
|
-
|
|
|
- for (int page = 1; page <= Math.ceil(totalCount / pageSize); page++) {
|
|
|
- ydParam.setCurrentPage(page);
|
|
|
- //创建护理计划 1次获取50条
|
|
|
- dataList = (List<Map>) ydClient.queryData(ydParam, YDConf.FORM_QUERY.retrieve_search_form).getData();
|
|
|
- log.info("dataList:{}-----page:" + page + "---", dataList.size());
|
|
|
-
|
|
|
- dataList.forEach(dataItem -> {
|
|
|
- Map formMap = (Map) dataItem.get("formData");
|
|
|
- List<Map> mapList = (List<Map>) formMap.get("tableField_lo3pmohx");
|
|
|
- for (int i = 0; i <= (daysInMonth - dayOfMonth); i++) {
|
|
|
- //获取是周几
|
|
|
- String dayOfWeek = firstDayOfNextMonth.plusDays(i).getDayOfWeek().getDisplayName(TextStyle.FULL, new Locale("zh", "CN"));
|
|
|
- //获取循环每天的日期
|
|
|
- LocalDate nextDay = firstDayOfNextMonth.plusDays(i);
|
|
|
- List<Map> maps = mapList.stream().filter(items -> items.get("selectField_lo3pmohy").equals(dayOfWeek.replace("星期", "周"))).collect(Collectors.toList());
|
|
|
- for (Map map : maps) {
|
|
|
- Map hashMap = new HashMap();
|
|
|
-
|
|
|
- hashMap.put("associationFormField_lo3pmohz", JSON.parse(map.get("associationFormField_lo3pmohz_id").toString())); //护理人员名称
|
|
|
- hashMap.put("textField_lo3pmoi0", map.get("textField_lo3pmoi0")); //护理人员所属机构
|
|
|
- hashMap.put("textField_lombve2g", map.get("textField_lomchzi3")); //护理人员身份证
|
|
|
- hashMap.put("textField_lo3pmoi3", map.get("textField_lo3pmoi3")); //护理人员手机号
|
|
|
- hashMap.put("associationFormField_lo3pmohw", JSON.parse(formMap.get("associationFormField_lo3pmohw_id").toString())); //护理对象姓名
|
|
|
- hashMap.put("textField_lnyhv5tn", formMap.get("textField_lnyhv5tn")); //护理对象身份证
|
|
|
- hashMap.put("selectField_lnyhv5tp", formMap.get("selectField_lnyhv5tp")); //护理对象等级
|
|
|
- hashMap.put("textField_lnyhv5tr", formMap.get("textField_lnyhv5tr")); //护理对象住址
|
|
|
- hashMap.put("selectField_lo3pmohy", dayOfWeek.replace("星期", "周")); //护理时间 (星期几)
|
|
|
- hashMap.put("dateField_lred6eoj", UtilDateTime.parse(String.valueOf(nextDay) + " " + map.get("selectField_lr1uxpu3"), "yyyy-MM-dd HH:mm")); //护理开始时间。 用当前日期+护理计划的 时分 转成时间戳
|
|
|
- hashMap.put("dateField_lred6eok", UtilDateTime.parse(String.valueOf(nextDay) + " " + map.get("selectField_lr1uxpu4"), "yyyy-MM-dd HH:mm")); //护理结束时间。 用当前日期+护理计划的 时分 转成时间戳
|
|
|
- hashMap.put("selectField_lqcgsbw2", "未执行"); //执行情况
|
|
|
- hashMap.put("selectField_lo56u5fn", "待上报"); //任务状态
|
|
|
-
|
|
|
- hashMap.put("textField_lvae7q5n", formMap.get("textField_lvae99fj")); //护理对象经度
|
|
|
- hashMap.put("textField_lvae7q5o", formMap.get("textField_lvae99fk")); //护理对象纬度
|
|
|
-
|
|
|
- hashMap.put("textField_lrx0r38x", String.valueOf(nextDay)); //护理日期-文本
|
|
|
- hashMap.put("selectField_lr36z6hd", "是"); //任务状态
|
|
|
- hashMap.put("textField_lo55rupj", formMap.get("textField_lo55rupj")); //护理对象姓名-文本
|
|
|
- hashMap.put("textField_lo3pmoi4", map.get("textField_lo3pmoi4")); //护理证书类型
|
|
|
- hashMap.put("employeeField_lo3pmoi6", JSON.parse(map.get("employeeField_lo3pmoi6_id").toString())); //护理人员姓名-成员
|
|
|
- hashMap.put("textField_lpgi8scj", map.get("textField_lo701pwy")); //计划明细id
|
|
|
- hashMap.put("textField_lq9llmhl", formMap.get("textField_lop4v4qx")); //护理对象ID
|
|
|
- hashMap.put("selectField_lr1uxpu3", map.get("selectField_lr1uxpu3")); //开始时间
|
|
|
- hashMap.put("selectField_lr1uxpu4", map.get("selectField_lr1uxpu4")); //结束时间
|
|
|
- hashMap.put("selectField_m4hsya94", "未回写"); //回写数据库状态
|
|
|
- if (formMap.get("departmentSelectField_lxztlnnx_id") != null) {
|
|
|
- hashMap.put("departmentSelectField_lxzto1e1", String.valueOf(formMap.get("departmentSelectField_lxztlnnx_id"))); //部门
|
|
|
- }
|
|
|
- try {
|
|
|
- Thread.sleep(200);
|
|
|
- } catch (InterruptedException e) {
|
|
|
- log.info("睡眠异常");
|
|
|
- }
|
|
|
- try {
|
|
|
- ydClient.operateData(YDParam.builder()
|
|
|
- .formUuid(formId)
|
|
|
-// .searchCondition(JSON.toJSONString(UtilMap.map("dateField_lred6eoj, textField_lnyhv5tn, textField_lombve2g",Arrays.asList(UtilDateTime.parse( nextDay+ " 00:00:01","yyyy-MM-dd HH:mm:ss"),UtilDateTime.parse( nextDay+ " 23:59:59","yyyy-MM-dd HH:mm:ss")),formMap.get("textField_lnyhv5tn"),map.get("textField_lomchzi3"))))
|
|
|
- .formDataJson(JSON.toJSONString(hashMap))
|
|
|
- .build(), YDConf.FORM_OPERATION.create);
|
|
|
- } catch (Exception e) {
|
|
|
- log.info("异常数据{}", hashMap);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- log.info("创建下月护理计划定时任务end", new Date());
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public void insertDatabaseTaskNew() {
|
|
|
log.info("创建下月护理计划定时任务生成到数据库:{}", new Date());
|
|
@@ -610,7 +508,7 @@ public class YBJServiceImpl implements YBJService {
|
|
|
.build();
|
|
|
List<Map> dataList = ydService.queryFormData_all(ydParam);
|
|
|
try {
|
|
|
- List<ObjectInfo> planCopies = new ArrayList<>();
|
|
|
+ List<Plan> planCopies = new ArrayList<>();
|
|
|
Class.forName(driver);
|
|
|
Connection connection = DriverManager.getConnection(url, username, password);
|
|
|
final PreparedStatement[] ps = {null};
|
|
@@ -983,7 +881,7 @@ public class YBJServiceImpl implements YBJService {
|
|
|
Class.forName(driver);
|
|
|
connection = DriverManager.getConnection(url, username, password);
|
|
|
for (int h = 0; h < dataList.size(); h++) {
|
|
|
- String updateSql = "UPDATE `yida_plan_details_c` SET is_cogradient = '是', plan_inst_id = '"+dataList.get(h).get("formInstanceId")+"' " +
|
|
|
+ String updateSql = "UPDATE `yida_plan_details` SET is_cogradient = '是', plan_inst_id = '"+dataList.get(h).get("formInstanceId")+"' " +
|
|
|
"where data_month in ('" + dataMonth + "','"+nextDataMonth+"') AND is_cogradient = '否' AND id = '" + dataList.get(h).get("textField_m3wp95ge") + "';";
|
|
|
ps = connection.prepareStatement(updateSql);
|
|
|
ps.executeUpdate();
|
|
@@ -1001,6 +899,20 @@ public class YBJServiceImpl implements YBJService {
|
|
|
}}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void breakPersonUpdate(Map<String, Object> data) {
|
|
|
+ long now = new Date().getTime();
|
|
|
+ String name = data.get("name").toString();
|
|
|
+ Plan plan = new Plan();
|
|
|
+ UpdateWrapper<Plan> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.eq("care_object_name",name);
|
|
|
+ updateWrapper.ge("care_start_time",now);
|
|
|
+ updateWrapper.eq("task_status","未上报");
|
|
|
+ plan.setIsDelete("1");
|
|
|
+ planMapper.update(plan,updateWrapper);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 定时任务同步数据库到宜搭
|
|
|
*/
|
|
@@ -1026,7 +938,7 @@ public class YBJServiceImpl implements YBJService {
|
|
|
"`care_date_text`,`start_time_text`,`end_time_text`,`sign_in_photo`, `sign_in_photo_down`, `sign_in_photo_name`, `sign_out_photo`, " +
|
|
|
"`sign_out_photo_down`, `sign_out_photo_name`, `sign_in_longitude`, `sign_in_latitude`, `sign_in_time`, `sign_in_position`, " +
|
|
|
"`sign_out_longitude`, `sign_out_latitude`, `sign_out_time`, `sign_out_position`, `sign_in_distance`, `sign_out_distance` " +
|
|
|
- "FROM `yida_plan_details_c` where data_month = '" + dataMonths.get(j) + "' AND is_cogradient = '否' ORDER BY id ASC LIMIT 400";
|
|
|
+ "FROM `yida_plan_details` where data_month = '" + dataMonths.get(j) + "' AND is_cogradient = '否' ORDER BY id ASC LIMIT 400";
|
|
|
ps = connection.prepareStatement(selectSql);
|
|
|
ResultSet rs = ps.executeQuery(selectSql);
|
|
|
while (rs.next()){
|
|
@@ -1384,7 +1296,7 @@ public class YBJServiceImpl implements YBJService {
|
|
|
String downLoad = image.get(0).get("downloadUrl").toString();
|
|
|
// downloadFile(remoteUrl,localUrl+fileName);
|
|
|
Date date = new Date(Long.parseLong(data.get("dateField_lp7obkef").toString()));
|
|
|
- HashMap<String, Object> updateMap = new HashMap<>();
|
|
|
+ Map<String, Object> updateMap = new HashMap<>();
|
|
|
if ("签到".equals(data.get("textField_lqoldqro"))){
|
|
|
plan.setSignInLongitude(data.get("textField_lu2ewbl7").toString());//签到经度
|
|
|
plan.setSignInLatitude(data.get("textField_lu2ewbl8").toString());//签到维度
|