소스 검색

删除没用的东西,以及慢病信息

xiaochan 1 년 전
부모
커밋
5c1c6208bb

+ 0 - 120
src/main/java/thyyxxk/webserver/controller/zhuyuanyizheng/emr/EmrControlRuleController.java

@@ -1,120 +0,0 @@
-package thyyxxk.webserver.controller.zhuyuanyizheng.emr;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.springframework.web.bind.annotation.*;
-import thyyxxk.webserver.config.auth.PassToken;
-import thyyxxk.webserver.entity.ResultVo;
-import thyyxxk.webserver.entity.zhuyuanyisheng.emr.EmrAuditDetail;
-import thyyxxk.webserver.entity.zhuyuanyisheng.emr.EmrLimitUnlock;
-import thyyxxk.webserver.entity.zhuyuanyisheng.emrcontrolrule.*;
-import thyyxxk.webserver.service.zhuyuanyisheng.emr.EmrControlRuleSever;
-import thyyxxk.webserver.service.zhuyuanyisheng.emr.EmrControlRuleSeverV2;
-import thyyxxk.webserver.utils.ResultVoUtil;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Administrator
- */
-@RestController
-@RequestMapping("/emrControlRule")
-public class EmrControlRuleController {
-    private final EmrControlRuleSever server;
-
-    private final EmrControlRuleSeverV2 serverv2;
-
-    public EmrControlRuleController(EmrControlRuleSever server, EmrControlRuleSeverV2 serverv2) {
-        this.server = server;
-        this.serverv2 = serverv2;
-    }
-
-    @GetMapping("/getAvailableObjects")
-    public ResultVo<List<Map<String, Object>>> getAvailableObjects() {
-        return server.getAvailableObjects();
-    }
-
-    @GetMapping("/specifyAdmissionQualityControl")
-    public ResultVo<JSONObject> specifyAdmissionQualityControl(@RequestParam("start") String start,
-                                                               @RequestParam("end") String end) {
-        return serverv2.specifyAdmissionQualityControl(start, end);
-    }
-
-    @GetMapping("/myPatientQualityControl")
-    public ResultVo<List<EmrAuditDetail>> myPatientQualityControl() {
-        return serverv2.myPatientQualityControl();
-    }
-
-
-    @GetMapping("/getRuleList")
-    public ResultVo<List<EmrRule>> getRuleList() {
-        return ResultVoUtil.success(server.getRuleList());
-    }
-
-    @GetMapping("/switchQualityControl")
-    public ResultVo<String> switchQualityControl(@RequestParam("id") String id,
-                                                 @RequestParam("offOn") Integer offOn) {
-        return server.switchQualityControl(id, offOn);
-    }
-
-    @GetMapping("/deleteRuleById")
-    public ResultVo<String> deleteRuleById(@RequestParam("id") String id) {
-        return server.deleteRuleById(id);
-    }
-
-    @GetMapping("/modifyTheAdmissionQualityControlTime")
-    public ResultVo<String> modifyTheAdmissionQualityControlTime(@RequestParam("date") String date) {
-        return server.modifyTheAdmissionQualityControlTime(date);
-    }
-
-    @GetMapping("/getAdmissDate")
-    public ResultVo<String> getAdmissDate() {
-        return server.getAdmissDate();
-    }
-
-    @GetMapping("/createRestrictions")
-    public ResultVo<EmrRuleVerify> createRestrictions(@RequestParam("code") String code,
-                                                      @RequestParam("id") String id,
-                                                      @RequestParam("patNo") String patNo) {
-        String[] strings = patNo.split("_");
-        return server.createRestrictions(code, strings[0], Integer.valueOf(strings[1]), Integer.valueOf(strings[2]), id);
-    }
-
-    ////////////////////////////////////////////////////////////////////////////////////////////////
-    @PostMapping("/requestToUnlockMedicalRecords")
-    public ResultVo<String> requestToUnlockMedicalRecords(@RequestBody EmrLimitUnlock param) {
-        return server.requestToUnlockMedicalRecords(param);
-    }
-
-    @PostMapping("/getApplicationData")
-    public ResultVo<IPage<EmrLimitUnlock>> getApplicationData(@RequestBody SelectUnlockParam param) {
-        return server.getApplicationData(param);
-    }
-
-    @PostMapping("/exportExcelUnlock")
-    @PassToken
-    public void exportExcelUnlock(HttpServletResponse response, @RequestBody SelectUnlockParam param) {
-        server.exportExcelUnlock(response, param);
-    }
-
-    @PostMapping("/reviewMedicalRecordsToUnlock")
-    public ResultVo<String> reviewMedicalRecordsToUnlock(@RequestBody EmrLimitUnlock param) {
-        return server.reviewMedicalRecordsToUnlock(param);
-    }
-
-    @GetMapping("/getMyUnlockByPatNo")
-    @PassToken
-    public ResultVo<EmrLimitUnlock> getMyUnlockByPatNo(@RequestParam("patNo") String patNo,
-                                                       @RequestParam("times") Integer times) {
-        return server.getMyUnlockByPatNo(patNo, times);
-    }
-
-
-    @PostMapping("/terminalPatients")
-    public ResultVo<List<QualityControlAnalysisOfMedicalRecords>> terminalPatients(@RequestBody FinalQuery param) {
-        return serverv2.terminalPatients(param);
-    }
-
-}

+ 13 - 0
src/main/java/thyyxxk/webserver/dao/his/inpatient/PatientDao.java

@@ -336,4 +336,17 @@ public interface PatientDao {
 
     @Update("update zy_actpatient set balance=#{balance} where inpatient_no=#{zyh}")
     void updateZyActPatientBalance(@Param("zyh") String zyh, @Param("balance") String balance);
+
+
+    @Select("select chronic_disease_type " +
+            "from crm_patient_mi " +
+            "where social_no = #{socialNo} ")
+    String getCrmBySocialNo(String socialNo);
+
+
+    @Select("select name " +
+            "from crm_zd_visit_type " +
+            "where code in (${typeList})")
+    List<String> getCrmTypeName(String typeList);
+
 }

+ 0 - 341
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/emr/EmrControlDao.java

@@ -1,341 +0,0 @@
-package thyyxxk.webserver.dao.his.zhuyuanyisheng.emr;
-
-
-import cn.hutool.json.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.Constants;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import org.apache.ibatis.annotations.*;
-import org.apache.poi.ss.formula.functions.Count;
-import thyyxxk.webserver.constants.sidicts.ListType;
-import thyyxxk.webserver.entity.fluorescenceTest.FluorescenceSpecimenResult;
-import thyyxxk.webserver.entity.zhuyuanyisheng.emr.EmrLimitUnlock;
-import thyyxxk.webserver.entity.zhuyuanyisheng.emr.EmrProgressNote;
-import thyyxxk.webserver.entity.zhuyuanyisheng.emrcontrolrule.*;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-public interface EmrControlDao {
-
-    @Select("select count(1) " +
-            "from emr_control_temp_code a, " +
-            "     emr_control_rule b " +
-            "where a.rule_id = b.id " +
-            "  and code = #{code} " +
-            "  and b.type = #{type} ")
-    int getEmrRuleCount(String code, int type);
-
-    @Insert("insert into emr_control_temp_code (code, rule_id) values (#{code},#{id})")
-    void insertControlRule(@Param("id") String id, @Param("code") String code);
-
-
-    @Insert("insert into emr_control_rule (id, type, off_or_on_rule,prompt_statement,name,sql,prescription,superior_doctor_time) " +
-            "values (#{id},#{param.type},#{param.offOrOnRule},#{param.promptStatement},#{param.name}," +
-            "#{param.sql},#{param.prescription},#{param.superiorDoctorTime})")
-    void insertRule(@Param("id") String id, @Param("param") RuleAdd param);
-
-    @Select("select name, id, group_name,sql_sentence " +
-            "from emr_data_maintenance " +
-            "where data_type = 3")
-    List<Map<String, Object>> getAvailableObjects();
-
-    @Select("select sql_sentence " +
-            " from emr_data_maintenance " +
-            " where id = 7")
-    String selectedSpecifyTheTimeOfAdmissionSql();
-
-    @Select("select rtrim(inpatient_no)                                                  as inpatient_no, " +
-            "       admiss_times, " +
-            "       (select rtrim(name) from zd_unit_code where code = zk_ward)          as deptName, " +
-            "       (select rtrim(name) from a_employee_mi where code = refer_physician) as tubeBedDoctorName, " +
-            "       admiss_date," +
-            "       rtrim(name) as name " +
-            "from zy_actpatient " +
-            "where ${condition} ")
-    List<QualityControlAnalysisOfMedicalRecords> selectedPatientsAdmittedAtTheSpecifiedTime(String condition);
-
-
-    @Select("select id, " +
-            "       type, " +
-            "       off_or_on_rule, " +
-            "       prompt_statement, " +
-            "       name, " +
-            "       sql, " +
-            "       prescription," +
-            "       superior_doctor_time " +
-            "from emr_control_rule ")
-    List<EmrRule> selectRules();
-
-    @Select("select id, " +
-            "       type, " +
-            "       off_or_on_rule, " +
-            "       prompt_statement, " +
-            "       name, " +
-            "       sql, " +
-            "       prescription " +
-            "from emr_control_rule " +
-            "where off_or_on_rule = 1")
-    List<EmrRule> selectRulesOpen();
-
-    @Select("select code " +
-            "from emr_control_temp_code " +
-            "where rule_id = #{id} ")
-    List<String> selectedEmrCode(String id);
-
-    @Select("${sql}")
-    Map<String, Object> executeSql(String sql);
-
-    @Select("${sql}")
-    Date executeSqlDate(String sql);
-
-    @Select("${sql}")
-    List<Date> executeSqlList(String sql);
-
-    /**
-     * 医嘱下达后是否创建了指定的片段
-     *
-     * @return
-     */
-    @Select("select count(1) from emr_progress_note where document_id = #{id} and creation_time > #{start} and creation_time <= #{end} ")
-    Integer theDoctorOrdersWhetherToCreateFragments(Integer id, Date start, Date end);
-
-    @Select("select id, " +
-            "       document_id, " +
-            "       name, " +
-            "       create_id, " +
-            "       creation_time, " +
-            "       refer_physician, " +
-            "       consult_physician, " +
-            "       dept_director " +
-            "from emr_progress_note " +
-            "where document_id = (select top 1 id " +
-            "                     from emr_patient_data " +
-            "                     where pat_no = #{patNo} " +
-            "                       and times = #{times} " +
-            "                       and del_flag = 0 " +
-            "                       and emr_category_code = 'shoucibingchengjilu')" +
-            " order by creation_time ")
-    List<EmrProgressNote> fragmentInterval(String patNo, Integer times);
-
-    @Select("select top 1 order_time " +
-            "from yz_act_order " +
-            "where inpatient_no = #{patNo} " +
-            "  and admiss_times = #{times} " +
-            "  and status_flag in ('3', '4') " +
-            "  and order_code in (select order_code from yz_zd_order_item_confirm where item_name = N'${name}')")
-    Date whetherThereIsASeriousIllnessDoctorSOrder(String patNo, Integer times, String name);
-
-
-    @Select("<script>" +
-            "select count(1) " +
-            "from emr_patient_data " +
-            "where pat_no = #{patNo} " +
-            "  and times = #{times} " +
-            "  and create_date &gt;= #{date} " +
-            "  and emr_category_code in " +
-            "<foreach collection='codeList' item='item'  open='(' close=')' separator=','>" +
-            "#{item}" +
-            "</foreach>" +
-            "</script>")
-    int determineWhetherTheDataWasCreated(String patNo,
-                                          Integer times,
-                                          Date date,
-                                          List<String> codeList);
-
-    @Select("select rtrim(code_rs) " +
-            "from dj_user_role a, " +
-            "     a_employee_mi b " +
-            "where role_id = 38 " +
-            "  and a.user_code = b.code " +
-            "  and isnull(b.del_flag, 0) = 0")
-    List<String> peopleWhoGetMedicalDepartment();
-
-    @Update("update emr_control_rule set off_or_on_rule = #{offOn} where id = #{id} ")
-    int switchQualityControl(String id, Integer offOn);
-
-    @Delete("delete emr_control_rule where id = #{id};" +
-            "delete emr_control_temp_code where rule_id = #{id} ")
-    void deleteRuleById(String id);
-
-    @Select("select code from emr_control_temp_code where rule_id = #{id}")
-    List<String> selectEmrCodeByRuleId(String id);
-
-    @Update("update emr_data_maintenance " +
-            "set sql_sentence = #{date} " +
-            "where id = 7")
-    void setTheTime(String date);
-
-
-    @Select("select sql_sentence " +
-            "from emr_data_maintenance where id = 7 ")
-    String getAdmissDate();
-
-
-    @Select("select id, " +
-            "       type, " +
-            "       off_or_on_rule, " +
-            "       prompt_statement, " +
-            "       name, " +
-            "       sql, " +
-            "       prescription, " +
-            "       superior_doctor_time, " +
-            "       code, " +
-            "       rule_id " +
-            "from emr_control_rule a, " +
-            "     emr_control_temp_code b " +
-            "where a.id = b.rule_id " +
-            "  and b.code = #{code}" +
-            "  and off_or_on_rule = 1 ")
-    List<EmrRule> selectRuleByEmrCode(String code);
-
-    @Insert("insert into emr_rule_unlock (pat_no, times, emr_id, code, " +
-            "date,input_id,input_remark,emr_name) " +
-            " values " +
-            " (#{patNo},#{times},#{id},#{code},#{date},#{inputId},#{remarks},#{name})")
-    void insertRemoveRestrictions(RemoveRestrictions data);
-
-    @Select("select top 1 id, " +
-            "       pat_no, " +
-            "       times, " +
-            "       emr_id, " +
-            "       code, " +
-            "       date, " +
-            "       input_id, " +
-            "       input_remark, " +
-            "       reviewed_by, " +
-            "       review_notes, " +
-            "       flag " +
-            "from emr_rule_unlock " +
-            "where pat_no = #{patNo} " +
-            "  and times = #{times} " +
-            "  and ${sql} " +
-            "  and date >= convert(varchar(10), getdate(), 120)" +
-            "  and flag = 1" +
-            "  and input_id = #{inputId} " +
-            "order by date desc ")
-    EmrRuleUnlock selectRemoveRestrictions(String patNo,
-                                           Integer times,
-                                           String sql,
-                                           String inputId);
-
-
-    @Select("select id, " +
-            "       pat_no, " +
-            "       times, " +
-            "       emr_id, " +
-            "       code, " +
-            "       date, " +
-            "       input_id, " +
-            "       input_name    = (select rtrim(name) from a_employee_mi where input_id = code), " +
-            "       input_remark, " +
-            "       reviewed_by, " +
-            "       reviewed_name = (select rtrim(name) from a_employee_mi where reviewed_by = code), " +
-            "       review_notes, " +
-            "       flag," +
-            "       emr_name," +
-            "       input_date," +
-            "       review_time " +
-            "from emr_rule_unlock ${ew.customSqlSegment} ")
-    List<EmrRuleUnlock> selectRuleUnlock(@Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper);
-
-    @Select("select count(1) " +
-            "from emr_rule_unlock " +
-            "where id = #{id} " +
-            "  and flag = 0 ")
-    int selectRuleUnlockById(Integer id);
-
-    @Update(" update emr_rule_unlock " +
-            " set " +
-            " flag = #{flag}," +
-            " reviewed_by = #{reviewedBy}," +
-            " review_notes = #{reviewNotes}," +
-            " review_time = getdate() " +
-            " where id = #{id}")
-    void updateUnlockById(EmrRuleUnlock param);
-
-    @Update("update emr_limit_unlock " +
-            "set state = 3 " +
-            "where pat_no = #{param.patNo} " +
-            "  and times = #{param.times} " +
-            "  and applicant = #{param.applicant} " +
-            "  and effective_time >= getdate()")
-    int updateUnlockOld(@Param("param") EmrLimitUnlock param);
-
-    @Insert("insert into emr_limit_unlock (pat_no, times, unlock_json, applicant, application_time, request_remarks, " +
-            "                              effective_time, state) " +
-            "values (#{param.patNo}, #{param.times},#{param.unlockJson},#{param.applicant},getdate(), #{param.requestRemarks}," +
-            "#{param.effectiveTime},0)")
-    int applicationUnlock(@Param("param") EmrLimitUnlock param);
-
-    @Select("select id, " +
-            "       pat_no, " +
-            "       times, " +
-            "       unlock_json, " +
-            "       applicant," +
-            "applicantName =    (select rtrim(name) from a_employee_mi where code = applicant), " +
-            "       application_time, " +
-            "       request_remarks, " +
-            "       approve," +
-            "approveName   =    (select rtrim(name) from a_employee_mi where code = approve), " +
-            "       review_time, " +
-            "       review_notes, " +
-            "       effective_time, " +
-            "       state " +
-            "from emr_limit_unlock " +
-            "${ew.customSqlSegment}")
-    IPage<EmrLimitUnlock> selectUnlock(IPage<EmrLimitUnlock> page,
-                                       @Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper);
-
-    @Select("select id, " +
-            "       pat_no, " +
-            "       times, " +
-            "       unlock_json, " +
-            "       applicant," +
-            "applicantName =    (select rtrim(name) from a_employee_mi where code = applicant), " +
-            "       application_time, " +
-            "       request_remarks, " +
-            "       approve," +
-            "approveName   =    (select rtrim(name) from a_employee_mi where code = approve), " +
-            "       review_time, " +
-            "       review_notes, " +
-            "       effective_time, " +
-            "       state " +
-            "from emr_limit_unlock  where id = #{id} ")
-    EmrLimitUnlock selectUnlockById(int id);
-
-
-    @Update("update emr_limit_unlock " +
-            "set state       = #{param.state}, " +
-            "    approve     = #{param.approve}, " +
-            "    review_time = getdate(), " +
-            "    review_notes= #{param.reviewNotes} " +
-            "where id = #{param.id} ")
-    void updateUnlockByIdNew(@Param("param") EmrLimitUnlock param);
-
-    @Select("select id,  " +
-            "       pat_no,  " +
-            "       times,  " +
-            "       unlock_json,  " +
-            "       applicant,  " +
-            "       application_time,  " +
-            "       request_remarks,  " +
-            "       approve,  " +
-            "       review_time,  " +
-            "       review_notes,  " +
-            "       effective_time,  " +
-            "       state  " +
-            "from emr_limit_unlock  " +
-            "where pat_no = #{patNo}  " +
-            "  and times = #{times}  " +
-            "  and applicant = #{applicant}" +
-            "  and state = 1  " +
-            "  and effective_time > getdate()")
-    EmrLimitUnlock selectMyUnlockReqByPatNo(String patNo,
-                                            Integer times,
-                                            String applicant);
-
-
-}

+ 2 - 0
src/main/java/thyyxxk/webserver/entity/inpatient/patient/Patient.java

@@ -194,6 +194,8 @@ public class Patient {
 
     private Integer finalControl;
 
+    private String crmName;
+
     public String getSexName() {
         if (sex == null) {
             return "";

+ 17 - 1
src/main/java/thyyxxk/webserver/service/inpatient/PatientService.java

@@ -1,10 +1,13 @@
 package thyyxxk.webserver.service.inpatient;
 
+import cn.hutool.core.util.ArrayUtil;
+import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
+import org.jetbrains.annotations.Contract;
 import org.jetbrains.annotations.NotNull;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -33,6 +36,7 @@ import thyyxxk.webserver.utils.*;
 
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @author dj
@@ -248,7 +252,7 @@ public class PatientService {
                 log.error("设置出生日期出错");
             }
         }
-
+        data.setCrmName(getCrm(data.getSocialNo()));
         try {
             // 年龄
             data.setAge(DateUtil.calculateAge(new SimpleDateFormat("yyyy-MM-dd").parse(data.getBirthDate()), data.getAdmissDate()));
@@ -258,6 +262,18 @@ public class PatientService {
 
     }
 
+    private @NotNull String getCrm(String socialNo) {
+        String type = dao.getCrmBySocialNo(socialNo);
+        if (StringUtil.isBlank(type)) {
+            return "";
+        }
+        List<String> typeList = dao.getCrmTypeName(type);
+        if (ListUtil.isBlank(typeList)) {
+            return "";
+        }
+        return String.join(",", typeList);
+    }
+
     private String getBirthdayFromSocialNo(String socialNo) {
         String birth = socialNo.substring(6, 14);
         String year = birth.substring(0, 4);

+ 0 - 2
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/YiZhuLuRuServer.java

@@ -105,9 +105,7 @@ public class YiZhuLuRuServer {
         if (ListUtil.isBlank(yiZhuList)) {
             return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "该患者还没有开医嘱。");
         }
-
         List<XinZhenYzActOrder> list = getOrderList(yiZhuList);
-
         return ResultVoUtil.success(list);
     }
 

+ 0 - 217
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/emr/EmrControlRuleSever.java

@@ -1,217 +0,0 @@
-package thyyxxk.webserver.service.zhuyuanyisheng.emr;
-
-import com.alibaba.fastjson.JSON;
-import com.baomidou.dynamic.datasource.annotation.DS;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import lombok.extern.slf4j.Slf4j;
-import org.jetbrains.annotations.NotNull;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import thyyxxk.webserver.config.auth.PassToken;
-import thyyxxk.webserver.config.exception.BizException;
-import thyyxxk.webserver.config.exception.ExceptionEnum;
-import thyyxxk.webserver.dao.his.zhuyuanyisheng.emr.EmrControlDao;
-import thyyxxk.webserver.entity.ResultVo;
-import thyyxxk.webserver.entity.zhuyuanyisheng.emr.EmrLimitUnlock;
-import thyyxxk.webserver.entity.zhuyuanyisheng.emrcontrolrule.*;
-import thyyxxk.webserver.utils.*;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.*;
-
-/**
- * @author Administrator
- */
-@Service
-@Slf4j
-public class EmrControlRuleSever {
-
-    private final EmrControlDao dao;
-
-    public EmrControlRuleSever(EmrControlDao dao) {
-        this.dao = dao;
-    }
-
-
-    public ResultVo<List<Map<String, Object>>> getAvailableObjects() {
-        return ResultVoUtil.success(dao.getAvailableObjects());
-    }
-
-    public List<EmrRule> getRuleList() {
-        List<EmrRule> list = dao.selectRules();
-        if (ListUtil.isBlank(list)) {
-            return new ArrayList<>();
-        }
-        list.forEach(item -> {
-            item.setMedicalRecordCode(dao.selectEmrCodeByRuleId(item.getId()));
-        });
-        return list;
-    }
-
-    public ResultVo<String> switchQualityControl(String id, Integer offOn) {
-        int num = dao.switchQualityControl(id, offOn);
-        if (num > 0) {
-            return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
-        }
-        return ResultVoUtil.success();
-    }
-
-    public ResultVo<String> deleteRuleById(String id) {
-        dao.deleteRuleById(id);
-        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
-    }
-
-    /**
-     * 修改入院质控时间
-     *
-     * @param date 时间
-     * @return 提示
-     */
-    public ResultVo<String> modifyTheAdmissionQualityControlTime(String date) {
-        dao.setTheTime(date);
-        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
-    }
-
-    public ResultVo<String> getAdmissDate() {
-        return ResultVoUtil.success(dao.getAdmissDate());
-    }
-
-
-    /**
-     * 创建病历的限制
-     *
-     * @param code        病历编码
-     * @param patNo       住院号
-     * @param times       住院次数
-     * @param doctorLevel 医生等级
-     * @param id          病历id
-     * @return 返回提示
-     */
-    public ResultVo<EmrRuleVerify> createRestrictions(String code, String patNo, Integer times, Integer doctorLevel, String id) {
-        log.info("病历编码:{},住院号:{},住院次数:{}", code, patNo, times);
-        EmrRuleVerify ruleVerify = new EmrRuleVerify();
-        // 获取质控的list
-        List<EmrRule> ruleList = dao.selectRuleByEmrCode(code);
-        // 如果质控的list为空就可以创建
-        if (ListUtil.isBlank(ruleList)) {
-            ruleVerify.setFlag(false);
-            return ResultVoUtil.success(ruleVerify);
-        }
-        for (EmrRule item : ruleList) {
-            String sql = item.getSql().replace("${PATNO}", "'" + patNo + "'")
-                    .replace("${TIMES}", "'" + times + "'");
-            Map<String, Object> executeSql = dao.executeSql(sql);
-            if (executeSql == null) {
-                continue;
-            }
-            boolean whetherToTimeOut = false;
-            if (doctorLevel == 1) {
-                whetherToTimeOut = DateUtil.moreThanHours((Date) executeSql.get("date"), item.getPrescription());
-                ruleVerify.setFlag(whetherToTimeOut);
-            }
-            if (doctorLevel > 1) {
-                whetherToTimeOut = DateUtil.moreThanHours((Date) executeSql.get("date"), item.getSuperiorDoctorTime());
-            }
-            ruleVerify.setFlag(whetherToTimeOut);
-            ruleVerify.setMessage(item.getPromptStatement());
-            break;
-        }
-
-        log.info("ruleList:{}", JSON.toJSONString(ruleList));
-        return ResultVoUtil.success(ruleVerify);
-    }
-
-
-    @Transactional(rollbackFor = Exception.class)
-    public ResultVo<String> requestToUnlockMedicalRecords(EmrLimitUnlock param) {
-        param.setApplicant(TokenUtil.getInstance().getTokenUserId());
-        param.setApplicationTime(new Date());
-        log.info("数据:{}", JSON.toJSONString(param));
-
-        // 把原来地申请取消
-        int count = dao.updateUnlockOld(param);
-        String str = "申请成功,等待医务部审核。";
-        if (count > 0) {
-            str = "原申请已顶替,申请成功,等待医务部审核。";
-        }
-        int insert = dao.applicationUnlock(param);
-        if (insert == 0) {
-            throw new BizException(ExceptionEnum.ERROR_MESSAGE, "申请错误。");
-        }
-        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, str);
-    }
-
-
-    public ResultVo<IPage<EmrLimitUnlock>> getApplicationData(SelectUnlockParam param) {
-        IPage<EmrLimitUnlock> iPage = new Page<>(param.getCurrentPage(), param.getPageSize(), param.getTotal() == 0);
-        QueryWrapper<EmrLimitUnlock> qw = getEmrLimitUnlockQueryWrapper(param);
-        iPage.setTotal(param.getTotal());
-        return ResultVoUtil.success(dao.selectUnlock(iPage, qw));
-    }
-
-    @NotNull
-    private static QueryWrapper<EmrLimitUnlock> getEmrLimitUnlockQueryWrapper(SelectUnlockParam param) {
-        QueryWrapper<EmrLimitUnlock> qw = new QueryWrapper<>();
-        if (ListUtil.notBlank(param.getDateRange())) {
-            qw.ge("application_time", param.getDateRange().get(0));
-            qw.lt("application_time", param.getDateRange().get(1));
-        }
-        if (param.getFlag() > -1) {
-            qw.eq("state", param.getFlag());
-        }
-        return qw;
-    }
-
-    public void exportExcelUnlock(HttpServletResponse response, SelectUnlockParam param) {
-        IPage<EmrLimitUnlock> iPage = new Page<>(param.getCurrentPage(), -1, false);
-        QueryWrapper<EmrLimitUnlock> qw = getEmrLimitUnlockQueryWrapper(param);
-        iPage = dao.selectUnlock(iPage, qw);
-        if (ListUtil.isBlank(iPage.getRecords())) {
-            return;
-        }
-
-        String[] title = {"住院号", "住院次数", "申请人", "申请时间", "申请权限", "申请编辑时间", "申请备注", "状态", "审核人", "审核时间", "审核备注"};
-        String[][] content = new String[iPage.getRecords().size()][];
-        for (int i = 0; i < iPage.getRecords().size(); i++) {
-            content[i] = new String[title.length];
-            EmrLimitUnlock index = iPage.getRecords().get(i);
-            content[i][0] = index.getPatNo();
-            content[i][1] = String.valueOf(index.getTimes());
-            content[i][2] = index.getApplicantName();
-            content[i][3] = DateUtil.formatDatetime(index.getApplicationTime());
-            content[i][4] = index.getUnlockJson();
-            content[i][5] = DateUtil.formatDatetime(index.getEffectiveTime());
-            content[i][6] = index.getRequestRemarks();
-            content[i][7] = index.getStateName();
-            content[i][8] = index.getApproveName();
-            content[i][9] = DateUtil.formatDatetime(index.getReviewTime());
-            content[i][10] = index.getReviewNotes();
-        }
-        ExcelUtil.exportExcel(response, title, content);
-        log.info("数据:{}", JSON.toJSONString(iPage));
-    }
-
-    public ResultVo<String> reviewMedicalRecordsToUnlock(EmrLimitUnlock param) {
-        EmrLimitUnlock emrLimitUnlock = dao.selectUnlockById(param.getId());
-        if (emrLimitUnlock.getState().equals(3)) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该数据已经被申请人删除了,无法审核。");
-        }
-        if (emrLimitUnlock.getState().equals(param.getState())) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请勿重复操作。");
-        }
-        param.setApprove(TokenUtil.getInstance().getTokenUserId());
-        dao.updateUnlockByIdNew(param);
-        log.info("电子病历质控审核:{}", JSON.toJSONString(param));
-        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
-    }
-
-    public ResultVo<EmrLimitUnlock> getMyUnlockByPatNo(String patNo, Integer times) {
-        return ResultVoUtil.success(dao.selectMyUnlockReqByPatNo(patNo, times, TokenUtil.getInstance().getTokenUserId()));
-    }
-
-
-
-
-}