Parcourir la source

Merge remote-tracking branch 'origin/master'

bzd_lxf il y a 4 mois
Parent
commit
073bed42d8

+ 10 - 0
health-admin/src/main/java/com/bzd/web/controller/dtp/PharmaceuticalServiceController.java

@@ -94,6 +94,16 @@ public class PharmaceuticalServiceController extends BaseController {
         List<PageData> pageData = pharmaceuticalService.slectPatientByNameOrPhone(pd);
         return getDataTable(pageData);
     }
+    @RequiresPermissions("dtp:pmService:archivesList")
+    @PostMapping("/slectPatientByNameOrPhoneOrIdCard")
+    @ResponseBody
+    public AjaxResult slectPatientByNameOrPhoneOrIdCard() throws Exception {
+        PageData pd = this.getPageData();
+        startPage();
+        PageData pageData = (PageData) pharmaceuticalService.slectPatientByNameOrPhoneOrIdCard(pd);
+
+        return AjaxResult.success(pageData);
+    }
 
     /**
      * 档案管理数据删除 根据id

+ 41 - 1
health-admin/src/main/java/com/bzd/web/controller/dtp/RecipeRegisterController.java

@@ -59,6 +59,20 @@ public class RecipeRegisterController extends BaseController {
         List<PageData> pageData = dtpService.findForList(pd);
         return  getDataTable(pageData);
     }
+    @RequiresPermissions("dtp:recipe:list")
+    @PostMapping("/getLastRecipe")
+    @ResponseBody
+    public AjaxResult getLastRecipe( ModelMap mmap) throws Exception {
+        PageData pd = this.getPageData();
+        startPage();
+        PageData pageData =dtpService.getLastRecipe(pd);
+//        List<PageData> recipeList = (List<PageData>) pageDataList.get("recipeList");
+//        Object recipe = pageData.get("recipe");
+//        mmap.put("recipe", recipe);
+//        mmap.put("recipeList", recipeList);
+        return  AjaxResult.success(pageData);
+    }
+
     /**
      * 新增页面
      */
@@ -69,6 +83,15 @@ public class RecipeRegisterController extends BaseController {
         return prefix + "/add";
     }
     /**
+     * 新建登记
+     */
+    @GetMapping("/newRecipe")
+    public String newRecipe(ModelMap mmap)
+    {
+        mmap.put("posts", 1);
+        return prefix + "/newRecipe";
+    }
+    /**
      * 药品信息页面
      */
     @RequiresPermissions("dtp:recipe:view")
@@ -92,7 +115,7 @@ public class RecipeRegisterController extends BaseController {
 
 
     /**
-     * 处方登记新增保存
+     * 处方登记新增保存-----暂时废弃改代码
      */
     //@RequiresPermissions("server:serv:add")
     @Log(title = "处方登记新增", businessType = BusinessType.INSERT)
@@ -104,7 +127,24 @@ public class RecipeRegisterController extends BaseController {
         PageData object = dtpService.save(pd);
         return AjaxResult.success(object.get("result").toString(),object);
     }
+    /**
+     * 处方登记保存
+     */
+    //@RequiresPermissions("server:serv:add")
+    @Log(title = "处方登记", businessType = BusinessType.INSERT)
+    @PostMapping("/saveCFDJ")
+    @ResponseBody
+    public AjaxResult saveCFDJ() throws Exception {
+        PageData pd = new PageData();
+        pd = this.getPageData();
+        int i = dtpService.saveCFDJ(pd);
+        if(i>0){
+            return AjaxResult.success("登记成功");
+        }else {
+            return AjaxResult.error("登记失败");
+        }
 
+    }
 
     /**
      * 保存处方照片

+ 22 - 1
health-admin/src/main/java/com/bzd/web/controller/gxhpz/DrugConfigController.java

@@ -278,16 +278,37 @@ public class DrugConfigController extends BaseController {
         mmap.put("posts", 1);
         return prefix + "/allDrugsInfo";
     }
+    /**
+     * 药品信息页面
+     */
+    @RequiresPermissions("dtp:yppz:view")
+    @GetMapping("/getAllProduct")
+    public String getAllProduct(ModelMap mmap)
+    {
+        mmap.put("posts", 1);
+        return prefix + "/allProduct";
+    }
     /**配置药**/
     @RequiresPermissions("gxhpz:yppz:list")
     @PostMapping("/getAllDrugs")
     @ResponseBody
-    public TableDataInfo storeTagList() throws Exception {
+    public TableDataInfo getAllDrugs() throws Exception {
         PageData pd = this.getPageData();
         startPage();
         List<PageData> pageData = drugConfigService.getAllDrugs(pd);
         return  getDataTable(pageData);
     }
+    /**配置药**/
+    @RequiresPermissions("gxhpz:yppz:list")
+    @PostMapping("/getAllProductInfo")
+    @ResponseBody
+    public TableDataInfo getAllProductInfo() throws Exception {
+        PageData pd = this.getPageData();
+        startPage();
+        List<PageData> pageData = drugConfigService.getAllProductInfo(pd);
+        return  getDataTable(pageData);
+    }
+
     /**
      * D值关联-启用停用
      */

+ 5 - 0
health-admin/src/main/resources/static/health/js/ry-ui.js

@@ -1194,6 +1194,11 @@ var table = {
                 table.set();
                 $.modal.openTab("添加" + table.options.modalName, $.operate.addUrl(id));
             },
+            // 添加信息,以tab页展现
+            addTab2: function (id) {
+                table.set();
+                $.modal.openTab(table.options.modalName, $.operate.addUrl2(id));
+            },
             // 添加信息 全屏
             addFull: function(id) {
                 table.set();

+ 9 - 2
health-admin/src/main/resources/templates/dtp/archives/archivesAdd.html

@@ -52,9 +52,9 @@
                 <input type="hidden" name="idCardImg" id="idCardImg" value="">
             </div>
             <div class="customize-form-group">
-                <label class="col-sm-1 control-label">性别:</label>
+                <label class="col-sm-1 control-label is-required">性别:</label>
                 <select name="gender" id="gender" class="styled-input" th:with="type=${@dict.getType('sys_user_sex')}" required>
-                    <option>请选择</option>
+                    <option value="">请选择</option>
                     <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                     ></option>
                 </select>
@@ -212,6 +212,11 @@
                     return false
                 }
             }
+            var gender= $("#gender").val()
+            if (gender==null || gender=="") {
+                $.modal.alert("请选择性别")
+                return false
+            }
             add();
         }
     }
@@ -233,6 +238,8 @@
             },
             success : function(data) {
                 $.operate.successCallback(data);
+                $.modal.close();
+                return data;
             }
         });
     }

+ 8 - 4
health-admin/src/main/resources/templates/dtp/recipe/recipe.html

@@ -79,13 +79,16 @@
 		        	<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="dtp:recipe:add">
 		                <i class="fa fa-plus"></i> 处方登记APP
 		            </a>
+					<a class="btn btn-success" onclick="$.operate.addTab2()" shiro:hasPermission="dtp:recipe:add">
+						<i class="fa fa-plus"></i> 新建登记
+					</a>
 		            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="sdtp:recipe:remove">
 		                <i class="fa fa-remove"></i> 删除
 		            </a>
-					<a class="btn btn-primary" onclick="budan()">
-						<i class="fa fa-plus"></i> 补单
-					</a>
-						<!--<button type="button"  onclick="budan()" class="btn btn-sm btn-primary">补单</button>-->
+<!--					<a class="btn btn-success" onclick="budan()">-->
+<!--						<i class="fa btn-primary"></i> 补单-->
+<!--					</a>-->
+						<button type="button"  onclick="budan()" class="btn-primary">补单</button>
 		        </div>
 
 				<div class="col-sm-12 select-table table-striped" style="width: 100%; overflow-x: hidden;">
@@ -172,6 +175,7 @@
 		        url: prefix + "/list",
 		        viewUrl: prefix + "/view/{id}",
 		        createUrl: prefix + "/add",
+				createUrl2: prefix + "/newRecipe",
 		        updateUrl: prefix + "/edit/{id}",
 		        removeUrl: prefix + "/remove",
 		        exportUrl: prefix + "/export",

+ 145 - 6
health-system/src/main/java/com/bzd/system/service/DTPService.java

@@ -41,7 +41,27 @@ public class DTPService {
     public List<PageData> findForList(final PageData pd) throws Exception {
         return (List<PageData>) daoSupport.findForList("DTPMapper.RecipeRegisterList", pd);
     }
-
+    /**
+     * 处方列表
+     *
+     * @param pd
+     * @return
+     * @throws Exception
+     */
+    public PageData  getLastRecipe(final PageData pd) throws Exception {
+        PageData pd3= new PageData();
+        PageData pdObj= (PageData) daoSupport.findForObject("DTPCFDJMapper.selectOneByPatientId", pd);
+        if(StringUtils.isNotNull(pdObj)){
+            pd3.put("recipe",pdObj);
+            PageData pd2=new PageData();
+            pd2.put("prescriptionNumber",pdObj.get("prescriptionNumber"));
+            List<PageData> pdObjList= (List<PageData>) daoSupport.findForList("DTPCFDJMapper.selectListRecordByPrescriptionNumber", pd2);
+            if(pdObjList.size()>0){
+                pd3.put("recipeList", pdObjList);
+            }
+        }
+        return pd3;
+    }
     /**
      * 处方信息
      *
@@ -66,18 +86,18 @@ public class DTPService {
     @Transactional(rollbackFor = Exception.class)
     public PageData save(final PageData pd) throws Exception {
         pd.put("createTime", DateUtils.getTime());//处方表 处方单号时间
-        Object prescriptionNumber = pd.get("prescriptionNumber");
-        Object prescriptionImg = pd.get("prescriptionImg");
-        Object prescriptionDate =pd.get("prescriptionDate");
+        String prescriptionNumber = (String) pd.get("prescriptionNumber");
+        String prescriptionImg = (String) pd.get("prescriptionImg");
+        String prescriptionDate = (String) pd.get("prescriptionDate");
         if (StringUtils.isEmpty(prescriptionNumber.toString())) {
             pd.put("prescriptionNumber", IdUtils.fastSimpleUUID());//处方表 处方单号 如果没有就自动生成
             if( StringUtils.isEmpty(prescriptionImg.toString())){
                 pd.put("status",5);//待上传处方
             }
-            if( StringUtils.isNotEmpty(prescriptionImg.toString())){
+            if( StringUtils.isNotEmpty(prescriptionImg)){
                 pd.put("status",6);//待绑定患者6
             }
-            if( StringUtils.isEmpty(prescriptionDate.toString())){
+            if( StringUtils.isEmpty(prescriptionDate)){
                 pd.put("prescriptionDate", DateUtils.getTime());
             }
 
@@ -146,7 +166,126 @@ public class DTPService {
            return resultpageData;
        }
     }
+    /**
+     * 处方登记 添加
+     *
+     * @param pd
+     * @return
+     * @throws Exception
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public int saveCFDJ(final PageData pd) throws Exception {
+
+
+        Object drugList = pd.get("drugData");//获取药品信息列表
+        String Id = IdUtils.fastSimpleUUID();//生成处方单号
+        List<PageData> addList = new ArrayList<>();
 
+        if (StringUtils.isNotNull(drugList)) {
+            try {
+                // 将 JSON 字符串转换为 List<Map<String, Object>>
+                ObjectMapper objectMapper = new ObjectMapper();
+                List<Map<String, Object>> rowsdrugList = objectMapper.readValue(drugList.toString(), List.class);
+                // 遍历列表并调用插入数据接口
+                if (rowsdrugList.size() > 0) {
+                    for (Map<String, Object> lxr : rowsdrugList) {
+                        PageData pageData = new PageData();
+
+                        // 设置固定或默认值
+                        pageData.put("createdBy", getSysUser().getLoginName());
+                        pageData.put("createdTime", DateUtils.getTime());
+                        pageData.put("storeId", getSysUser().getDeptId());
+
+                        // 从 lxr 获取数据并映射到数据库字段
+                        pageData.put("mdmCode", lxr.get("mdmCode"));
+                        pageData.put("productName", lxr.get("productName"));
+                        pageData.put("genericName", lxr.get("genericName"));
+                        pageData.put("specification", lxr.get("specification"));
+                        pageData.put("manufacturerShortName", lxr.get("manufacturerShortName"));
+                        pageData.put("administrationMethod", lxr.get("administrationMethod"));
+                        pageData.put("packageQuantity", 1);
+                        pageData.put("singleDoseValue", 1);
+                        pageData.put("singleDoseUnit", lxr.get("singleDoseUnit"));
+                        pageData.put("dosageFrequency", lxr.get("dosageFrequency"));
+                        pageData.put("dosageFrequencyDays", 1);
+                        pageData.put("dvalueDays", 1);
+
+
+
+
+
+
+                        // 添加其他可能需要的字段(如果有的话)
+                        pageData.put("medicationRoute", lxr.get("medicationRoute"));
+//                        pageData.put("sales", lxr.get("sales"));
+                        pageData.put("prescriptionNumber", Id);
+                        pageData.put("prescriptionDate", DateUtils.getTime());
+                        pageData.put("hospital", lxr.get("hospital"));
+                        pageData.put("prescribingDoctor", lxr.get("prescribingDoctor"));
+                        pageData.put("department", lxr.get("department"));
+                        pageData.put("attendingPhysician", lxr.get("attendingPhysician"));
+                        pageData.put("clinicalDiagnosis", lxr.get("clinicalDiagnosis"));
+                        pageData.put("registrant", lxr.get("registrant"));
+                        pageData.put("registrationDate", DateUtils.getTime());
+//                        pageData.put("saleDate", lxr.get("saleDate"));
+//                        pageData.put("pharmacyName", lxr.get("pharmacyName"));
+//                        pageData.put("updatedBy", lxr.get("updatedBy"));
+//                        pageData.put("updatedTime", lxr.get("updatedTime"));
+//                        pageData.put("remarks", lxr.get("remarks"));
+                        addList.add(pageData);
+                    }
+                    final HashMap<String, Object> addMap = new HashMap<String, Object>();
+                    addMap.put("dataList", addList);
+                    int resultDrug= dao.executeBatch("DTPCFDJMapper.batchAddDrugPurchaseRecord", addMap);
+                }
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+
+        }
+
+
+        // 从表单数据填充
+        pd.put("prescriptionNumber", Id); // 处方单表id主键,Id 应该是某个方式生成的唯一标识符
+        pd.put("storeId", getSysUser().getDeptId());
+        pd.put("storeName", getSysUser().getDeptId()); // 假设 getDeptName() 可以获取部门名称
+        pd.put("createdBy", getSysUser().getUserId());
+        pd.put("createTime", DateUtils.getTime());
+
+        // 直接从表单数据填充
+        pd.put("hospital", pd.get("hospital"));
+        pd.put("prescribingDoctor", pd.get("prescribingDoctor"));
+        pd.put("department", pd.get("department"));
+        pd.put("prescriptionDiagnosis", pd.get("prescriptionDiagnosis"));
+        pd.put("attendingDoctor", pd.get("attendingDoctor"));
+        pd.put("clinicalDiagnosis", pd.get("clinicalDiagnosis"));
+        pd.put("prescriptionImageUrl", pd.get("prescriptionImageUrl"));
+        pd.put("prescriptionIssueDate", pd.get("prescriptionIssueDate"));
+        pd.put("invoiceImageUrl", pd.get("invoiceImageUrl"));
+        pd.put("invoiceCode", pd.get("invoiceCode"));
+        pd.put("saleDate", pd.get("saleDate"));
+        pd.put("registrationDate", pd.get("registrationDate"));
+        pd.put("registerPharmacistName", pd.get("registerPharmacistName"));
+        pd.put("registrant", pd.get("registrant"));
+        pd.put("reviewingName", pd.get("reviewingName"));
+
+        // 患者信息
+        pd.put("patientId", pd.get("patientId"));
+        pd.put("patientName", pd.get("patientName"));
+       String sex= (String) pd.get("gender");
+
+        if(sex.equals("男")){
+            pd.put("gender", 1);
+        }
+        if(sex.equals("女")){
+            pd.put("gender", 0);
+        }
+        pd.put("age", pd.get("age"));
+
+        int result = daoSupport.save("DTPCFDJMapper.insertPrescriptionRegistration", pd);
+       return result;
+    }
 
     /**
      * 处方删除

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

@@ -147,6 +147,11 @@ public class DrugConfigService {
     public List<PageData> getAllDrugs(final PageData pd) throws Exception {
         return (List<PageData>) daoSupport.findForList("drugConfigMapper.getAllDrugConfig", pd);
     }
+    /**配置药查询**/
+    public List<PageData> getAllProductInfo(final PageData pd) throws Exception {
+        return (List<PageData>) daoSupport.findForList("drugConfigMapper.getAllProductInfo", pd);
+    }
+
     /**
      * 启用停用D值配关联
      * @param pd

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

@@ -594,5 +594,23 @@
         </where>
 
     </select>
+    <!--配置过的药品查询-->
+    <select id="getAllProductInfo" parameterType="pd" resultType="pd">
+
+        select p.*,d.is_insurance_drug,d.insurance_category,d.purchase_limit_quantity,d.prescription_required,d.prohibit_ordering,d.mid_pack_order_logic,d.max_order_limit,d.drug_delivery_way,d.registered_item,d.follow_up_item,d.cold_chain_item,d.flow_item,d.charity_aid_item
+        from s_gxhpz_product_info p left join s_gxhpz_product_dtpinfo d on p.product_code = d.product_code
+        <where>
+            <if test="id != null">
+                AND p.id = #{id}
+            </if>
+            <if test="query != null and query != ''">
+                AND (p.generic_name LIKE CONCAT('%', #{query}, '%') OR p.product_name LIKE CONCAT('%', #{query}, '%') OR p.product_code LIKE CONCAT('%', #{query}, '%'))
+            </if>
+            <if test="manufacturerShortName != null and manufacturerShortName != ''">
+                AND p.manufacturer_abbreviation = #{manufacturerShortName}
+            </if>
 
+        </where>
+
+    </select>
 </mapper>

+ 5 - 0
health-system/src/main/resources/mapper/pmServiceMapper/PharmaceuticalServiceMapper.xml

@@ -73,6 +73,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	<select id="slectPatientByNameOrPhone" parameterType="pd" resultType="pd">
 	select * from s_dtp_ysfw_archive_management where  1=1  AND  name LIKE CONCAT('%', #{query}, '%') or phoneNumber=#{query}
 	</select>
+
+	<select id="slectPatientByNameOrPhoneOrIdCard" parameterType="pd" resultType="pd">
+		select * from s_dtp_ysfw_archive_management where  1=1  AND  name =#{query} or phoneNumber=#{query} or documentNumber=#{query}
+	</select>
+
 	<select id="selectPatientById" parameterType="pd" resultType="pd">
 		select * from s_dtp_ysfw_archive_management where  1=1 and id=#{patientId}
 	</select>