Browse Source

卫健,批量审核

sugangqiang 1 year ago
parent
commit
8bd2ac5609

+ 27 - 0
app/admin/controller/Talent.php

@@ -23,6 +23,7 @@ use app\common\state\ProjectState;
 use app\admin\api\RsApi;
 use app\admin\model\ApiData;
 use app\common\state\CommonConst;
+use app\common\api\Response;
 
 /**
  * Description of Talent
@@ -1040,6 +1041,32 @@ class Talent extends AdminController {
         return $this->commonSubmitCheck($talent_info, 2);
     }
 
+    public function batchCheck() {
+        $params = $this->request->param();
+        $ids = array_filter(explode(",", $params["ids"]));
+        $checkState = $params["checkState"];
+        $checkMsg = $params["checkMsg"];
+        $fields = array_filter(explode(",", $params["fields"]));
+        $files = array_filter(explode(",", $params["files"]));
+
+        if (count($ids) == 0) {
+            return new Response(Response::ERROR, "没有选择审核对象");
+        }
+        if (!$checkState || !in_array($checkState, [3, 2, 6])) {
+            return new Response(Response::ERROR, "请选择审核状态");
+        }
+        if (in_array($checkState, [2, 6]) && !$fields && !$files) {
+            return new Response(Response::ERROR, "请选择可修改的字段或附件");
+        }
+        if (\StrUtil::isEmpOrNull($checkMsg)) {
+            return new Response(Response::ERROR, "请填写审核意见");
+        }
+        for ($i = 0; $i < count($ids); $i++) {
+            queue("app\job\Talent", ["type" => 6, "id" => $ids[$i], "user" => $this->user, "checkState" => $checkState, "fields" => $fields, "files" => $files, "checkMsg" => $checkMsg]); //加入批量审核处理队列
+        }
+        return new Response(Response::SUCCESS, "批量审核已经提交到队列执行中,请稍候片刻");
+    }
+
     /**
      * 初审-提交未保存
      * @param \think\Request $request

+ 4 - 4
app/common/api/TalentLogApi.php

@@ -154,8 +154,8 @@ class TalentLogApi {
         }
     }
 
-    public static function write($type, $mainId, $state = [], $description = "", $active = 0, $fileType = null, $fileId = null, $companyId = null) {
-        $user = session("user");
+    public static function write($type, $mainId, $state = [], $description = "", $active = 0, $fileType = null, $fileId = null, $companyId = null, $user = null) {
+        $user = $user ? $user : session("user");
         $last_log = self::getLastLog($mainId, $type, 0, ["active", "=", 1]);
         $log["last_state"] = $last_log["state"] ?: 0;
         $log["id"] = getStringId();
@@ -185,8 +185,8 @@ class TalentLogApi {
         return TalentLog::create($log);
     }
 
-    public static function rewrite($id, $state = [], $description = "", $active = 0) {
-        $user = session("user");
+    public static function rewrite($id, $state = [], $description = "", $active = 0, $user = null) {
+        $user = $user ? $user : session("user");
         if (is_array($state)) {
             $log["state"] = $state[0];
             $log["new_state"] = $state[1];

+ 1 - 0
app/common/api/VerifyApi.php

@@ -70,6 +70,7 @@ class VerifyApi {
             $info["enterpriseBankNetwork"] = $enterprise["bankNetwork"];
             $info["enterpriseBank"] = $enterprise["bank"];
             $info["isGeneral"] = $enterprise["isGeneral"];
+            $info["medicalCommunityId"] = $enterprise["medicalCommunityId"];
             $info["medicalCommunityName"] = $enterprise["medicalCommunityId"] ? \app\common\api\Nhc::getMedicalCommunityMap()[$enterprise["medicalCommunityId"]] : "";
 
             if ($info["talent_type"]) {

+ 103 - 0
app/job/Talent.php

@@ -309,6 +309,109 @@ class Talent {
                     Log::write($e->getMessage(), "error");
                 }
                 break;
+            case 6://卫健批量审核
+                $condition = null;
+                $upddata["pass_dept_check"] = 0;
+                $talent_info = \app\common\api\VerifyApi::getTalentInfoById($data["id"]);
+                if ($talent_info && $talent_info["checkState"] == TalentState::SCND_SUBMIT) {
+                    if ($data["checkState"] == 3) {
+                        //审核成功,并取消设置越过部门并审
+                        $log_checkState = $checkState = TalentState::FST_VERIFY_PASS; //初审成功
+                    } else {
+//审核驳回并记录需要修改的字段和上传文件
+                        if (in_array("talent_condition", $data["fields"])) {
+                            $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
+                            $data["files"] = array_merge($data["files"], (array) explode(",", $condition["bindFileTypes"]));
+                        }
+                        if ($talent_info["enterpriseType"] == CommonConst::ENTERPRISE_WJ) {
+                            if ($data["checkState"] == 6) {
+                                //驳回到分院
+                                if ($talent_info["isGeneral"] == 1) {
+                                    //总院不能驳回到分院,自动变更为退回总院
+                                    $checkState = TalentState::SCND_SAVE;
+                                } else {
+                                    $checkState = TalentState::FST_SAVE;
+                                }
+                            } else {
+                                if ($talent_info["isGeneral"] == 1) {
+                                    $checkState = TalentState::SCND_SAVE; //退回材料编辑状态
+                                } else {
+                                    if (\app\common\api\Nhc::hasGeneralHospital($talent_info["medicalCommunityId"])) {
+                                        $checkState = TalentState::FST_SUBMIT;
+                                    } else {
+                                        $checkState = TalentState::FST_SAVE;
+                                    }
+                                }
+                            }
+                        } else {
+                            $checkState = TalentState::SCND_SAVE; //退回材料编辑状态
+                        }
+                        $log_checkState = TalentState::FST_VERIFY_REJECT; //日志记录拒绝状态
+                    }
+
+                    $nowProcess = 3;
+                    if ($checkState == TalentState::FST_VERIFY_PASS) {
+                        $upddata["highProcess"] = $nowProcess > $talent_info["highProcess"] ? $nowProcess : $talent_info["highProcess"];
+                    }
+                    $userIds = [];
+                    if ($log_checkState == TalentState::FST_VERIFY_PASS) {
+                        $upddata["first_dept_check_time"] = date("Y-m-d H:i:s");
+                        $condition = $condition ? $condition : TalentConditionApi::getOne($talent_info["talent_condition"]);
+                        $companyIds = array_filter(explode(",", $condition["companyIds"])); //该条件下需要审核的所有单位
+                        if ($talent_info["re_check_companys"]) {
+                            $unpass_companyIds = array_filter(explode(",", $talent_info["re_check_companys"]));
+                        } else {
+//这边去除已经审核通过的单位,主要通过日志是否存在记录。
+                            $pass_companyIds = TalentLogApi::getPassDepts($data["id"]); //已经通过的单位
+                            $unpass_companyIds = array_diff($companyIds, (array) $pass_companyIds); //排除已经通过的单位
+                            if (!$unpass_companyIds) {
+                                $data["pass_dept_check"] = 1; //部门已经全部审核过了,跳过部门审核
+                            }
+                        }
+                        if ($unpass_companyIds) {
+                            sort($unpass_companyIds);
+                            $delay = 9 * 24 * 3600; //9天的秒数
+                            queue("app\job\Talent", ["type" => 1, "id" => $data["id"]], $delay); //加入部门审核超期处理队列,延迟7天执行
+                            TalentLogApi::writeDeptLogs($data["id"], $unpass_companyIds, TalentState::FST_VERIFY_PASS);
+
+                            /*
+                              //初审通过发送短信通知并审部门
+                              $codes = ["talentInfo_depCheck"];
+                              $menuIds = MenuApi::getMenuIdsByCodes($codes);
+
+                              $where = [];
+                              $where[] = ["menuid", "in", $menuIds];
+                              $roleIds = SysRelation::where($where)->group("roleid")->having("count(*)=" . count($codes))->column("roleid");
+
+                              $where = [];
+                              $where[] = ["status", "=", 1];
+                              //$where[] = ["type", "=", $this->user["type"]];
+                              $where[] = ["companyId", "in", $unpass_companyIds];
+                              $where[] = ["roleid", "<>", 1];
+                              $regstr = ",(" . implode("|", $roleIds) . "),";
+                              $whereRaw = "concat(',',roleid,',') REGEXP '$regstr'";
+                              $userIds = User::where($where)->whereRaw($whereRaw)->column("id");
+                             */
+                        }
+                    }
+
+                    $log = TalentLogApi::getLastLog($data["id"], 1);
+                    if (!$log && !$talent_info["oldId"])
+                        return json(["msg" => "日志数据异常,保存失败"]);
+                    if ($log["active"] === 0) {
+                        TalentLogApi::rewrite($log["id"], [$log_checkState, $checkState], $data["checkMsg"], 1, $data["user"]);
+                    } else {
+                        TalentLogApi::write(1, $data["id"], [$log_checkState, $checkState], $data["checkMsg"], 1, null, null, null, $data["user"]);
+                    }
+
+                    $upddata["id"] = $talent_info["id"];
+                    $upddata["modify_files"] = $data["files"] ? implode(",", $data["files"]) : "";
+                    $upddata["modify_fields"] = $data["fields"] ? implode(",", $data["fields"]) : "";
+                    $upddata["checkState"] = $checkState;
+                    TalentModel::update($upddata);
+                    return true;
+                }
+                break;
         }
         return false;
     }

+ 46 - 7
public/static/modular/talentIdentify/talentInfo/hospital/talentInfo_base.js

@@ -335,11 +335,9 @@ TalentInfo.batchCheck = function () {
         Feng.info("请至少选择一行数据!");
         return;
     }
-    var ids = "";
-    var count = 0;
+    var ids = [];
     for (var i = 0; i < selected.length; i++) {
-        count++;
-        ids = ids + selected[i].id + ",";
+        ids.push(selected[i].id);
     }
 
     var ajax = new $ax("/admin/talent/findFieldsAndFilesForBatch", function (data) {
@@ -367,13 +365,54 @@ TalentInfo.batchCheck = function () {
                     for (var key in data.fileList) {
                         html2 = html2 + '<ul><li style="width: 100%"><input type="checkbox" value="' + data.fileList[key].id + '"><span>' + data.fileList[key].name + '</span></li></ul>';
                     }
-                    $("#batchcount").html(count + "人");
+                    $("#batchcount").html(ids.length + "人");
                     $("#checkMsg").text(data.checkMsg);
                     $("#firstBatchCheckForm #field_info ul").css("overflow", "hidden").html(html1);
                     $("#field_file").css("overflow", "hidden").empty().append(html2);
                 },
                 yes: function (index, layero) {
-
+                    var checkState = $("#checkStateFirstModal").val();
+                    var checkMsg = $("#checkMsgFirst").val();
+                    if (checkState == null || checkState == '') {
+                        Feng.info("请选择审核状态");
+                        return;
+                    }
+                    if (checkMsg == null || checkMsg == '') {
+                        Feng.info("请填写审核意见");
+                        return;
+                    }
+                    var fields = '';
+                    var files = '';
+                    var companys = '';
+                    $("#field_info li input").each(function (index) {
+                        if ($(this).is(":checked")) {
+                            fields = fields + $(this).val() + ",";
+                        }
+                    });
+                    $("#field_file li input").each(function (index) {
+                        if ($(this).is(":checked")) {
+                            files = files + $(this).val() + ",";
+                        }
+                    });
+                    if ((checkState == 2 || checkState == 6) && fields == '' && files == '') {
+                        Feng.info("请选择可修改的字段或附件!");
+                        return;
+                    }
+                    var ajax = new $ax("/admin/talent/batchCheck", function (data) {
+                        if (data.code == 200) {
+                            layer.close(i);
+                            Feng.success(data.msg);
+                        } else {
+                            Feng.error(data.msg);
+                        }
+                        locked = false;
+                    }, function (data) {
+                        Feng.error("提交审核失败!" + data.responseJSON.message + "!");
+                        locked = false;
+                    });
+                    ajax.setData({"ids": ids.join(","), "checkState": checkState, "checkMsg": checkMsg,
+                        "fields": fields, "files": files})
+                    ajax.start();
                 }
             });
         } else {
@@ -628,7 +667,7 @@ TalentInfo.createFirstCheckModal = function () {
             '                            <option value="">请选择</option>\n' +
             '                            <option value="3">审核通过</option>\n' +
             '                            <option value="2">审核驳回</option>\n' +
-            '                            <option value="-1">审核不通过</option>\n' +
+            '                            <option value="6">驳回到分院</option>\n' +
             '                        </select>\n' +
             '                    </div>\n' +
             '                    <div class="form-group" style="margin: 10px;">\n' +

+ 1 - 1
public/static/modular/talentIdentify/talentInfo/hospital/talentInfo_common_check_new.js

@@ -597,7 +597,7 @@ TalentInfoInfoDlg.firstCheck = function (i) {
             companys += $(this).val() + ",";
         }
     });
-    if (checkState == 2 && fields == '' && files == '') {
+    if ((checkState == 2 || checkState == 6) && fields == '' && files == '') {
         Feng.info("请选择可修改的字段或附件!");
         return;
     }