浏览代码

住院功能开发

hurugang 5 年之前
父节点
当前提交
f6952eba77

+ 174 - 1
src/main/java/cn/hnthyy/thmz/controller/APatientMiController.java

@@ -4,10 +4,10 @@ import cn.hnthyy.thmz.Utils.IDCardUtil;
 import cn.hnthyy.thmz.Utils.SeedUtil;
 import cn.hnthyy.thmz.Utils.StringUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
+import cn.hnthyy.thmz.entity.his.APatientMi;
 import cn.hnthyy.thmz.entity.his.MzPatientMi;
 import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.service.his.APatientMiService;
-import cn.hnthyy.thmz.service.his.MzPatientMiService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -53,4 +53,177 @@ public class APatientMiController {
         }
     }
 
+
+
+
+//    /**
+//     * 保存住院病人信息
+//     *
+//     * @return
+//     */
+//    @UserLoginToken
+//    @RequestMapping(value = "/saveZyPatient", method = {RequestMethod.POST})
+//    public Map<String, Object> saveZyPatient(@RequestBody APatientMi aPatientMi) {
+//        Map<String, Object> resultMap = new HashMap<>();
+//        try {
+//            if (checkPatient(aPatientMi, resultMap)){
+//                return resultMap;
+//            }
+//            APatientMi aPatientMiDb=aPatientMiService.queryAPatientByMzNo(aPatientMi.getMzNo());
+//            if(aPatientMiDb==null){
+//                if(StringUtils.isBlank(aPatientMiDb.getInpatientNo())){
+//
+//                }
+//               //新增
+//                aPatientMiService
+//            }else {
+//                //修改
+//
+//
+//            }
+//            mzPatientMi.setIcCardNo(mzPatientMi.getIcCardNo().trim());
+//            MzPatientMi dbMzPatientMi=mzPatientMiService.queryByIcCardNo(mzPatientMi.getIcCardNo());
+//            if(dbMzPatientMi!=null){
+//                resultMap.put("code", -1);
+//                resultMap.put("message", "新增病人信息失败,已经存在相同的诊疗卡");
+//                return resultMap;
+//            }
+//            int num=mzPatientMiService.saveMzPatientMi(mzPatientMi);
+//            if(num==1){
+//                resultMap.put("code", 0);
+//                resultMap.put("message", "保存病人信息成功");
+//                resultMap.put("data",mzPatientMi);
+//                return resultMap;
+//            }
+//            resultMap.put("code", -1);
+//            resultMap.put("message", "保存病人信息失败");
+//            return resultMap;
+//        } catch (Exception e) {
+//            if (e instanceof DataIntegrityViolationException){
+//                if(e.getMessage().contains("将截断字符串或二进制数据")){
+//                    resultMap.put("code", -1);
+//                    resultMap.put("message", "病人地址信息超长");
+//                    log.error("系统异常,错误信息{病人地址信息超长}");
+//                    return resultMap;
+//                }
+//            }
+//            e.printStackTrace();
+//            resultMap.put("code", -1);
+//            resultMap.put("message", StringUtils.isBlank(e.getMessage())?"系统出错,请联系管理员":e.getMessage());
+//            log.error("系统异常,错误信息{}", e.getMessage());
+//            return resultMap;
+//        }
+//    }
+
+
+
+
+
+    /**
+     * 校验病人信息
+     * @param aPatientMi
+     * @param resultMap
+     * @return
+     */
+    private boolean checkPatient(@RequestBody APatientMi aPatientMi, Map<String, Object> resultMap) {
+        if (aPatientMi == null) {
+            resultMap.put("code", -1);
+            resultMap.put("message", "病人信息不能为空");
+            return true;
+        }
+        if (StringUtils.isBlank(aPatientMi.getName())) {
+            resultMap.put("code", -1);
+            resultMap.put("message", "病人姓名不能为空");
+            return true;
+        }
+        if (StringUtils.isBlank(aPatientMi.getSex())) {
+            resultMap.put("code", -1);
+            resultMap.put("message", "病人性别不能为空");
+            return true;
+        }
+        if (aPatientMi.getBirthDate() == null) {
+            resultMap.put("code", -1);
+            resultMap.put("message", "病人出生日期不能为空");
+            return true;
+        }
+        if (StringUtils.isBlank(aPatientMi.getMzNo())) {
+            resultMap.put("code", -1);
+            resultMap.put("message", "病人门诊编号不能为空");
+            return true;
+        }
+        if (StringUtils.isBlank(aPatientMi.getHomeTel())) {
+            resultMap.put("code", -1);
+            resultMap.put("message", "病人手机号码不能为空");
+            return true;
+        }
+        if (StringUtils.isBlank(aPatientMi.getMarryCode())) {
+            resultMap.put("code", -1);
+            resultMap.put("message", "病人婚姻状态不能为空");
+            return true;
+        }
+        if (StringUtils.isBlank(aPatientMi.getOccupationCode())) {
+            resultMap.put("code", -1);
+            resultMap.put("message", "病人职业不能为空");
+            return true;
+        }
+        if (StringUtils.isBlank(aPatientMi.getCountry())) {
+            resultMap.put("code", -1);
+            resultMap.put("message", "病人国籍不能为空");
+            return true;
+        }
+        if (StringUtils.isBlank(aPatientMi.getNationCode())) {
+            resultMap.put("code", -1);
+            resultMap.put("message", "病人民族不能为空");
+            return true;
+        }
+        if (StringUtils.isBlank(aPatientMi.getBirthPlace())) {
+            resultMap.put("code", -1);
+            resultMap.put("message", "病人出生地址不能为空");
+            return true;
+        }
+        if (StringUtils.isBlank(aPatientMi.getAccountStreet())) {
+            resultMap.put("code", -1);
+            resultMap.put("message", "病人户口地址不能为空");
+            return true;
+        }
+
+        if (StringUtils.isBlank(aPatientMi.getHomeStreet())) {
+            aPatientMi.setHomeStreet("-");
+        }
+        if (StringUtils.isBlank(aPatientMi.getEmployerStreet())) {
+            aPatientMi.setEmployerStreet("-");
+        }
+        if(StringUtils.isNotBlank(aPatientMi.getSocialNo()) && !aPatientMi.getSocialNo().startsWith("K")){
+            //校验身份证号码格式
+            String checkResult = IDCardUtil.IdentityCardVerification(aPatientMi.getSocialNo());
+            if (StringUtils.isNotBlank(checkResult)) {
+                resultMap.put("code", -1);
+                resultMap.put("message", checkResult);
+                return true;
+            }
+        }
+        //校验手机号码格式
+        String checkResult = StringUtil.isPhone(aPatientMi.getHomeTel());
+        if (StringUtils.isNotBlank(checkResult)) {
+            resultMap.put("code", -1);
+            resultMap.put("message", checkResult);
+            return true;
+        }
+        //如果紧急联系人电话不为空,校验紧急联系电话号码
+        if(StringUtils.isNotBlank(aPatientMi.getRelationTel())){
+            checkResult = StringUtil.isPhone(aPatientMi.getRelationTel());
+            if(StringUtils.isNotBlank(checkResult)){
+                resultMap.put("code", -1);
+                resultMap.put("message", checkResult);
+                return true;
+            }
+        }
+        if (StringUtils.isBlank(aPatientMi.getSocialNo())) {
+            resultMap.put("code", -1);
+            resultMap.put("message", "病人身份证号码不能为空");
+            return true;
+        }
+        return false;
+    }
+
 }

+ 5 - 0
src/main/java/cn/hnthyy/thmz/entity/his/APatientMi.java

@@ -19,9 +19,13 @@ public class APatientMi {
     private String name;
     //出生日期
     private Date birthDate;
+    //婚姻状态
     private String marryCode;
+    //民族
     private String nationCode;
+    //职业
     private String occupationCode;
+    //
     private String vipCode;
     //身份证
     private String socialNo;
@@ -33,6 +37,7 @@ public class APatientMi {
     private String tempTel;
     private String tempZipcode;
     private String employerName;
+    //单位地址
     private String employerStreet;
     private String employerDistrict;
     private String employerTel;

+ 32 - 0
src/main/java/cn/hnthyy/thmz/entity/his/ZyConfig.java

@@ -0,0 +1,32 @@
+package cn.hnthyy.thmz.entity.his;
+
+import lombok.Data;
+
+@Data
+public class ZyConfig {
+    //记录id
+    private Integer itemNo;
+    //住院流水号
+    private Integer zySerialNo;
+    //
+    private Integer delNo;
+    //
+    private Integer modifyNo;
+    //
+    private Integer depositNoType;
+    //
+    private Integer receiptNoType;
+    //
+    private Integer delNo2;
+    //家床号码
+    private Integer jcNo;
+    //
+    private Integer chargeCode;
+    //
+    private Integer fpZyType;
+    //住院号
+    private Integer inpatientNo;
+    //
+    private Integer ybYlh;
+
+}

+ 51 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/ZyConfigMapper.java

@@ -0,0 +1,51 @@
+package cn.hnthyy.thmz.mapper.his;
+
+import cn.hnthyy.thmz.entity.his.ZyConfig;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+
+import java.util.Date;
+
+public interface ZyConfigMapper {
+
+    /**
+     * 加锁
+     * @param updateTime
+     * @return
+     */
+    @Update("update zy_config set update_time=#{updateTime,jdbcType=TIMESTAMP} where item_no = 1")
+    int updateForBlock(@Param("updateTime") Date updateTime);
+
+    /**
+     * 查询住院配置表信息
+     * @return
+     */
+    @Select(" select * from zy_config where item_no = 1")
+    ZyConfig selectZyConfig();
+
+
+    /**
+     * 更新序列号
+     * @param zyConfig
+     * @return
+     */
+    @Update({"<script>",
+            "update zy_config ",
+            "<trim prefix='set' prefixOverrides=',' suffix=' where item_no =1 ' >",
+            "<when test='zySerialNo!=null'>",
+            "zy_serial_no =#{zySerialNo,jdbcType=INTEGER}",
+            "</when>",
+            "<when test='delNo!=null'>",
+            ",del_no =#{delNo,jdbcType=INTEGER}",
+            "</when>",
+            "<when test='jcNo!=null'>",
+            ",jc_no =#{jcNo,jdbcType=INTEGER}",
+            "</when>",
+            "</trim>"
+            ,"</script>"})
+    int updateZyConfig(ZyConfig zyConfig);
+
+
+
+}

+ 19 - 0
src/main/java/cn/hnthyy/thmz/service/his/APatientMiService.java

@@ -30,4 +30,23 @@ public interface APatientMiService {
      * @return
      */
     APatientMi queryAPatientByMzNo(String mzNo);
+
+
+    /**
+     * 保存住院病人信息
+     * @param aPatientMi
+     * @return
+     */
+    int saveMzPatientMi(APatientMi aPatientMi);
+
+
+
+
+
+    /**
+     * 更新病人信息
+     * @param aPatientMi
+     * @return
+     */
+    int modifyMzPatientMi(APatientMi aPatientMi);
 }

+ 18 - 0
src/main/java/cn/hnthyy/thmz/service/his/ZyConfigService.java

@@ -0,0 +1,18 @@
+package cn.hnthyy.thmz.service.his;
+
+import cn.hnthyy.thmz.entity.MzException;
+
+public interface ZyConfigService {
+    /**
+     * 获取住院号
+     * @return
+     */
+    int getInpatientNo() throws MzException;
+
+    /**
+     * 获取家床号
+     * @return
+     */
+    Integer getJcNo() throws MzException;
+
+}

+ 10 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/APatientMiServiceImpl.java

@@ -30,4 +30,14 @@ public class APatientMiServiceImpl implements APatientMiService {
     public APatientMi queryAPatientByMzNo(String mzNo) {
         return aPatientMiMapper.selectAPatientByMzNo(mzNo);
     }
+
+    @Override
+    public int saveMzPatientMi(APatientMi aPatientMi) {
+        return aPatientMiMapper.insertMzPatientMi(aPatientMi);
+    }
+
+    @Override
+    public int modifyMzPatientMi(APatientMi aPatientMi) {
+        return aPatientMiMapper.updateMzPatientMi(aPatientMi);
+    }
 }

+ 46 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/ZyConfigServiceImpl.java

@@ -0,0 +1,46 @@
+package cn.hnthyy.thmz.service.impl.his;
+
+import cn.hnthyy.thmz.entity.MzException;
+import cn.hnthyy.thmz.entity.his.ZyConfig;
+import cn.hnthyy.thmz.mapper.his.ZyConfigMapper;
+import cn.hnthyy.thmz.service.his.ZyConfigService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+
+@Service
+public class ZyConfigServiceImpl implements ZyConfigService {
+    @SuppressWarnings("all")
+    @Autowired
+    private ZyConfigMapper zyConfigMapper;
+    @Override
+    public int getInpatientNo() throws MzException {
+        zyConfigMapper.updateForBlock(new Date());
+        ZyConfig zyConfig = zyConfigMapper.selectZyConfig();
+        if (zyConfig == null) {
+            throw new MzException("住院序列号生成器不存在,请先设置!");
+        }
+        zyConfig.setInpatientNo(zyConfig.getInpatientNo() + 1);
+        int num = zyConfigMapper.updateZyConfig(zyConfig);
+        if (num == 0) {
+            throw new MzException("获取住院号失败,请重试!");
+        }
+        return zyConfig.getInpatientNo();
+    }
+
+    @Override
+    public Integer getJcNo() throws MzException {
+        zyConfigMapper.updateForBlock(new Date());
+        ZyConfig zyConfig = zyConfigMapper.selectZyConfig();
+        if (zyConfig == null) {
+            throw new MzException("住院序列号生成器不存在,请先设置!");
+        }
+        zyConfig.setJcNo(zyConfig.getJcNo() + 1);
+        int num = zyConfigMapper.updateZyConfig(zyConfig);
+        if (num == 0) {
+            throw new MzException("获取家床号失败,请重试!");
+        }
+        return zyConfig.getJcNo();
+    }
+}

+ 4 - 4
src/main/resources/static/js/hospitalized.js

@@ -1139,12 +1139,12 @@ function initCountrySelect() {
             }
             var html = '';
             $.each(res.data, function (commentIndex, comment) {
-                html += '<option value="' + comment.name + '">' + comment.name + '</option>';
+                html += '<option value="' + comment.code + '">' + comment.name + '</option>';
             });
             $('#nationality').empty();
             $('#nationality').html(html);
             $('#nationality').selectpicker('destroy').selectpicker('refresh');
-            $('#nationality').selectpicker('val','中国');
+            $('#nationality').selectpicker('val','cn');
             $('#nationality').selectpicker('refresh');
 
         }
@@ -1169,12 +1169,12 @@ function initNationSelect() {
             }
             var html = '';
             $.each(res.data, function (commentIndex, comment) {
-                html += '<option value="' + comment.name + '">' + comment.name + '</option>';
+                html += '<option value="' + comment.code + '">' + comment.name + '</option>';
             });
             $('#nation').empty();
             $('#nation').html(html);
             $('#nation').selectpicker('destroy').selectpicker('refresh');
-            $('#nation').selectpicker('val','汉族');
+            $('#nation').selectpicker('val','HA');
             $('#nation').selectpicker('refresh');
         }
     });