Selaa lähdekoodia

医保局代码整理提交

zfc 1 vuosi sitten
vanhempi
commit
6eaf27d3b0

+ 43 - 43
mjava-yibaoju/src/main/java/com/malk/yibaoju/controller/YBJController.java

@@ -35,7 +35,6 @@ public class YBJController {
 
     @Autowired
     private YBJService ybjService;
-
     @Autowired
     private YDClient ydClient;
 
@@ -49,8 +48,10 @@ public class YBJController {
         return McR.success(ydClient.convertTemporaryUrl(UtilMap.getString(data, "url")));
     }
 
+
     /**
-     * 根据创建的护理计划生成本月多条护理数据
+     * 根据护理安排创建护理计划
+     * 通过参数 1个护理安排创建多条护理计划
      */
     @SneakyThrows
     @PostMapping("createPlan")
@@ -58,11 +59,9 @@ public class YBJController {
 
         Map data = UtilServlet.getParamMap(request);
         log.info("createPlan 护理计划{}",data);
-
         LocalDate currentDate = LocalDate.now();
         //获取当前日期是本月几号
         int dayOfMonth = currentDate.getDayOfMonth();
-
         if ("1".equals(data.get("status"))){
             ybjService.creatInfo(data.get("formInstId").toString());
             //删除睡眠两秒  在执行创建
@@ -80,10 +79,33 @@ public class YBJController {
         return McR.success();
     }
 
+    /**
+     * 通过安排创建本月所有的护理计划
+     * @param request
+     * @return
+     */
+    @PostMapping("syncCreatePlan")
+    McR syncCreatePlan(HttpServletRequest request) {
+        ybjService.syncNursePlan();
+        return McR.success();
+    }
 
 
     /**
-     * 暂停/恢复护理对象 删除/创建护理计划
+     * 通过安排创建下月所有的护理计划
+     * @param request
+     * @return
+     */
+    @PostMapping("syncCreateNextPlan")
+    McR syncCreateNextPlan(HttpServletRequest request) {
+        ybjService.syncCreatePlan();
+        return McR.success();
+    }
+
+    /**
+     * 暂停护理对象  删除所有未执行的护理计划
+     * 恢复护理对象  新增所有护理任务 如果当前日期是25日  则需要生成下月的数据
+     * 如果当前日期小于25日  则只生成本月的数据
      * @param request
      * @return
      */
@@ -93,11 +115,9 @@ public class YBJController {
 
         Map data = UtilServlet.getParamMap(request);
         log.info("deletePlan 暂停/恢复护理对象 删除/创建护理计划{}",data);
-
         LocalDate currentDate = LocalDate.now();
         //获取当前日期是本月几号
         int dayOfMonth = currentDate.getDayOfMonth();
-
         if ("1".equals(data.get("code"))){
             //获取护理对象CID
             ybjService.deletePlan(data.get("cId").toString());
@@ -115,12 +135,10 @@ public class YBJController {
                     Thread.sleep(2000);
                     ybjService.creatNextInfo(map.get("formInstanceId").toString());
                 }
-
                 Thread.sleep(2000);
                 ybjService.creatNextInfo(map.get("formInstanceId").toString());
             }
         }else{   //编辑护理对象信息
-
             //先删除
             ybjService.deletePlan(data.get("cId").toString());
             //删除睡眠两秒  在执行创建
@@ -135,42 +153,35 @@ public class YBJController {
             if(dataList.size()>0){
                 Map map = (Map) dataList.get(0);
                 ybjService.creatInfo(map.get("formInstanceId").toString());
-
                 if (dayOfMonth>24){
                     Thread.sleep(2000);
                     ybjService.creatNextInfo(map.get("formInstanceId").toString());
                 }
-
             }
-
         }
         return McR.success();
     }
 
-
     @Autowired
     private YDService ydService;
-
     /**
      * 更新子表关联表单 fixme 1.28 子表单关联表单更新
+     *
+     * 更新护理安排中的成员组件信息
      */
     @GetMapping("update")
     McR update() {
 
         List<Map> dataList = ydService.queryFormData_all(YDParam.builder()
                 .formUuid("FORM-RK966E7105DFD27FA7EQHAOH9IFS2RN6MP3OL2")
-//                .searchFieldJson(JSON.toJSONString(UtilMap.map("textField_lnyhv5tn", "310226193301123225")))
                 .build());
-
         for (Map formData: dataList) {
-
             List<Map> details = (List<Map>) formData.get("tableField_lo3pmohx");
             for (Map row: details) {
                 row.put("employeeField_lo3pmoi6", "employeeField_lo3pmoi6_id");
                 row.put("associationFormField_lo3pmohz", YDConf.associationForm("APP_YIDJ71B8QORD2YHNZ26Q", "FORM-RK966E7105DFD27FA7EQHAOH9IFS2RN6MP3OL2" ,UtilMap.getString(row,"textField_lrvtfzng"), UtilMap.getString(row, "textField_lrvtfznf"), "", false));
             }
             formData.put("tableField_lo3pmohx", details);
-
             try {
                 ydClient.operateData(YDParam.builder()
                         .formInstanceId(UtilMap.getString(formData, "instanceId"))
@@ -180,25 +191,15 @@ public class YBJController {
                 log.info("更新异常, {}",UtilMap.getString(formData, "instanceId") );
             }
         }
-
         log.info("更新子表关联表单, {}", dataList.size());
 
         return McR.success();
     }
 
-    /**
-     * 通过安排创建护理任务
-     * @param request
-     * @return
-     */
-    @PostMapping("syncCreatePlan")
-    McR syncCreatePlan(HttpServletRequest request) {
-        ybjService.syncNursePlan();
-        return McR.success();
-    }
 
     /**
-     * 修改打卡数据中的护理计划名称
+     * 打卡列表传数据到打卡页面无法加载关联控件
+     * 通过代码将关联控件信息写入到打卡页面
      * @param request
      * @return
      */
@@ -206,26 +207,20 @@ public class YBJController {
     McR updatePlanName(HttpServletRequest request) {
         Map data = UtilServlet.getParamMap(request);
         log.info("修改打卡数据中的护理计划名称{}",data);
-
-//        List<Map> mapList = Arrays.asList(UtilMap.map("appType, formUuid, instanceId, title, subTitle, formType","APP_YIDJ71B8QORD2YHNZ26Q","FORM-IY966L71PJ8FV10D61M1HBHU6FB320M2765OLM",data.get("relevanceInstanceId").toString(),data.get("titleName").toString(),"",""));;
-
         Map hashMap = new HashMap();
         hashMap.put("associationFormField_lpgi5wv5",YDConf.associationForm("APP_YIDJ71B8QORD2YHNZ26Q","FORM-IY966L71PJ8FV10D61M1HBHU6FB320M2765OLM",data.get("relevanceInstanceId").toString(),data.get("titleName").toString(),"",false));
-
         ydClient.operateData(YDParam.builder()
                 .formInstanceId(data.get("currentInstanceId").toString())
                 .updateFormDataJson(JSON.toJSONString(hashMap))
                 .build(), YDConf.FORM_OPERATION.update);
-
         return McR.success();
     }
 
 
-
     @Autowired
     private DDService ddService;
-
     /**
+     * 地图
      * jsApi 注册
      */
     @PostMapping("register")
@@ -235,10 +230,13 @@ public class YBJController {
         return McR.success(ddService.registerJsApi(data.get("url"), data.get("nonceStr")));
     }
 
-
-
-    @RequestMapping("test")
-    McR test(HttpServletRequest request) {
+    /**
+     * 同步护理对象坐标地址
+     * @param request
+     * @return
+     */
+    @RequestMapping("synPointInfo")
+    McR synPointInfo(HttpServletRequest request) {
 
         YDParam ydParam = new YDParam();
         ydParam = YDParam.builder()
@@ -266,20 +264,22 @@ public class YBJController {
 
                 List<Map> mapList = (List<Map>) ydClient.queryData(hldxParam, YDConf.FORM_QUERY.retrieve_search_form).getData();
                 Map fkmap = (Map) mapList.get(0).get("formData");
-
                 // 更新
                 ydClient.operateData(YDParam.builder()
                         .formInstanceId((String) dataItem.get("formInstanceId"))
                         .updateFormDataJson(JSON.toJSONString(UtilMap.map("textField_lvae99fj, textField_lvae99fk", fkmap.get("textField_ljghmc0e"),fkmap.get("textField_ljghmc0f"))))
                         .build(), YDConf.FORM_OPERATION.update);
-
             });
         }
 
         return McR.success();
     }
 
+    @RequestMapping("test")
+    McR test(HttpServletRequest request) {
 
+        return McR.success();
+    }
 
 
 

+ 1 - 1
mjava-yibaoju/src/main/java/com/malk/yibaoju/schedule/ScheduleTask.java

@@ -36,7 +36,7 @@ public class ScheduleTask {
     /**
      * 每天凌晨1-4点更新计划护理的任务状态
      */
-    @Scheduled(cron = " 0 0/20 1,4 * * ? ")
+    @Scheduled(cron = " 0 0/25 4 * * ? ")
     public void syncDingTalkStatus() {
         try {
             ybjService.syncUpdatePlanStatus();

+ 105 - 95
mjava-yibaoju/src/main/java/com/malk/yibaoju/service/impl/YBJServiceImpl.java

@@ -51,7 +51,6 @@ public class YBJServiceImpl implements YBJService {
         //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);
@@ -146,6 +145,108 @@ public class YBJServiceImpl implements YBJService {
     }
 
 
+
+    /**
+     *定时任务每月25号创建下月的数据
+     */
+    @Override
+    @SneakyThrows
+    public void syncCreatePlan() {
+
+        YDParam ydParam = new YDParam();
+        log.info("创建下月护理计划定时任务Start",new Date());
+
+        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<>();
+        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());
+            LocalDate currentDate = LocalDate.now();
+            //获取下月1号的日期
+            LocalDate firstDayOfNextMonth  = currentDate.plusMonths(1).with(TemporalAdjusters.firstDayOfMonth());
+            //获取日期是几号
+            int dayOfMonth = firstDayOfNextMonth .getDayOfMonth();
+            //获取月天数
+            int daysInMonth = firstDayOfNextMonth.lengthOfMonth();
+            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();
+                        try {
+                            Thread.sleep(100);
+                        } catch (InterruptedException e) {
+                            throw new RuntimeException(e);
+                        }
+                        //通过护理时间  护理对象  护理人员验证数据是否已经存在
+                        YDParam ydParam1 = YDParam.builder()
+                                .formUuid("FORM-IY966L71PJ8FV10D61M1HBHU6FB320M2765OLM")
+                                .searchFieldJson(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.with(TemporalAdjusters.lastDayOfMonth())+ " 23:59:59","yyyy-MM-dd HH:mm:ss")),formMap.get("textField_lnyhv5tn"),map.get("textField_lomchzi3"))))
+                                .build();
+                        List<Map> dataLists = (List<Map>) ydClient.queryData(ydParam1, YDConf.FORM_QUERY.retrieve_search_form).getData();
+                        if (dataLists.size()<1){
+                            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
+                            try {
+                                ydClient.operateData(YDParam.builder()
+                                        .formUuid("FORM-IY966L71PJ8FV10D61M1HBHU6FB320M2765OLM")
+                                        .formDataJson(JSON.toJSONString(hashMap))
+                                        .build(), YDConf.FORM_OPERATION.create);
+                            } catch (Exception e) {
+                                log.info("异常数据{}",hashMap);
+                            }
+                        }
+                    }
+                }
+            });
+        }
+        log.info("创建下月护理计划定时任务end",new Date());
+    }
+
+
+
+
+
+
     /**
      *每天同步护理状态
      */
@@ -157,6 +258,9 @@ public class YBJServiceImpl implements YBJService {
     }
 
 
+    /**
+     * 不同上报状态  定时任务每天执行
+     */
     @SneakyThrows
     public void syncPlanStatus() {
 
@@ -472,101 +576,7 @@ public class YBJServiceImpl implements YBJService {
     }
 
 
-    /**
-     *定时任务每月25号创建下月的数据
-     */
-    @Override
-    @SneakyThrows
-    public void syncCreatePlan() {
-
-        YDParam ydParam = new YDParam();
-        log.info("创建护理计划定时任务Start",new Date());
 
-        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<>();
-        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());
-            LocalDate currentDate = LocalDate.now();
-            //获取下月1号的日期
-            LocalDate firstDayOfNextMonth  = currentDate.plusMonths(1).with(TemporalAdjusters.firstDayOfMonth());
-            //获取当前日期是本月几号
-            int dayOfMonth = firstDayOfNextMonth .getDayOfMonth();
-            //获取本月天数
-            int daysInMonth = firstDayOfNextMonth.lengthOfMonth();
-            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();
-                        try {
-                            Thread.sleep(100);
-                        } catch (InterruptedException e) {
-                            throw new RuntimeException(e);
-                        }
-                        //通过护理时间  护理对象  护理人员验证数据是否已经存在
-                        YDParam ydParam1 = YDParam.builder()
-                                .formUuid("FORM-IY966L71PJ8FV10D61M1HBHU6FB320M2765OLM")
-                                .searchFieldJson(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.with(TemporalAdjusters.lastDayOfMonth())+ " 23:59:59","yyyy-MM-dd HH:mm:ss")),formMap.get("textField_lnyhv5tn"),map.get("textField_lomchzi3"))))
-                                .build();
-                        List<Map> dataLists = (List<Map>) ydClient.queryData(ydParam1, YDConf.FORM_QUERY.retrieve_search_form).getData();
-                        if (dataLists.size()<1){
-                            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
-                            try {
-                                ydClient.operateData(YDParam.builder()
-                                        .formUuid("FORM-IY966L71PJ8FV10D61M1HBHU6FB320M2765OLM")
-                                        .formDataJson(JSON.toJSONString(hashMap))
-                                        .build(), YDConf.FORM_OPERATION.create);
-                            } catch (Exception e) {
-                                log.info("异常数据{}",hashMap);
-                            }
-                        }
-                    }
-                }
-            });
-        }
-        log.info("创建护理计划定时任务end",new Date());
-    }
 
 
 }