瀏覽代碼

拉取代码

XMLWAN 3 年之前
父節點
當前提交
9ae061a106
共有 7 個文件被更改,包括 592 次插入200 次删除
  1. 347 178
      controllers/sz/sz_his_api_controller.go
  2. 6 2
      enums/error_code.go
  3. 二進制
      gdyb
  4. 102 0
      models/drug.go
  5. 24 10
      models/sz_his_models.go
  6. 37 1
      service/his_service.go
  7. 76 9
      service/sz_his_service.go

+ 347 - 178
controllers/sz/sz_his_api_controller.go 查看文件

@@ -187,8 +187,9 @@ func SZHisManagerApiRegistRouters() {
187 187
 	beego.Router("/sz/api/drug/get", &SZHisApiController{}, "get:GetDrugList")
188 188
 	//协议机构诊疗项目
189 189
 	beego.Router("/sz/api/treatment/get", &SZHisApiController{}, "get:GetTreatmentProject")
190
-	//协议机构目录
190
+	//协议机构目录备案撤销
191 191
 	beego.Router("/sz/api/revocation/get", &SZHisApiController{}, "get:GetRevocation")
192
+
192 193
 	//定点机构约定信息查询
193 194
 	//beego.Router("/sz/api/information/query/get",&SZHisApiController{},"get:GetInformationQuery")
194 195
 	//-医药师信息登记
@@ -197,7 +198,9 @@ func SZHisManagerApiRegistRouters() {
197 198
 	beego.Router("/sz/api/medical/get", &SZHisApiController{}, "get:GetMedicalList")
198 199
 	//医药师信息更新
199 200
 	beego.Router("/sz/api/update/medical/get", &SZHisApiController{}, "get:GetUpdateMedicalList")
201
+	//协议机构材料目录备案
200 202
 
203
+	beego.Router("/sz/api/goods/get", &SZHisApiController{}, "get:GetGoodsList")
201 204
 }
202 205
 
203 206
 func IntPtr(n int) uintptr {
@@ -1313,7 +1316,7 @@ func (c *SZHisApiController) GetDrugList() {
1313 1316
 	for _, item := range list {
1314 1317
 		fmt.Println(item.DrugDosageForm)
1315 1318
 		for _, it := range drugs {
1316
-			fmt.Println("2222", it.Value, it.Name)
1319
+
1317 1320
 			if item.DrugDosageForm == it.Value {
1318 1321
 				item.DrugDosageName = it.Name
1319 1322
 			}
@@ -1392,7 +1395,7 @@ func (c *SZHisApiController) GetDrugList() {
1392 1395
 			isSuccess = false
1393 1396
 			//失败
1394 1397
 
1395
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePreSettleFaildParamWrong)
1398
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorDrugPreSettleFaildParamWrong)
1396 1399
 			return
1397 1400
 		}
1398 1401
 		fmt.Println(isSuccess)
@@ -1472,7 +1475,7 @@ func (c *SZHisApiController) GetTreatmentProject() {
1472 1475
 			isSuccess = false
1473 1476
 			//失败
1474 1477
 
1475
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePreSettleFaildParamWrong)
1478
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorDrugPreSettleFaildParamWrong)
1476 1479
 			return
1477 1480
 		}
1478 1481
 		fmt.Println(isSuccess)
@@ -1481,82 +1484,165 @@ func (c *SZHisApiController) GetTreatmentProject() {
1481 1484
 
1482 1485
 func (c *SZHisApiController) GetRevocation() {
1483 1486
 
1484
-	//获取药品库数据
1485
-	list, _ := service.GetDrugList(10028)
1487
+	id, _ := c.GetInt64("id")
1488
+	//用来区分是药品的撤销还是耗材的撤销  1.药品  2.诊疗项目 3.材料 5.辅助器具项目
1486 1489
 
1487
-	miConfig, _ := service.FindMedicalInsuranceInfo(10028)
1488
-	var doctor_name string
1489
-	var doctor_code string
1490
+	type_id, _ := c.GetInt64("type_id")
1491
+	fmt.Println("type_id2222222", type_id)
1492
+	if type_id == 1 {
1493
+		//获取药品库数据
1494
+		list, _ := service.GetDrugListByDetail(10028, id)
1490 1495
 
1491
-	doctor_name = "黄亦轩"
1492
-	doctor_code = "1001"
1496
+		miConfig, _ := service.FindMedicalInsuranceInfo(10028)
1497
+		var doctor_name string
1498
+		var doctor_code string
1493 1499
 
1494
-	var pagesize int = 50
1495
-	var start int = 1
1496
-	var stop int
1497
-	var pagecount int
1498
-	var curpage int
1499
-	var isSuccess bool = true
1500
-	//总页数,向上取整,注意除之前要先转换类型为float64
1501
-	pagecount = int(math.Ceil(float64(len(list)) / float64(pagesize)))
1500
+		doctor_name = "黄亦轩"
1501
+		doctor_code = "1001"
1502 1502
 
1503
-	var ress []*Result
1504
-	for curpage = 1; curpage <= pagecount; curpage++ {
1505
-		if curpage == 1 {
1506
-			start = 1
1507
-		} else {
1508
-			start = (curpage-1)*pagesize + 1
1509
-		}
1510
-		stop = curpage * pagesize
1511
-		if stop > len(list) {
1512
-			stop = len(list)
1513
-		}
1514
-		//这里就可以查看开始和结束了
1515
-		fmt.Println(list[start-1 : stop])
1516
-		var customs []*models.DrugDetail
1517
-		for _, item := range list {
1518
-			fmt.Println("医疗机构编码", item.MedicalInsuranceNumber)
1519
-			detail := &models.DrugDetail{
1503
+		var pagesize int = 50
1504
+		var start int = 1
1505
+		var stop int
1506
+		var pagecount int
1507
+		var curpage int
1508
+		var isSuccess bool = true
1509
+		//总页数,向上取整,注意除之前要先转换类型为float64
1510
+		pagecount = int(math.Ceil(float64(len(list)) / float64(pagesize)))
1511
+
1512
+		var ress []*Result
1513
+		for curpage = 1; curpage <= pagecount; curpage++ {
1514
+			if curpage == 1 {
1515
+				start = 1
1516
+			} else {
1517
+				start = (curpage-1)*pagesize + 1
1518
+			}
1519
+			stop = curpage * pagesize
1520
+			if stop > len(list) {
1521
+				stop = len(list)
1522
+			}
1523
+			//这里就可以查看开始和结束了
1524
+			fmt.Println(list[start-1 : stop])
1525
+			var customs []*models.DrugDetail
1526
+			for _, item := range list {
1527
+				fmt.Println("医疗机构编码", item.MedicalInsuranceNumber)
1528
+				detail := &models.DrugDetail{
1529
+
1530
+					MedicalInsuranceNumber: item.MedicalInsuranceNumber, //社保目录
1531
+					Code:                   item.Code,                   //协议机构内部目录编码
1532
+					DrugName:               item.DrugName,               //协议机构内部目录名称
1533
+					DrugSpec:               item.DrugSpec,
1534
+					ManufacturerName:       item.ManufacturerName,
1535
+					MinUnit:                item.MinUnit,
1536
+					RetailPrice:            item.RetailPrice, //协议机构内部项目收费价格
1537
+					LimitRemark:            item.LimitRemark,
1538
+				}
1539
+				customs = append(customs, detail)
1540
+			}
1541
+			result := service.SzybML010(doctor_name, doctor_code, miConfig.Code, customs, type_id)
1542
+			fmt.Println("reuslt", result)
1543
+			var dat map[string]interface{}
1544
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
1545
+				fmt.Println(dat)
1546
+			} else {
1547
+				fmt.Println(err)
1548
+			}
1520 1549
 
1521
-				MedicalInsuranceNumber: item.MedicalInsuranceNumber, //社保目录
1522
-				Code:                   item.Code,                   //协议机构内部目录编码
1523
-				DrugName:               item.DrugName,               //协议机构内部目录名称
1524
-				DrugSpec:               item.DrugSpec,
1525
-				ManufacturerName:       item.ManufacturerName,
1526
-				MinUnit:                item.MinUnit,
1527
-				RetailPrice:            item.RetailPrice, //协议机构内部项目收费价格
1528
-				LimitRemark:            item.LimitRemark,
1550
+			userJSONBytes, _ := json.Marshal(dat)
1551
+
1552
+			var res Result
1553
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
1554
+				utils.ErrorLog("解析失败:%v", err)
1555
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1556
+				return
1529 1557
 			}
1530
-			customs = append(customs, detail)
1531
-		}
1532
-		result := service.SzybML010(doctor_name, doctor_code, miConfig.Code, customs)
1533
-		fmt.Println("reuslt9999999999999999", result)
1534
-		var dat map[string]interface{}
1535
-		if err := json.Unmarshal([]byte(result), &dat); err == nil {
1536
-			fmt.Println(dat)
1537
-		} else {
1538
-			fmt.Println(err)
1558
+			if res.Transreturncode == "00000000" {
1559
+				ress = append(ress, &res)
1560
+			} else {
1561
+				isSuccess = false
1562
+				//失败
1563
+
1564
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorDrugReturnFaildParamWrong)
1565
+				return
1566
+			}
1567
+			fmt.Println(isSuccess)
1539 1568
 		}
1540 1569
 
1541
-		userJSONBytes, _ := json.Marshal(dat)
1570
+	}
1542 1571
 
1543
-		var res Result
1544
-		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
1545
-			utils.ErrorLog("解析失败:%v", err)
1546
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1547
-			return
1548
-		}
1549
-		if res.Transreturncode == "00000000" {
1550
-			ress = append(ress, &res)
1551
-		} else {
1552
-			isSuccess = false
1553
-			//失败
1572
+	if type_id == 3 {
1554 1573
 
1555
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePreSettleFaildParamWrong)
1556
-			return
1574
+		//获取药品库数据
1575
+		list, _ := service.GetGoodListByDetail(10028, id)
1576
+
1577
+		miConfig, _ := service.FindMedicalInsuranceInfo(10028)
1578
+		var doctor_name string
1579
+		var doctor_code string
1580
+
1581
+		doctor_name = "黄亦轩"
1582
+		doctor_code = "1001"
1583
+
1584
+		var pagesize int = 50
1585
+		var start int = 1
1586
+		var stop int
1587
+		var pagecount int
1588
+		var curpage int
1589
+		var isSuccess bool = true
1590
+		//总页数,向上取整,注意除之前要先转换类型为float64
1591
+		pagecount = int(math.Ceil(float64(len(list)) / float64(pagesize)))
1592
+
1593
+		var ress []*Result
1594
+		for curpage = 1; curpage <= pagecount; curpage++ {
1595
+			if curpage == 1 {
1596
+				start = 1
1597
+			} else {
1598
+				start = (curpage-1)*pagesize + 1
1599
+			}
1600
+			stop = curpage * pagesize
1601
+			if stop > len(list) {
1602
+				stop = len(list)
1603
+			}
1604
+			//这里就可以查看开始和结束了
1605
+			fmt.Println(list[start-1 : stop])
1606
+			var customs []*models.DrugDetail
1607
+			for _, item := range list {
1608
+				fmt.Println("医疗机构编码", item.MedicalInsuranceNumber)
1609
+				detail := &models.DrugDetail{
1610
+					SocialSecurityDirectoryCode: item.SocialSecurityDirectoryCode,
1611
+					ManufacturerName:            item.ManufacturerName,
1612
+				}
1613
+				customs = append(customs, detail)
1614
+			}
1615
+			result := service.SzybML010(doctor_name, doctor_code, miConfig.Code, customs, type_id)
1616
+			fmt.Println("reuslt", result)
1617
+			var dat map[string]interface{}
1618
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
1619
+				fmt.Println(dat)
1620
+			} else {
1621
+				fmt.Println(err)
1622
+			}
1623
+
1624
+			userJSONBytes, _ := json.Marshal(dat)
1625
+
1626
+			var res Result
1627
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
1628
+				utils.ErrorLog("解析失败:%v", err)
1629
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1630
+				return
1631
+			}
1632
+			if res.Transreturncode == "00000000" {
1633
+				ress = append(ress, &res)
1634
+			} else {
1635
+				isSuccess = false
1636
+				//失败
1637
+
1638
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorDrugReturnFaildParamWrong)
1639
+				return
1640
+			}
1641
+			fmt.Println(isSuccess)
1557 1642
 		}
1558
-		fmt.Println(isSuccess)
1643
+
1559 1644
 	}
1645
+
1560 1646
 }
1561 1647
 
1562 1648
 //func  (c *SZHisApiController) GetInformationQuery()  {
@@ -1646,41 +1732,41 @@ func (c *SZHisApiController) GetDoctorList() {
1646 1732
 			detail := &models.DocDetail{
1647 1733
 				UserName:                                item.UserName,
1648 1734
 				RoleId:                                  item.Name,
1649
-				Sex:                                     "",
1650
-				CardType:                                "",
1651
-				IdCard:                                  "",
1652
-				Phone:                                   "",
1653
-				WorkMajorName:                           "",
1654
-				Nation:                                  "",
1735
+				Sex:                                     "1",
1736
+				CardType:                                "01",
1737
+				IdCard:                                  "430526199408156511",
1738
+				Phone:                                   "13318464642",
1739
+				WorkMajorName:                           "医生",
1740
+				Nation:                                  "01",
1655 1741
 				BirthDay:                                20201022,
1656
-				WorkTime:                                12,
1657
-				Education:                               "",
1658
-				StudyMajorName:                          "",
1659
-				CertificateCode:                         "",   //证书编码
1660
-				MedicalCode:                             "",   //医师资格编码
1661
-				MedicalRangeCode:                        "",   //医师执业范围代码
1662
-				MedicalLevel:                            "",   //医生级别
1663
-				TypeJob:                                 "",   //职业类别
1664
-				DoctorNumber:                            "",   //医师编号
1665
-				Licensing:                               "",   //职业标志
1666
-				DoctorServiceStatus:                     "",   //医师医保服务资格状态
1667
-				MonitoringLevel:                         "",   //监控等级
1668
-				DrugPsychotropicSubstances:              "",   //毒麻精神药品资格
1669
-				HealthCareCode:                          "",   // 母婴保健技术考核合格证书编号
1670
-				PlanningTechnicalServiceCode:            "",   //计划生育技术服务人员合格证编号
1671
-				PharmacistType:                          "",   //药师类别
1672
-				PharmacistPracticeCategory:              "",   //药师执业类别
1673
-				PharmacistsLicensing:                    "",   //药师执业范围
1674
-				PharmacistRegistrationNumber:            "",   //执业药师注册证编号
1675
-				OfficeCode:                              "",   //科室编码
1676
-				JobNumber:                               "",   //工号
1677
-				PostName:                                "",   //职位名称
1678
-				TechnicalJobLevelCode:                   "",   //专业技术职务级别编码
1679
-				IsActive:                                "",   //在职与否
1680
-				PrescriptionQualificationIdentification: "",   //处方资格标识
1681
-				IdentificationOutpatients:               "",   //门诊大病医师标识
1682
-				OutpatientIllnessCategory:               "",   //门诊大病类别
1683
-				StartTime:                               1233, //开始日期
1742
+				WorkTime:                                20201022,
1743
+				Education:                               "21",
1744
+				StudyMajorName:                          "医生",
1745
+				CertificateCode:                         "y2222222", //证书编码
1746
+				MedicalCode:                             "y2222222", //医师资格编码
1747
+				MedicalRangeCode:                        "101",      //医师执业范围代码
1748
+				MedicalLevel:                            "1",        //医生级别
1749
+				TypeJob:                                 "1",        //职业类别
1750
+				DoctorNumber:                            "22222",    //医师编号b
1751
+				Licensing:                               "1",        //职业标志
1752
+				DoctorServiceStatus:                     "1",        //医师医保服务资格状态
1753
+				MonitoringLevel:                         "1",        //监控等级
1754
+				DrugPsychotropicSubstances:              "1",        //毒麻精神药品资格
1755
+				HealthCareCode:                          "1001",     // 母婴保健技术考核合格证书编号
1756
+				PlanningTechnicalServiceCode:            "1002",     //计划生育技术服务人员合格证编号
1757
+				PharmacistType:                          "1",        //药师类别
1758
+				PharmacistPracticeCategory:              "1",        //药师执业类别
1759
+				PharmacistsLicensing:                    "1",        //药师执业范围
1760
+				PharmacistRegistrationNumber:            "000200",   //执业药师注册证编号
1761
+				OfficeCode:                              "9933",     //科室编码
1762
+				JobNumber:                               "82021344", //工号
1763
+				PostName:                                "主任",       //职位名称
1764
+				TechnicalJobLevelCode:                   "231",      //专业技术职务级别编码
1765
+				IsActive:                                "1",        //在职与否
1766
+				PrescriptionQualificationIdentification: "1",        //处方资格标识
1767
+				IdentificationOutpatients:               "1",        //门诊大病医师标识
1768
+				OutpatientIllnessCategory:               "血友病",      //门诊大病类别
1769
+				StartTime:                               20210311,   //开始日期
1684 1770
 			}
1685 1771
 			customs = append(customs, detail)
1686 1772
 		}
@@ -1708,7 +1794,7 @@ func (c *SZHisApiController) GetDoctorList() {
1708 1794
 			isSuccess = false
1709 1795
 			//失败
1710 1796
 
1711
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePreSettleFaildParamWrong)
1797
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorDrugPreSettleFaildParamWrong)
1712 1798
 			return
1713 1799
 		}
1714 1800
 		fmt.Println(isSuccess)
@@ -1763,43 +1849,44 @@ func (c *SZHisApiController) GetMedicalList() {
1763 1849
 		for _, item := range list {
1764 1850
 			fmt.Println("医护类别", item.Name)
1765 1851
 			detail := &models.DocDetail{
1852
+				StaffCode:                               "H27224269",
1766 1853
 				UserName:                                item.UserName,
1767 1854
 				RoleId:                                  item.Name,
1768
-				Sex:                                     "",
1769
-				CardType:                                "",
1770
-				IdCard:                                  "",
1771
-				Phone:                                   "",
1772
-				WorkMajorName:                           "",
1773
-				Nation:                                  "",
1855
+				Sex:                                     "1",
1856
+				CardType:                                "01",
1857
+				IdCard:                                  "430526199408156511",
1858
+				Phone:                                   "13318464642",
1859
+				WorkMajorName:                           "医生",
1860
+				Nation:                                  "01",
1774 1861
 				BirthDay:                                20201022,
1775
-				WorkTime:                                12,
1776
-				Education:                               "",
1777
-				StudyMajorName:                          "",
1778
-				CertificateCode:                         "",   //证书编码
1779
-				MedicalCode:                             "",   //医师资格编码
1780
-				MedicalRangeCode:                        "",   //医师执业范围代码
1781
-				MedicalLevel:                            "",   //医生级别
1782
-				TypeJob:                                 "",   //职业类别
1783
-				DoctorNumber:                            "",   //医师编号
1784
-				Licensing:                               "",   //职业标志
1785
-				DoctorServiceStatus:                     "",   //医师医保服务资格状态
1786
-				MonitoringLevel:                         "",   //监控等级
1787
-				DrugPsychotropicSubstances:              "",   //毒麻精神药品资格
1788
-				HealthCareCode:                          "",   // 母婴保健技术考核合格证书编号
1789
-				PlanningTechnicalServiceCode:            "",   //计划生育技术服务人员合格证编号
1790
-				PharmacistType:                          "",   //药师类别
1791
-				PharmacistPracticeCategory:              "",   //药师执业类别
1792
-				PharmacistsLicensing:                    "",   //药师执业范围
1793
-				PharmacistRegistrationNumber:            "",   //执业药师注册证编号
1794
-				OfficeCode:                              "",   //科室编码
1795
-				JobNumber:                               "",   //工号
1796
-				PostName:                                "",   //职位名称
1797
-				TechnicalJobLevelCode:                   "",   //专业技术职务级别编码
1798
-				IsActive:                                "",   //在职与否
1799
-				PrescriptionQualificationIdentification: "",   //处方资格标识
1800
-				IdentificationOutpatients:               "",   //门诊大病医师标识
1801
-				OutpatientIllnessCategory:               "",   //门诊大病类别
1802
-				StartTime:                               1233, //开始日期
1862
+				WorkTime:                                20201022,
1863
+				Education:                               "21",
1864
+				StudyMajorName:                          "医生",
1865
+				CertificateCode:                         "y2222222", //证书编码
1866
+				MedicalCode:                             "y2222222", //医师资格编码
1867
+				MedicalRangeCode:                        "101",      //医师执业范围代码
1868
+				MedicalLevel:                            "1",        //医生级别
1869
+				TypeJob:                                 "1",        //职业类别
1870
+				DoctorNumber:                            "22222",    //医师编号b
1871
+				Licensing:                               "1",        //职业标志
1872
+				DoctorServiceStatus:                     "1",        //医师医保服务资格状态
1873
+				MonitoringLevel:                         "1",        //监控等级
1874
+				DrugPsychotropicSubstances:              "1",        //毒麻精神药品资格
1875
+				HealthCareCode:                          "1001",     // 母婴保健技术考核合格证书编号
1876
+				PlanningTechnicalServiceCode:            "1002",     //计划生育技术服务人员合格证编号
1877
+				PharmacistType:                          "1",        //药师类别
1878
+				PharmacistPracticeCategory:              "1",        //药师执业类别
1879
+				PharmacistsLicensing:                    "1",        //药师执业范围
1880
+				PharmacistRegistrationNumber:            "000200",   //执业药师注册证编号
1881
+				OfficeCode:                              "9933",     //科室编码
1882
+				JobNumber:                               "82021344", //工号
1883
+				PostName:                                "主任",       //职位名称
1884
+				TechnicalJobLevelCode:                   "231",      //专业技术职务级别编码
1885
+				IsActive:                                "1",        //在职与否
1886
+				PrescriptionQualificationIdentification: "1",        //处方资格标识
1887
+				IdentificationOutpatients:               "1",        //门诊大病医师标识
1888
+				OutpatientIllnessCategory:               "血友病",      //门诊大病类别
1889
+				StartTime:                               20210311,   //开始日期
1803 1890
 			}
1804 1891
 			customs = append(customs, detail)
1805 1892
 		}
@@ -1827,7 +1914,7 @@ func (c *SZHisApiController) GetMedicalList() {
1827 1914
 			isSuccess = false
1828 1915
 			//失败
1829 1916
 
1830
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePreSettleFaildParamWrong)
1917
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorDrugPreSettleFaildParamWrong)
1831 1918
 			return
1832 1919
 		}
1833 1920
 		fmt.Println(isSuccess)
@@ -1882,45 +1969,45 @@ func (c *SZHisApiController) GetUpdateMedicalList() {
1882 1969
 		for _, item := range list {
1883 1970
 			fmt.Println("医护类别", item.Name)
1884 1971
 			detail := &models.DocDetail{
1885
-				StaffCode:                               "",            //医护人员编码
1886
-				UserName:                                item.UserName, //医护人员姓名
1887
-				RoleId:                                  item.Name,     //医护人员类别
1888
-				Sex:                                     "",            //性别
1889
-				CardType:                                "",            //证件类型
1890
-				IdCard:                                  "",            //证件号码
1891
-				Phone:                                   "",            //联系电话
1892
-				WorkMajorName:                           "",            //现从事专业名称
1893
-				Nation:                                  "",            //民族
1894
-				BirthDay:                                20201022,      //出生日期
1895
-				WorkTime:                                12,            //参加工作日期
1896
-				Education:                               "",            //学历
1897
-				StudyMajorName:                          "",            //所学的专业名称
1898
-				CertificateCode:                         "",            //证书编码
1899
-				MedicalCode:                             "",            //医师资格编码
1900
-				MedicalRangeCode:                        "",            //医师执业范围代码
1901
-				MedicalLevel:                            "",            //医生级别
1902
-				TypeJob:                                 "",            //职业类别
1903
-				DoctorNumber:                            "",            //医师编号
1904
-				Licensing:                               "",            //职业标志
1905
-				DoctorServiceStatus:                     "",            //医师医保服务资格状态
1906
-				MonitoringLevel:                         "",            //监控等级
1907
-				DrugPsychotropicSubstances:              "",            //毒麻精神药品资格
1908
-				HealthCareCode:                          "",            // 母婴保健技术考核合格证书编号
1909
-				PlanningTechnicalServiceCode:            "",            //计划生育技术服务人员合格证编号
1910
-				PharmacistType:                          "",            //药师类别
1911
-				PharmacistPracticeCategory:              "",            //药师执业类别
1912
-				PharmacistsLicensing:                    "",            //药师执业范围
1913
-				PharmacistRegistrationNumber:            "",            //执业药师注册证编号
1914
-				OfficeCode:                              "",            //科室编码
1915
-				JobNumber:                               "",            //工号
1916
-				PostName:                                "",            //职位名称
1917
-				TechnicalJobLevelCode:                   "",            //专业技术职务级别编码
1918
-				IsActive:                                "",            //在职与否
1919
-				PrescriptionQualificationIdentification: "",            //处方资格标识
1920
-				IdentificationOutpatients:               "",            //门诊大病医师标识
1921
-				OutpatientIllnessCategory:               "",            //门诊大病类别
1922
-				StartTime:                               1233,          //开始日期
1923
-				EndTime:                                 123333,
1972
+				StaffCode:                               "H27224269", //医护人员编码
1973
+				UserName:                                item.UserName,
1974
+				RoleId:                                  "1",
1975
+				Sex:                                     "1",
1976
+				CardType:                                "01",
1977
+				IdCard:                                  "430526199408156511",
1978
+				Phone:                                   "13318464642",
1979
+				WorkMajorName:                           "医生",
1980
+				Nation:                                  "01",
1981
+				BirthDay:                                20201022,
1982
+				WorkTime:                                20201022,
1983
+				Education:                               "21",
1984
+				StudyMajorName:                          "医生",
1985
+				CertificateCode:                         "y2222222", //证书编码
1986
+				MedicalCode:                             "y2222222", //医师资格编码
1987
+				MedicalRangeCode:                        "101",      //医师执业范围代码
1988
+				MedicalLevel:                            "1",        //医生级别
1989
+				TypeJob:                                 "1",        //职业类别
1990
+				DoctorNumber:                            "22222",    //医师编号b
1991
+				Licensing:                               "1",        //职业标志
1992
+				DoctorServiceStatus:                     "1",        //医师医保服务资格状态
1993
+				MonitoringLevel:                         "1",        //监控等级
1994
+				DrugPsychotropicSubstances:              "1",        //毒麻精神药品资格
1995
+				HealthCareCode:                          "1001",     // 母婴保健技术考核合格证书编号
1996
+				PlanningTechnicalServiceCode:            "1002",     //计划生育技术服务人员合格证编号
1997
+				PharmacistType:                          "1",        //药师类别
1998
+				PharmacistPracticeCategory:              "1",        //药师执业类别
1999
+				PharmacistsLicensing:                    "1",        //药师执业范围
2000
+				PharmacistRegistrationNumber:            "000200",   //执业药师注册证编号
2001
+				OfficeCode:                              "9933",     //科室编码
2002
+				JobNumber:                               "82021344", //工号
2003
+				PostName:                                "主任",       //职位名称
2004
+				TechnicalJobLevelCode:                   "231",      //专业技术职务级别编码
2005
+				IsActive:                                "1",        //在职与否
2006
+				PrescriptionQualificationIdentification: "1",        //处方资格标识
2007
+				IdentificationOutpatients:               "1",        //门诊大病医师标识
2008
+				OutpatientIllnessCategory:               "血友病",      //门诊大病类别
2009
+				StartTime:                               20210311,   //开始日期
2010
+				EndTime:                                 20210313,
1924 2011
 			}
1925 2012
 			customs = append(customs, detail)
1926 2013
 		}
@@ -1948,7 +2035,89 @@ func (c *SZHisApiController) GetUpdateMedicalList() {
1948 2035
 			isSuccess = false
1949 2036
 			//失败
1950 2037
 
1951
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePreSettleFaildParamWrong)
2038
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorDrugPreSettleFaildParamWrong)
2039
+			return
2040
+		}
2041
+		fmt.Println(isSuccess)
2042
+
2043
+	}
2044
+}
2045
+
2046
+func (c *SZHisApiController) GetGoodsList() {
2047
+
2048
+	//获取所有耗材信息
2049
+	list, _ := service.GetGoodInformationList(10028)
2050
+	fmt.Println("list22222", list)
2051
+	//获取单位
2052
+	miConfig, _ := service.FindMedicalInsuranceInfo(10028)
2053
+	var doctor_name string
2054
+	var doctor_code string
2055
+
2056
+	doctor_name = "黄亦轩"
2057
+	doctor_code = "1001"
2058
+
2059
+	var pagesize int = 50
2060
+	var start int = 1
2061
+	var stop int
2062
+	var pagecount int
2063
+	var curpage int
2064
+	var isSuccess bool = true
2065
+	//总页数,向上取整,注意除之前要先转换类型为float64
2066
+	pagecount = int(math.Ceil(float64(len(list)) / float64(pagesize)))
2067
+
2068
+	var ress []*Result
2069
+	for curpage = 1; curpage <= pagecount; curpage++ {
2070
+		if curpage == 1 {
2071
+			start = 1
2072
+		} else {
2073
+			start = (curpage-1)*pagesize + 1
2074
+		}
2075
+		stop = curpage * pagesize
2076
+		if stop > len(list) {
2077
+			stop = len(list)
2078
+		}
2079
+		//这里就可以查看开始和结束了
2080
+		fmt.Println(list[start-1 : stop])
2081
+		var customs []*models.GoodDetail
2082
+		for _, item := range list {
2083
+
2084
+			detail := &models.GoodDetail{
2085
+				GoodName:                    item.GoodName,
2086
+				SocialSecurityDirectoryCode: item.SocialSecurityDirectoryCode,
2087
+				ManufacturerName:            item.ManufacturerName,
2088
+				ProductionType:              item.ProductionType,
2089
+				SpecialMedical:              item.SpecialMedical,
2090
+				BuyPrice:                    item.BuyPrice,
2091
+				SellPrice:                   item.SellPrice,
2092
+				Remark:                      item.Remark,
2093
+			}
2094
+			customs = append(customs, detail)
2095
+		}
2096
+
2097
+		result := service.SzybYML007(doctor_name, doctor_code, miConfig.Code, customs)
2098
+		fmt.Println("reuslt8888", result)
2099
+		var dat map[string]interface{}
2100
+		if err := json.Unmarshal([]byte(result), &dat); err == nil {
2101
+			fmt.Println(dat)
2102
+		} else {
2103
+			fmt.Println(err)
2104
+		}
2105
+
2106
+		userJSONBytes, _ := json.Marshal(dat)
2107
+
2108
+		var res Result
2109
+		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
2110
+			utils.ErrorLog("解析失败:%v", err)
2111
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2112
+			return
2113
+		}
2114
+		if res.Transreturncode == "00000000" {
2115
+			ress = append(ress, &res)
2116
+		} else {
2117
+			isSuccess = false
2118
+			//失败
2119
+
2120
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorDrugPreSettleFaildParamWrong)
1952 2121
 			return
1953 2122
 		}
1954 2123
 		fmt.Println(isSuccess)

+ 6 - 2
enums/error_code.go 查看文件

@@ -36,7 +36,7 @@ const ( // ErrorCode
36 36
 	ErrorCodeDBDelete         = 8003
37 37
 	ErrorCodeDBSelectNoResult = 8004
38 38
 	ErrorCodeDataException    = 8005
39
-
39
+	ErrorDrugDataException    = 8006
40 40
 	// 业务逻辑操作错误 9000+
41 41
 	ErrorCodeRoleNotExist           = 9001
42 42
 	ErrorCodeAdminUserNotExist      = 9002
@@ -240,6 +240,8 @@ const ( // ErrorCode
240 240
 	ErrorCodeHisOrderNoExistParamWrong = 30000
241 241
 
242 242
 	ErrorCodePreSettleFaildParamWrong = 30001
243
+	ErrorDrugPreSettleFaildParamWrong = 30002
244
+	ErrorDrugReturnFaildParamWrong    = 3003
243 245
 )
244 246
 
245 247
 var ErrCodeMsgs = map[int]string{
@@ -274,7 +276,7 @@ var ErrCodeMsgs = map[int]string{
274 276
 	ErrorCodeDBDelete:         "数据库删除出错",
275 277
 	ErrorCodeDBSelectNoResult: "查询无结果",
276 278
 	ErrorCodeDataException:    "数据异常",
277
-
279
+	ErrorDrugDataException:    "",
278 280
 	// 业务逻辑操作错误
279 281
 	ErrorCodeRoleNotExist:           "角色不存在",
280 282
 	ErrorCodeAdminUserNotExist:      "管理员不存在",
@@ -462,6 +464,8 @@ var ErrCodeMsgs = map[int]string{
462 464
 
463 465
 	ErrorCodePreSettleFaildParamWrong:  "预结算失败",
464 466
 	ErrorCodeHisOrderNoExistParamWrong: "订单不存在",
467
+	ErrorDrugPreSettleFaildParamWrong:  "备案失败",
468
+	ErrorDrugReturnFaildParamWrong:     "撤销失败",
465 469
 }
466 470
 
467 471
 type SGJError struct {

二進制
gdyb 查看文件


+ 102 - 0
models/drug.go 查看文件

@@ -147,3 +147,105 @@ type BaseDrugList struct {
147 147
 	ManufacturerName       string  `gorm:"column:manufacturer_name" json:"manufacturer_name" form:"manufacturer_name"`
148 148
 	DrugDosageName         string
149 149
 }
150
+
151
+type XtGoodInformation struct {
152
+	ID                          int64   `gorm:"column:id" json:"id" form:"id"`
153
+	GoodCode                    string  `gorm:"column:good_code" json:"good_code" form:"good_code"`
154
+	SpecificationName           string  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
155
+	GoodTypeId                  int64   `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
156
+	GoodUnit                    int64   `gorm:"column:good_unit" json:"good_unit" form:"good_unit"`
157
+	BuyPrice                    float64 `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
158
+	SellPrice                   float64 `gorm:"column:sell_price" json:"sell_price" form:"sell_price"`
159
+	Remark                      string  `gorm:"column:remark" json:"remark" form:"remark"`
160
+	Ctime                       int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
161
+	Mtime                       int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
162
+	Manufacturer                int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
163
+	Dealer                      int64   `gorm:"column:dealer" json:"dealer" form:"dealer"`
164
+	ExpiryDateWarnDayCount      int64   `gorm:"column:expiry_date_warn_day_count" json:"expiry_date_warn_day_count" form:"expiry_date_warn_day_count"`
165
+	StockWarnCount              int64   `gorm:"column:stock_warn_count" json:"stock_warn_count" form:"stock_warn_count"`
166
+	IsReuse                     int64   `gorm:"column:is_reuse" json:"is_reuse" form:"is_reuse"`
167
+	Status                      int64   `gorm:"column:status" json:"status" form:"status"`
168
+	FilmArea                    string  `gorm:"column:film_area" json:"film_area" form:"film_area"`
169
+	IsUse                       int64   `gorm:"column:is_use" json:"is_use" form:"is_use"`
170
+	FilmMaterialQuality         string  `gorm:"column:film_material_quality" json:"film_material_quality" form:"film_material_quality"`
171
+	OrgId                       int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
172
+	Modifier                    int64   `gorm:"column:modifier" json:"modifier" form:"modifier"`
173
+	Creater                     int64   `gorm:"column:creater" json:"creater" form:"creater"`
174
+	GoodName                    string  `gorm:"column:good_name" json:"good_name" form:"good_name"`
175
+	Pinyin                      string  `gorm:"column:pinyin" json:"pinyin" form:"pinyin"`
176
+	Wubi                        string  `gorm:"column:wubi" json:"wubi" form:"wubi"`
177
+	GoodKind                    int64   `gorm:"column:good_kind" json:"good_kind" form:"good_kind"`
178
+	MedicalInsuranceLevel       int64   `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
179
+	RetailPrice                 float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
180
+	MedicalInsuranceNumber      string  `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
181
+	IsSpecialDiseases           int64   `gorm:"column:is_special_diseases" json:"is_special_diseases" form:"is_special_diseases"`
182
+	IsRecord                    int64   `gorm:"column:is_record" json:"is_record" form:"is_record"`
183
+	StatisticsCategory          int64   `gorm:"column:statistics_category" json:"statistics_category" form:"statistics_category"`
184
+	GoodStatus                  string  `gorm:"column:good_status" json:"good_status" form:"good_status"`
185
+	DefaultCount                int64   `gorm:"column:default_count" json:"default_count" form:"default_count"`
186
+	Sign                        int64   `gorm:"column:sign" json:"sign" form:"sign"`
187
+	IsDefault                   int64   `gorm:"column:is_default" json:"is_default" form:"is_default"`
188
+	IsChargeUse                 int64   `gorm:"column:is_charge_use" json:"is_charge_use" form:"is_charge_use"`
189
+	IsChargePredict             int64   `gorm:"column:is_charge_predict" json:"is_charge_predict" form:"is_charge_predict"`
190
+	IsStatisticsWork            int64   `gorm:"column:is_statistics_work" json:"is_statistics_work" form:"is_statistics_work"`
191
+	Sort                        int64   `gorm:"column:sort" json:"sort" form:"sort"`
192
+	IsDoctorUse                 int64   `gorm:"column:is_doctor_use" json:"is_doctor_use" form:"is_doctor_use"`
193
+	Agent                       string  `gorm:"column:agent" json:"agent" form:"agent"`
194
+	GoodNumber                  string  `gorm:"column:good_number" json:"good_number" form:"good_number"`
195
+	CommdityCode                string  `gorm:"column:commdity_code" json:"commdity_code" form:"commdity_code"`
196
+	SocialSecurityDirectoryCode string  `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
197
+	ProductionType              string  `gorm:"column:production_type" json:"production_type" form:"production_type"`
198
+	SpecialMedical              string  `gorm:"column:special_medical" json:"special_medical" form:"special_medical"`
199
+	ManufacturerName            string  `gorm:"column:manufacturer_name" json:"manufacturer_name" form:"manufacturer_name"`
200
+}
201
+
202
+type GoodInformation struct {
203
+	ID                          int64   `gorm:"column:id" json:"id" form:"id"`
204
+	GoodCode                    string  `gorm:"column:good_code" json:"good_code" form:"good_code"`
205
+	SpecificationName           string  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
206
+	GoodTypeId                  int64   `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
207
+	GoodUnit                    int64   `gorm:"column:good_unit" json:"good_unit" form:"good_unit"`
208
+	BuyPrice                    float64 `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
209
+	SellPrice                   float64 `gorm:"column:sell_price" json:"sell_price" form:"sell_price"`
210
+	Remark                      string  `gorm:"column:remark" json:"remark" form:"remark"`
211
+	Ctime                       int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
212
+	Mtime                       int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
213
+	Manufacturer                int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
214
+	Dealer                      int64   `gorm:"column:dealer" json:"dealer" form:"dealer"`
215
+	ExpiryDateWarnDayCount      int64   `gorm:"column:expiry_date_warn_day_count" json:"expiry_date_warn_day_count" form:"expiry_date_warn_day_count"`
216
+	StockWarnCount              int64   `gorm:"column:stock_warn_count" json:"stock_warn_count" form:"stock_warn_count"`
217
+	IsReuse                     int64   `gorm:"column:is_reuse" json:"is_reuse" form:"is_reuse"`
218
+	Status                      int64   `gorm:"column:status" json:"status" form:"status"`
219
+	FilmArea                    string  `gorm:"column:film_area" json:"film_area" form:"film_area"`
220
+	IsUse                       int64   `gorm:"column:is_use" json:"is_use" form:"is_use"`
221
+	FilmMaterialQuality         string  `gorm:"column:film_material_quality" json:"film_material_quality" form:"film_material_quality"`
222
+	OrgId                       int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
223
+	Modifier                    int64   `gorm:"column:modifier" json:"modifier" form:"modifier"`
224
+	Creater                     int64   `gorm:"column:creater" json:"creater" form:"creater"`
225
+	GoodName                    string  `gorm:"column:good_name" json:"good_name" form:"good_name"`
226
+	Pinyin                      string  `gorm:"column:pinyin" json:"pinyin" form:"pinyin"`
227
+	Wubi                        string  `gorm:"column:wubi" json:"wubi" form:"wubi"`
228
+	GoodKind                    int64   `gorm:"column:good_kind" json:"good_kind" form:"good_kind"`
229
+	MedicalInsuranceLevel       int64   `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
230
+	RetailPrice                 float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
231
+	MedicalInsuranceNumber      string  `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
232
+	IsSpecialDiseases           int64   `gorm:"column:is_special_diseases" json:"is_special_diseases" form:"is_special_diseases"`
233
+	IsRecord                    int64   `gorm:"column:is_record" json:"is_record" form:"is_record"`
234
+	StatisticsCategory          int64   `gorm:"column:statistics_category" json:"statistics_category" form:"statistics_category"`
235
+	GoodStatus                  string  `gorm:"column:good_status" json:"good_status" form:"good_status"`
236
+	DefaultCount                int64   `gorm:"column:default_count" json:"default_count" form:"default_count"`
237
+	Sign                        int64   `gorm:"column:sign" json:"sign" form:"sign"`
238
+	IsDefault                   int64   `gorm:"column:is_default" json:"is_default" form:"is_default"`
239
+	IsChargeUse                 int64   `gorm:"column:is_charge_use" json:"is_charge_use" form:"is_charge_use"`
240
+	IsChargePredict             int64   `gorm:"column:is_charge_predict" json:"is_charge_predict" form:"is_charge_predict"`
241
+	IsStatisticsWork            int64   `gorm:"column:is_statistics_work" json:"is_statistics_work" form:"is_statistics_work"`
242
+	Sort                        int64   `gorm:"column:sort" json:"sort" form:"sort"`
243
+	IsDoctorUse                 int64   `gorm:"column:is_doctor_use" json:"is_doctor_use" form:"is_doctor_use"`
244
+	Agent                       string  `gorm:"column:agent" json:"agent" form:"agent"`
245
+	GoodNumber                  string  `gorm:"column:good_number" json:"good_number" form:"good_number"`
246
+	CommdityCode                string  `gorm:"column:commdity_code" json:"commdity_code" form:"commdity_code"`
247
+	SocialSecurityDirectoryCode string  `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
248
+	ProductionType              string  `gorm:"column:production_type" json:"production_type" form:"production_type"`
249
+	SpecialMedical              string  `gorm:"column:special_medical" json:"special_medical" form:"special_medical"`
250
+	ManufacturerName            string  `gorm:"column:manufacturer_name" json:"manufacturer_name" form:"manufacturer_name"`
251
+}

+ 24 - 10
models/sz_his_models.go 查看文件

@@ -20,16 +20,17 @@ type CustomDetail struct {
20 20
 }
21 21
 
22 22
 type DrugDetail struct {
23
-	MedicalInsuranceNumber string  //社保目录编码
24
-	Code                   string  // 药品本位码
25
-	DrugName               string  //医药机构内部目录名称
26
-	DrugSpec               string  //规格
27
-	DrugDosageName         string  //剂型
28
-	MinUnit                string  //计价单位
29
-	ManufacturerName       string  //厂家
30
-	RetailPrice            float64 //药品收费价格
31
-	LastPrice              float64 // 药品进货价格
32
-	LimitRemark            string  //药品备注
23
+	MedicalInsuranceNumber      string  //社保目录编码
24
+	Code                        string  // 药品本位码
25
+	DrugName                    string  //医药机构内部目录名称
26
+	DrugSpec                    string  //规格
27
+	DrugDosageName              string  //剂型
28
+	MinUnit                     string  //计价单位
29
+	ManufacturerName            string  //厂家
30
+	RetailPrice                 float64 //药品收费价格
31
+	LastPrice                   float64 // 药品进货价格
32
+	LimitRemark                 string  //药品备注
33
+	SocialSecurityDirectoryCode string  //社保目录编码
33 34
 }
34 35
 
35 36
 type DocDetail struct {
@@ -73,3 +74,16 @@ type DocDetail struct {
73 74
 	StaffCode                               string //医护人员编码
74 75
 	EndTime                                 int64  // 结束日期
75 76
 }
77
+
78
+type GoodDetail struct {
79
+	SpecificationName           string
80
+	GoodName                    string
81
+	MinUnit                     string  //计价单位
82
+	ManufacturerName            string  //厂家
83
+	BuyPrice                    float64 //进货价格
84
+	SellPrice                   float64 //出售价格
85
+	SocialSecurityDirectoryCode string  //社保目录编码
86
+	ProductionType              string  //生产地类别
87
+	SpecialMedical              string  //特殊医用材料标识
88
+	Remark                      string  //备注
89
+}

+ 37 - 1
service/his_service.go 查看文件

@@ -986,7 +986,7 @@ func GetDrugDosageForm(orgid int64) (dataconfig []*models.XtDrugDataConfig, err
986 986
 
987 987
 func GetDoctorList(orgid int64) (role []*models.SgjUserAdminRole, err error) {
988 988
 
989
-	err = UserReadDB().Model(&role).Where("org_id = ? and status = 1", orgid).Find(&role).Error
989
+	err = UserReadDB().Model(&role).Where("org_id = ? and status = 1 and id = 2722", orgid).Find(&role).Error
990 990
 	return role, err
991 991
 }
992 992
 
@@ -995,3 +995,39 @@ func GetRoleList(orgid int64) (role []*models.SgjUserRole, err error) {
995 995
 	err = UserReadDB().Model(&role).Where("org_id = ? and status =1", orgid).Find(&role).Error
996 996
 	return role, err
997 997
 }
998
+
999
+func GetDrugListByDetail(orgID int64, id int64) (drug []*models.BaseDrugList, err error) {
1000
+
1001
+	db := XTReadDB().Table("xt_base_drug as x").Where("x.status = 1")
1002
+	table := XTReadDB().Table("xt_manufacturer as m")
1003
+	fmt.Print(table)
1004
+	if orgID > 0 {
1005
+		db = db.Where("x.org_id = ? and x.id = ?", orgID, id)
1006
+	}
1007
+	err = db.Select("x.id,x.medical_insurance_number,x.code,x.drug_name,x.drug_spec,x.drug_type,x.min_unit,x.last_price,x.retail_price,x.limit_remark,x.drug_dosage_form,m.manufacturer_name").Joins("left join xt_manufacturer as m on m.id = x.manufacturer").Scan(&drug).Error
1008
+
1009
+	return drug, err
1010
+}
1011
+
1012
+func GetGoodInformationList(orgid int64) (good []*models.GoodInformation, err error) {
1013
+
1014
+	db := XTReadDB().Table("xt_good_information as x").Where("x.status=1")
1015
+	table := XTReadDB().Table("xt_manufacturer as m")
1016
+	fmt.Println(table)
1017
+	if orgid > 0 {
1018
+		db = db.Where("x.org_id = ? and x.id= 976", orgid)
1019
+	}
1020
+	err = db.Select("x.id,x.social_security_directory_code,x.good_name,x.specification_name,x.production_type,x.special_medical,x.good_unit,x.buy_price,x.sell_price,x.remark,m.manufacturer_name").Joins("left join xt_manufacturer as m on m.id = x.manufacturer").Scan(&good).Error
1021
+	return good, err
1022
+}
1023
+
1024
+func GetGoodListByDetail(orgid int64, id int64) (good []*models.GoodInformation, err error) {
1025
+	db := XTReadDB().Table("xt_good_information as x").Where("x.status=1")
1026
+	table := XTReadDB().Table("xt_manufacturer as m")
1027
+	fmt.Println(table)
1028
+	if orgid > 0 {
1029
+		db = db.Where("x.org_id = ? and x.id= ?", orgid, id)
1030
+	}
1031
+	err = db.Select("x.id,x.social_security_directory_code,x.good_name,x.specification_name,x.production_type,x.special_medical,x.good_unit,x.buy_price,x.sell_price,x.remark,m.manufacturer_name").Joins("left join xt_manufacturer as m on m.id = x.manufacturer").Scan(&good).Error
1032
+	return good, err
1033
+}

+ 76 - 9
service/sz_his_service.go 查看文件

@@ -8,6 +8,7 @@ import (
8 8
 	"io/ioutil"
9 9
 	"math/rand"
10 10
 	"net/http"
11
+	"strconv"
11 12
 	"time"
12 13
 	_ "unsafe"
13 14
 )
@@ -642,7 +643,7 @@ func SzybML009(doctor string, doctor_code string, fixmedins_code string, datas [
642 643
 
643 644
 }
644 645
 
645
-func SzybML010(doctor string, doctor_code string, fixmedins_code string, datas []*models.DrugDetail) string {
646
+func SzybML010(doctor string, doctor_code string, fixmedins_code string, datas []*models.DrugDetail, typeId int64) string {
646 647
 	//生成输入报文
647 648
 	inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code)
648 649
 
@@ -654,7 +655,7 @@ func SzybML010(doctor string, doctor_code string, fixmedins_code string, datas [
654 655
 
655 656
 	for _, item := range datas {
656 657
 		feedetailInfo := make(map[string]interface{})
657
-		feedetailInfo["ake003"] = "1"
658
+		feedetailInfo["ake003"] = strconv.FormatInt(typeId, 10)
658 659
 		feedetailInfo["ake001"] = item.MedicalInsuranceNumber //社保目录编码
659 660
 		feedetailInfo["ake005"] = "110100002"                 //协议机构内部目录编码
660 661
 		feedetail = append(feedetail, feedetailInfo)
@@ -705,13 +706,14 @@ func SzybYS001(doctor string, doctor_code string, fixmedins_code string, datas [
705 706
 	inputData := make(map[string]interface{})
706 707
 
707 708
 	inputData["listsize"] = len(datas)
708
-	inputMessage["transType"] = "ML010" // 交易编码
709
+	inputMessage["transType"] = "YS001" // 交易编码
709 710
 	feedetail := make([]map[string]interface{}, 0)
710 711
 
711 712
 	for _, item := range datas {
713
+		fmt.Println("item222222", item.RoleId)
712 714
 		feedetailInfo := make(map[string]interface{})
713 715
 		feedetailInfo["aac003"] = item.UserName
714
-		feedetailInfo["bka633"] = item.RoleId
716
+		feedetailInfo["bka633"] = "1"
715 717
 		feedetailInfo["aac004"] = item.Sex
716 718
 		feedetailInfo["aac058"] = item.CardType
717 719
 		feedetailInfo["aac147"] = item.IdCard
@@ -796,14 +798,14 @@ func SzybYS002(doctor string, doctor_code string, fixmedins_code string, datas [
796 798
 	inputData := make(map[string]interface{})
797 799
 
798 800
 	inputData["listsize"] = len(datas)
799
-	inputMessage["transType"] = "ML010" // 交易编码
801
+	inputMessage["transType"] = "YS002" // 交易编码
800 802
 	feedetail := make([]map[string]interface{}, 0)
801 803
 
802 804
 	for _, item := range datas {
803 805
 		fmt.Println("item2222", item)
804 806
 		feedetailInfo := make(map[string]interface{})
805
-		feedetailInfo["bkc320"] = 1111
806
-		feedetailInfo["bke155"] = ""
807
+		feedetailInfo["bkc320"] = "H27224269"
808
+		feedetailInfo["bke155"] = "4"
807 809
 		feedetail = append(feedetail, feedetailInfo)
808 810
 	}
809 811
 
@@ -852,12 +854,12 @@ func SzybYS003(doctor string, doctor_code string, fixmedins_code string, datas [
852 854
 	inputData := make(map[string]interface{})
853 855
 
854 856
 	inputData["listsize"] = len(datas)
855
-	inputMessage["transType"] = "ML010" // 交易编码
857
+	inputMessage["transType"] = "YS003" // 交易编码
856 858
 	feedetail := make([]map[string]interface{}, 0)
857 859
 
858 860
 	for _, item := range datas {
859 861
 		feedetailInfo := make(map[string]interface{})
860
-		feedetailInfo["bkc320"] = ""
862
+		feedetailInfo["bkc320"] = item.StaffCode
861 863
 		feedetailInfo["aac003"] = item.UserName
862 864
 		feedetailInfo["bka633"] = item.RoleId
863 865
 		feedetailInfo["aac004"] = item.Sex
@@ -935,3 +937,68 @@ func SzybYS003(doctor string, doctor_code string, fixmedins_code string, datas [
935 937
 	str := string(respBytes)
936 938
 	return str
937 939
 }
940
+
941
+func SzybYML007(doctor string, doctor_code string, fixmedins_code string, datas []*models.GoodDetail) string {
942
+
943
+	//生成输入报文
944
+	inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code)
945
+
946
+	inputData := make(map[string]interface{})
947
+
948
+	inputData["listsize"] = len(datas)
949
+	inputMessage["transType"] = "ML007" // 交易编码
950
+	feedetail := make([]map[string]interface{}, 0)
951
+
952
+	for _, item := range datas {
953
+		fmt.Println("item222222222", item.BuyPrice)
954
+		feedetailInfo := make(map[string]interface{})
955
+		feedetailInfo["ake001"] = item.SocialSecurityDirectoryCode // 社保目录编码
956
+		feedetailInfo["ake005"] = "110100002"                      //协议机构内部目录编码
957
+		feedetailInfo["ake006"] = item.GoodName                    //医药机构内部目录名称
958
+		feedetailInfo["bka053"] = item.ManufacturerName            //生产厂家
959
+		feedetailInfo["ake004"] = "1"                              //生产地类别
960
+		feedetailInfo["ckf261"] = "1"                              //特殊医用材料标识
961
+		feedetailInfo["aka067"] = "支"                              //计价单位
962
+		feedetailInfo["aka074"] = "ftp"                            //规格
963
+		feedetailInfo["bka505"] = item.BuyPrice                    //进货价
964
+		feedetailInfo["bka506"] = item.SellPrice                   // 收获价
965
+		feedetailInfo["aae013"] = item.Remark                      //备注
966
+		feedetail = append(feedetail, feedetailInfo)
967
+	}
968
+
969
+	inputData["inputlist"] = feedetail
970
+	inputMessage["transBody"] = inputData
971
+
972
+	bytesData, err := json.Marshal(inputMessage)
973
+	fmt.Println(string(bytesData))
974
+	if err != nil {
975
+		fmt.Println(err.Error())
976
+		return err.Error()
977
+	}
978
+	reader := bytes.NewReader(bytesData)
979
+	//url := "http://192.168.1.99:10000"
980
+	url := "http://192.168.1.228:17001/szsi-portal/transData"
981
+
982
+	request, err := http.NewRequest("POST", url, reader)
983
+	if err != nil {
984
+		fmt.Println(err.Error())
985
+		return err.Error()
986
+	}
987
+
988
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
989
+
990
+	client := http.Client{}
991
+	resp, err := client.Do(request)
992
+	if err != nil {
993
+		fmt.Println(err.Error())
994
+		return err.Error()
995
+	}
996
+	respBytes, err := ioutil.ReadAll(resp.Body)
997
+	if err != nil {
998
+		fmt.Println(err.Error())
999
+		return err.Error()
1000
+	}
1001
+	fmt.Println(string(respBytes))
1002
+	str := string(respBytes)
1003
+	return str
1004
+}