Browse Source

历史排班

28169 1 year ago
parent
commit
3781b0f231

+ 52 - 30
controllers/manage_api_controller.go View File

@@ -155,6 +155,9 @@ func ManageRouters() {
155 155
 	beego.Router("/api/manage/getobjectregistrationbyidlist", &MachineApiController{}, "Get:GetObjectRegistrationByIdList")
156 156
 	beego.Router("/api/manage/updateobjectregistration", &MachineApiController{}, "Post:UpdateObjectRegistration")
157 157
 	beego.Router("/api/manage/deleteobjectregistration", &MachineApiController{}, "Get:DeleteObjectTregistration")
158
+
159
+	beego.Router("/api/manage/getregistgoodinforlist", &MachineApiController{}, "Get:GetRegistGoodInforList")
160
+	beego.Router("/api/manage/getregistnumber", &MachineApiController{}, "Get:GetRegistNumber")
158 161
 }
159 162
 
160 163
 func (this *MachineApiController) SaveManageInfo() {
@@ -230,6 +233,7 @@ func (this *MachineApiController) SaveManageInfo() {
230 233
 	work_time := dataBody["work_time"].(string)
231 234
 	treat_types := dataBody["treat_type"].([]interface{})
232 235
 	revers := int64(dataBody["revers_mode"].(float64))
236
+	zone_id := int64(dataBody["zone_id"].(float64))
233 237
 	ids := make([]int64, 0)
234 238
 	for _, treat := range treat_types {
235 239
 		id := int64(treat.(float64))
@@ -248,7 +252,7 @@ func (this *MachineApiController) SaveManageInfo() {
248 252
 		DeviceType:          device_type,
249 253
 		BedNumber:           number.Number,
250 254
 		BedId:               bed_number,
251
-		ZoneId:              number.ZoneID,
255
+		ZoneId:              zone_id,
252 256
 		DeviceName:          device_name,
253 257
 		ManufactureFactory:  manufacture_factory,
254 258
 		ServiceManufacturer: service_manufacturer,
@@ -363,6 +367,7 @@ func (this *MachineApiController) UpdateMachineInfo() {
363 367
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisNoExist)
364 368
 		return
365 369
 	}
370
+	zone_id := int64(dataBody["zone_id"].(float64))
366 371
 	addmacher := models.DeviceAddmacher{
367 372
 		ID:                  id,
368 373
 		SerialNumber:        serial_number,
@@ -388,6 +393,7 @@ func (this *MachineApiController) UpdateMachineInfo() {
388 393
 		RubbishReason:       rubbish_reason,
389 394
 		UserYear:            user_year,
390 395
 		WorkTime:            work_time,
396
+		ZoneId:              zone_id,
391 397
 	}
392 398
 	err = service.UpdateMachine(id, orgid, &addmacher)
393 399
 	errors := service.UpdateTreatMode(id, orgid, ids)
@@ -490,6 +496,7 @@ func (this *MachineApiController) UpdateMachinetwo() {
490 496
 
491 497
 	revers_modes := int64(dataBody["revers_mode"].(float64))
492 498
 
499
+	zone_id := int64(dataBody["zone_id"].(float64))
493 500
 	addmacher := models.DeviceAddmacher{
494 501
 		ID:                  id,
495 502
 		SerialNumber:        serial_number,
@@ -516,6 +523,7 @@ func (this *MachineApiController) UpdateMachinetwo() {
516 523
 		WorkTime:            work_time,
517 524
 		DisinfectionMode:    disinfection_mode,
518 525
 		ReversMode:          revers_modes,
526
+		ZoneId:              zone_id,
519 527
 	}
520 528
 	fmt.Println("addmacher", addmacher)
521 529
 	err = service.UpdateMachine(id, orgid, &addmacher)
@@ -2748,32 +2756,20 @@ func (this *MachineApiController) GetTimeWarning() {
2748 2756
 func (this *MachineApiController) SaveManageinfoTwo() {
2749 2757
 	adminUserInfo := this.GetAdminUserInfo()
2750 2758
 	orgid := adminUserInfo.CurrentOrgId
2751
-	fmt.Println("机构id", orgid)
2752 2759
 	dataBody := make(map[string]interface{}, 0)
2753 2760
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
2754 2761
 	fmt.Println("err", err)
2755 2762
 	serial_numbe := dataBody["serial_number"].(string)
2756
-	fmt.Println("序列号", serial_numbe)
2757 2763
 	device_type := int64(dataBody["device_type"].(float64))
2758
-	fmt.Println("设备类型", device_type)
2759
-	//bed_number := dataBody["beds"].(string)
2760
-	//fmt.Println("床位号", bed_number)
2761 2764
 	bed_number := this.GetString("beds")
2762 2765
 	device_name := dataBody["device_name"].(string)
2763
-	fmt.Println("设备名称", device_name)
2764 2766
 	manufacture_factory := dataBody["manufacture_factory"].(string)
2765
-	fmt.Println("生产厂家", manufacture_factory)
2766 2767
 	service_manufacturer := dataBody["service_manufacturer"].(string)
2767
-	fmt.Println("维修厂家", service_manufacturer)
2768 2768
 	unit_type := int64(dataBody["unit_type"].(float64))
2769
-	//unit_type := strconv.FormatInt(unittype, 10)
2770
-	//fmt.Println("设备型号", unit_type)
2771 2769
 	use_section := dataBody["use_section"].(string)
2772
-	fmt.Println("使用科室", use_section)
2773 2770
 	section_number := dataBody["section_number"].(string)
2774
-	fmt.Println("科室编号", section_number)
2775 2771
 	buy_date := dataBody["buy_date"].(string)
2776
-	fmt.Println("buy_date", buy_date)
2772
+
2777 2773
 	timeLayout := "2006-01-02 15:04:05"
2778 2774
 	theTime, err := utils.ParseTimeStringToTime(timeLayout, buy_date+" 00:00:00")
2779 2775
 	buydate := theTime.Unix()
@@ -2781,7 +2777,6 @@ func (this *MachineApiController) SaveManageinfoTwo() {
2781 2777
 	if int_num < 0 {
2782 2778
 		buydate = 0
2783 2779
 	}
2784
-	fmt.Println("购买日期", buydate)
2785 2780
 
2786 2781
 	install_date := dataBody["install_date"].(string)
2787 2782
 	toTime, err := utils.ParseTimeStringToTime(timeLayout, install_date+" 00:00:00")
@@ -2790,7 +2785,6 @@ func (this *MachineApiController) SaveManageinfoTwo() {
2790 2785
 	if buy_num < 0 {
2791 2786
 		installdate = 0
2792 2787
 	}
2793
-	fmt.Println("安装日期", installdate)
2794 2788
 
2795 2789
 	start_date := dataBody["start_date"].(string)
2796 2790
 	stringToTime, err := utils.ParseTimeStringToTime(timeLayout, start_date+" 00:00:00")
@@ -2799,20 +2793,12 @@ func (this *MachineApiController) SaveManageinfoTwo() {
2799 2793
 	if start_num < 0 {
2800 2794
 		startdate = 0
2801 2795
 	}
2802
-	fmt.Println("启用日期", startdate)
2803
-
2804 2796
 	maintenance_engineer := dataBody["maintenance_engineer"].(string)
2805
-	fmt.Println("维修工程", maintenance_engineer)
2806 2797
 	telephone := dataBody["telephone"].(string)
2807
-	fmt.Println("telephone", telephone)
2808 2798
 	guarantee_date := dataBody["guarantee_date"].(string)
2809
-	fmt.Println("保修期限", guarantee_date)
2810 2799
 	machine_status := int64(dataBody["machine_status"].(float64))
2811
-	fmt.Println("机器状态", machine_status)
2812 2800
 	disinfection_mode := int64(dataBody["Disinfection_mode"].(float64))
2813
-	fmt.Println("消毒方式", disinfection_mode)
2814 2801
 	remarks := dataBody["remarks"].(string)
2815
-	fmt.Println("备注", remarks)
2816 2802
 	rubbish_date := dataBody["rubbish_date"].(string)
2817 2803
 	timeStringToTime, err := utils.ParseTimeStringToTime(timeLayout, rubbish_date+" 00:00:00")
2818 2804
 	rubbishdate := timeStringToTime.Unix()
@@ -2820,16 +2806,11 @@ func (this *MachineApiController) SaveManageinfoTwo() {
2820 2806
 	if rubb_num < 0 {
2821 2807
 		rubbishdate = 0
2822 2808
 	}
2823
-	fmt.Println("报废日期", rubbishdate)
2824 2809
 	rubbish_reason := int64(dataBody["rubbish_reason"].(float64))
2825
-	fmt.Println("报废原因", rubbish_reason)
2826 2810
 	user_year := dataBody["user_year"].(string)
2827
-	fmt.Println("使用年限", user_year)
2828 2811
 	work_time := dataBody["work_time"].(string)
2829
-	fmt.Println("工作时长", work_time)
2830 2812
 	revers := int64(dataBody["revers_mode"].(float64))
2831
-	fmt.Println("反渗模式", revers)
2832
-
2813
+	zone_id := int64(dataBody["zone_id"].(float64))
2833 2814
 	addmacher := &models.DeviceAddmacher{
2834 2815
 		SerialNumber:        serial_numbe,
2835 2816
 		DeviceType:          device_type,
@@ -2857,6 +2838,7 @@ func (this *MachineApiController) SaveManageinfoTwo() {
2857 2838
 		Status:              1,
2858 2839
 		Ctime:               time.Now().Unix(),
2859 2840
 		UserOrgId:           orgid,
2841
+		ZoneId:              zone_id,
2860 2842
 	}
2861 2843
 	err = service.CreateMacher(addmacher)
2862 2844
 	fmt.Println("什么原因啊", err)
@@ -3646,6 +3628,7 @@ func (this *MachineApiController) GetAllDoctorList() {
3646 3628
 	appId := this.GetAdminUserInfo().CurrentAppId
3647 3629
 	list, err := service.GetAllDoctorTwo(orgId, appId)
3648 3630
 	operators, err := service.GetAdminUserEsOne(orgId)
3631
+
3649 3632
 	if err != nil {
3650 3633
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
3651 3634
 		return
@@ -5692,3 +5675,42 @@ func (this *MachineApiController) DeleteObjectTregistration() {
5692 5675
 	})
5693 5676
 	return
5694 5677
 }
5678
+
5679
+func (this *MachineApiController) GetRegistGoodInforList() {
5680
+
5681
+	orgId := this.GetAdminUserInfo().CurrentOrgId
5682
+
5683
+	list, err := service.GetRegistGoodInforList(orgId)
5684
+
5685
+	if err != nil {
5686
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
5687
+		return
5688
+	}
5689
+	this.ServeSuccessJSON(map[string]interface{}{
5690
+		"list": list,
5691
+	})
5692
+	return
5693
+}
5694
+
5695
+func (this *MachineApiController) GetRegistNumber() {
5696
+
5697
+	id, _ := this.GetInt64("id")
5698
+	record_date := this.GetString("record_date")
5699
+	timeLayout := "2006-01-02"
5700
+	loc, _ := time.LoadLocation("Local")
5701
+	dataBody := make(map[string]interface{}, 0)
5702
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
5703
+	fmt.Println(err)
5704
+	recorddate, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
5705
+	recorddateunix := recorddate.Unix()
5706
+	orgId := this.GetAdminUserInfo().CurrentOrgId
5707
+	infor, err := service.GetRegistNumber(recorddateunix, id, orgId)
5708
+	if err != nil {
5709
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
5710
+		return
5711
+	}
5712
+	this.ServeSuccessJSON(map[string]interface{}{
5713
+		"list": infor,
5714
+	})
5715
+	return
5716
+}

+ 32 - 0
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -2296,6 +2296,14 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2296 2296
 				newprescribe.Bicarbonate = 31.1
2297 2297
 				newprescribe.DialysateFlow = 500
2298 2298
 			}
2299
+			appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
2300
+			//
2301
+			if appRole.UserType == 2 || appRole.UserType == 1 {
2302
+				newprescribe.PrescriptionDoctor = adminUserInfo.AdminUser.Id
2303
+				if adminUserInfo.Org.Id == 9882 {
2304
+					newprescribe.Creater = adminUserInfo.AdminUser.Id
2305
+				}
2306
+			}
2299 2307
 			err := service.UpDateDialysisPrescription(&newprescribe)
2300 2308
 			//获取key,清空redis
2301 2309
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
@@ -2410,6 +2418,14 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2410 2418
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
2411 2419
 				}
2412 2420
 			} else {
2421
+				appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
2422
+				//
2423
+				if appRole.UserType == 2 || appRole.UserType == 1 {
2424
+					newprescribe.PrescriptionDoctor = adminUserInfo.AdminUser.Id
2425
+					if adminUserInfo.Org.Id == 9882 {
2426
+						newprescribe.Creater = adminUserInfo.AdminUser.Id
2427
+					}
2428
+				}
2413 2429
 				err := service.UpDateDialysisPrescription(&newprescribe)
2414 2430
 				//获取key,清空redis
2415 2431
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
@@ -2529,6 +2545,14 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2529 2545
 					newprescribe.Bicarbonate = 31.1
2530 2546
 					newprescribe.DialysateFlow = 500
2531 2547
 				}
2548
+				appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
2549
+				//
2550
+				if appRole.UserType == 2 || appRole.UserType == 1 {
2551
+					newprescribe.PrescriptionDoctor = adminUserInfo.AdminUser.Id
2552
+					if adminUserInfo.Org.Id == 9882 {
2553
+						newprescribe.Creater = adminUserInfo.AdminUser.Id
2554
+					}
2555
+				}
2532 2556
 				err := service.UpDateDialysisPrescription(&newprescribe)
2533 2557
 				//获取key,清空redis
2534 2558
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
@@ -2609,6 +2633,14 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2609 2633
 					newprescribe.Bicarbonate = 31.1
2610 2634
 					newprescribe.DialysateFlow = 500
2611 2635
 				}
2636
+				appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
2637
+				//
2638
+				if appRole.UserType == 2 || appRole.UserType == 1 {
2639
+					newprescribe.PrescriptionDoctor = adminUserInfo.AdminUser.Id
2640
+					if adminUserInfo.Org.Id == 9882 {
2641
+						newprescribe.Creater = adminUserInfo.AdminUser.Id
2642
+					}
2643
+				}
2612 2644
 				err := service.UpDateDialysisPrescription(&newprescribe)
2613 2645
 				//获取key,清空redis
2614 2646
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"

+ 2 - 0
controllers/self_drug_api_congtroller.go View File

@@ -2726,6 +2726,7 @@ func (this *SelfDrugApiController) GetStorehouseList() {
2726 2726
 	manufacturerList, _ := service.GetNewAllManufacturerList(orgId)
2727 2727
 	goodType, _ := service.GetAllNewGoodType(orgId)
2728 2728
 	patientList, _ := service.GetAllpatientThirty(orgId)
2729
+	dealerList, _ := service.GetAllDealerList(orgId)
2729 2730
 	if err != nil {
2730 2731
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取仓库失败")
2731 2732
 		return
@@ -2736,6 +2737,7 @@ func (this *SelfDrugApiController) GetStorehouseList() {
2736 2737
 		"manufacturerList": manufacturerList,
2737 2738
 		"goodTypeList":     goodType,
2738 2739
 		"patientList":      patientList,
2740
+		"dealerList":       dealerList,
2739 2741
 	})
2740 2742
 }
2741 2743
 

+ 89 - 0
controllers/sign_api_controller.go View File

@@ -2,6 +2,7 @@ package controllers
2 2
 
3 3
 import (
4 4
 	"XT_New/service"
5
+	"encoding/json"
5 6
 	"fmt"
6 7
 	"github.com/astaxie/beego"
7 8
 )
@@ -14,6 +15,14 @@ func SignApiRegistRouters() {
14 15
 
15 16
 	//获取短信验证码
16 17
 	beego.Router("/api/sign/getsign", &SignApiController{}, "Get:GetSign")
18
+
19
+	//创建个人用户并实名
20
+	beego.Router("/api/sign/createrusername", &SignApiController{}, "Get:CreateUserName")
21
+
22
+	//创建个人印章
23
+	beego.Router("/api/sign/createpersionseal", &SignApiController{}, "Get:CreatePersionSeal")
24
+
25
+	//上传文件创建和他
17 26
 }
18 27
 
19 28
 // 短信服务接口
@@ -30,3 +39,83 @@ func (this *SignApiController) GetSign() {
30 39
 	return
31 40
 
32 41
 }
42
+
43
+type Result2121 struct {
44
+	Phone          string `json:"phone"`
45
+	DisPlayName    string `json:"dis_play_name"`
46
+	Authentication string `json:"authentication"`
47
+	TwAuthReq      struct {
48
+		OneLineAuth string `json:"oneLineAuth"`
49
+		ApiAuthReq  struct {
50
+			RealName   float64 `json:"real_name"`
51
+			IdCardType string  `json:"id_card_type"`
52
+			IdCardNum  string  `json:"id_card_num"`
53
+			BankCard   string  `json:"bank_card"`
54
+			CodeNumber string  `json:"code_number"`
55
+			VerifyCode string  `json:"verify_code"`
56
+		} `json:"apiAuthReq"`
57
+	} `json:"twAuthReq"`
58
+}
59
+
60
+type MapData struct {
61
+	dat struct {
62
+		Code float64 `json:"code"`
63
+		data struct {
64
+			userId string `json:"userId"`
65
+		}
66
+	}
67
+}
68
+
69
+// 创建个人用户并实名
70
+func (this *SignApiController) CreateUserName() {
71
+
72
+	phone := this.GetString("phone")
73
+	disPlayName := this.GetString("disPlayName")
74
+
75
+	sign, userId := service.CreateUserName(phone, disPlayName)
76
+
77
+	var dat map[string]interface{}
78
+
79
+	if err := json.Unmarshal([]byte(sign), &dat); err == nil {
80
+		fmt.Println(dat)
81
+	} else {
82
+		fmt.Println(err)
83
+	}
84
+
85
+	this.ServeSuccessJSON(map[string]interface{}{
86
+		"sign":   sign,
87
+		"dat":    dat,
88
+		"userId": userId,
89
+	})
90
+	return
91
+}
92
+
93
+// 创建个人印章
94
+func (this *SignApiController) CreatePersionSeal() {
95
+
96
+	user_id := this.GetString("user_id")
97
+	person_seal_type, _ := this.GetInt64("person_seal_type")
98
+	person_seal_name := this.GetString("person_seal_name")
99
+	person_seal_base := this.GetString("person_seal_base")
100
+	color, _ := this.GetInt64("color")
101
+	alpha, _ := this.GetInt64("alpha")
102
+	width, _ := this.GetInt64("width")
103
+	height, _ := this.GetInt64("height")
104
+	border, _ := this.GetInt64("border")
105
+	font_type, _ := this.GetInt64("font_type")
106
+
107
+	sign, personSealId := service.CreatePersionSeal(user_id, person_seal_type, person_seal_name, person_seal_base, color, alpha, width, height, border, font_type)
108
+	var dat map[string]interface{}
109
+	if err := json.Unmarshal([]byte(sign), &dat); err == nil {
110
+		fmt.Println(dat)
111
+	} else {
112
+		fmt.Println(err)
113
+	}
114
+	this.ServeSuccessJSON(map[string]interface{}{
115
+		"sign":         sign,
116
+		"dat":          dat,
117
+		"personSealId": personSealId,
118
+	})
119
+	return
120
+
121
+}

+ 3 - 0
controllers/stock_in_api_controller.go View File

@@ -6521,13 +6521,16 @@ func (this *StockManagerApiController) GetInventoryDetailList() {
6521 6521
 	limit, _ := this.GetInt64("limit")
6522 6522
 	page, _ := this.GetInt64("page")
6523 6523
 	orgId := this.GetAdminUserInfo().CurrentOrgId
6524
+	appId := this.GetAdminUserInfo().CurrentAppId
6524 6525
 	storehouse_id, _ := this.GetInt64("storehouse_id")
6525 6526
 	houseList, _ := service.GetAllStoreHouseList(orgId)
6526 6527
 	list, total, _ := service.GetInventoryDetailList(keyword, limit, page, orgId, storehouse_id)
6528
+	doclist, _ := service.GetAllDoctorListSix(orgId, appId)
6527 6529
 	this.ServeSuccessJSON(map[string]interface{}{
6528 6530
 		"list":      list,
6529 6531
 		"total":     total,
6530 6532
 		"houseList": houseList,
6533
+		"doclist":   doclist,
6531 6534
 	})
6532 6535
 }
6533 6536
 

+ 8 - 8
service/his_charge_service.go View File

@@ -22,7 +22,7 @@ func GetAllPatientChargeDetails(org_id int64, start_time int64, end_time int64,
22 22
 							}).Preload("HisChargeGoodInfo", func(db *gorm.DB) *gorm.DB {
23 23
 								return db.Select("id,good_name,good_unit,specification_name").Where("status = 1 ")
24 24
 							}).Where("status = 1 ")
25
-						})
25
+						}).Where("status = 1")
26 26
 					}).Where("status = 1  AND ctime >= ? AND ctime <= ? AND user_org_id = ? AND order_status = 2", start_time, end_time, org_id)
27 27
 			}).Where("p.status = 1  AND p.user_org_id = ?", org_id).Group("id").Find(&patients).Error
28 28
 
@@ -39,7 +39,7 @@ func GetAllPatientChargeDetails(org_id int64, start_time int64, end_time int64,
39 39
 							}).Preload("HisChargeGoodInfo", func(db *gorm.DB) *gorm.DB {
40 40
 								return db.Select("id,good_name,good_unit,specification_name").Where("status = 1 ")
41 41
 							}).Where("status = 1 ")
42
-						})
42
+						}).Where("status = 1")
43 43
 					}).Where("status = 1  AND ctime >= ? AND ctime <= ? AND user_org_id = ? AND order_status = 2", start_time, end_time, org_id)
44 44
 			}).Where("p.status = 1  AND p.user_org_id = ?", org_id).Group("id").Find(&patients).Error
45 45
 
@@ -54,7 +54,7 @@ func GetAllPatientChargeDetails(org_id int64, start_time int64, end_time int64,
54 54
 							return db.Select("id,project_id,user_org_id,status,patient_id,record_date,count,type").Preload("HisChargeProject", func(db *gorm.DB) *gorm.DB {
55 55
 								return db.Select("id,project_name,unit").Where("status = 1 ")
56 56
 							}).Where("status = 1 ")
57
-						})
57
+						}).Where("status = 1")
58 58
 					}).Where("status = 1  AND ctime >= ? AND ctime <= ? AND user_org_id = ? AND order_status = 2", start_time, end_time, org_id)
59 59
 			}).Where("p.status = 1  AND p.user_org_id = ?", org_id).Group("id").Find(&patients).Error
60 60
 
@@ -69,7 +69,7 @@ func GetAllPatientChargeDetails(org_id int64, start_time int64, end_time int64,
69 69
 							return db.Select("id,project_id,user_org_id,status,patient_id,record_date,count,type").Preload("HisChargeGoodInfo", func(db *gorm.DB) *gorm.DB {
70 70
 								return db.Select("id,good_name,good_unit,specification_name").Where("status = 1 ")
71 71
 							}).Where("status = 1 ")
72
-						})
72
+						}).Where("status = 1")
73 73
 					}).Where("status = 1  AND ctime >= ? AND ctime <= ? AND user_org_id = ? AND order_status = 2", start_time, end_time, org_id)
74 74
 			}).Where("p.status = 1  AND p.user_org_id = ?", org_id).Group("id").Find(&patients).Error
75 75
 
@@ -92,7 +92,7 @@ func GetAllPatientChargeDetails(org_id int64, start_time int64, end_time int64,
92 92
 							}).Preload("HisChargeGoodInfo", func(db *gorm.DB) *gorm.DB {
93 93
 								return db.Select("id,good_name,good_unit,specification_name").Where("status = 1 ")
94 94
 							}).Where("status = 1 ")
95
-						})
95
+						}).Where("status = 1")
96 96
 					}).Where("status = 1  AND ctime >= ? AND ctime <= ? AND user_org_id = ? AND order_status = 2", start_time, end_time, org_id)
97 97
 			}).Where("p.status = 1  AND p.user_org_id = ? AND p.name LIKE ?", org_id, keyword).Group("id").Find(&patients).Error
98 98
 
@@ -109,7 +109,7 @@ func GetAllPatientChargeDetails(org_id int64, start_time int64, end_time int64,
109 109
 							}).Preload("HisChargeGoodInfo", func(db *gorm.DB) *gorm.DB {
110 110
 								return db.Select("id,good_name,good_unit,specification_name").Where("status = 1 ")
111 111
 							}).Where("status = 1 ")
112
-						})
112
+						}).Where("status = 1")
113 113
 					}).Where("status = 1  AND ctime >= ? AND ctime <= ? AND user_org_id = ? AND order_status = 2", start_time, end_time, org_id)
114 114
 			}).Where("p.status = 1  AND p.user_org_id = ? AND p.name LIKE ?", org_id, keyword).Group("id").Find(&patients).Error
115 115
 
@@ -124,7 +124,7 @@ func GetAllPatientChargeDetails(org_id int64, start_time int64, end_time int64,
124 124
 							return db.Select("id,project_id,user_org_id,status,patient_id,record_date,count,type").Preload("HisChargeProject", func(db *gorm.DB) *gorm.DB {
125 125
 								return db.Select("id,project_name,unit").Where("status = 1 ")
126 126
 							}).Where("status = 1 ")
127
-						})
127
+						}).Where("status = 1")
128 128
 					}).Where("status = 1  AND ctime >= ? AND ctime <= ? AND user_org_id = ? AND order_status = 2", start_time, end_time, org_id)
129 129
 			}).Where("p.status = 1  AND p.user_org_id = ? AND p.name LIKE ?", org_id, keyword).Group("id").Find(&patients).Error
130 130
 
@@ -139,7 +139,7 @@ func GetAllPatientChargeDetails(org_id int64, start_time int64, end_time int64,
139 139
 							return db.Select("id,project_id,user_org_id,status,patient_id,record_date,count,type").Preload("HisChargeGoodInfo", func(db *gorm.DB) *gorm.DB {
140 140
 								return db.Select("id,good_name,good_unit,specification_name").Where("status = 1 ")
141 141
 							}).Where("status = 1 ")
142
-						})
142
+						}).Where("status = 1")
143 143
 					}).Where("status = 1  AND ctime >= ? AND ctime <= ? AND user_org_id = ? AND order_status = 2", start_time, end_time, org_id)
144 144
 			}).Where("p.status = 1  AND p.user_org_id = ? AND p.name LIKE ?", org_id, keyword).Group("id").Find(&patients).Error
145 145
 

+ 15 - 1
service/manage_service.go View File

@@ -53,7 +53,7 @@ func CreateMacher(machers *models.DeviceAddmacher) error {
53 53
 
54 54
 func UpdateMachine(id int64, orgid int64, addmacher *models.DeviceAddmacher) error {
55 55
 
56
-	err := writeUserDb.Model(&addmacher).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Updates(map[string]interface{}{"serial_number": addmacher.SerialNumber, "device_type": addmacher.DeviceType, "bed_number": addmacher.BedNumber, "device_name": addmacher.DeviceName, "manufacture_factory": addmacher.ManufactureFactory, "service_manufacturer": addmacher.ServiceManufacturer, "unit_type": addmacher.UnitType, "use_section": addmacher.UseSection, "section_number": addmacher.SectionNumber, "buy_date": addmacher.BuyDate, "install_date": addmacher.InstallDate, "start_date": addmacher.StartDate, "maintenace_engineer": addmacher.MaintenaceEngineer, "telephone": addmacher.Telephone, "guarantee_date": addmacher.GuaranteeDate, "machine_status": addmacher.MachineStatus, "user_total": addmacher.UserTotal, "remarks": addmacher.Remarks, "rubbish_date": addmacher.RubbishDate, "rubbish_reason": addmacher.RubbishReason, "user_year": addmacher.UserYear, "work_time": addmacher.WorkTime, "bed_id": addmacher.BedId, "disinfection_mode": addmacher.DisinfectionMode, "revers_mode": addmacher.ReversMode, "mtime": time.Now().Unix()}).Error
56
+	err := writeUserDb.Model(&addmacher).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Updates(map[string]interface{}{"serial_number": addmacher.SerialNumber, "device_type": addmacher.DeviceType, "bed_number": addmacher.BedNumber, "device_name": addmacher.DeviceName, "manufacture_factory": addmacher.ManufactureFactory, "service_manufacturer": addmacher.ServiceManufacturer, "unit_type": addmacher.UnitType, "use_section": addmacher.UseSection, "section_number": addmacher.SectionNumber, "buy_date": addmacher.BuyDate, "install_date": addmacher.InstallDate, "start_date": addmacher.StartDate, "maintenace_engineer": addmacher.MaintenaceEngineer, "telephone": addmacher.Telephone, "guarantee_date": addmacher.GuaranteeDate, "machine_status": addmacher.MachineStatus, "user_total": addmacher.UserTotal, "remarks": addmacher.Remarks, "rubbish_date": addmacher.RubbishDate, "rubbish_reason": addmacher.RubbishReason, "user_year": addmacher.UserYear, "work_time": addmacher.WorkTime, "bed_id": addmacher.BedId, "disinfection_mode": addmacher.DisinfectionMode, "revers_mode": addmacher.ReversMode, "mtime": time.Now().Unix(), "zone_id": addmacher.ZoneId}).Error
57 57
 
58 58
 	return err
59 59
 
@@ -1794,3 +1794,17 @@ func DeleteObjectTregistration(id int64) error {
1794 1794
 	err := XTWriteDB().Model(&models.XtDialysisRegistration{}).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"status": 0}).Error
1795 1795
 	return err
1796 1796
 }
1797
+
1798
+func GetRegistGoodInforList(user_org_id int64) (good []*models.GoodInformationFourty, err error) {
1799
+
1800
+	err = XTReadDB().Where("org_id = ? and status =1", user_org_id).Find(&good).Error
1801
+
1802
+	return good, err
1803
+}
1804
+
1805
+func GetRegistNumber(sys_record_time int64, good_id int64, user_org_id int64) (infor []*models.WarehouseOutInfoNight, err error) {
1806
+
1807
+	err = XTReadDB().Where("sys_record_time = ? and good_id = ? and org_id = ? and status =1", sys_record_time, good_id, user_org_id).Find(&infor).Error
1808
+
1809
+	return infor, err
1810
+}

+ 1 - 1
service/self_drug_service.go View File

@@ -1115,7 +1115,7 @@ func GetDrugInventoryDetailList(keyword string, page int64, limit int64, orgid i
1115 1115
 	if storehouse_id > 0 {
1116 1116
 		db = db.Where("x.storehouse_id = ?", storehouse_id)
1117 1117
 	}
1118
-	err = db.Select("x.id,x.drug_name,x.specification_name,x.warehousing_unit,x.count,x.last_price,x.retail_price,x.manufacturer,x.dealer,x.remark,x.drug_id,x.warehousing_order,x.number,x.batch_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,x.total,x.drug_origin_place,x.expiry_date,x.product_date,x.min_count,x.storehouse_id,x.warehouse_info_id,t.dose,t.dose_unit,t.max_unit,x.min_unit,x.stock_max_number,x.stock_min_number,x.last_stock_max_number,x.last_stock_min_number,x.inventory_type,t.min_number,t.retail_price").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_base_drug as t on t.id =x.drug_id").Count(&total).Offset(offset).Limit(limit).Scan(&list).Error
1118
+	err = db.Select("x.id,x.drug_name,x.specification_name,x.warehousing_unit,x.count,x.last_price,x.retail_price,x.manufacturer,x.dealer,x.remark,x.drug_id,x.warehousing_order,x.number,x.batch_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,x.total,x.drug_origin_place,x.expiry_date,x.product_date,x.min_count,x.storehouse_id,x.ctime,x.warehouse_info_id,t.dose,t.dose_unit,t.max_unit,x.min_unit,x.stock_max_number,x.stock_min_number,x.last_stock_max_number,x.last_stock_min_number,x.inventory_type,t.min_number,t.retail_price").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_base_drug as t on t.id =x.drug_id").Count(&total).Offset(offset).Limit(limit).Scan(&list).Error
1119 1119
 	return list, total, err
1120 1120
 }
1121 1121
 

+ 158 - 18
service/sign_service.go View File

@@ -1,12 +1,11 @@
1 1
 package service
2 2
 
3 3
 import (
4
+	"XT_New/utils"
4 5
 	"bytes"
5 6
 	"crypto/hmac"
6 7
 	"crypto/sha1"
7
-	"crypto/sha256"
8 8
 	"encoding/base64"
9
-	"encoding/hex"
10 9
 	"encoding/json"
11 10
 	"fmt"
12 11
 	"github.com/astaxie/beego"
@@ -78,22 +77,6 @@ func GetSignNameByPhone(phoneOne string) string {
78 77
 	return str
79 78
 }
80 79
 
81
-// 生成签名
82
-func setSignatureStr(nonce string, secret_key string) string {
83
-	fmt.Println(nonce)
84
-	fmt.Println(secret_key)
85
-	str := secret_key + nonce
86
-	hash := sha256.New()
87
-	//输入数据
88
-	hash.Write([]byte(str))
89
-	//计算哈希值
90
-	bytes := hash.Sum(nil)
91
-	//将字符串编码为16进制格式,返回字符串
92
-	hashCode := hex.EncodeToString(bytes)
93
-	//返回哈希值
94
-	return hashCode
95
-}
96
-
97 80
 func generateHMACSHA1SignatureOne(data interface{}, key, serviceCode string) (string, error) {
98 81
 	// 将数据转换为 JSON 格式的字节数组
99 82
 	jsonData, err := json.Marshal(data)
@@ -118,3 +101,160 @@ func generateHMACSHA1SignatureOne(data interface{}, key, serviceCode string) (st
118 101
 	// 返回带有前缀的签名字符串
119 102
 	return "HMAC-SHA1 " + signature, nil
120 103
 }
104
+
105
+func CreateUserName(phone string, disPlayName string) (string, string) {
106
+
107
+	var url string
108
+
109
+	url = "http://demo.itruscloud.com/apigate/contractpaasapi/user/createUserRealName"
110
+	var phoneOne string
111
+
112
+	phoneOne = "13318464649"
113
+
114
+	var disPlayNameOne string
115
+
116
+	disPlayNameOne = "王老师"
117
+
118
+	var authentication string
119
+	//测试环境用true
120
+	authentication = "true"
121
+
122
+	maprequest := make(map[string]interface{})
123
+
124
+	twAuthReq := make(map[string]interface{})
125
+
126
+	apiAuthReq := make(map[string]interface{})
127
+
128
+	customerReq := make(map[string]interface{})
129
+
130
+	customerReq["idCardType"] = "0"
131
+	customerReq["idCardNum"] = "430526199408156511"
132
+
133
+	apiAuthReq["realNameType"] = 3
134
+	apiAuthReq["idCardType"] = "0"
135
+	apiAuthReq["idCardNum"] = "430526199408156511"
136
+	apiAuthReq["bankCard"] = "6225551675364804"
137
+	//验证码流水号
138
+	apiAuthReq["codeNumber"] = "msg202307071510269187701"
139
+	//验证码
140
+	apiAuthReq["verifyCode"] = "123456"
141
+
142
+	twAuthReq["oneLineAuth"] = "false"
143
+
144
+	twAuthReq["apiAuthReq"] = apiAuthReq
145
+
146
+	maprequest["phone"] = phoneOne
147
+	maprequest["displayName"] = disPlayNameOne
148
+	maprequest["authentication"] = authentication
149
+
150
+	maprequest["twAuthReq"] = twAuthReq
151
+	maprequest["customerAuthReq"] = customerReq
152
+
153
+	byterequest, _ := json.Marshal(maprequest)
154
+
155
+	appId := beego.AppConfig.String("sign_appid")
156
+
157
+	serviceKye := beego.AppConfig.String("serviceKye")
158
+
159
+	serviceCode := beego.AppConfig.String("serviceCode")
160
+
161
+	reader := bytes.NewReader(byterequest)
162
+
163
+	signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
164
+
165
+	fmt.Println(signatureStr)
166
+
167
+	request, err := http.NewRequest("POST", url, reader)
168
+	if err != nil {
169
+		fmt.Println(err.Error())
170
+	}
171
+	fmt.Println("请求参数", request)
172
+	fmt.Println("Content-Signature", signatureStr)
173
+	fmt.Println("appID", appId)
174
+	fmt.Println("serviceCode", serviceCode)
175
+	request.Header.Set("appId", appId)
176
+	request.Header.Set("serviceCode", serviceCode)
177
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
178
+	request.Header.Set("Content-Signature", signatureStr)
179
+	client := http.Client{}
180
+
181
+	resp, err := client.Do(request)
182
+	if err != nil {
183
+		fmt.Println(err.Error())
184
+
185
+	}
186
+	respBytes, err := ioutil.ReadAll(resp.Body)
187
+	if err != nil {
188
+		fmt.Println(err.Error())
189
+
190
+	}
191
+	str := string(respBytes)
192
+
193
+	var respJSON map[string]interface{}
194
+	if err := json.Unmarshal([]byte(string(respBytes)), &respJSON); err != nil {
195
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
196
+	}
197
+	var UserId string
198
+	UserId = respJSON["data"].(map[string]interface{})["userId"].(string)
199
+	fmt.Println("str", UserId)
200
+	return str, UserId
201
+
202
+}
203
+
204
+func CreatePersionSeal(user_id string, person_seal_type int64, person_seal_name string, person_seal_base string, color int64, alpha int64, width int64, height int64, border int64, font_type int64) (string, string) {
205
+
206
+	maprequest := make(map[string]interface{})
207
+
208
+	maprequest["userId"] = "DVVZ65G1JTC1BH3AHYY2KYAE"
209
+
210
+	maprequest["personSealType"] = 1
211
+
212
+	maprequest["personSealName"] = "测试印章"
213
+
214
+	var url string
215
+
216
+	url = "http://demo.itruscloud.com/apigate/contractpaasapi/user/createPersonSeal"
217
+	appId := beego.AppConfig.String("sign_appid")
218
+
219
+	serviceKye := beego.AppConfig.String("serviceKye")
220
+
221
+	serviceCode := beego.AppConfig.String("serviceCode")
222
+	byterequest, _ := json.Marshal(maprequest)
223
+	reader := bytes.NewReader(byterequest)
224
+
225
+	signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
226
+
227
+	fmt.Println(signatureStr)
228
+
229
+	request, err := http.NewRequest("POST", url, reader)
230
+	if err != nil {
231
+		fmt.Println(err.Error())
232
+	}
233
+
234
+	request.Header.Set("appId", appId)
235
+	request.Header.Set("serviceCode", serviceCode)
236
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
237
+	request.Header.Set("Content-Signature", signatureStr)
238
+	client := http.Client{}
239
+
240
+	resp, err := client.Do(request)
241
+	if err != nil {
242
+		fmt.Println(err.Error())
243
+
244
+	}
245
+	respBytes, err := ioutil.ReadAll(resp.Body)
246
+	if err != nil {
247
+		fmt.Println(err.Error())
248
+
249
+	}
250
+	str := string(respBytes)
251
+
252
+	var respJSON map[string]interface{}
253
+	if err := json.Unmarshal([]byte(string(respBytes)), &respJSON); err != nil {
254
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
255
+	}
256
+	var personSealId string
257
+	personSealId = respJSON["data"].(map[string]interface{})["personSealId"].(string)
258
+	fmt.Println("str", personSealId)
259
+	return str, personSealId
260
+}

+ 1 - 1
service/stock_service.go View File

@@ -6109,7 +6109,7 @@ func GetInventoryDetailList(keyword string, limit int64, page int64, orgid int64
6109 6109
 	if storehouse_id > 0 {
6110 6110
 		db = db.Where("x.storehouse_id = ?", storehouse_id)
6111 6111
 	}
6112
-	err = db.Select("x.id,x.good_name,x.specification_name,x.warehousing_unit,x.count,x.buy_price,x.packing_price,x.new_price,x.manufacturer,x.dealer,x.remark,x.good_id,x.warehousing_order,x.license_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,x.total,x.number,x.expire_date,x.product_date,t.packing_unit,x.last_stock_count,x.type,x.inventory_type,x.stock_count,x.storehouse_id").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_good_information as t on t.id =x.good_id").Count(&total).Offset(offset).Limit(limit).Scan(&list).Error
6112
+	err = db.Select("x.id,x.good_name,x.specification_name,x.warehousing_unit,x.count,x.buy_price,x.packing_price,x.new_price,x.manufacturer,x.dealer,x.remark,x.good_id,x.warehousing_order,x.license_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,x.total,x.number,x.expire_date,x.product_date,t.packing_unit,x.last_stock_count,x.type,x.inventory_type,x.stock_count,x.storehouse_id,x.ctime").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_good_information as t on t.id =x.good_id").Count(&total).Offset(offset).Limit(limit).Scan(&list).Error
6113 6113
 	return list, total, err
6114 6114
 }
6115 6115