Explorar el Código

卫健高教++

sugangqiang hace 1 año
padre
commit
5457e9903e

+ 53 - 4
app/common/controller/Auth.php

@@ -16,6 +16,7 @@ use app\common\api\UploadApi;
 use app\enterprise\model\Talent;
 use app\common\api\TalentState;
 use think\facade\Db;
+use app\common\state\CommonConst;
 
 class Auth extends BaseController {
 
@@ -93,6 +94,9 @@ class Auth extends BaseController {
                 'verificationCode' => \StrUtil::getRequestDecodeParam($this->request, 'verificationCode'),
                 'legal' => \StrUtil::getRequestDecodeParam($this->request, 'legal'),
                 'street' => \StrUtil::getRequestDecodeParam($this->request, 'street'),
+                'province' => \StrUtil::getRequestDecodeParam($this->request, 'province'),
+                'city' => \StrUtil::getRequestDecodeParam($this->request, 'city'),
+                'county' => \StrUtil::getRequestDecodeParam($this->request, 'county'),
                 'address' => \StrUtil::getRequestDecodeParam($this->request, 'address'),
                 'type' => intval($this->request['type']),
                 'agencyType' => intval($this->request['agencyType']),
@@ -102,6 +106,8 @@ class Auth extends BaseController {
                 'enterpriseType' => \StrUtil::getRequestDecodeParam($this->request, 'enterpriseType'),
                 'agentEmail' => \StrUtil::getRequestDecodeParam($this->request, 'agentEmail'),
                 'ephone' => \StrUtil::getRequestDecodeParam($this->request, 'ephone'),
+                'medicalCommunityId' => \StrUtil::getRequestDecodeParam($this->request, 'medicalCommunityId'),
+                'isGeneral' => \StrUtil::getRequestDecodeParam($this->request, 'isGeneral'),
                 'industryFieldNew' => \StrUtil::getRequestDecodeParam($this->request, 'industryFieldNew'),
                 'industryFieldOld' => \StrUtil::getRequestDecodeParam($this->request, 'industryFieldOld'),
                 'bankCard' => \StrUtil::getRequestDecodeParam($this->request, 'bankCard'),
@@ -166,7 +172,7 @@ class Auth extends BaseController {
                         $data['special'] = 0;
                         break;
                     case 'minfei':
-                        $data['type'] = 1;
+                        $data['type'] = CommonConst::ENTERPRISE_NORMAL;
                         $registerTimeLimitReturnObj = $this->checkRegisterTime(3, $data['organizationTag']);
                         if ($registerTimeLimitReturnObj !== true)
                             return \StrUtil::back($registerTimeLimitReturnObj, "Register.epCallBack");
@@ -188,7 +194,7 @@ class Auth extends BaseController {
                         $data['special'] = 3;
                         break;
                     case 'shiye':
-                        $data['type'] = 1;
+                        $data['type'] = CommonConst::ENTERPRISE_NORMAL;
                         validate(Enterprise::class)->batch(true)->scene('sy_add')->check($data); //事业单位
                         $registerTimeLimitReturnObj = $this->checkRegisterTime(1, $data['institutionTag']);
                         if ($registerTimeLimitReturnObj !== true)
@@ -200,6 +206,34 @@ class Auth extends BaseController {
                         }
                         $data['special'] = 1;
                         break;
+                    case "weijian":
+                        $data["type"] = CommonConst::ENTERPRISE_WJ; //卫健
+                        validate(\app\common\validate\Hospital::class)->batch(true)->scene('add')->check($data);
+                        if (!array_key_exists('imgurl', $files) || $files['imgurl'] == '') {
+                            $response_object->code = 500;
+                            $response_object->msg = '请上传医疗机构执业许可证';
+                            return \StrUtil::back($response_object, "Register.epCallBack");
+                        }
+                        if (!array_key_exists('beian', $files) || $files['beian'] == '') {
+                            $response_object->code = 500;
+                            $response_object->msg = '请上传人才联络员备案表';
+                            return \StrUtil::back($response_object, "Register.epCallBack");
+                        }
+                        break;
+                    case "gaojiao":
+                        $data["type"] = CommonConst::ENTERPRISE_GJ; //高教
+                        validate(\app\common\validate\School::class)->batch(true)->scene('add')->check($data);
+                        if (!array_key_exists('imgurl', $files) || $files['imgurl'] == '') {
+                            $response_object->code = 500;
+                            $response_object->msg = '请上传办学许可证、法人证书或登记证书';
+                            return \StrUtil::back($response_object, "Register.epCallBack");
+                        }
+                        if (!array_key_exists('beian', $files) || $files['beian'] == '') {
+                            $response_object->code = 500;
+                            $response_object->msg = '请上传人才联络员备案表不能为空';
+                            return \StrUtil::back($response_object, "Register.epCallBack");
+                        }
+                        break;
                 }
 
                 //检验验证码
@@ -332,6 +366,9 @@ class Auth extends BaseController {
                 'agentName' => \StrUtil::getRequestDecodeParam($this->request, 'agentName'), //人才联络员
                 'legal' => \StrUtil::getRequestDecodeParam($this->request, 'legal'), //法人
                 'street' => \StrUtil::getRequestDecodeParam($this->request, 'street'), //镇街
+                'province' => \StrUtil::getRequestDecodeParam($this->request, 'province'), //省
+                'city' => \StrUtil::getRequestDecodeParam($this->request, 'city'), //市
+                'county' => \StrUtil::getRequestDecodeParam($this->request, 'county'), //县
                 'address' => \StrUtil::getRequestDecodeParam($this->request, 'address'), //地址
                 'type' => intval($this->request['type']),
                 'agencyType' => intval($this->request['agencyType']),
@@ -342,6 +379,8 @@ class Auth extends BaseController {
                 'agentPhone' => \StrUtil::getRequestDecodeParam($this->request, 'agentPhone'), //手机
                 'agentEmail' => \StrUtil::getRequestDecodeParam($this->request, 'agentEmail'), //邮箱
                 'ephone' => \StrUtil::getRequestDecodeParam($this->request, 'ephone'), //单位电话
+                'medicalCommunityId' => \StrUtil::getRequestDecodeParam($this->request, 'medicalCommunityId'), //卫健专属:医共体
+                'isGeneral' => \StrUtil::getRequestDecodeParam($this->request, 'isGeneral'), //卫健专属:是否总院
                 'industryFieldNew' => \StrUtil::getRequestDecodeParam($this->request, 'industryFieldNew'), //产业领域
                 'industryFieldOld' => \StrUtil::getRequestDecodeParam($this->request, 'industryFieldOld'), //行业领域
                 'bankCard' => \StrUtil::getRequestDecodeParam($this->request, 'bankCard'), //银行
@@ -412,6 +451,7 @@ class Auth extends BaseController {
                 }
                 $data['id'] = $ep->id;
                 if ($ep->special == 0) {
+                    $idCardName = "营业执照";
                     if ($data["type"] == 1) {
                         if ($data["agencyType"] == 1) {
                             validate(\app\common\validate\Enterprise::class)->batch(true)->scene('change')->check($data);
@@ -434,12 +474,21 @@ class Auth extends BaseController {
                             $response_object->msg = '开户许可证/基本存款账户信息不能为空';
                             return \StrUtil::back($response_object, "Register.epCallBack");
                         }
-                    } else {
+                    } else if ($data["type"] == 2) {
+                        //集成电路
                         validate(\app\common\validate\Enterprise::class)->batch(true)->scene('jc_change')->check($data);
+                    } else if ($data["type"] == 3) {
+                        //卫健医院
+                        validate(\app\common\validate\Hospital::class)->batch(true)->scene('change')->check($data);
+                        $idCardName = "医疗机构执业许可证";
+                    } else {
+                        //高教学校
+                        validate(\app\common\validate\School::class)->batch(true)->scene('change')->check($data);
+                        $idCardName = "办学许可证、法人证书或登记证书";
                     }
                     if (!$data["imgurl"] && !$ep->imgurl) {
                         $response_object->code = 500;
-                        $response_object->msg = '营业执照不能为空';
+                        $response_object->msg = $idCardName . '不能为空';
                         return \StrUtil::back($response_object, "Register.epCallBack");
                     }
                     if (!$data["beian"] && !$ep->beian) {

+ 4 - 0
app/common/state/CommonConst.php

@@ -24,6 +24,10 @@ class CommonConst {
     const ZRZYJ = "zrzyj";     //自然资源局
     const visit = "visitGroup";     //走访核查小组
     const JYJ = "jyj";         //教育局
+    const ENTERPRISE_NORMAL = 1; //通常企业
+    const ENTERPRISE_JC = 2; //电路企业
+    const ENTERPRISE_WJ = 3; //卫健医院
+    const ENTERPRISE_GJ = 4; //高教学校
 
     /**
      * 晋江市优秀人才津补贴审核单位 

+ 71 - 0
app/common/validate/Hospital.php

@@ -0,0 +1,71 @@
+<?php
+
+namespace app\common\validate;
+
+use think\Validate;
+use app\admin\model\Enterprise as EnterpriseModel;
+
+class Hospital extends Validate {
+
+    protected $rule = [
+        'username' => 'require|max:50|unique:un_enterprise',
+        'password' => 'require|min:8|regex:/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,}$/',
+        're_password' => 'require|confirm:password',
+        'name' => 'require|max:100|checkName', //|regex:/^[\x{4e00}-\x{9fa5}\(\)()\da-zA-Z&]{2,50}$/u
+        'idCard' => 'require',
+        'legal' => 'require', //|regex:/^[\x{4e00}-\x{9fa5}]+$/u
+        'ephone' => 'require',
+        'medicalCommunityId' => 'require',
+        'isGeneral' => 'require',
+        'province' => 'require',
+        'city' => 'require',
+        'address' => 'require',
+        'agentName' => 'require|regex:/^[\x{4e00}-\x{9fa5}]+$/u|max:30',
+        'agentPhone' => 'require|mobile',
+        'verificationCode' => 'require',
+        'agentEmail' => 'require|email'
+    ];
+    protected $message = [
+        'username.require' => '请填写账号!',
+        'username.max' => '账号最多50个字符!',
+        'username.unique' => '该账号已被注册',
+        'password.require' => '请填写密码!',
+        'password.min' => '密码最少长度8位',
+        'password.regex' => '密码应包含字母与数字两种字符',
+        're_password.require' => '请输入重复密码',
+        're_password.confirm' => '两次密码输入不一致',
+        'name.require' => '请输入医院名称',
+        'name.max' => '医院名称最多100个字符!',
+        'idCard.require' => '请填写登记号!',
+        'legal.require' => '请输入医院法人',
+        'ephone.require' => '请输入医院电话',
+        'medicalCommunityId.require' => '请选择医共体',
+        'isGeneral.require' => '请选择是否总院',
+        'province.require' => '请选择医院所在省份',
+        'city.require' => '请选择医院所在市',
+        'address.require' => '请输入医院地址',
+        'agentName.require' => '请填写人才联络员',
+        'agentName.max' => '人才联络员最多30个字符',
+        'agentName.regex' => '人才联络员姓名只能是中文',
+        'agentPhone.require' => '请填写人才联络员手机号',
+        "agentPhone.mobile" => "请填写正确的人才联络员手机号",
+        'verificationCode.require' => '请输入手机验证码',
+        'agentEmail|require' => '请输入邮箱',
+        'agentEmail.email' => '邮箱格式错误'
+    ];
+    protected $scene = [
+        'add' => ['username', 'password', 're_password', 'name', 'idCard', 'legal', 'ephone', 'medicalCommunityId', 'isGeneral', 'province', 'city', 'address', 'agentName', 'agentPhone', 'verificationCode', 'agentEmail'],
+        'change' => ['name', 'idCard', 'legal', 'ephone', 'medicalCommunityId', 'isGeneral', 'province', 'city', 'address', 'agentName', 'agentPhone', 'agentEmail'],
+        'changePwd' => ['password']
+    ];
+
+    protected function checkName($value, $rule, $data = []) {
+        $info = EnterpriseModel::where('name', $value)->where('active', 1)->where('delete', 0)->where('id', '<>', $data['id'])->find();
+        if ($info) {
+            return "医院名称已被使用";
+        } else {
+            return true;
+        }
+    }
+
+}

+ 65 - 0
app/common/validate/School.php

@@ -0,0 +1,65 @@
+<?php
+
+namespace app\common\validate;
+
+use think\Validate;
+use app\admin\model\Enterprise as EnterpriseModel;
+
+class School extends Validate {
+
+    protected $rule = [
+        'username' => 'require|max:50|unique:un_enterprise',
+        'password' => 'require|min:8|regex:/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,}$/',
+        're_password' => 'require|confirm:password',
+        'name' => 'require|max:100|checkName', //|regex:/^[\x{4e00}-\x{9fa5}\(\)()\da-zA-Z&]{2,50}$/u
+        'legal' => 'require', //|regex:/^[\x{4e00}-\x{9fa5}]+$/u
+        'ephone' => 'require',
+        'province' => 'require',
+        'city' => 'require',
+        'address' => 'require',
+        'agentName' => 'require|regex:/^[\x{4e00}-\x{9fa5}]+$/u|max:30',
+        'agentPhone' => 'require|mobile',
+        'verificationCode' => 'require',
+        'agentEmail' => 'require|email'
+    ];
+    protected $message = [
+        'username.require' => '请填写账号!',
+        'username.max' => '账号最多50个字符!',
+        'username.unique' => '该账号已被注册',
+        'password.require' => '请填写密码!',
+        'password.min' => '密码最少长度8位',
+        'password.regex' => '密码应包含字母与数字两种字符',
+        're_password.require' => '请输入重复密码',
+        're_password.confirm' => '两次密码输入不一致',
+        'name.require' => '请输入学校名称',
+        'name.max' => '学校名称最多100个字符!',
+        'legal.require' => '请输入学校法人',
+        'ephone.require' => '请输入学校电话',
+        'province.require' => '请选择学校所在省份',
+        'city.require' => '请选择学校所在市',
+        'address.require' => '请输入学校地址',
+        'agentName.require' => '请填写人才联络员',
+        'agentName.max' => '人才联络员最多30个字符',
+        'agentName.regex' => '人才联络员姓名只能是中文',
+        'agentPhone.require' => '请填写人才联络员手机号',
+        "agentPhone.mobile" => "请填写正确的人才联络员手机号",
+        'verificationCode.require' => '请输入手机验证码',
+        'agentEmail|require' => '请输入邮箱',
+        'agentEmail.email' => '邮箱格式错误'
+    ];
+    protected $scene = [
+        'add' => ['username', 'password', 're_password', 'name', 'legal', 'ephone', 'province', 'city', 'address', 'agentName', 'agentPhone', 'verificationCode', 'agentEmail'],
+        'change' => ['name', 'legal', 'ephone', 'province', 'city', 'address', 'agentName', 'agentPhone', 'agentEmail'],
+        'changePwd' => ['password'],
+    ];
+
+    protected function checkName($value, $rule, $data = []) {
+        $info = EnterpriseModel::where('name', $value)->where('active', 1)->where('delete', 0)->where('id', '<>', $data['id'])->find();
+        if ($info) {
+            return "学校名称已存在";
+        } else {
+            return true;
+        }
+    }
+
+}

+ 49 - 12
public/static/modular/gate/enterprise/enterprise_edit.js

@@ -8,6 +8,24 @@ var psSmsBtn = $("#ps_sms_btn");
 
 Register.enterpriseUserRegister = function () {
     $("#agentPhone").removeAttr("disabled");
+    var type = $("#type").val();
+    var special = $("#special").val();
+    var enterpriseTypeName = "企业";
+    var idCardName = "统一社会信用代码";
+    switch (special) {
+        case 0:
+            if (type == 3) {
+                enterpriseTypeName = "医院";
+                idCardName = "登记号";
+            }
+            if (type == 4) {
+                enterpriseTypeName = "学校";
+            }
+            break;
+        case 1:
+            enterpriseTypeName = "单位";
+            break;
+    }
     var username = $("#username").val();
     var name = $("#name").val();
     var idCard = $("#idCard").val();
@@ -15,12 +33,15 @@ Register.enterpriseUserRegister = function () {
     var agentPhone = $("#agentPhone").val();
     var legal = $("#legal").val();
     var street = $("#street").val();
+    var province = $("#province").val();
+    var city = $("#city").val();
+    var county = $("#county").val();
     var address = $("#address").val();
-    var type = $("#type").val();
     var agencyType = $("#agencyType").val();
-    var special = $("#special").val();
     var agentEmail = $("#agentEmail").val();
     var ephone = $("#ephone").val();
+    var medicalCommunityId = $("#medicalCommunityId").val();
+    var isGeneral = $("#isGeneral").val();
     var bankCard = $("#bankCard").val();
     var bank = $("#bank").val();
     var bankNetwork = $("#bankNetwork").val();
@@ -33,19 +54,19 @@ Register.enterpriseUserRegister = function () {
         return;
     }
     if (name == null || name == '') {
-        Feng.info("请填写单位名称!");
+        Feng.info("请填写" + enterpriseTypeName + "名称!");
         return;
     }
     if (name.length > 100) {
-        Feng.info("单位名称最多100个字符!");
+        Feng.info(enterpriseTypeName + "名称最多100个字符!");
         return;
     }
-    if ((idCard == null || idCard == '') && special != "1") {
-        Feng.info("请填写统一社会信用代码!");
+    if ((idCard == null || idCard == '') && special != "1" && type != 4) {
+        Feng.info("请填写" + idCardName + "!");
         return;
     }
     if (idCard.length > 40) {
-        Feng.info("统一社会信用代码最多40个字符!");
+        Feng.info(idCardName + "最多40个字符!");
         return;
     }
     if ((legal == null || legal == '') && special != "1") {
@@ -53,18 +74,34 @@ Register.enterpriseUserRegister = function () {
         return;
     }
     if (ephone == null || ephone == '') {
-        Feng.info("请填写单位电话");
+        Feng.info("请填写" + enterpriseTypeName + "电话");
         return;
     }
-    if (street == null || street == '') {
+    if ((medicalCommunityId == null || medicalCommunityId == '') && type == 3) {
+        Feng.info("请选择医共体");
+        return;
+    }
+    if ((isGeneral == null || isGeneral == '') && type == 3) {
+        Feng.info("请选择是否总院");
+        return;
+    }
+    if ((street == null || street == '') && [3, 4].indexOf(type) == -1) {
         Feng.info("请选择所属街道!");
         return;
     }
+    if ((province == null || province == '') && [3, 4].indexOf(type) > -1) {
+        Feng.info("请选择" + enterpriseTypeName + "所在省份!");
+        return;
+    }
+    if ((city == null || city == '') && [3, 4].indexOf(type) > -1) {
+        Feng.info("请选择" + enterpriseTypeName + "所在市!");
+        return;
+    }
     if (address == null || address == '') {
-        Feng.info("请填写单位地址!");
+        Feng.info("请填写" + enterpriseTypeName + "地址!");
         return;
     }
-    if (special != "1" && type != 2) {
+    if (special != "1" && [2, 3, 4].indexOf(type) == -1) {
         if (bankCard == null || bankCard == '') {
             Feng.info("请填写企业银行账号!");
             return;
@@ -133,7 +170,7 @@ Register.enterpriseUserRegister = function () {
         return;
     }
     if (!/(^(\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})))$/.test(ephone)) {
-        Feng.info("单位电话格式不合法!");
+        Feng.info(enterpriseTypeName + "电话格式不合法!");
         return;
     }
     if (!/(^(\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})))$/.test(agentPhone)) {