|
@@ -56,8 +56,8 @@ func HisManagerApiRegistRouters() {
|
56
|
56
|
beego.Router("/api/hisorder/get", &HisApiController{}, "get:GetHisOrder")
|
57
|
57
|
|
58
|
58
|
beego.Router("/api/register/get", &HisApiController{}, "get:GetRegisterInfo")
|
59
|
|
-
|
60
|
59
|
beego.Router("/api/upload/get", &HisApiController{}, "get:GetUploadInfo")
|
|
60
|
+ beego.Router("/api/presettle/get", &HisApiController{}, "get:PreSettle")
|
61
|
61
|
|
62
|
62
|
beego.Router("/api/refund/post", &HisApiController{}, "post:Refund")
|
63
|
63
|
|
|
@@ -290,7 +290,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
290
|
290
|
record_date := c.GetString("record_date")
|
291
|
291
|
patient_id, _ := c.GetInt64("patient_id")
|
292
|
292
|
reg_type, _ := c.GetInt64("reg_type")
|
293
|
|
- diagnose := c.GetString("diagnose")
|
|
293
|
+ diagnose, _ := c.GetInt64("diagnose")
|
294
|
294
|
sick_type, _ := c.GetInt64("sick_type")
|
295
|
295
|
sick_history := c.GetString("sick_history")
|
296
|
296
|
doctor_id, _ := c.GetInt64("doctor", 0)
|
|
@@ -520,6 +520,17 @@ func (c *HisApiController) CreateHisPrescription() {
|
520
|
520
|
}
|
521
|
521
|
order_status := int64(items["order_status"].(float64))
|
522
|
522
|
|
|
523
|
+ if items["med_type"] == nil || reflect.TypeOf(items["med_type"]).String() != "float64" {
|
|
524
|
+ utils.ErrorLog("med_type")
|
|
525
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
526
|
+ return
|
|
527
|
+ }
|
|
528
|
+ med_type := strconv.Itoa(int(items["med_type"].(float64)))
|
|
529
|
+
|
|
530
|
+ if med_type == "0" {
|
|
531
|
+ med_type = "14"
|
|
532
|
+ }
|
|
533
|
+
|
523
|
534
|
if order_status == 0 {
|
524
|
535
|
order_status = 1
|
525
|
536
|
}
|
|
@@ -559,6 +570,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
559
|
570
|
PrescriptionNumber: hpInfo.PrescriptionNumber,
|
560
|
571
|
PreTime: pTime,
|
561
|
572
|
PType: p_type,
|
|
573
|
+ MedType: med_type,
|
562
|
574
|
}
|
563
|
575
|
tempPrescription = prescription
|
564
|
576
|
service.SaveHisPrescription(tempPrescription)
|
|
@@ -571,6 +583,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
571
|
583
|
tempPrescription.Doctor = role.UserName
|
572
|
584
|
tempPrescription.OrderStatus = order_status
|
573
|
585
|
tempPrescription.PreTime = pTime
|
|
586
|
+ tempPrescription.MedType = med_type
|
574
|
587
|
service.SaveHisPrescription(tempPrescription)
|
575
|
588
|
}
|
576
|
589
|
//service.SaveHisPrescription(prescription)
|
|
@@ -714,7 +727,7 @@ func (c *HisApiController) EditHisPrescription() {
|
714
|
727
|
record_date := c.GetString("record_date")
|
715
|
728
|
patient_id, _ := c.GetInt64("patient_id")
|
716
|
729
|
reg_type, _ := c.GetInt64("reg_type")
|
717
|
|
- diagnose := c.GetString("diagnose")
|
|
730
|
+ diagnose, _ := c.GetInt64("diagnose", 0)
|
718
|
731
|
sick_type, _ := c.GetInt64("sick_type")
|
719
|
732
|
sick_history := c.GetString("sick_history")
|
720
|
733
|
doctor_id, _ := c.GetInt64("doctor", 0)
|
|
@@ -819,6 +832,13 @@ func (c *HisApiController) EditHisPrescription() {
|
819
|
832
|
}
|
820
|
833
|
types := int64(items["type"].(float64))
|
821
|
834
|
|
|
835
|
+ if items["med_type"] == nil || reflect.TypeOf(items["med_type"]).String() != "float64" {
|
|
836
|
+ utils.ErrorLog("med_type")
|
|
837
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
838
|
+ return
|
|
839
|
+ }
|
|
840
|
+ med_type := strconv.Itoa(int(items["med_type"].(float64)))
|
|
841
|
+
|
822
|
842
|
historyPrescription, _ := service.GetHisPrescriptionByID(adminInfo.CurrentOrgId, id)
|
823
|
843
|
|
824
|
844
|
ctime := time.Now().Unix()
|
|
@@ -840,6 +860,7 @@ func (c *HisApiController) EditHisPrescription() {
|
840
|
860
|
BatchNumber: "",
|
841
|
861
|
PrescriptionNumber: hpInfo.PrescriptionNumber,
|
842
|
862
|
PType: hpInfo.PType,
|
|
863
|
+ MedType: med_type,
|
843
|
864
|
}
|
844
|
865
|
|
845
|
866
|
if historyPrescription.ID > 0 {
|
|
@@ -2727,6 +2748,15 @@ func (c *HisApiController) GetUploadInfo() {
|
2727
|
2748
|
fapiao_code := c.GetString("fapiao_code")
|
2728
|
2749
|
fapiao_number := c.GetString("fapiao_number")
|
2729
|
2750
|
|
|
2751
|
+ diagnosis_id, _ := c.GetInt64("diagnosis")
|
|
2752
|
+ sick_type, _ := c.GetInt64("sick_type")
|
|
2753
|
+ reg_type, _ := c.GetInt64("p_type")
|
|
2754
|
+ order_id, _ := c.GetInt64("order_id")
|
|
2755
|
+
|
|
2756
|
+ his, _ := service.GetHisPatientByIdThree(his_patient_id)
|
|
2757
|
+
|
|
2758
|
+ tempOrder, _ := service.GetHisOrderByID(order_id)
|
|
2759
|
+
|
2730
|
2760
|
theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
|
2731
|
2761
|
if err != nil {
|
2732
|
2762
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
@@ -2738,214 +2768,258 @@ func (c *HisApiController) GetUploadInfo() {
|
2738
|
2768
|
var start_time int64
|
2739
|
2769
|
var end_time int64
|
2740
|
2770
|
|
2741
|
|
- if settle_accounts_type == 1 { //日结
|
|
2771
|
+ if tempOrder.ID == 0 {
|
2742
|
2772
|
|
2743
|
|
- prescriptions, _ = service.GetSettleHisPrescription(adminUser.CurrentOrgId, id, his_patient_id, recordDateTime)
|
|
2773
|
+ if settle_accounts_type == 1 { //日结
|
2744
|
2774
|
|
2745
|
|
- } else { //月结
|
2746
|
|
- start_time_str := c.GetString("start_time")
|
2747
|
|
- end_time_str := c.GetString("end_time")
|
2748
|
|
- timeLayout := "2006-01-02"
|
2749
|
|
- loc, _ := time.LoadLocation("Local")
|
2750
|
|
- theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
|
2751
|
|
- if err != nil {
|
2752
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
2753
|
|
- return
|
2754
|
|
- }
|
2755
|
|
- recordStartTime := theStartTime.Unix()
|
2756
|
|
- start_time = recordStartTime
|
2757
|
|
- theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
|
2758
|
|
- if err != nil {
|
2759
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
2760
|
|
- return
|
2761
|
|
- }
|
2762
|
|
- recordEndTime := theEndTime.Unix()
|
2763
|
|
- end_time = recordEndTime
|
2764
|
|
- prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime)
|
2765
|
|
- }
|
|
2775
|
+ prescriptions, _ = service.GetSettleHisPrescription(adminUser.CurrentOrgId, id, his_patient_id, recordDateTime, reg_type)
|
2766
|
2776
|
|
2767
|
|
- his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
|
|
2777
|
+ } else { //月结
|
|
2778
|
+ start_time_str := c.GetString("start_time")
|
|
2779
|
+ end_time_str := c.GetString("end_time")
|
|
2780
|
+ timeLayout := "2006-01-02"
|
|
2781
|
+ loc, _ := time.LoadLocation("Local")
|
|
2782
|
+ theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
|
|
2783
|
+ if err != nil {
|
|
2784
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
2785
|
+ return
|
|
2786
|
+ }
|
|
2787
|
+ recordStartTime := theStartTime.Unix()
|
|
2788
|
+ start_time = recordStartTime
|
|
2789
|
+ theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
|
|
2790
|
+ if err != nil {
|
|
2791
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
2792
|
+ return
|
|
2793
|
+ }
|
|
2794
|
+ recordEndTime := theEndTime.Unix()
|
|
2795
|
+ end_time = recordEndTime
|
|
2796
|
+ prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime, reg_type)
|
|
2797
|
+ }
|
2768
|
2798
|
|
2769
|
|
- fmt.Println("~~~~~~~~~")
|
2770
|
|
- fmt.Println(his.Number)
|
2771
|
|
- fmt.Println("~~~~~~~~~")
|
|
2799
|
+ fmt.Println("~~~~~~~~~")
|
|
2800
|
+ fmt.Println(his.Number)
|
|
2801
|
+ fmt.Println("~~~~~~~~~")
|
2772
|
2802
|
|
2773
|
|
- timestamp := time.Now().Unix()
|
2774
|
|
- tempTime := time.Unix(timestamp, 0)
|
2775
|
|
- timeFormat := tempTime.Format("20060102150405")
|
2776
|
|
- chrgBchno := rand.Intn(100000) + 10000
|
2777
|
|
- chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
|
2778
|
|
- strconv.FormatInt(his.PatientId, 10)
|
|
2803
|
+ timestamp := time.Now().Unix()
|
|
2804
|
+ tempTime := time.Unix(timestamp, 0)
|
|
2805
|
+ timeFormat := tempTime.Format("20060102150405")
|
|
2806
|
+ chrgBchno := rand.Intn(100000) + 10000
|
|
2807
|
+ chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
|
|
2808
|
+ strconv.FormatInt(his.PatientId, 10)
|
2779
|
2809
|
|
2780
|
|
- var ids []int64
|
|
2810
|
+ var ids []int64
|
2781
|
2811
|
|
2782
|
|
- for _, item := range prescriptions {
|
2783
|
|
- ids = append(ids, item.ID)
|
2784
|
|
- }
|
|
2812
|
+ for _, item := range prescriptions {
|
|
2813
|
+ ids = append(ids, item.ID)
|
|
2814
|
+ }
|
2785
|
2815
|
|
2786
|
|
- var total float64
|
2787
|
|
- for _, item := range prescriptions {
|
2788
|
|
- if item.Type == 1 { //药品
|
2789
|
|
- for _, subItem := range item.HisDoctorAdviceInfo {
|
2790
|
|
- total = total + (subItem.Price * subItem.PrescribingNumber)
|
|
2816
|
+ var total float64
|
|
2817
|
+ for _, item := range prescriptions {
|
|
2818
|
+ if item.Type == 1 { //药品
|
|
2819
|
+ for _, subItem := range item.HisDoctorAdviceInfo {
|
|
2820
|
+ total = total + (subItem.Price * subItem.PrescribingNumber)
|
|
2821
|
+ }
|
2791
|
2822
|
}
|
2792
|
|
- }
|
2793
|
|
- if item.Type == 2 { //项目
|
2794
|
|
- for _, subItem := range item.HisPrescriptionProject {
|
|
2823
|
+ if item.Type == 2 { //项目
|
|
2824
|
+ for _, subItem := range item.HisPrescriptionProject {
|
|
2825
|
+ total = total + (subItem.Price * float64(subItem.Count))
|
|
2826
|
+ }
|
|
2827
|
+ }
|
|
2828
|
+
|
|
2829
|
+ for _, subItem := range item.HisAdditionalCharge {
|
2795
|
2830
|
total = total + (subItem.Price * float64(subItem.Count))
|
2796
|
2831
|
}
|
2797
|
2832
|
}
|
2798
|
2833
|
|
2799
|
|
- for _, subItem := range item.HisAdditionalCharge {
|
2800
|
|
- total = total + (subItem.Price * float64(subItem.Count))
|
|
2834
|
+ allTotal := fmt.Sprintf("%.2f", total)
|
|
2835
|
+ totals, _ := strconv.ParseFloat(allTotal, 64)
|
|
2836
|
+ order := &models.HisOrder{
|
|
2837
|
+ UserOrgId: adminUser.CurrentOrgId,
|
|
2838
|
+ HisPatientId: his.ID,
|
|
2839
|
+ PatientId: id,
|
|
2840
|
+ SettleAccountsDate: recordDateTime,
|
|
2841
|
+ Ctime: time.Now().Unix(),
|
|
2842
|
+ Mtime: time.Now().Unix(),
|
|
2843
|
+ Status: 1,
|
|
2844
|
+ OrderStatus: 2,
|
|
2845
|
+ MdtrtId: his.Number,
|
|
2846
|
+ Number: chrg_bchno,
|
|
2847
|
+ MedfeeSumamt: totals,
|
|
2848
|
+ PayWay: pay_way,
|
|
2849
|
+ PayPrice: pay_price,
|
|
2850
|
+ MedType: strconv.Itoa(int(reg_type)),
|
|
2851
|
+ PayCardNo: pay_card_no,
|
|
2852
|
+ DiscountPrice: discount_price,
|
|
2853
|
+ PreferentialPrice: preferential_price,
|
|
2854
|
+ RealityPrice: reality_price,
|
|
2855
|
+ FoundPrice: found_price,
|
|
2856
|
+ MedicalInsurancePrice: medical_insurance_price,
|
|
2857
|
+ PrivatePrice: private_price,
|
|
2858
|
+ SettleEndTime: end_time,
|
|
2859
|
+ SettleStartTime: start_time,
|
|
2860
|
+ SettleType: settle_accounts_type,
|
|
2861
|
+ FaPiaoCode: fapiao_code,
|
|
2862
|
+ FaPiaoNumber: fapiao_number,
|
|
2863
|
+ PType: 2,
|
|
2864
|
+ }
|
|
2865
|
+ err = service.CreateOrder(order)
|
|
2866
|
+ if err != nil {
|
|
2867
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateOrderException)
|
|
2868
|
+ return
|
2801
|
2869
|
}
|
2802
|
|
- }
|
2803
|
2870
|
|
2804
|
|
- allTotal := fmt.Sprintf("%.2f", total)
|
2805
|
|
- totals, _ := strconv.ParseFloat(allTotal, 64)
|
2806
|
|
- order := &models.HisOrder{
|
2807
|
|
- UserOrgId: adminUser.CurrentOrgId,
|
2808
|
|
- HisPatientId: his.ID,
|
2809
|
|
- PatientId: id,
|
2810
|
|
- SettleAccountsDate: recordDateTime,
|
2811
|
|
- Ctime: time.Now().Unix(),
|
2812
|
|
- Mtime: time.Now().Unix(),
|
2813
|
|
- Status: 1,
|
2814
|
|
- OrderStatus: 2,
|
2815
|
|
- MdtrtId: his.Number,
|
2816
|
|
- Number: chrg_bchno,
|
2817
|
|
- MedfeeSumamt: totals,
|
2818
|
|
- PayWay: pay_way,
|
2819
|
|
- PayPrice: pay_price,
|
2820
|
|
- PayCardNo: pay_card_no,
|
2821
|
|
- DiscountPrice: discount_price,
|
2822
|
|
- PreferentialPrice: preferential_price,
|
2823
|
|
- RealityPrice: reality_price,
|
2824
|
|
- FoundPrice: found_price,
|
2825
|
|
- MedicalInsurancePrice: medical_insurance_price,
|
2826
|
|
- PrivatePrice: private_price,
|
2827
|
|
- SettleEndTime: end_time,
|
2828
|
|
- SettleStartTime: start_time,
|
2829
|
|
- SettleType: settle_accounts_type,
|
2830
|
|
- FaPiaoCode: fapiao_code,
|
2831
|
|
- FaPiaoNumber: fapiao_number,
|
2832
|
|
- PType: 2,
|
2833
|
|
- }
|
2834
|
|
- err = service.CreateOrder(order)
|
2835
|
|
- if err != nil {
|
2836
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateOrderException)
|
2837
|
|
- return
|
2838
|
|
- }
|
|
2871
|
+ var customs []*Custom
|
|
2872
|
+ for _, item := range prescriptions {
|
|
2873
|
+
|
|
2874
|
+ if item.Type == 1 { //药品
|
|
2875
|
+ for _, subItem := range item.HisDoctorAdviceInfo {
|
|
2876
|
+ cus := &Custom{
|
|
2877
|
+ AdviceId: subItem.ID,
|
|
2878
|
+ ProjectId: 0,
|
|
2879
|
+ DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*subItem.PrescribingNumber),
|
|
2880
|
+ Cut: fmt.Sprintf("%.2f", subItem.PrescribingNumber),
|
|
2881
|
+ FeedetlSn: subItem.FeedetlSn,
|
|
2882
|
+ Price: fmt.Sprintf("%.2f", subItem.Price),
|
|
2883
|
+ MedListCodg: subItem.MedListCodg,
|
|
2884
|
+ Type: 1,
|
|
2885
|
+ }
|
|
2886
|
+ customs = append(customs, cus)
|
|
2887
|
+ }
|
|
2888
|
+ }
|
2839
|
2889
|
|
2840
|
|
- var customs []*Custom
|
2841
|
|
- for _, item := range prescriptions {
|
|
2890
|
+ if item.Type == 2 { //项目
|
|
2891
|
+ for _, subItem := range item.HisPrescriptionProject {
|
|
2892
|
+
|
|
2893
|
+ cus := &Custom{
|
|
2894
|
+ AdviceId: 0,
|
|
2895
|
+ ProjectId: subItem.ID,
|
|
2896
|
+ DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
|
|
2897
|
+ Cut: fmt.Sprintf("%.2f", float64(subItem.Count)),
|
|
2898
|
+ FeedetlSn: subItem.FeedetlSn,
|
|
2899
|
+ Price: fmt.Sprintf("%.2f", float64(subItem.Price)),
|
|
2900
|
+ MedListCodg: subItem.MedListCodg,
|
|
2901
|
+ Type: 2,
|
|
2902
|
+ }
|
2842
|
2903
|
|
2843
|
|
- if item.Type == 1 { //药品
|
2844
|
|
- for _, subItem := range item.HisDoctorAdviceInfo {
|
2845
|
|
- cus := &Custom{
|
2846
|
|
- AdviceId: subItem.ID,
|
2847
|
|
- ProjectId: 0,
|
2848
|
|
- DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*subItem.PrescribingNumber),
|
2849
|
|
- Cut: fmt.Sprintf("%.2f", subItem.PrescribingNumber),
|
2850
|
|
- FeedetlSn: subItem.FeedetlSn,
|
2851
|
|
- Price: fmt.Sprintf("%.2f", subItem.Price),
|
2852
|
|
- MedListCodg: subItem.MedListCodg,
|
2853
|
|
- Type: 1,
|
|
2904
|
+ customs = append(customs, cus)
|
2854
|
2905
|
}
|
2855
|
|
- customs = append(customs, cus)
|
2856
|
2906
|
}
|
2857
|
|
- }
|
2858
|
|
-
|
2859
|
|
- if item.Type == 2 { //项目
|
2860
|
|
- for _, subItem := range item.HisPrescriptionProject {
|
2861
|
2907
|
|
|
2908
|
+ for _, item := range item.HisAdditionalCharge {
|
2862
|
2909
|
cus := &Custom{
|
|
2910
|
+ ItemId: item.ID,
|
2863
|
2911
|
AdviceId: 0,
|
2864
|
|
- ProjectId: subItem.ID,
|
2865
|
|
- DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
|
2866
|
|
- Cut: fmt.Sprintf("%.2f", float64(subItem.Count)),
|
2867
|
|
- FeedetlSn: subItem.FeedetlSn,
|
2868
|
|
- Price: fmt.Sprintf("%.2f", float64(subItem.Price)),
|
2869
|
|
- MedListCodg: subItem.MedListCodg,
|
2870
|
|
- Type: 2,
|
|
2912
|
+ ProjectId: 0,
|
|
2913
|
+ DetItemFeeSumamt: fmt.Sprintf("%.2f", item.Price),
|
|
2914
|
+ Cut: fmt.Sprintf("%.2f", float64(item.Count)),
|
|
2915
|
+ FeedetlSn: item.FeedetlSn,
|
|
2916
|
+ Price: fmt.Sprintf("%.2f", float64(item.Price)),
|
|
2917
|
+ MedListCodg: item.XtHisAddtionConfig.Code,
|
|
2918
|
+ Type: 3,
|
2871
|
2919
|
}
|
2872
|
2920
|
|
2873
|
2921
|
customs = append(customs, cus)
|
2874
|
2922
|
}
|
|
2923
|
+
|
2875
|
2924
|
}
|
2876
|
2925
|
|
2877
|
|
- for _, item := range item.HisAdditionalCharge {
|
2878
|
|
- cus := &Custom{
|
2879
|
|
- ItemId: item.ID,
|
2880
|
|
- AdviceId: 0,
|
2881
|
|
- ProjectId: 0,
|
2882
|
|
- DetItemFeeSumamt: fmt.Sprintf("%.2f", item.Price),
|
2883
|
|
- Cut: fmt.Sprintf("%.2f", float64(item.Count)),
|
2884
|
|
- FeedetlSn: item.FeedetlSn,
|
2885
|
|
- Price: fmt.Sprintf("%.2f", float64(item.Price)),
|
2886
|
|
- MedListCodg: item.XtHisAddtionConfig.Code,
|
2887
|
|
- Type: 3,
|
|
2926
|
+ for _, item := range customs {
|
|
2927
|
+ var advice_id int64 = 0
|
|
2928
|
+ var project_id int64 = 0
|
|
2929
|
+ var item_id int64 = 0
|
|
2930
|
+
|
|
2931
|
+ var types int64 = 0
|
|
2932
|
+
|
|
2933
|
+ if item.Type == 1 {
|
|
2934
|
+ advice_id = item.AdviceId
|
|
2935
|
+ project_id = 0
|
|
2936
|
+ item_id = 0
|
|
2937
|
+ } else if item.Type == 2 {
|
|
2938
|
+ advice_id = 0
|
|
2939
|
+ item_id = 0
|
|
2940
|
+
|
|
2941
|
+ project_id = item.ProjectId
|
|
2942
|
+ } else if item.Type == 3 {
|
|
2943
|
+ advice_id = 0
|
|
2944
|
+ item_id = item.ItemId
|
|
2945
|
+ project_id = 0
|
2888
|
2946
|
}
|
2889
|
2947
|
|
2890
|
|
- customs = append(customs, cus)
|
|
2948
|
+ detItemFeeSumamt, _ := strconv.ParseFloat(item.DetItemFeeSumamt, 32)
|
|
2949
|
+ cut, _ := strconv.ParseFloat(item.Cut, 32)
|
|
2950
|
+ pric, _ := strconv.ParseFloat(item.Price, 32)
|
|
2951
|
+
|
|
2952
|
+ info := &models.HisOrderInfo{
|
|
2953
|
+ OrderNumber: order.Number,
|
|
2954
|
+ UploadDate: time.Now().Unix(),
|
|
2955
|
+ AdviceId: advice_id,
|
|
2956
|
+ DetItemFeeSumamt: detItemFeeSumamt,
|
|
2957
|
+ Cnt: cut,
|
|
2958
|
+ Pric: pric,
|
|
2959
|
+ PatientId: id,
|
|
2960
|
+ Status: 1,
|
|
2961
|
+ Mtime: time.Now().Unix(),
|
|
2962
|
+ Ctime: time.Now().Unix(),
|
|
2963
|
+ UserOrgId: adminUser.CurrentOrgId,
|
|
2964
|
+ HisPatientId: his.ID,
|
|
2965
|
+ OrderId: order.ID,
|
|
2966
|
+ ProjectId: project_id,
|
|
2967
|
+ Type: types,
|
|
2968
|
+ ItemId: item_id,
|
|
2969
|
+ }
|
|
2970
|
+ service.CreateOrderInfo(info)
|
2891
|
2971
|
}
|
2892
|
|
-
|
2893
|
|
- }
|
2894
|
|
-
|
2895
|
|
- for _, item := range customs {
|
2896
|
|
- var advice_id int64 = 0
|
2897
|
|
- var project_id int64 = 0
|
2898
|
|
- var item_id int64 = 0
|
2899
|
|
-
|
2900
|
|
- var types int64 = 0
|
2901
|
|
-
|
2902
|
|
- if item.Type == 1 {
|
2903
|
|
- advice_id = item.AdviceId
|
2904
|
|
- project_id = 0
|
2905
|
|
- item_id = 0
|
2906
|
|
- } else if item.Type == 2 {
|
2907
|
|
- advice_id = 0
|
2908
|
|
- item_id = 0
|
2909
|
|
-
|
2910
|
|
- project_id = item.ProjectId
|
2911
|
|
- } else if item.Type == 3 {
|
2912
|
|
- advice_id = 0
|
2913
|
|
- item_id = item.ItemId
|
2914
|
|
- project_id = 0
|
|
2972
|
+ his.Diagnosis = diagnosis_id
|
|
2973
|
+ his.SickType = sick_type
|
|
2974
|
+ his.RegisterType = reg_type
|
|
2975
|
+ his.MedicalTreatmentType = reg_type
|
|
2976
|
+
|
|
2977
|
+ service.UpdataHisPateint(&his)
|
|
2978
|
+ err = service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
|
|
2979
|
+ err = service.UpDateHisPrescriptionInfoNumber(adminUser.CurrentOrgId, id, chrg_bchno, recordDateTime, his_patient_id)
|
|
2980
|
+ err = service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
|
|
2981
|
+ if err == nil {
|
|
2982
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2983
|
+ "msg": "结算成功",
|
|
2984
|
+ })
|
2915
|
2985
|
}
|
2916
|
2986
|
|
2917
|
|
- detItemFeeSumamt, _ := strconv.ParseFloat(item.DetItemFeeSumamt, 32)
|
2918
|
|
- cut, _ := strconv.ParseFloat(item.Cut, 32)
|
2919
|
|
- pric, _ := strconv.ParseFloat(item.Price, 32)
|
|
2987
|
+ } else {
|
|
2988
|
+ if tempOrder.IsPre > 0 {
|
|
2989
|
+
|
|
2990
|
+ allTotal := fmt.Sprintf("%.2f", tempOrder.MedfeeSumamt)
|
|
2991
|
+ totals, _ := strconv.ParseFloat(allTotal, 64)
|
|
2992
|
+
|
|
2993
|
+ tempOrder.OrderStatus = 2
|
|
2994
|
+ tempOrder.PayWay = pay_way
|
|
2995
|
+ tempOrder.PayPrice = pay_price
|
|
2996
|
+ tempOrder.PayCardNo = pay_card_no
|
|
2997
|
+ tempOrder.DiscountPrice = discount_price
|
|
2998
|
+ tempOrder.PreferentialPrice = preferential_price
|
|
2999
|
+ tempOrder.RealityPrice = reality_price
|
|
3000
|
+ tempOrder.FoundPrice = found_price
|
|
3001
|
+ tempOrder.MedicalInsurancePrice = medical_insurance_price
|
|
3002
|
+ tempOrder.PrivatePrice = private_price
|
|
3003
|
+ tempOrder.FaPiaoCode = fapiao_code
|
|
3004
|
+ tempOrder.FaPiaoNumber = fapiao_number
|
|
3005
|
+ tempOrder.PType = 2
|
|
3006
|
+ tempOrder.MedfeeSumamt = totals
|
|
3007
|
+
|
|
3008
|
+ err = service.SaveHisOrder(&tempOrder)
|
|
3009
|
+ err = service.UpdataOrderStatusTwo(tempOrder.Number, adminUser.CurrentOrgId)
|
|
3010
|
+ if err != nil {
|
|
3011
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateOrderException)
|
|
3012
|
+ return
|
|
3013
|
+ }
|
|
3014
|
+ if err == nil {
|
|
3015
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
3016
|
+ "msg": "结算成功",
|
|
3017
|
+ })
|
|
3018
|
+ }
|
2920
|
3019
|
|
2921
|
|
- info := &models.HisOrderInfo{
|
2922
|
|
- OrderNumber: order.Number,
|
2923
|
|
- UploadDate: time.Now().Unix(),
|
2924
|
|
- AdviceId: advice_id,
|
2925
|
|
- DetItemFeeSumamt: detItemFeeSumamt,
|
2926
|
|
- Cnt: cut,
|
2927
|
|
- Pric: pric,
|
2928
|
|
- PatientId: id,
|
2929
|
|
- Status: 1,
|
2930
|
|
- Mtime: time.Now().Unix(),
|
2931
|
|
- Ctime: time.Now().Unix(),
|
2932
|
|
- UserOrgId: adminUser.CurrentOrgId,
|
2933
|
|
- HisPatientId: his.ID,
|
2934
|
|
- OrderId: order.ID,
|
2935
|
|
- ProjectId: project_id,
|
2936
|
|
- Type: types,
|
2937
|
|
- ItemId: item_id,
|
2938
|
3020
|
}
|
2939
|
|
- service.CreateOrderInfo(info)
|
2940
|
|
- }
|
2941
|
|
- err = service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
|
2942
|
|
- err = service.UpDateHisPrescriptionInfoNumber(adminUser.CurrentOrgId, id, chrg_bchno, recordDateTime, his_patient_id)
|
2943
|
|
- err = service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
|
2944
|
|
- if err == nil {
|
2945
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
2946
|
|
- "msg": "结算成功",
|
2947
|
|
- })
|
2948
|
3021
|
}
|
|
3022
|
+
|
2949
|
3023
|
}
|
2950
|
3024
|
|
2951
|
3025
|
//退款
|
|
@@ -3149,6 +3223,8 @@ func (this *HisApiController) GetHisDayPrescription() {
|
3149
|
3223
|
|
3150
|
3224
|
func (c *HisApiController) GetHisChargePatientList() {
|
3151
|
3225
|
record_date := c.GetString("record_date")
|
|
3226
|
+ order_status, _ := c.GetInt64("type")
|
|
3227
|
+
|
3152
|
3228
|
timeLayout := "2006-01-02"
|
3153
|
3229
|
loc, _ := time.LoadLocation("Local")
|
3154
|
3230
|
theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
@@ -3158,8 +3234,13 @@ func (c *HisApiController) GetHisChargePatientList() {
|
3158
|
3234
|
}
|
3159
|
3235
|
recordDateTime := theTime.Unix()
|
3160
|
3236
|
adminInfo := c.GetAdminUserInfo()
|
|
3237
|
+ var tempPatients []*service.NewTempPatients
|
3161
|
3238
|
//tempPatients, _ := service.GetAllChargeHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
|
3162
|
|
- tempPatients, _ := service.GetNewAllChargeHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
|
|
3239
|
+ if order_status != 2 {
|
|
3240
|
+ tempPatients, _ = service.GetNewAllUnChargeHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
|
|
3241
|
+ } else {
|
|
3242
|
+ tempPatients, _ = service.GetNewAllChargeHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
|
|
3243
|
+ }
|
3163
|
3244
|
|
3164
|
3245
|
var patients []*service.NewTempPatients
|
3165
|
3246
|
var patients_two []*service.NewTempPatients
|
|
@@ -3233,6 +3314,7 @@ func (c *HisApiController) GetHisChargePatientInfo() {
|
3233
|
3314
|
end_time := c.GetString("end_time")
|
3234
|
3315
|
order_status, _ := c.GetInt64("type", 0)
|
3235
|
3316
|
p_type, _ := c.GetInt64("p_type", 0)
|
|
3317
|
+ order_id, _ := c.GetInt64("order_id", 0)
|
3236
|
3318
|
|
3237
|
3319
|
timeLayout := "2006-01-02"
|
3238
|
3320
|
loc, _ := time.LoadLocation("Local")
|
|
@@ -3261,21 +3343,22 @@ func (c *HisApiController) GetHisChargePatientInfo() {
|
3261
|
3343
|
|
3262
|
3344
|
var prescriptions []*models.HisPrescription
|
3263
|
3345
|
|
|
3346
|
+ order, _ := service.GetHisOrderByID(order_id)
|
|
3347
|
+
|
3264
|
3348
|
if order_status == 1 || order_status == 0 {
|
3265
|
3349
|
prescriptions, _ = service.GetUnChargeHisPrescriptionFive(admin.CurrentOrgId, patient_id, his_patient_id, recordDateTime, p_type)
|
3266
|
3350
|
} else if order_status == 2 {
|
3267
|
|
- prescriptions, _ = service.GetChargeHisPrescriptionFive(admin.CurrentOrgId, patient_id, his_patient_id, recordDateTime, p_type)
|
|
3351
|
+ prescriptions, _ = service.GetChargeHisPrescriptionSeven(admin.CurrentOrgId, patient_id, order.Number, p_type)
|
3268
|
3352
|
}
|
3269
|
3353
|
|
3270
|
3354
|
var monthPrescriptions []*models.HisPrescription
|
3271
|
3355
|
if order_status == 1 || order_status == 0 {
|
3272
|
3356
|
monthPrescriptions, _ = service.GetUnChargeMonthHisPrescriptionThree(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, p_type)
|
3273
|
3357
|
} else if order_status == 2 {
|
3274
|
|
- monthPrescriptions, _ = service.GetChargeMonthHisPrescriptionFour(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, p_type)
|
|
3358
|
+ monthPrescriptions, _ = service.GetChargeMonthHisPrescriptionFive(admin.CurrentOrgId, patient_id, order.Number, p_type)
|
3275
|
3359
|
}
|
3276
|
3360
|
case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
3277
|
3361
|
patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
|
3278
|
|
- order, _ := service.GetNewHisOrder(admin.CurrentOrgId, his_patient_info.Number, patient_id)
|
3279
|
3362
|
doctors, _ := service.GetHisAdminUserDoctors(admin.CurrentOrgId)
|
3280
|
3363
|
//获取所有科室信息
|
3281
|
3364
|
department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
|
|
@@ -3541,17 +3624,17 @@ func (c *HisApiController) GetFaPiaoData() {
|
3541
|
3624
|
admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, adminUser.AdminUser.Id)
|
3542
|
3625
|
|
3543
|
3626
|
c.ServeSuccessJSON(map[string]interface{}{
|
3544
|
|
- "order_number": order.Number, //业务流水号
|
3545
|
|
- "id_card_no": his.IdCardNo, //社会保障号
|
3546
|
|
- "department_name": department.Name, //科室
|
3547
|
|
- "number": his.Number, //门诊号
|
3548
|
|
- "date": order.SettleAccountsDate, //结算日期
|
3549
|
|
- "name": order.PsnName, //姓名
|
3550
|
|
- "gender": order.Gend, //性别
|
3551
|
|
- "psn_cash_money": order.PsnCashPay, //个人支付
|
3552
|
|
- "pay_way": "门诊", //结算方式
|
3553
|
|
- "medfee_sumamt": order.MedfeeSumamt, //总费用
|
3554
|
|
- "admin_user_name": admin.UserName, //收款员
|
|
3627
|
+ "order_number": order.Number, //业务流水号
|
|
3628
|
+ "id_card_no": his.IdCardNo, //社会保障号
|
|
3629
|
+ "department_name": department.Name, //科室
|
|
3630
|
+ "number": his.Number, //门诊号
|
|
3631
|
+ "date": order.SettleEndTime, //结算日期
|
|
3632
|
+ "name": order.PsnName, //姓名
|
|
3633
|
+ "gender": order.Gend, //性别
|
|
3634
|
+ "psn_cash_money": order.PsnCashPay, //个人支付
|
|
3635
|
+ "pay_way": "门诊", //结算方式
|
|
3636
|
+ "medfee_sumamt": order.MedfeeSumamt, //总费用
|
|
3637
|
+ "admin_user_name": admin.UserName, //收款员
|
3555
|
3638
|
|
3556
|
3639
|
"bedCostTotal": bedCostTotal,
|
3557
|
3640
|
"bedCostSelfTotal": bedCostSelfTotal,
|
|
@@ -4296,3 +4379,226 @@ func (c *HisApiController) CreateHisPrescriptionTemplate() {
|
4296
|
4379
|
}
|
4297
|
4380
|
|
4298
|
4381
|
}
|
|
4382
|
+
|
|
4383
|
+func (c *HisApiController) PreSettle() {
|
|
4384
|
+ id, _ := c.GetInt64("id")
|
|
4385
|
+ record_time := c.GetString("record_time")
|
|
4386
|
+ his_patient_id, _ := c.GetInt64("his_patient_id")
|
|
4387
|
+
|
|
4388
|
+ timeLayout := "2006-01-02"
|
|
4389
|
+ loc, _ := time.LoadLocation("Local")
|
|
4390
|
+ settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
|
|
4391
|
+ diagnosis_id, _ := c.GetInt64("diagnosis")
|
|
4392
|
+ sick_type, _ := c.GetInt64("sick_type")
|
|
4393
|
+ reg_type, _ := c.GetInt64("p_type")
|
|
4394
|
+
|
|
4395
|
+ his, _ := service.GetHisPatientByIdThree(his_patient_id)
|
|
4396
|
+
|
|
4397
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
|
|
4398
|
+ if err != nil {
|
|
4399
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
4400
|
+ return
|
|
4401
|
+ }
|
|
4402
|
+ recordDateTime := theTime.Unix()
|
|
4403
|
+ adminUser := c.GetAdminUserInfo()
|
|
4404
|
+ var prescriptions []*models.HisPrescription
|
|
4405
|
+ var start_time int64
|
|
4406
|
+ var end_time int64
|
|
4407
|
+
|
|
4408
|
+ if settle_accounts_type == 1 { //日结
|
|
4409
|
+
|
|
4410
|
+ prescriptions, _ = service.GetSettleHisPrescription(adminUser.CurrentOrgId, id, his_patient_id, recordDateTime, reg_type)
|
|
4411
|
+
|
|
4412
|
+ } else { //月结
|
|
4413
|
+ start_time_str := c.GetString("start_time")
|
|
4414
|
+ end_time_str := c.GetString("end_time")
|
|
4415
|
+ timeLayout := "2006-01-02"
|
|
4416
|
+ loc, _ := time.LoadLocation("Local")
|
|
4417
|
+ theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
|
|
4418
|
+ if err != nil {
|
|
4419
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
4420
|
+ return
|
|
4421
|
+ }
|
|
4422
|
+ recordStartTime := theStartTime.Unix()
|
|
4423
|
+ start_time = recordStartTime
|
|
4424
|
+ theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
|
|
4425
|
+ if err != nil {
|
|
4426
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
4427
|
+ return
|
|
4428
|
+ }
|
|
4429
|
+ recordEndTime := theEndTime.Unix()
|
|
4430
|
+ end_time = recordEndTime
|
|
4431
|
+ prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime, reg_type)
|
|
4432
|
+ }
|
|
4433
|
+
|
|
4434
|
+ timestamp := time.Now().Unix()
|
|
4435
|
+ tempTime := time.Unix(timestamp, 0)
|
|
4436
|
+ timeFormat := tempTime.Format("20060102150405")
|
|
4437
|
+ chrgBchno := rand.Intn(100000) + 10000
|
|
4438
|
+ chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
|
|
4439
|
+ strconv.FormatInt(his.PatientId, 10)
|
|
4440
|
+
|
|
4441
|
+ var ids []int64
|
|
4442
|
+
|
|
4443
|
+ for _, item := range prescriptions {
|
|
4444
|
+ ids = append(ids, item.ID)
|
|
4445
|
+ }
|
|
4446
|
+
|
|
4447
|
+ var total float64
|
|
4448
|
+ for _, item := range prescriptions {
|
|
4449
|
+ if item.Type == 1 { //药品
|
|
4450
|
+ for _, subItem := range item.HisDoctorAdviceInfo {
|
|
4451
|
+ total = total + (subItem.Price * subItem.PrescribingNumber)
|
|
4452
|
+ }
|
|
4453
|
+ }
|
|
4454
|
+ if item.Type == 2 { //项目
|
|
4455
|
+ for _, subItem := range item.HisPrescriptionProject {
|
|
4456
|
+ total = total + (subItem.Price * float64(subItem.Count))
|
|
4457
|
+ }
|
|
4458
|
+ }
|
|
4459
|
+
|
|
4460
|
+ for _, subItem := range item.HisAdditionalCharge {
|
|
4461
|
+ total = total + (subItem.Price * float64(subItem.Count))
|
|
4462
|
+ }
|
|
4463
|
+ }
|
|
4464
|
+
|
|
4465
|
+ allTotal := fmt.Sprintf("%.2f", total)
|
|
4466
|
+ totals, _ := strconv.ParseFloat(allTotal, 64)
|
|
4467
|
+ order := &models.HisOrder{
|
|
4468
|
+ UserOrgId: adminUser.CurrentOrgId,
|
|
4469
|
+ HisPatientId: his.ID,
|
|
4470
|
+ PatientId: id,
|
|
4471
|
+ SettleAccountsDate: recordDateTime,
|
|
4472
|
+ Ctime: time.Now().Unix(),
|
|
4473
|
+ Mtime: time.Now().Unix(),
|
|
4474
|
+ Status: 1,
|
|
4475
|
+ OrderStatus: 1,
|
|
4476
|
+ MdtrtId: his.Number,
|
|
4477
|
+ Number: chrg_bchno,
|
|
4478
|
+ MedfeeSumamt: totals,
|
|
4479
|
+ SettleEndTime: end_time,
|
|
4480
|
+ SettleStartTime: start_time,
|
|
4481
|
+ SettleType: settle_accounts_type,
|
|
4482
|
+ PType: 2,
|
|
4483
|
+ IsPre: 1,
|
|
4484
|
+ MedType: strconv.Itoa(int(reg_type)),
|
|
4485
|
+ }
|
|
4486
|
+ err = service.CreateOrder(order)
|
|
4487
|
+ if err != nil {
|
|
4488
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateOrderException)
|
|
4489
|
+ return
|
|
4490
|
+ }
|
|
4491
|
+
|
|
4492
|
+ var customs []*Custom
|
|
4493
|
+ for _, item := range prescriptions {
|
|
4494
|
+
|
|
4495
|
+ if item.Type == 1 { //药品
|
|
4496
|
+ for _, subItem := range item.HisDoctorAdviceInfo {
|
|
4497
|
+ cus := &Custom{
|
|
4498
|
+ AdviceId: subItem.ID,
|
|
4499
|
+ ProjectId: 0,
|
|
4500
|
+ DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*subItem.PrescribingNumber),
|
|
4501
|
+ Cut: fmt.Sprintf("%.2f", subItem.PrescribingNumber),
|
|
4502
|
+ FeedetlSn: subItem.FeedetlSn,
|
|
4503
|
+ Price: fmt.Sprintf("%.2f", subItem.Price),
|
|
4504
|
+ MedListCodg: subItem.MedListCodg,
|
|
4505
|
+ Type: 1,
|
|
4506
|
+ }
|
|
4507
|
+ customs = append(customs, cus)
|
|
4508
|
+ }
|
|
4509
|
+ }
|
|
4510
|
+
|
|
4511
|
+ if item.Type == 2 { //项目
|
|
4512
|
+ for _, subItem := range item.HisPrescriptionProject {
|
|
4513
|
+
|
|
4514
|
+ cus := &Custom{
|
|
4515
|
+ AdviceId: 0,
|
|
4516
|
+ ProjectId: subItem.ID,
|
|
4517
|
+ DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
|
|
4518
|
+ Cut: fmt.Sprintf("%.2f", float64(subItem.Count)),
|
|
4519
|
+ FeedetlSn: subItem.FeedetlSn,
|
|
4520
|
+ Price: fmt.Sprintf("%.2f", float64(subItem.Price)),
|
|
4521
|
+ MedListCodg: subItem.MedListCodg,
|
|
4522
|
+ Type: 2,
|
|
4523
|
+ }
|
|
4524
|
+
|
|
4525
|
+ customs = append(customs, cus)
|
|
4526
|
+ }
|
|
4527
|
+ }
|
|
4528
|
+
|
|
4529
|
+ for _, item := range item.HisAdditionalCharge {
|
|
4530
|
+ cus := &Custom{
|
|
4531
|
+ ItemId: item.ID,
|
|
4532
|
+ AdviceId: 0,
|
|
4533
|
+ ProjectId: 0,
|
|
4534
|
+ DetItemFeeSumamt: fmt.Sprintf("%.2f", item.Price),
|
|
4535
|
+ Cut: fmt.Sprintf("%.2f", float64(item.Count)),
|
|
4536
|
+ FeedetlSn: item.FeedetlSn,
|
|
4537
|
+ Price: fmt.Sprintf("%.2f", float64(item.Price)),
|
|
4538
|
+ MedListCodg: item.XtHisAddtionConfig.Code,
|
|
4539
|
+ Type: 3,
|
|
4540
|
+ }
|
|
4541
|
+
|
|
4542
|
+ customs = append(customs, cus)
|
|
4543
|
+ }
|
|
4544
|
+
|
|
4545
|
+ }
|
|
4546
|
+
|
|
4547
|
+ for _, item := range customs {
|
|
4548
|
+ var advice_id int64 = 0
|
|
4549
|
+ var project_id int64 = 0
|
|
4550
|
+ var item_id int64 = 0
|
|
4551
|
+
|
|
4552
|
+ var types int64 = 0
|
|
4553
|
+
|
|
4554
|
+ if item.Type == 1 {
|
|
4555
|
+ advice_id = item.AdviceId
|
|
4556
|
+ project_id = 0
|
|
4557
|
+ item_id = 0
|
|
4558
|
+ } else if item.Type == 2 {
|
|
4559
|
+ advice_id = 0
|
|
4560
|
+ item_id = 0
|
|
4561
|
+
|
|
4562
|
+ project_id = item.ProjectId
|
|
4563
|
+ } else if item.Type == 3 {
|
|
4564
|
+ advice_id = 0
|
|
4565
|
+ item_id = item.ItemId
|
|
4566
|
+ project_id = 0
|
|
4567
|
+ }
|
|
4568
|
+
|
|
4569
|
+ detItemFeeSumamt, _ := strconv.ParseFloat(item.DetItemFeeSumamt, 32)
|
|
4570
|
+ cut, _ := strconv.ParseFloat(item.Cut, 32)
|
|
4571
|
+ pric, _ := strconv.ParseFloat(item.Price, 32)
|
|
4572
|
+
|
|
4573
|
+ info := &models.HisOrderInfo{
|
|
4574
|
+ OrderNumber: order.Number,
|
|
4575
|
+ UploadDate: time.Now().Unix(),
|
|
4576
|
+ AdviceId: advice_id,
|
|
4577
|
+ DetItemFeeSumamt: detItemFeeSumamt,
|
|
4578
|
+ Cnt: cut,
|
|
4579
|
+ Pric: pric,
|
|
4580
|
+ PatientId: id,
|
|
4581
|
+ Status: 1,
|
|
4582
|
+ Mtime: time.Now().Unix(),
|
|
4583
|
+ Ctime: time.Now().Unix(),
|
|
4584
|
+ UserOrgId: adminUser.CurrentOrgId,
|
|
4585
|
+ HisPatientId: his.ID,
|
|
4586
|
+ OrderId: order.ID,
|
|
4587
|
+ ProjectId: project_id,
|
|
4588
|
+ Type: types,
|
|
4589
|
+ ItemId: item_id,
|
|
4590
|
+ }
|
|
4591
|
+ service.CreateOrderInfo(info)
|
|
4592
|
+ }
|
|
4593
|
+ his.Diagnosis = diagnosis_id
|
|
4594
|
+ his.SickType = sick_type
|
|
4595
|
+ service.UpdataHisPateint(&his)
|
|
4596
|
+ err = service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
|
|
4597
|
+ err = service.UpDateHisPrescriptionInfoNumber(adminUser.CurrentOrgId, id, chrg_bchno, recordDateTime, his_patient_id)
|
|
4598
|
+ //err = service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
|
|
4599
|
+ if err == nil {
|
|
4600
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
4601
|
+ "msg": "结算成功",
|
|
4602
|
+ })
|
|
4603
|
+ }
|
|
4604
|
+}
|