Browse Source

互联网医院挂号的线下处方支持互联网缴费

hurugang 3 years ago
parent
commit
82f0bf9c92

+ 22 - 8
src/main/java/cn/hnthyy/thmz/controller/api/MedicalViewApiController.java

@@ -507,7 +507,7 @@ public class MedicalViewApiController {
         WhiteList whiteList=whiteListService.queryByIpAddress(ip);
         if(whiteList==null){
             results.put("resultCode", -1);
-            results.put("message", "当前请求来源未在白名单中【"+ip+"】");
+            results.put("resultMessage", "当前请求来源未在白名单中【"+ip+"】");
             return results;
         }
         if (haicipat == null) {
@@ -678,7 +678,7 @@ public class MedicalViewApiController {
         WhiteList whiteList=whiteListService.queryByIpAddress(ip);
         if(whiteList==null){
             results.put("resultCode", -1);
-            results.put("message", "当前请求来源未在白名单中【"+ip+"】");
+            results.put("resultMessage", "当前请求来源未在白名单中【"+ip+"】");
             return results;
         }
         if (haiciCharge == null) {
@@ -924,7 +924,7 @@ public class MedicalViewApiController {
         WhiteList whiteList=whiteListService.queryByIpAddress(ip);
         if(whiteList==null){
             results.put("resultCode", -1);
-            results.put("message", "当前请求来源未在白名单中【"+ip+"】");
+            results.put("resultMessage", "当前请求来源未在白名单中【"+ip+"】");
             return results;
         }
         if (mzDepositFile == null) {
@@ -1071,7 +1071,7 @@ public class MedicalViewApiController {
             WhiteList whiteList=whiteListService.queryByIpAddress(ip);
             if(whiteList==null){
                 results.put("resultCode", -1);
-                results.put("message", "当前请求来源未在白名单中【"+ip+"】");
+                results.put("resultMessage", "当前请求来源未在白名单中【"+ip+"】");
                 return results;
             }
             mzPrescriptionVo.setJzFlag(YesNoEnum.NO.code);
@@ -1114,15 +1114,22 @@ public class MedicalViewApiController {
      * @return
      */
     @RequestMapping(value = "/nucleicAcidApplication", method = {RequestMethod.GET})
-    public Map<String, Object> nucleicAcidApplication(@RequestParam("patientId") String patientId) {
+    public Map<String, Object> nucleicAcidApplication(@RequestParam("patientId") String patientId, HttpServletRequest httpServletRequest) {
         Map<String, Object> results = new HashMap<>();
         try {
+            String ip=HttpUtil.getIPAddress(httpServletRequest);
+            WhiteList whiteList=whiteListService.queryByIpAddress(ip);
+            if(whiteList==null){
+                results.put("resultCode", -1);
+                results.put("resultMessage", "当前请求来源未在白名单中【"+ip+"】");
+                return results;
+            }
             if (StringUtils.isBlank(patientId)) {
                 results.put("resultCode", -1);
                 results.put("resultMessage", "患者ID不能为空");
                 return results;
             }
-            Clinic clinic = mzChargeDetailService.nucleicAcidApplication(patientId);
+            Clinic clinic = mzChargeDetailService.nucleicAcidApplication(patientId,whiteList.getOpId());
             if (clinic != null && clinic.getId() != null) {
                 results.put("resultCode", 0);
                 results.put("resultMessage", "核酸申请(单人单管)保存成功");
@@ -1153,15 +1160,22 @@ public class MedicalViewApiController {
      * @return
      */
     @RequestMapping(value = "/hybridTestApplication", method = {RequestMethod.GET})
-    public Map<String, Object> hybridTestApplication(@RequestParam("patientId") String patientId) {
+    public Map<String, Object> hybridTestApplication(@RequestParam("patientId") String patientId, HttpServletRequest httpServletRequest) {
         Map<String, Object> results = new HashMap<>();
         try {
+            String ip=HttpUtil.getIPAddress(httpServletRequest);
+            WhiteList whiteList=whiteListService.queryByIpAddress(ip);
+            if(whiteList==null){
+                results.put("resultCode", -1);
+                results.put("resultMessage", "当前请求来源未在白名单中【"+ip+"】");
+                return results;
+            }
             if (StringUtils.isBlank(patientId)) {
                 results.put("resultCode", -1);
                 results.put("resultMessage", "患者ID不能为空");
                 return results;
             }
-            Clinic clinic = mzChargeDetailService.hybridTestApplication(patientId);
+            Clinic clinic = mzChargeDetailService.hybridTestApplication(patientId,whiteList.getOpId());
             if (clinic != null && clinic.getId() != null) {
                 results.put("resultCode", 0);
                 results.put("resultMessage", "核酸申请(混检)保存成功");

+ 1 - 1
src/main/java/cn/hnthyy/thmz/controller/mz/ClinicController.java

@@ -794,7 +794,7 @@ public class ClinicController {
             Clinic clinic = new Clinic();
             clinic.setBeginDate(DateUtil.fomart(beginTime, "yyyy-MM-dd HH:mm:ss"));
             clinic.setEndDate(DateUtil.fomart(endTime, "yyyy-MM-dd HH:mm:ss"));
-            clinic.setOpId(tokenUser.getUserIdCode());
+            clinic.setDoctorCode(tokenUser.getUserIdCode());
             resultMap.put("numberOfPatient", clinicService.queryNumberOfPatient(clinic));
             resultMap.put("numberOfPrescription", clinicService.queryNumberOfPrescription(clinic));
             resultMap.put("numberOfIcdText", clinicService.queryNumberOfIcdText(clinic));

+ 2 - 2
src/main/java/cn/hnthyy/thmz/controller/mz/MzChargeDetailController.java

@@ -1403,7 +1403,7 @@ public class MzChargeDetailController {
                 results.put("message", "患者ID不能为空");
                 return results;
             }
-            Clinic clinic = mzChargeDetailService.nucleicAcidApplication(patientId);
+            Clinic clinic = mzChargeDetailService.nucleicAcidApplication(patientId,Constants.BRZZJF_CODE);
             if (clinic != null && clinic.getId() != null) {
                 results.put("code", 0);
                 results.put("message", "核酸申请保存成功");
@@ -1442,7 +1442,7 @@ public class MzChargeDetailController {
                 results.put("message", "患者ID不能为空");
                 return results;
             }
-            Clinic clinic = mzChargeDetailService.hybridTestApplication(patientId);
+            Clinic clinic = mzChargeDetailService.hybridTestApplication(patientId,Constants.BRZZJF_CODE);
             if (clinic != null && clinic.getId() != null) {
                 results.put("code", 0);
                 results.put("message", "核酸申请保存成功");

+ 4 - 4
src/main/java/cn/hnthyy/thmz/enums/ClinicStatusEnum.java

@@ -13,10 +13,10 @@ public enum ClinicStatusEnum {
     REGISTRATION_TO_CLINIC(1,"挂号已接诊"),
     //退号 挂号表数据
     BACK_REGISTRATION(2,"已退号"),
-    //暂无  可能无用
-    UN_CLINIC(3,"候诊"),
-    //新增状态,医生接诊中状态  可能无用
-    IN_CLINIC(4,"接诊中"),
+//    //暂无  可能无用
+//    UN_CLINIC(3,"候诊"),
+//    //新增状态,医生接诊中状态  可能无用
+//    IN_CLINIC(4,"接诊中"),
     HAD_CLINIC(5,"已接诊未缴费"),
     CHARGED(6,"已缴费"),
     REFUND(7,"已退费");

+ 2 - 2
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzZdWorkTimeMapper.java

@@ -11,7 +11,7 @@ public interface MzZdWorkTimeMapper {
      * 查询所有在使用中的时间区间
      * @return
      */
-    @Select("select code,rtrim(name) name,rtrim(start_time) start_time,rtrim(end_time) end_time,del_flag from mz_zd_work_time WITH(NOLOCK) where del_flag =0 order by code")
+    @Select("select rtrim(code) code,rtrim(name) name,rtrim(start_time) start_time,rtrim(end_time) end_time,del_flag from mz_zd_work_time WITH(NOLOCK) where del_flag =0 order by code")
     List<MzZdWorkTime> selectAllMzZdWorkTime();
 
     /**
@@ -19,7 +19,7 @@ public interface MzZdWorkTimeMapper {
      * @param code
      * @return
      */
-    @Select("select code,rtrim(name) name,rtrim(start_time) start_time,rtrim(end_time) end_time,del_flag from mz_zd_work_time WITH(NOLOCK) where code =#{code} and del_flag =0 order by code")
+    @Select("select rtrim(code) code,rtrim(name) name,rtrim(start_time) start_time,rtrim(end_time) end_time,del_flag from mz_zd_work_time WITH(NOLOCK) where code =#{code} and del_flag =0 order by code")
     MzZdWorkTime selectMzZdWorkTimeByCode(@Param("code")String code);
 
 }

+ 9 - 6
src/main/java/cn/hnthyy/thmz/mapper/thmz/ClinicMapper.java

@@ -118,6 +118,9 @@ public interface ClinicMapper {
     List<Clinic> selectByPatientIdAndTimes(@Param("patientId") String patientId, @Param("times") Integer times);
 
 
+
+
+
     /**
      * 查询符合条件的总数
      *
@@ -172,7 +175,7 @@ public interface ClinicMapper {
      */
     @Select("select sum(a.num) " +
             "from (" +
-            "select count(patient_id) num from t_clinic where  op_day>=#{beginDate} and op_day<=#{endDate} and op_id=#{opId}  and clinic_status in(4,5,6) GROUP BY patient_id) a")
+            "select count(patient_id) num from t_clinic where  op_day>=#{beginDate} and op_day<=#{endDate} and dept_code=#{doctorCode}  and clinic_status in(4,5,6) GROUP BY patient_id) a")
     Integer selectNumberOfPrescription(Clinic clinic);
 
     /**
@@ -181,7 +184,7 @@ public interface ClinicMapper {
      */
     @Select("select count(a.patient_id)  " +
             "from (" +
-            "select patient_id from t_clinic where  op_day>=#{beginDate} and op_day<=#{endDate} and op_id=#{opId}  and clinic_status in(4,5,6) GROUP BY patient_id) a")
+            "select patient_id from t_clinic where  op_day>=#{beginDate} and op_day<=#{endDate} and dept_code=#{doctorCode}  and clinic_status in(4,5,6) GROUP BY patient_id) a")
     Integer selectNumberOfPatient(Clinic clinic);
 
 
@@ -189,7 +192,7 @@ public interface ClinicMapper {
      * 查询医生的诊断与数量
      * @return
      */
-    @Select("select icd_text,count(1) num from t_clinic where  op_day>=#{beginDate} and op_day<=#{endDate} and op_id=#{opId}  and clinic_status in(4,5,6) GROUP BY icd_text order by num desc ")
+    @Select("select icd_text,count(1) num from t_clinic where  op_day>=#{beginDate} and op_day<=#{endDate} and dept_code=#{doctorCode}  and clinic_status in(4,5,6) GROUP BY icd_text order by num desc ")
     List<Map<String,Object>> selectNumberOfIcdText(Clinic clinic);
 
 
@@ -225,9 +228,9 @@ public interface ClinicMapper {
             "<when test='clinicStatus!=null'>",
             ",clinic_status =#{clinicStatus}",
             "</when>",
-            "<when test='opId!=null'>",
-            ",op_id =#{opId}",
-            "</when>",
+//            "<when test='opId!=null'>",
+//            ",op_id =#{opId}",
+//            "</when>",
             "<when test='opDay!=null'>",
             ",op_day =#{opDay}",
             "</when>",

+ 2 - 2
src/main/java/cn/hnthyy/thmz/service/his/mz/MzChargeDetailService.java

@@ -307,7 +307,7 @@ public interface MzChargeDetailService {
      * @param patientId
      * @return
      */
-    Clinic nucleicAcidApplication(String patientId) throws MzException;
+    Clinic nucleicAcidApplication(String patientId,String opId) throws MzException;
 
     /**
      * 核酸检测(混检)开处方收费,只收费不生成医技申请
@@ -315,7 +315,7 @@ public interface MzChargeDetailService {
      * @param patientId
      * @return
      */
-    Clinic hybridTestApplication(String patientId) throws MzException;
+    Clinic hybridTestApplication(String patientId,String opId) throws MzException;
 
 
     /**

+ 14 - 5
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzChargeDetailServiceImpl.java

@@ -1122,6 +1122,8 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             updateMzfzPatientOrder.setSerialNo(Integer.valueOf(mzPrescriptionVo.getSerialNo()));
             updateMzfzPatientOrder.setStatusFlag(MzfzStatusEnum.CLINIC.code);
             mzfzPatientOrderMapper.updateMzfzPatientOrder(updateMzfzPatientOrder);
+            MzfzPatientOrder mzfzPatientOrder = mzfzPatientOrderMapper.selectBySerialNo(mzPrescriptionVo.getSerialNo());
+            dbClinic=clinicMapper.selectByPatientIdAndTimesAndReceiptNo(mzfzPatientOrder.getPatientId(),mzfzPatientOrder.getTimes(),0);
         }
         Clinic clinic = new Clinic();
         clinic.setPatientId(mzPatientMi.getPatientId());
@@ -1130,8 +1132,15 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         clinic.setReceiptNo(newMzVisitTable.getReceiptNo());
         clinic.setDeptCode(mzPrescriptionVo.getVisitDeptCode());
         clinic.setDoctorCode(mzPrescriptionVo.getDoctorCode());
+        String opId =mzPrescriptionVo.getDoctorCode();
         //互联网医院处方保存是用互联网收费员名义保存
-        clinic.setOpId(StringUtils.isNotBlank(mzPrescriptionVo.getOpId())?mzPrescriptionVo.getOpId():mzPrescriptionVo.getDoctorCode());
+        if(StringUtils.isNotBlank(mzPrescriptionVo.getOpId())){
+            opId=mzPrescriptionVo.getOpId();
+        }else if(dbClinic!=null && Constants.HLWYY_CODE.equals(dbClinic.getOpId())){
+            //如果是当前患者的号子来源是互联网医院的话,处方都算互联网医院
+            opId=dbClinic.getOpId();
+        }
+        clinic.setOpId(opId);
         clinic.setOpDay(new Date());
         clinic.setIcdCode(realIcdText != null ? mzPrescriptionVo.getIcdCode() : null);
         clinic.setIcdText(realIcdText != null ? mzPrescriptionVo.getIcdText() : mzPrescriptionVo.getMzBlRecord().getTentativeDiagnosis());
@@ -2274,7 +2283,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
 
 
     @Override
-    public Clinic nucleicAcidApplication(String patientId) throws MzException {
+    public Clinic nucleicAcidApplication(String patientId,String opId) throws MzException {
         MzPatientMi mzPatientMi = mzPatientMiMapper.selectByPatientId(patientId);
         if (mzPatientMi == null) {
             throw new MzException("当前挂号的病人信息不存在,请先保存病人信息!");
@@ -2289,7 +2298,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         mzPrescriptionVo.setPatientId(patientId);
         mzPrescriptionVo.setIcdCode("");
         mzPrescriptionVo.setIcdText("申请核酸检测(单人单管)");
-        mzPrescriptionVo.setDoctorCode(Constants.BRZZJF_CODE);
+        mzPrescriptionVo.setDoctorCode(opId);
         mzPrescriptionVo.setVisitDeptCode(Constants.ZZBM);
         mzPrescriptionVo.setJzFlag(YesNoEnum.NO.code);
         mzPrescriptionVo.setFirstOrNot(YesNoEnum.NO.code);
@@ -2323,7 +2332,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
     }
 
     @Override
-    public Clinic hybridTestApplication(String patientId) throws MzException {
+    public Clinic hybridTestApplication(String patientId,String opId) throws MzException {
         MzPatientMi mzPatientMi = mzPatientMiMapper.selectByPatientId(patientId);
         if (mzPatientMi == null) {
             throw new MzException("当前挂号的病人信息不存在,请先保存病人信息!");
@@ -2338,7 +2347,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         mzPrescriptionVo.setPatientId(patientId);
         mzPrescriptionVo.setIcdCode("");
         mzPrescriptionVo.setIcdText("申请核酸检测(混检)");
-        mzPrescriptionVo.setDoctorCode(Constants.BRZZJF_CODE);
+        mzPrescriptionVo.setDoctorCode(opId);
         mzPrescriptionVo.setVisitDeptCode(Constants.ZZBM);
         mzPrescriptionVo.setJzFlag(YesNoEnum.NO.code);
         mzPrescriptionVo.setFirstOrNot(YesNoEnum.NO.code);