Browse Source

修改随访表单

bzd_wsp 2 months ago
parent
commit
a971518779

+ 24 - 12
health-admin/src/main/java/com/bzd/web/controller/gxhpz/FollowTaskController.java

@@ -200,7 +200,8 @@ public class FollowTaskController extends BaseController {
             pd1 = pharmaceuticalService.selectPatientById(pd2);//查询患者信息
             if(StringUtils.isNotNull(Plan1)){
 
-                pdt1.put("planId_cg", Plan1.get("id"));
+                pdt1.put("planId", Plan1.get("planId"));
+                pd1.put("planId_cg", Plan1.get("planId"));
                 pd1.put("Plan1",Plan1);//常规随访的 类型的计划
                 pd1.put("follow_up_person",Plan1.get("follow_up_person"));
                 pd1.put("productName",Plan1.get("productName"));
@@ -236,8 +237,17 @@ public class FollowTaskController extends BaseController {
 
             PageData Plan2 = followPlanService.selectPlanByCPB(pd4);//去查计划 脱落召回
             if(StringUtils.isNotNull(Plan2)){
-                pdt2.put("planId_tl", Plan2.get("id"));
-                List<PageData> listTask2= followTaskService.findForList(pdt2);//去查任务 脱落召回
+               String planIdrw = (String) Plan2.get("planId");
+               if(StringUtils.isNotEmpty(planIdrw)){
+                   pdt2.put("planId", planIdrw);
+                   List<PageData> listTask2= followTaskService.findForList(pdt2);//去查任务 脱落召回
+                   if(listTask2.size()>0){
+                       pd1.put("listTask2",listTask2);
+                   }
+               }
+                pd1.put("planId_tl", Plan2.get("planId"));
+
+
                 pd1.put("follow_up_person2",Plan2.get("follow_up_person"));
                 pd1.put("productName2",Plan2.get("productName"));
                 pd1.put("specification2",Plan2.get("specification"));
@@ -266,9 +276,7 @@ public class FollowTaskController extends BaseController {
                             break;
                     }
                 }
-                if(listTask2.size()>0){
-                    pd1.put("listTask2",listTask2);
-                }
+
             }
             PageData  Degree =followPlanService.getPerfectionDegree(pd2);//查询档案完善度百分比
             List<PageData>  records =pharmaceuticalService.getDrugPurchaseList(pd5);//去查购药记录
@@ -335,10 +343,12 @@ public class FollowTaskController extends BaseController {
     {
         PageData pd = this.getPageData();
         Integer update = followPlanService.closePlan(pd);
-        if(update<=0){
-            return error("关闭计划失败");
+        if(update>0){
+            return AjaxResult.success("关闭计划成功");
+        }else{
+            return AjaxResult.error("关闭计划失败");
         }
-        return toAjax(update);
+
     }
     /**
      * 关闭任务
@@ -351,10 +361,12 @@ public class FollowTaskController extends BaseController {
     {
         PageData pd = this.getPageData();
         Integer update = followTaskService.closeTask(pd);
-        if(update<=0){
-            return error("关闭任务划失败");
+        if(update>0){
+            return AjaxResult.success("关闭任务成功");
+        }else{
+            return AjaxResult.error("关闭任务划失败");
         }
-        return toAjax(update);
+
     }
 
 

+ 54 - 46
health-admin/src/main/resources/templates/dtp/followUp/followUpEdit.html

@@ -4,6 +4,7 @@
     <th:block th:include="include :: header('随访任务详情')" />
     <th:block th:include="include :: layout-latest-css" />
     <th:block th:include="include :: ztree-css" />
+    <th:block th:include="include :: select2-css" />
 </head>
 <style>
     .select2-dropdown {
@@ -503,6 +504,7 @@
                                     <label class="is-required">回访方式:</label>
                                     <div class="input-groups" th:with="type=${@dict.getType('sys_select_dtp_ysfw_huifangfangshi')}">
                                         <input type="hidden" id="id" name="id" th:value="${bc_id}">
+                                        <input type="hidden" id="planId" name="planId" th:value="${planId}">
                                         <input type="hidden" id="planId_cg" name="planId_cg" th:value="${planId_cg}">
                                         <input type="hidden" id="planId_tl" name="planId_tl" th:value="${planId_tl}">
                                         <input type="hidden" id="patientId" name="patientId" th:value="${patientId}">
@@ -730,6 +732,7 @@
     </div>
 </form>
 <th:block th:include="include :: footer" />
+<th:block th:include="include :: select2-js" />
 <th:block th:include="include :: jquery-cxselect-js" />
 <th:block th:include="include :: layout-latest-js" />
 <th:block th:include="include :: bootstrap-table-fixed-columns-js" />
@@ -1279,56 +1282,61 @@
 
 
     // 关闭计划
-    function closePlan(planFlag){
-            $.modal.confirm("确认要关闭计划吗?,关闭计划后将停止该计划下的所有任务", function() {
-                $.modal.alert("确认");
-            });
-
-        var formData = new FormData();
-        if(planFlag==1){
-            var taskId = $("#id").val();
-            var id = $("#planId_cg").val();
-        }
-        if(planFlag==2){
-            var taskId = $("#id").val();
-            var id = $("#planId_tl").val();
-        }
-
-        formData.append('taskId', taskId);
-        formData.append('id', id);
-        $.ajax({
-            url: prefix_task + "/closePlan",
-            data: formData,
-            type: "post",
-            processData: false,
-            contentType: false,
-            success: function(result) {
-                $.modal.success("关闭计划成功",result);
-            },
-            error: function(xhr, status, error) {
-                $.modal.alertError("关闭计划失败");
+    function closePlan(planFlag) {
+        $.modal.confirm("确认要关闭计划吗? 关闭计划后将停止该计划下的所有任务", function() {
+            var formData = new FormData();
+            var taskId, planId;
+
+            if (planFlag === 1) {
+                taskId = $("#id").val();
+                planId = $("#planId_cg").val();
+            } else if (planFlag === 2) {
+                taskId = $("#id").val();
+                planId = $("#planId_tl").val();
             }
+
+            formData.append('taskId', taskId);
+            formData.append('planId', planId);
+
+            $.ajax({
+                url: prefix_task + "/closePlan",
+                data: formData,
+                method: 'POST',
+                processData: false, // 防止 jQuery 自动转换数据
+                contentType: false, // 不设置内容类型
+                dataType: 'json',
+                error: function(request) {
+                    $.modal.alertError("关闭计划失败");
+                },
+                success: function(data) {
+                    $.modal.alertSuccess("关闭计划成功");
+                   // $.modal.reload();
+                    window.location.reload();
+                }
+            });
         });
     }
     // 关闭任务
-    function closeTask(id){
-        $.modal.confirm("确认要关闭任务吗?,关闭任务后将停止该任务的随访操作", function() {
-            $.modal.alert("确认");
-        });
-        var formData = new FormData();
-        formData.append('id', id);
-        $.ajax({
-            url: prefix_task + "/closeTask",
-            data: formData,
-            type: "post",
-            processData: false,
-            contentType: false,
-            success: function(result) {
-                $.modal.success("关闭任务成功",result);
-            },
-            error: function(xhr, status, error) {
-                $.modal.alertError("关闭任务失败");
-            }
+    function closeTask(id) {
+        $.modal.confirm("确认要关闭任务吗? 关闭任务后将停止该任务的随访操作", function() {
+            var formData = new FormData();
+            formData.append('id', id);
+
+            $.ajax({
+                url: prefix_task + "/closeTask",
+                data: formData,
+                method: 'POST',
+                processData: false, // 防止 jQuery 自动转换数据
+                contentType: false, // 不设置内容类型
+                success: function(data) {
+                    $.modal.alertSuccess("关闭任务成功");
+                    // $.modal.reload();
+                    window.location.reload();
+                },
+                error: function(xhr, status, error) {
+                    $.modal.alertError("关闭任务失败");
+                }
+            });
         });
     }
 

+ 87 - 5
health-system/src/main/java/com/bzd/system/service/DTPService.java

@@ -566,6 +566,13 @@ public class DTPService {
         List<PageData> addList = new ArrayList<>();
         int resultDrug=0;
         int drugQuantity=0;
+
+        //生成计划ID
+        String planId =  IdUtils.fastSimpleUUID();
+        String registrant = (String) pd.get("registrant");
+        if(StringUtils.isEmpty(registrant)){
+            pd.put("registrant", getSysUser().getLoginName());
+        }
         try {
             if (StringUtils.isNotNull(drugList)) {
                 // 将 JSON 字符串转换为 List<Map<String, Object>>
@@ -576,7 +583,7 @@ public class DTPService {
                 if (rowsdrugList.size() > 0) {
                     for (Map<String, Object> lxr : rowsdrugList) {
                         PageData pageData = new PageData();
-
+                        PageData pdPlan = new PageData();
                         // 设置固定或默认值
                         pageData.put("createdBy", getSysUser().getLoginName());
                         pageData.put("createdTime", DateUtils.getTime());
@@ -622,8 +629,85 @@ public class DTPService {
 //                        pageData.put("updatedBy", lxr.get("updatedBy"));
 //                        pageData.put("updatedTime", lxr.get("updatedTime"));
 //                        pageData.put("remarks", lxr.get("remarks"));
+
+
+                        String followUpItem   = (String) lxr.get("followUpItem");//是否是随访品 1是,0否
+                        if( StringUtils.isNotEmpty(followUpItem) && "是".equals(followUpItem) ){
+
+                            PageData   pdCPB=new PageData();
+                            if (StringUtils.isNotEmpty(patientId)) {
+                                pdCPB.put("patientId", patientId);
+                            }else {
+                                returnPageData.put("msg", "天添加败未获取患者信息");
+                                returnPageData.put("code", 300);
+                                return returnPageData;
+                            }
+                            pdCPB.put("mdmCode", lxr.get("mdmCode"));
+                            pdCPB.put("productCode", lxr.get("productCode"));
+
+                            List<PageData> SOPList= (List<PageData>) daoSupport.findForList("SDtpYypzFollowUpSopMapper.selectSOPTemplateByProductCode", pdCPB);
+                            if(SOPList.size()>0){//说明是配置品
+                              String businessBelonging = (String) SOPList.get(0).get("businessBelonging");//业务归属
+                            }
+
+                            //先查询该患者购买在这个药品是否已经有计划 mdmCode patientId businessBelonging
+                            //List<PageData> planList= (List<PageData>) daoSupport.findForList("followPlanMapper.selectPlanListByCPB", pdCPB);
+                            PageData plan= (PageData) daoSupport.findForObject("followPlanMapper.selectPlanByCPB", pdCPB);
+                            //生成任务ID
+                            String taskId =  IdUtils.fastSimpleUUID();
+                            if(StringUtils.isNotNull(plan)){
+                                pdCPB.put("planId", plan.get("planId"));
+                                planId= plan.get("planId").toString();
+                            }else {
+                                pdCPB.put("planId", planId);
+                                pdCPB.put("productName", lxr.get("productName"));//'药品名称'
+                                pdCPB.put("businessBelonging", "常规随访");//业务归属 先写死 默认这个药品已经配置了业务归属为常规随访的药
+                                pdCPB.put("specification", lxr.get("specification"));
+                                pdCPB.put("storeId", getSysUser().getDeptId());
+                                pdCPB.put("storeName", getSysUser().getDept().getDeptName());
+                                pdCPB.put("templateId", "12345");//'模版ID' 先假设写死 实际是获取模板ID
+                                pdCPB.put("planName", lxr.get("productName")+"-随访");//'计划名称' 默认用药品作为名称
+                               // pdCPB.put("taskId", taskId);
+                                pdCPB.put("follow_up_person", "周敏");//'随访跟进人' 先写死
+                                pdCPB.put("follow_up_person_id", "7");//'随访跟进人id' 先写死
+                                pdCPB.put("createdBy", "系统创建");//'创建人'
+                                pdCPB.put("createdTime", DateUtils.getTime());//'创建时间'
+                                pdCPB.put("updatedBy", getSysUser().getLoginName());//'创建时间'
+                                pdCPB.put("updatedTime", DateUtils.getTime());//'创建时间'
+                                pdCPB.put("status", 1);//'计划状态: 0关闭 1开启/进行中,2默认:2已创建待开启'
+                                int FollowPlan = dao.executeBatch("followPlanMapper.insertFollowPlan", pdCPB);
+                                System.out.println("FollowPlan.size()="+FollowPlan);
+                            }
+                               pdCPB.put("appointmentDate", DateUtils.getTime());//'预约日期'
+                               pdCPB.put("businessBelonging", "常规随访");//'业务归属:常规随访,脱落召回'
+                               pdCPB.put("taskName", "第1次任务");//'任务名称'
+                               pdCPB.put("taskTheme", "常规随访");//'任务主题'
+                               pdCPB.put("planId", planId);//'计划ID'
+                               pdCPB.put("patientId", patientId);//'患者id'
+                               pdCPB.put("patientName", pd.get("patientName"));//'患者姓名'
+                               pdCPB.put("gender", pd.get("gender"));//'性别:0男,1女,2未知'
+                               pdCPB.put("age", pd.get("age"));//'年龄'
+                               //pdCPB.put("followUpSummary", "无");//'随访小结'
+                               //pdCPB.put("followUpSummaryid", lxr.get("followUpSummaryid"));//'随访小结id'
+                               pdCPB.put("disease", pd.get("prescriptionDiagnosis"));//'疾病' 先用处方诊断字段代替
+                               pdCPB.put("storeName", getSysUser().getDeptId());//'门店'
+                               pdCPB.put("mdmCode", lxr.get("mdmCode"));//'药品编码'
+                               pdCPB.put("genericName", lxr.get("genericName"));//'药品通用名'
+                               pdCPB.put("productName", lxr.get("productName"));//'商品名'
+                               pdCPB.put("taskFollower", "周敏");//'任务跟进人'
+                               pdCPB.put("nutrition_evaluation_id", "11111111");//'营养测评id'
+                               pdCPB.put("medication_record_id", "22222222");//'用药记录id'
+                               pdCPB.put("taskStatus", "待执行");//任务状态:\r\n,0待执行,\r\n1已完成,\r\n2未完成,\r\n3已下发
+                               pdCPB.put("operator", pd.get("registrant"));//'操作人'
+                               pdCPB.put("createdAt", DateUtils.getTime());
+                               pdCPB.put("updatedAt", DateUtils.getTime());
+                               pdCPB.put("storeId", getSysUser().getDeptId());
+                               int FollowTask = dao.executeBatch("followTaskMapper.insertFollowTask", pdCPB);
+                               System.out.println("FollowTask.size()="+FollowTask);
+                        }
                         addList.add(pageData);
                         resultDrug = dao.executeBatch("DTPCFDJMapper.batchAddDrugPurchaseRecordNew", pageData);
+                        System.out.println("resultDrug.size()="+resultDrug);
                     }
 //                        final HashMap<String, Object> addMap = new HashMap<String, Object>();
 //                        addMap.put("dataList", addList);
@@ -653,11 +737,9 @@ public class DTPService {
                 pd.put("registerPharmacistName", getSysUser().getLoginName());
             }
 
-            String registrant = (String) pd.get("registrant");
-            if(StringUtils.isEmpty(registrant)){
-                pd.put("registrant", getSysUser().getLoginName());
-            }
+
             int result = daoSupport.save("DTPCFDJMapper.insertPrescriptionRegistration", pd);
+            System.out.println("result.size()="+result);
             if(resultDrug>0 && result>0){
                 returnPageData.put("code", 200);
                 returnPageData.put("prescriptionNumber", prescriptionNumber);

+ 10 - 0
health-system/src/main/java/com/bzd/system/service/gxhpz/DrugConfigService.java

@@ -179,6 +179,16 @@ public class DrugConfigService {
             pd13.put("product_name", pd.get("productName"));//通用名
             pd13.put("generic_name", pd.get("genericName"));//通用名
             pd13.put("manufacturer_abbreviation", pd.get("manufacturerShortName"));//厂家简称
+
+            pd13.put("dosage_max",pd.get("dosage_max"));
+            pd13.put("dosage_min",pd.get("dosage_min"));
+            pd13.put("dosage_normal",pd.get("dosage_normal"));
+            pd13.put("unit_normal",pd.get("unit_normal"));
+            pd13.put("unit_max",pd.get("unit_max"));
+            pd13.put("unit_min",pd.get("unit_min"));
+            pd13.put("packing_unit",pd.get("packing_unit"));
+            pd13.put("packing_value",pd.get("packing_value"));
+
             int res13=daoSupport.update("SPProductinfoMapper.productUpdate", pd13);
             System.out.println("res13:s_gxhpz_product_info表更改条数"+res13);
             //更新患者管理品

+ 3 - 2
health-system/src/main/java/com/bzd/system/service/gxhpz/FollowPlanService.java

@@ -107,9 +107,10 @@ public class FollowPlanService {
         pd.put("operator", getSysUser().getLoginName());//'操作人'
         pd.put("updatedTime", DateUtils.getTime());//'更新时间'
         pd.put("updatedBy", getSysUser().getLoginName());//更新人
-
-        int task = daoSupport.update("followTaskMapper.stopFollowTask", pd);
         int plan = daoSupport.update("followPlanMapper.closeFollowPlan", pd);
+        //pd.put("id", pd.get("taskId"));//设置真确的任务计划id
+        int task = daoSupport.update("followTaskMapper.stopFollowTask", pd);
+
         if (task > 0 && plan > 0) {
             return 1;
         } else {

+ 9 - 0
health-system/src/main/resources/mapper/dtp/SDtpYypzFollowUpSopMapper.xml

@@ -1,6 +1,15 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="SDtpYypzFollowUpSopMapper" >
+
+    <!-- 通过药品查询模版信息 -->
+    <select id="selectSOPTemplateByProductCode" parameterType="pd" resultType="pd">
+        select up.*,dr.productName,dr.productCode,dr.specification from s_dtp_yypz_follow_up_sop up  left join s_dtp_yypz_template_drug dr on up.templateId=dr.templateId where 1=1
+        <if test="productCode !=null and productCode !='' ">
+            and dr.productCode = #{productCode}
+        </if>
+
+    </select>
     <!-- 通用查询映射结果 -->
 
     <select id="selectSDtpYypzFollowUpSopList" parameterType="pd" resultType="pd">

+ 24 - 0
health-system/src/main/resources/mapper/gxhpz/drugConfigMapper.xml

@@ -357,6 +357,30 @@
             <if test="remarks != null and remarks != ''">
                 remarks = #{remarks},
             </if>
+            <if test="dosage_max != null and dosage_max != ''">
+                dosage_max=#{dosage_max},
+            </if>
+            <if test="dosage_min != null and dosage_min != ''">
+                dosage_min=#{dosage_min},
+            </if>
+            <if test="dosage_normal != null and dosage_normal != ''">
+                dosage_normal=#{dosage_normal},
+            </if>
+            <if test="unit_normal != null and unit_normal != ''">
+                unit_normal=#{unit_normal},
+            </if>
+            <if test="unit_max != null and unit_max != ''">
+                unit_max=#{unit_max},
+            </if>
+            <if test="unit_min != null and unit_min != ''">
+                unit_min=#{unit_min},
+            </if>
+            <if test="packing_unit != null and packing_unit != ''">
+                packing_unit=#{packing_unit},
+            </if>
+            <if test="packing_value != null and packing_value != ''">
+                packing_value=#{packing_value},
+            </if>
         </trim>
         <where>
             <if test="id != null">

+ 44 - 3
health-system/src/main/resources/mapper/gxhpz/followPlanMapper.xml

@@ -9,6 +9,10 @@
         <if test="id != null">
             and id = #{id}
         </if>
+        <if test="planId != null and planId != ''">
+            and planId = #{planId}
+        </if>
+
         <if test="productName != null and productName != ''">
             and productName = #{productName}
         </if>
@@ -35,8 +39,36 @@
 
     <!-- 根据药品编码和患者id查询计划 只能出现一条数据 -->
     <select id="selectPlanByCPB" parameterType="pd" resultType="pd">
-        select p.*,DATE_FORMAT(p.updatedTime, '%Y-%m-%d %H:%i:%s') AS updatedTime1 ,DATE_FORMAT(p.createdTime, '%Y-%m-%d %H:%i:%s') AS createdTime1  from s_gxhpz_follow_plan  p where p.mdmCode = #{mdmCode} and p.patientId = #{patientId} and p.businessBelonging=#{businessBelonging}
+        select p.*,DATE_FORMAT(p.updatedTime, '%Y-%m-%d %H:%i:%s')
+            AS updatedTime1 ,DATE_FORMAT(p.createdTime, '%Y-%m-%d %H:%i:%s')
+            AS createdTime1  from s_gxhpz_follow_plan  p where 1=1
+        <if test="mdmCode != null and mdmCode != ''">
+           and  p.mdmCode = #{mdmCode}
+        </if>
+        <if test="patientId != null and patientId != ''">
+            and p.patientId = #{patientId}
+        </if>
+        <if test="businessBelonging != null and businessBelonging != ''">
+            and p.businessBelonging=#{businessBelonging}
+        </if>
+
+    </select>
+    <!-- 根据药品编码和患者id查询计划 多条数据-->
+    <select id="selectPlanListByCPB" parameterType="pd" resultType="pd">
+        select p.*,DATE_FORMAT(p.updatedTime, '%Y-%m-%d %H:%i:%s')
+        AS updatedTime1 ,DATE_FORMAT(p.createdTime, '%Y-%m-%d %H:%i:%s')
+        AS createdTime1  from s_gxhpz_follow_plan  p where 1=1
+        <if test="mdmCode != null and mdmCode != ''">
+            p.mdmCode = #{mdmCode}
+        </if>
+        <if test="patientId != null and patientId != ''">
+            and p.patientId = #{patientId}
+        </if>
+        <if test="businessBelonging != null and businessBelonging != ''">
+            and p.businessBelonging=#{businessBelonging}
+        </if>
     </select>
+
     <!-- 根据ID查询单个计划 -->
     <select id="selectOneById" parameterType="pd" resultType="pd">
         select * from s_gxhpz_follow_plan where id = #{id}
@@ -56,7 +88,7 @@
                 updatedTime = #{updatedTime},
             </if>
         </set>
-        where id = #{id}
+        where planId = #{planId}
     </update>
     <!-- 插入新计划 -->
     <insert id="insertFollowPlan" parameterType="pd">
@@ -92,6 +124,9 @@
             <if test="taskId != null and taskId != ''">
                 taskId,
             </if>
+            <if test="planId != null and planId != ''">
+                 planId,
+            </if>
             <if test="follow_up_person != null and follow_up_person != ''">
                 follow_up_person,
             </if>
@@ -146,6 +181,9 @@
             <if test="taskId != null and taskId != ''">
                 #{taskId},
             </if>
+            <if test="planId != null and planId != ''">
+                 #{planId},
+            </if>
             <if test="follow_up_person != null and follow_up_person != ''">
                 #{follow_up_person},
             </if>
@@ -204,6 +242,9 @@
             <if test="taskId != null and taskId != ''">
                 taskId = #{taskId},
             </if>
+            <if test="planId != null and planId != ''">
+                 planId = #{planId},
+            </if>
             <if test="follow_up_person != null and follow_up_person != ''">
                 follow_up_person = #{follow_up_person},
             </if>
@@ -223,7 +264,7 @@
                 updatedTime=#{updatedTime},
             </if>
         </set>
-        where id = #{id}
+        where planId = #{planId}
     </update>
 
     <!-- 删除计划 -->

+ 1 - 1
health-system/src/main/resources/mapper/gxhpz/followTaskMapper.xml

@@ -56,7 +56,7 @@
                 operator = #{operator},
             </if>
         </set>
-        where planId = #{id}
+        where planId = #{planId}
     </update>
     <!-- 关闭任务 -->
     <update id="closeTask" parameterType="pd">